LCOV - code coverage report
Current view: top level - chart2/source/view/axes - VPolarRadiusAxis.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 79 1.3 %
Date: 2014-11-03 Functions: 2 16 12.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 "VPolarRadiusAxis.hxx"
      21             : #include "VCartesianAxis.hxx"
      22             : #include "PlottingPositionHelper.hxx"
      23             : #include "CommonConverters.hxx"
      24             : #include "Tickmarks_Equidistant.hxx"
      25             : #include <rtl/math.hxx>
      26             : 
      27             : namespace chart
      28             : {
      29             : using namespace ::com::sun::star;
      30             : using namespace ::com::sun::star::chart2;
      31             : using namespace ::rtl::math;
      32             : 
      33           0 : VPolarRadiusAxis::VPolarRadiusAxis( const AxisProperties& rAxisProperties
      34             :             , const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
      35             :             , sal_Int32 nDimensionCount )
      36           0 :             : VPolarAxis( rAxisProperties, xNumberFormatsSupplier, 1/*nDimensionIndex*/, nDimensionCount )
      37             : {
      38           0 :     m_aAxisProperties.maLabelAlignment.mfLabelDirection = 0.0;
      39           0 :     m_aAxisProperties.maLabelAlignment.mfInnerTickDirection = 0.0;
      40           0 :     m_aAxisProperties.maLabelAlignment.meAlignment = LABEL_ALIGN_RIGHT;
      41           0 :     m_aAxisProperties.m_bIsMainAxis=false;
      42           0 :     m_aAxisProperties.init();
      43             : 
      44             :     m_apAxisWithLabels.reset( new VCartesianAxis(
      45             :         m_aAxisProperties,xNumberFormatsSupplier,1/*nDimensionIndex*/,nDimensionCount
      46           0 :         ,new PolarPlottingPositionHelper() ) );
      47           0 : }
      48             : 
      49           0 : VPolarRadiusAxis::~VPolarRadiusAxis()
      50             : {
      51           0 :     delete m_pPosHelper;
      52           0 :     m_pPosHelper = NULL;
      53           0 : }
      54             : 
      55           0 : void VPolarRadiusAxis::setTransformationSceneToScreen( const drawing::HomogenMatrix& rMatrix)
      56             : {
      57           0 :     VPolarAxis::setTransformationSceneToScreen( rMatrix );
      58           0 :     m_apAxisWithLabels->setTransformationSceneToScreen( rMatrix );
      59           0 : }
      60             : 
      61           0 : void VPolarRadiusAxis::setExplicitScaleAndIncrement(
      62             :               const ExplicitScaleData& rScale
      63             :             , const ExplicitIncrementData& rIncrement )
      64             :             throw (uno::RuntimeException)
      65             : {
      66           0 :     VPolarAxis::setExplicitScaleAndIncrement( rScale, rIncrement );
      67           0 :     m_apAxisWithLabels->setExplicitScaleAndIncrement( rScale, rIncrement );
      68           0 : }
      69             : 
      70           0 : void VPolarRadiusAxis::initPlotter(  const uno::Reference< drawing::XShapes >& xLogicTarget
      71             :        , const uno::Reference< drawing::XShapes >& xFinalTarget
      72             :        , const uno::Reference< lang::XMultiServiceFactory >& xShapeFactory
      73             :        , const OUString& rCID )
      74             :             throw (uno::RuntimeException)
      75             : {
      76           0 :     VPolarAxis::initPlotter(  xLogicTarget, xFinalTarget, xShapeFactory, rCID );
      77           0 :     m_apAxisWithLabels->initPlotter(  xLogicTarget, xFinalTarget, xShapeFactory, rCID );
      78           0 : }
      79             : 
      80           0 : void VPolarRadiusAxis::setScales( const std::vector< ExplicitScaleData >& rScales, bool bSwapXAndYAxis )
      81             : {
      82           0 :     VPolarAxis::setScales( rScales, bSwapXAndYAxis );
      83           0 :     m_apAxisWithLabels->setScales( rScales, bSwapXAndYAxis );
      84           0 : }
      85             : 
      86           0 : void VPolarRadiusAxis::initAxisLabelProperties( const ::com::sun::star::awt::Size& rFontReferenceSize
      87             :                   , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels )
      88             : {
      89           0 :     VPolarAxis::initAxisLabelProperties( rFontReferenceSize, rMaximumSpaceForLabels );
      90           0 :     m_apAxisWithLabels->initAxisLabelProperties( rFontReferenceSize, rMaximumSpaceForLabels );
      91           0 : }
      92             : 
      93           0 : sal_Int32 VPolarRadiusAxis::estimateMaximumAutoMainIncrementCount()
      94             : {
      95           0 :     return 2;
      96             : }
      97             : 
      98           0 : bool VPolarRadiusAxis::prepareShapeCreation()
      99             : {
     100             :     //returns true if all is ready for further shape creation and any shapes need to be created
     101           0 :     if( !isAnythingToDraw() )
     102           0 :         return false;
     103             : 
     104           0 :     if( m_xGroupShape_Shapes.is() )
     105           0 :         return true;
     106             : 
     107           0 :     return true;
     108             : }
     109             : 
     110           0 : void VPolarRadiusAxis::createMaximumLabels()
     111             : {
     112           0 :     m_apAxisWithLabels->createMaximumLabels();
     113           0 : }
     114             : 
     115           0 : void VPolarRadiusAxis::updatePositions()
     116             : {
     117           0 :     m_apAxisWithLabels->updatePositions();
     118           0 : }
     119             : 
     120           0 : void VPolarRadiusAxis::createLabels()
     121             : {
     122           0 :     m_apAxisWithLabels->createLabels();
     123           0 : }
     124             : 
     125           0 : void VPolarRadiusAxis::createShapes()
     126             : {
     127           0 :     if( !prepareShapeCreation() )
     128           0 :         return;
     129             : 
     130           0 :     const ExplicitScaleData& rAngleScale         = m_pPosHelper->getScales()[0];
     131           0 :     const ExplicitIncrementData& rAngleIncrement = m_aIncrements[0];
     132             : 
     133           0 :     TickInfoArraysType aAngleTickInfos;
     134           0 :     TickFactory aAngleTickFactory( rAngleScale, rAngleIncrement );
     135           0 :     aAngleTickFactory.getAllTicks( aAngleTickInfos );
     136             : 
     137           0 :     uno::Reference< XScaling > xInverseScaling( NULL );
     138           0 :     if( rAngleScale.Scaling.is() )
     139           0 :         xInverseScaling = rAngleScale.Scaling->getInverseScaling();
     140             : 
     141           0 :     AxisProperties aAxisProperties(m_aAxisProperties);
     142             : 
     143           0 :     sal_Int32 nTick = 0;
     144           0 :     EquidistantTickIter aIter( aAngleTickInfos, rAngleIncrement, 0, 0 );
     145           0 :     for( TickInfo* pTickInfo = aIter.firstInfo()
     146             :         ; pTickInfo; pTickInfo = aIter.nextInfo(), nTick++ )
     147             :     {
     148           0 :         if( nTick == 0 )
     149             :         {
     150           0 :             m_apAxisWithLabels->createShapes();
     151           0 :             continue;
     152             :         }
     153             : 
     154             :         //xxxxx pTickInfo->updateUnscaledValue( xInverseScaling );
     155           0 :         aAxisProperties.m_pfMainLinePositionAtOtherAxis.reset(pTickInfo->getUnscaledTickValue());
     156           0 :         aAxisProperties.m_bDisplayLabels=false;
     157             : 
     158             :         VCartesianAxis aAxis(aAxisProperties,m_xNumberFormatsSupplier
     159           0 :             ,1,2,new PolarPlottingPositionHelper());
     160           0 :         aAxis.setExplicitScaleAndIncrement( m_aScale, m_aIncrement );
     161           0 :         aAxis.initPlotter(m_xLogicTarget,m_xFinalTarget,m_xShapeFactory, m_aCID );
     162           0 :         aAxis.setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix( m_aMatrixScreenToScene ) );
     163           0 :         aAxis.setScales( m_pPosHelper->getScales(), false );
     164           0 :         aAxis.initAxisLabelProperties(m_aAxisLabelProperties.m_aFontReferenceSize,m_aAxisLabelProperties.m_aMaximumSpaceForLabels);
     165           0 :         aAxis.createShapes();
     166           0 :     }
     167             : }
     168             : 
     169         108 : } //namespace chart
     170             : 
     171             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10