LCOV - code coverage report
Current view: top level - chart2/source/view/main - PlotterBase.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 34 42 81.0 %
Date: 2014-04-11 Functions: 7 8 87.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "PlotterBase.hxx"
      21             : #include "PlottingPositionHelper.hxx"
      22             : #include "AbstractShapeFactory.hxx"
      23             : #include <rtl/math.hxx>
      24             : #include <com/sun/star/chart2/DataPointLabel.hpp>
      25             : 
      26             : namespace chart
      27             : {
      28             : using namespace ::com::sun::star;
      29             : using namespace ::com::sun::star::chart2;
      30             : 
      31        3054 : PlotterBase::PlotterBase( sal_Int32 nDimensionCount )
      32             :         : m_xLogicTarget(NULL)
      33             :         , m_xFinalTarget(NULL)
      34             :         , m_xShapeFactory(NULL)
      35             :         , m_pShapeFactory(NULL)
      36             :         , m_aCID()
      37             :         , m_nDimension(nDimensionCount)
      38        3054 :         , m_pPosHelper(NULL)
      39             : {
      40        3054 : }
      41             : 
      42        3053 : void PlotterBase::initPlotter(  const uno::Reference< drawing::XShapes >& xLogicTarget
      43             :        , const uno::Reference< drawing::XShapes >& xFinalTarget
      44             :        , const uno::Reference< lang::XMultiServiceFactory >& xShapeFactory
      45             :        , const OUString& rCID )
      46             :             throw (uno::RuntimeException)
      47             : {
      48             :     OSL_PRECOND(xLogicTarget.is()&&xFinalTarget.is()&&xShapeFactory.is(),"no proper initialization parameters");
      49             :     //is only allowed to be called once
      50        3053 :     m_xLogicTarget  = xLogicTarget;
      51        3053 :     m_xFinalTarget  = xFinalTarget;
      52        3053 :     m_xShapeFactory = xShapeFactory;
      53        3053 :     m_pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(xShapeFactory);
      54        3053 :     m_aCID = rCID;
      55        3053 : }
      56             : 
      57        2829 : PlotterBase::~PlotterBase()
      58             : {
      59        2829 : }
      60             : 
      61        4861 : void PlotterBase::setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis )
      62             : {
      63        4861 :     if (!m_pPosHelper)
      64        4861 :         return;
      65             : 
      66             :     OSL_PRECOND(m_nDimension<=static_cast<sal_Int32>(rScales.size()),"Dimension of Plotter does not fit two dimension of given scale sequence");
      67        4861 :     m_pPosHelper->setScales( rScales, bSwapXAndYAxis );
      68             : }
      69             : 
      70       13663 : void PlotterBase::setTransformationSceneToScreen( const drawing::HomogenMatrix& rMatrix)
      71             : {
      72       13663 :     if (!m_pPosHelper)
      73           0 :         return;
      74             : 
      75             :     OSL_PRECOND(m_nDimension==2,"Set this transformation only in case of 2D");
      76       13663 :     if(m_nDimension!=2)
      77           0 :         return;
      78       13663 :     m_pPosHelper->setTransformationSceneToScreen( rMatrix );
      79             : }
      80             : 
      81        7344 : uno::Reference< drawing::XShapes > PlotterBase::createGroupShape(
      82             :             const uno::Reference< drawing::XShapes >& xTarget
      83             :             , const OUString& rName )
      84             : {
      85        7344 :     if(!m_xShapeFactory.is())
      86           0 :         return NULL;
      87             : 
      88        7344 :     if(m_nDimension==2)
      89             :     {
      90             :         //create and add to target
      91        7084 :         return m_pShapeFactory->createGroup2D( xTarget, rName );
      92             :     }
      93             :     else
      94             :     {
      95             :         //create and added to target
      96         260 :         return m_pShapeFactory->createGroup3D( xTarget, rName );
      97             :     }
      98             : }
      99             : 
     100        1244 : bool PlotterBase::isValidPosition( const drawing::Position3D& rPos )
     101             : {
     102        1244 :     if( ::rtl::math::isNan(rPos.PositionX) )
     103           6 :         return false;
     104        1238 :     if( ::rtl::math::isNan(rPos.PositionY) )
     105           0 :         return false;
     106        1238 :     if( ::rtl::math::isNan(rPos.PositionZ) )
     107           0 :         return false;
     108        1238 :     if( ::rtl::math::isInf(rPos.PositionX) )
     109           0 :         return false;
     110        1238 :     if( ::rtl::math::isInf(rPos.PositionY) )
     111           0 :         return false;
     112        1238 :     if( ::rtl::math::isInf(rPos.PositionZ) )
     113           0 :         return false;
     114        1238 :     return true;
     115             : }
     116             : 
     117             : } //namespace chart
     118             : 
     119             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10