LCOV - code coverage report
Current view: top level - chart2/source/view/main - PlotterBase.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 34 40 85.0 %
Date: 2012-08-25 Functions: 7 8 87.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 20 36 55.6 %

           Branch data     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 "ShapeFactory.hxx"
      23                 :            : #include <rtl/math.hxx>
      24                 :            : #include <com/sun/star/chart2/DataPointLabel.hpp>
      25                 :            : 
      26                 :            : //.............................................................................
      27                 :            : namespace chart
      28                 :            : {
      29                 :            : //.............................................................................
      30                 :            : using namespace ::com::sun::star;
      31                 :            : using namespace ::com::sun::star::chart2;
      32                 :            : 
      33                 :            : //-----------------------------------------------------------------------------
      34                 :            : //-----------------------------------------------------------------------------
      35                 :            : //-----------------------------------------------------------------------------
      36                 :            : 
      37                 :       4857 : PlotterBase::PlotterBase( sal_Int32 nDimensionCount )
      38                 :            :         : m_xLogicTarget(NULL)
      39                 :            :         , m_xFinalTarget(NULL)
      40                 :            :         , m_xShapeFactory(NULL)
      41                 :            :         , m_pShapeFactory(NULL)
      42                 :            :         , m_aCID()
      43                 :            :         , m_nDimension(nDimensionCount)
      44 [ +  - ][ +  - ]:       4857 :         , m_pPosHelper(NULL)
      45                 :            : {
      46                 :       4857 : }
      47                 :            : 
      48                 :       4857 : void PlotterBase::initPlotter(  const uno::Reference< drawing::XShapes >& xLogicTarget
      49                 :            :        , const uno::Reference< drawing::XShapes >& xFinalTarget
      50                 :            :        , const uno::Reference< lang::XMultiServiceFactory >& xShapeFactory
      51                 :            :        , const rtl::OUString& rCID )
      52                 :            :             throw (uno::RuntimeException)
      53                 :            : {
      54                 :            :     OSL_PRECOND(xLogicTarget.is()&&xFinalTarget.is()&&xShapeFactory.is(),"no proper initialization parameters");
      55                 :            :     //is only allowed to be called once
      56                 :       4857 :     m_xLogicTarget  = xLogicTarget;
      57                 :       4857 :     m_xFinalTarget  = xFinalTarget;
      58                 :       4857 :     m_xShapeFactory = xShapeFactory;
      59 [ +  - ][ +  - ]:       4857 :     m_pShapeFactory = new ShapeFactory(xShapeFactory);
      60                 :       4857 :     m_aCID = rCID;
      61                 :       4857 : }
      62                 :            : 
      63                 :       4857 : PlotterBase::~PlotterBase()
      64                 :            : {
      65 [ +  - ][ +  - ]:       4857 :     delete m_pShapeFactory;
      66         [ -  + ]:       4857 : }
      67                 :            : 
      68                 :       7738 : void PlotterBase::setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis )
      69                 :            : {
      70                 :            :     OSL_PRECOND(m_nDimension<=static_cast<sal_Int32>(rScales.size()),"Dimension of Plotter does not fit two dimension of given scale sequence");
      71                 :       7738 :     m_pPosHelper->setScales( rScales, bSwapXAndYAxis );
      72                 :       7738 : }
      73                 :            : 
      74                 :            : 
      75                 :      21106 : void PlotterBase::setTransformationSceneToScreen( const drawing::HomogenMatrix& rMatrix)
      76                 :            : {
      77                 :            :     OSL_PRECOND(m_nDimension==2,"Set this transformation only in case of 2D");
      78         [ -  + ]:      21106 :     if(m_nDimension!=2)
      79                 :      21106 :         return;
      80                 :      21106 :     m_pPosHelper->setTransformationSceneToScreen( rMatrix );
      81                 :            : }
      82                 :            : 
      83                 :      12683 : uno::Reference< drawing::XShapes > PlotterBase::createGroupShape(
      84                 :            :             const uno::Reference< drawing::XShapes >& xTarget
      85                 :            :             , ::rtl::OUString rName )
      86                 :            : {
      87         [ -  + ]:      12683 :     if(!m_xShapeFactory.is())
      88                 :          0 :         return NULL;
      89                 :            : 
      90         [ +  + ]:      12683 :     if(m_nDimension==2)
      91                 :            :     {
      92                 :            :         //create and add to target
      93         [ +  - ]:      12045 :         return m_pShapeFactory->createGroup2D( xTarget, rName );
      94                 :            :     }
      95                 :            :     else
      96                 :            :     {
      97                 :            :         //create and added to target
      98         [ +  - ]:      12683 :         return m_pShapeFactory->createGroup3D( xTarget, rName );
      99                 :            :     }
     100                 :            : }
     101                 :            : 
     102                 :       2754 : bool PlotterBase::isValidPosition( const drawing::Position3D& rPos )
     103                 :            : {
     104         [ +  + ]:       2754 :     if( ::rtl::math::isNan(rPos.PositionX) )
     105                 :         12 :         return false;
     106         [ -  + ]:       2742 :     if( ::rtl::math::isNan(rPos.PositionY) )
     107                 :          0 :         return false;
     108         [ -  + ]:       2742 :     if( ::rtl::math::isNan(rPos.PositionZ) )
     109                 :          0 :         return false;
     110         [ -  + ]:       2742 :     if( ::rtl::math::isInf(rPos.PositionX) )
     111                 :          0 :         return false;
     112         [ -  + ]:       2742 :     if( ::rtl::math::isInf(rPos.PositionY) )
     113                 :          0 :         return false;
     114         [ -  + ]:       2742 :     if( ::rtl::math::isInf(rPos.PositionZ) )
     115                 :          0 :         return false;
     116                 :       2754 :     return true;
     117                 :            : }
     118                 :            : 
     119                 :            : //.............................................................................
     120                 :            : } //namespace chart
     121                 :            : //.............................................................................
     122                 :            : 
     123                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10