LCOV - code coverage report
Current view: top level - libreoffice/chart2/source/view/axes - VPolarCoordinateSystem.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 91 0.0 %
Date: 2012-12-27 Functions: 0 8 0.0 %
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 "VPolarCoordinateSystem.hxx"
      21             : #include "VPolarGrid.hxx"
      22             : #include "VPolarAxis.hxx"
      23             : #include "AxisIndexDefines.hxx"
      24             : #include "AxisHelper.hxx"
      25             : 
      26             : //.............................................................................
      27             : namespace chart
      28             : {
      29             : //.............................................................................
      30             : using namespace ::com::sun::star;
      31             : using namespace ::com::sun::star::chart2;
      32             : using ::com::sun::star::uno::Reference;
      33             : 
      34           0 : VPolarCoordinateSystem::VPolarCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys )
      35           0 :     : VCoordinateSystem(xCooSys)
      36             : {
      37           0 : }
      38             : 
      39           0 : VPolarCoordinateSystem::~VPolarCoordinateSystem()
      40             : {
      41           0 : }
      42             : 
      43             : //better performance for big data
      44           0 : uno::Sequence< sal_Int32 > VPolarCoordinateSystem::getCoordinateSystemResolution(
      45             :             const awt::Size& rPageSize, const awt::Size& rPageResolution )
      46             : {
      47           0 :     uno::Sequence< sal_Int32 > aResolution( VCoordinateSystem::getCoordinateSystemResolution( rPageSize, rPageResolution) );
      48             : 
      49           0 :     if( aResolution.getLength() >= 2 )
      50             :     {
      51           0 :         if( this->getPropertySwapXAndYAxis() )
      52             :         {
      53           0 :             aResolution[0]/=2;//radius
      54           0 :             aResolution[1]*=4;//outer circle resolution
      55             :         }
      56             :         else
      57             :         {
      58           0 :             aResolution[0]*=4;//outer circle resolution
      59           0 :             aResolution[1]/=2;//radius
      60             :         }
      61             :     }
      62             : 
      63           0 :     return aResolution;
      64             : }
      65             : 
      66           0 : void VPolarCoordinateSystem::createVAxisList(
      67             :               const uno::Reference< util::XNumberFormatsSupplier > & xNumberFormatsSupplier
      68             :             , const awt::Size& rFontReferenceSize
      69             :             , const awt::Rectangle& rMaximumSpaceForLabels
      70             :             )
      71             : {
      72           0 :     m_aAxisMap.clear();
      73           0 :     sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
      74           0 :     sal_Int32 nDimensionIndex = 0;
      75             : 
      76             :     //create angle axis (dimension index 0)
      77           0 :     for( nDimensionIndex = 0; nDimensionIndex < nDimensionCount; nDimensionIndex++ )
      78             :     {
      79           0 :         sal_Int32 nMaxAxisIndex = m_xCooSysModel->getMaximumAxisIndexByDimension(nDimensionIndex);
      80           0 :         for( sal_Int32 nAxisIndex = 0; nAxisIndex <= nMaxAxisIndex; nAxisIndex++ )
      81             :         {
      82           0 :             Reference< XAxis > xAxis( this->getAxisByDimension(nDimensionIndex,nAxisIndex) );
      83           0 :             if(!xAxis.is() || !AxisHelper::shouldAxisBeDisplayed( xAxis, m_xCooSysModel ))
      84           0 :                 continue;
      85           0 :             AxisProperties aAxisProperties(xAxis,this->getExplicitCategoriesProvider());
      86           0 :             aAxisProperties.init();
      87           0 :             if(aAxisProperties.m_bDisplayLabels)
      88           0 :                 aAxisProperties.m_nNumberFormatKey = this->getNumberFormatKeyForAxis( xAxis, xNumberFormatsSupplier );
      89             : 
      90           0 :             ::boost::shared_ptr< VAxisBase > apVAxis( VPolarAxis::createAxis( aAxisProperties,xNumberFormatsSupplier,nDimensionIndex,nDimensionCount) );
      91           0 :             tFullAxisIndex aFullAxisIndex( nDimensionIndex, nAxisIndex );
      92           0 :             m_aAxisMap[aFullAxisIndex] = apVAxis;
      93             : 
      94           0 :             apVAxis->initAxisLabelProperties(rFontReferenceSize,rMaximumSpaceForLabels);
      95           0 :         }
      96             :     }
      97           0 : }
      98             : 
      99           0 : void VPolarCoordinateSystem::initVAxisInList()
     100             : {
     101           0 :     if(!m_xLogicTargetForAxes.is() || !m_xFinalTarget.is() || !m_xCooSysModel.is() )
     102           0 :         return;
     103             : 
     104           0 :     sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
     105           0 :     bool bSwapXAndY = this->getPropertySwapXAndYAxis();
     106             : 
     107           0 :     tVAxisMap::iterator aIt( m_aAxisMap.begin() );
     108           0 :     tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
     109           0 :     for( ; aIt != aEnd; ++aIt )
     110             :     {
     111           0 :         VAxisBase* pVAxis = aIt->second.get();
     112           0 :         if( pVAxis )
     113             :         {
     114           0 :             sal_Int32 nDimensionIndex = aIt->first.first;
     115           0 :             sal_Int32 nAxisIndex = aIt->first.second;
     116           0 :             pVAxis->setExplicitScaleAndIncrement( this->getExplicitScale( nDimensionIndex, nAxisIndex ), this->getExplicitIncrement(nDimensionIndex, nAxisIndex) );
     117             :             pVAxis->initPlotter(m_xLogicTargetForAxes,m_xFinalTarget,m_xShapeFactory
     118           0 :                 , this->createCIDForAxis( getAxisByDimension( nDimensionIndex, nAxisIndex ), nDimensionIndex, nAxisIndex ) );
     119           0 :             VPolarAxis* pVPolarAxis = dynamic_cast< VPolarAxis* >( pVAxis );
     120           0 :             if( pVPolarAxis )
     121           0 :                 pVPolarAxis->setIncrements( this->getExplicitIncrements( nDimensionIndex, nAxisIndex ) );
     122           0 :             if(2==nDimensionCount)
     123           0 :                 pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
     124           0 :             pVAxis->setScales( this->getExplicitScales( nDimensionIndex, nAxisIndex ), bSwapXAndY );
     125             :         }
     126             :     }
     127             : }
     128             : 
     129           0 : void VPolarCoordinateSystem::updateScalesAndIncrementsOnAxes()
     130             : {
     131           0 :     if(!m_xLogicTargetForAxes.is() || !m_xFinalTarget.is() || !m_xCooSysModel.is() )
     132           0 :         return;
     133             : 
     134           0 :     sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
     135           0 :     bool bSwapXAndY = this->getPropertySwapXAndYAxis();
     136             : 
     137           0 :     tVAxisMap::iterator aIt( m_aAxisMap.begin() );
     138           0 :     tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
     139           0 :     for( ; aIt != aEnd; ++aIt )
     140             :     {
     141           0 :         VAxisBase* pVAxis = aIt->second.get();
     142           0 :         if( pVAxis )
     143             :         {
     144           0 :             sal_Int32 nDimensionIndex = aIt->first.first;
     145           0 :             sal_Int32 nAxisIndex = aIt->first.second;
     146           0 :             pVAxis->setExplicitScaleAndIncrement( this->getExplicitScale( nDimensionIndex, nAxisIndex ), this->getExplicitIncrement(nDimensionIndex, nAxisIndex) );
     147           0 :             VPolarAxis* pVPolarAxis = dynamic_cast< VPolarAxis* >( pVAxis );
     148           0 :             if( pVPolarAxis )
     149           0 :                 pVPolarAxis->setIncrements( this->getExplicitIncrements( nDimensionIndex, nAxisIndex ) );
     150           0 :             if(2==nDimensionCount)
     151           0 :                 pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
     152           0 :             pVAxis->setScales( this->getExplicitScales( nDimensionIndex, nAxisIndex ), bSwapXAndY );
     153             :         }
     154             :     }
     155             : }
     156             : 
     157           0 : void VPolarCoordinateSystem::createGridShapes()
     158             : {
     159           0 :     if(!m_xLogicTargetForGrids.is() || !m_xFinalTarget.is() )
     160           0 :         return;
     161             : 
     162           0 :     sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
     163           0 :     bool bSwapXAndY = this->getPropertySwapXAndYAxis();
     164             : 
     165           0 :     for( sal_Int32 nDimensionIndex=0; nDimensionIndex<3; nDimensionIndex++)
     166             :     {
     167           0 :         sal_Int32 nAxisIndex = MAIN_AXIS_INDEX;
     168             : 
     169           0 :         Reference< XAxis > xAxis( AxisHelper::getAxis( nDimensionIndex, nAxisIndex, m_xCooSysModel ) );
     170           0 :         if(!xAxis.is() || !AxisHelper::shouldAxisBeDisplayed( xAxis, m_xCooSysModel ))
     171           0 :             continue;
     172             : 
     173           0 :         VPolarGrid aGrid(nDimensionIndex,nDimensionCount,this->getGridListFromAxis( xAxis ));
     174           0 :         aGrid.setIncrements( this->getExplicitIncrements( nDimensionIndex, nAxisIndex ) );
     175             :         aGrid.initPlotter(m_xLogicTargetForGrids,m_xFinalTarget,m_xShapeFactory
     176           0 :             , this->createCIDForGrid( xAxis, nDimensionIndex, nAxisIndex ) );
     177           0 :         if(2==nDimensionCount)
     178           0 :             aGrid.setTransformationSceneToScreen( m_aMatrixSceneToScreen );
     179           0 :         aGrid.setScales( this->getExplicitScales( nDimensionIndex, nAxisIndex), bSwapXAndY );
     180           0 :         aGrid.createShapes();
     181           0 :     }
     182             : }
     183             : 
     184             : //.............................................................................
     185             : } //namespace chart
     186             : //.............................................................................
     187             : 
     188             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10