LCOV - code coverage report
Current view: top level - chart2/source/view/charttypes - AreaChart.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 288 519 55.5 %
Date: 2014-04-11 Functions: 16 20 80.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 "AreaChart.hxx"
      21             : #include "PlottingPositionHelper.hxx"
      22             : #include "AbstractShapeFactory.hxx"
      23             : #include "CommonConverters.hxx"
      24             : #include "macros.hxx"
      25             : #include "ViewDefines.hxx"
      26             : #include "ObjectIdentifier.hxx"
      27             : #include "Splines.hxx"
      28             : #include "ChartTypeHelper.hxx"
      29             : #include "LabelPositionHelper.hxx"
      30             : #include "Clipping.hxx"
      31             : #include "Stripe.hxx"
      32             : #include "DateHelper.hxx"
      33             : #include <unonames.hxx>
      34             : 
      35             : #include <com/sun/star/chart2/Symbol.hpp>
      36             : #include <com/sun/star/chart/DataLabelPlacement.hpp>
      37             : #include <com/sun/star/chart/MissingValueTreatment.hpp>
      38             : 
      39             : #include <editeng/unoprnms.hxx>
      40             : #include <rtl/math.hxx>
      41             : 
      42             : #include <com/sun/star/drawing/DoubleSequence.hpp>
      43             : #include <com/sun/star/drawing/NormalsKind.hpp>
      44             : #include <com/sun/star/lang/XServiceName.hpp>
      45             : 
      46             : namespace chart
      47             : {
      48             : using namespace ::com::sun::star;
      49             : using namespace ::rtl::math;
      50             : using namespace ::com::sun::star::chart2;
      51             : 
      52          52 : AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
      53             :                      , sal_Int32 nDimensionCount
      54             :                      , bool bCategoryXAxis
      55             :                      , bool bNoArea
      56             :                      )
      57             :         : VSeriesPlotter( xChartTypeModel, nDimensionCount, bCategoryXAxis )
      58           0 :         , m_pMainPosHelper(new PlottingPositionHelper())
      59          52 :         , m_bArea(!bNoArea)
      60             :         , m_bLine(bNoArea)
      61          52 :         , m_bSymbol( ChartTypeHelper::isSupportingSymbolProperties(xChartTypeModel,nDimensionCount) )
      62             :         , m_eCurveStyle(CurveStyle_LINES)
      63             :         , m_nCurveResolution(20)
      64             :         , m_nSplineOrder(3)
      65             :         , m_xSeriesTarget(0)
      66             :         , m_xErrorBarTarget(0)
      67             :         , m_xTextTarget(0)
      68         156 :         , m_xRegressionCurveEquationTarget(0)
      69             : {
      70          52 :     m_pMainPosHelper->AllowShiftXAxisPos(true);
      71          52 :     m_pMainPosHelper->AllowShiftZAxisPos(true);
      72             : 
      73          52 :     PlotterBase::m_pPosHelper = m_pMainPosHelper;
      74          52 :     VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper;
      75             : 
      76             :     try
      77             :     {
      78          52 :         if( m_xChartTypeModelProps.is() )
      79             :         {
      80          52 :             m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_CURVE_STYLE) >>= m_eCurveStyle;
      81          52 :             m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) >>= m_nCurveResolution;
      82          52 :             m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) >>= m_nSplineOrder;
      83             :         }
      84             :     }
      85           0 :     catch( uno::Exception& e )
      86             :     {
      87             :         //the above properties are not supported by all charttypes supported by this class (e.g. area or net chart)
      88             :         //in that cases this exception is ok
      89           0 :         e.Context.is();//to have debug information without compilation warnings
      90             :     }
      91          52 : }
      92             : 
      93         156 : AreaChart::~AreaChart()
      94             : {
      95          52 :     delete m_pMainPosHelper;
      96         104 : }
      97             : 
      98         112 : double AreaChart::getMaximumX()
      99             : {
     100         112 :     double fMax = VSeriesPlotter::getMaximumX();
     101         112 :     return fMax;
     102             : }
     103             : 
     104         228 : bool AreaChart::isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex )
     105             : {
     106         228 :     return VSeriesPlotter::isExpandIfValuesCloseToBorder( nDimensionIndex );
     107             : }
     108             : 
     109         548 : bool AreaChart::isSeparateStackingForDifferentSigns( sal_Int32 /*nDimensionIndex*/ )
     110             : {
     111             :     // no separate stacking in all types of line/area charts
     112         548 :     return false;
     113             : }
     114             : 
     115         198 : LegendSymbolStyle AreaChart::getLegendSymbolStyle()
     116             : {
     117         198 :     if( m_bArea || m_nDimension == 3 )
     118           9 :         return LegendSymbolStyle_BOX;
     119         189 :     return LegendSymbolStyle_LINE;
     120             : }
     121             : 
     122         150 : uno::Any AreaChart::getExplicitSymbol( const VDataSeries& rSeries, sal_Int32 nPointIndex )
     123             : {
     124         150 :     uno::Any aRet;
     125             : 
     126         150 :     Symbol* pSymbolProperties = rSeries.getSymbolProperties( nPointIndex );
     127         150 :     if( pSymbolProperties )
     128             :     {
     129         150 :         aRet = uno::makeAny(*pSymbolProperties);
     130             :     }
     131             : 
     132         150 :     return aRet;
     133             : }
     134             : 
     135          52 : drawing::Direction3D AreaChart::getPreferredDiagramAspectRatio() const
     136             : {
     137          52 :     drawing::Direction3D aRet(1,-1,1);
     138          52 :     if( m_nDimension == 2 )
     139          49 :         aRet = drawing::Direction3D(-1,-1,-1);
     140           3 :     else if (m_pPosHelper)
     141             :     {
     142           3 :         drawing::Direction3D aScale( m_pPosHelper->getScaledLogicWidth() );
     143           3 :         aRet.DirectionZ = aScale.DirectionZ*0.2;
     144           3 :         if(aRet.DirectionZ>1.0)
     145           0 :             aRet.DirectionZ=1.0;
     146           3 :         if(aRet.DirectionZ>10)
     147           0 :             aRet.DirectionZ=10;
     148             :     }
     149          52 :     return aRet;
     150             : }
     151             : 
     152           0 : bool AreaChart::keepAspectRatio() const
     153             : {
     154           0 :     if( m_nDimension == 2 )
     155             :     {
     156           0 :         if( !m_bSymbol )
     157           0 :             return false;
     158             :     }
     159           0 :     return true;
     160             : }
     161             : 
     162         151 : void AreaChart::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot )
     163             : {
     164         151 :     if( m_bArea && pSeries )
     165             :     {
     166           0 :         sal_Int32 nMissingValueTreatment = pSeries->getMissingValueTreatment();
     167           0 :         if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP  )
     168           0 :             pSeries->setMissingValueTreatment( ::com::sun::star::chart::MissingValueTreatment::USE_ZERO );
     169             :     }
     170         151 :     if( m_nDimension == 3 && !m_bCategoryXAxis )
     171             :     {
     172             :         //3D xy always deep
     173             :         OSL_ENSURE( zSlot==-1,"3D xy charts should be deep stacked in model also" );
     174           0 :         zSlot=-1;
     175           0 :         xSlot=0;
     176           0 :         ySlot=0;
     177             :     }
     178         151 :     VSeriesPlotter::addSeries( pSeries, zSlot, xSlot, ySlot );
     179         151 : }
     180             : 
     181           0 : void lcl_removeDuplicatePoints( drawing::PolyPolygonShape3D& rPolyPoly, PlottingPositionHelper& rPosHelper )
     182             : {
     183           0 :     sal_Int32 nPolyCount = rPolyPoly.SequenceX.getLength();
     184           0 :     if(!nPolyCount)
     185           0 :         return;
     186             : 
     187           0 :     drawing::PolyPolygonShape3D aTmp;
     188           0 :     aTmp.SequenceX.realloc(nPolyCount);
     189           0 :     aTmp.SequenceY.realloc(nPolyCount);
     190           0 :     aTmp.SequenceZ.realloc(nPolyCount);
     191             : 
     192           0 :     for( sal_Int32 nPolygonIndex = 0; nPolygonIndex<nPolyCount; nPolygonIndex++ )
     193             :     {
     194           0 :         drawing::DoubleSequence* pOuterSourceX = &rPolyPoly.SequenceX.getArray()[nPolygonIndex];
     195           0 :         drawing::DoubleSequence* pOuterSourceY = &rPolyPoly.SequenceY.getArray()[nPolygonIndex];
     196           0 :         drawing::DoubleSequence* pOuterSourceZ = &rPolyPoly.SequenceZ.getArray()[nPolygonIndex];
     197             : 
     198           0 :         drawing::DoubleSequence* pOuterTargetX = &aTmp.SequenceX.getArray()[nPolygonIndex];
     199           0 :         drawing::DoubleSequence* pOuterTargetY = &aTmp.SequenceY.getArray()[nPolygonIndex];
     200           0 :         drawing::DoubleSequence* pOuterTargetZ = &aTmp.SequenceZ.getArray()[nPolygonIndex];
     201             : 
     202           0 :         sal_Int32 nPointCount = pOuterSourceX->getLength();
     203           0 :         if( !nPointCount )
     204           0 :             continue;
     205             : 
     206           0 :         pOuterTargetX->realloc(nPointCount);
     207           0 :         pOuterTargetY->realloc(nPointCount);
     208           0 :         pOuterTargetZ->realloc(nPointCount);
     209             : 
     210           0 :         double* pSourceX = pOuterSourceX->getArray();
     211           0 :         double* pSourceY = pOuterSourceY->getArray();
     212           0 :         double* pSourceZ = pOuterSourceZ->getArray();
     213             : 
     214           0 :         double* pTargetX = pOuterTargetX->getArray();
     215           0 :         double* pTargetY = pOuterTargetY->getArray();
     216           0 :         double* pTargetZ = pOuterTargetZ->getArray();
     217             : 
     218             :         //copy first point
     219           0 :         *pTargetX=*pSourceX++;
     220           0 :         *pTargetY=*pSourceY++;
     221           0 :         *pTargetZ=*pSourceZ++;
     222           0 :         sal_Int32 nTargetPointCount=1;
     223             : 
     224           0 :         for( sal_Int32 nSource=1; nSource<nPointCount; nSource++ )
     225             :         {
     226           0 :             if( !rPosHelper.isSameForGivenResolution( *pTargetX, *pTargetY, *pTargetZ
     227           0 :                                                    , *pSourceX, *pSourceY, *pSourceZ ) )
     228             :             {
     229           0 :                 pTargetX++; pTargetY++; pTargetZ++;
     230           0 :                 *pTargetX=*pSourceX;
     231           0 :                 *pTargetY=*pSourceY;
     232           0 :                 *pTargetZ=*pSourceZ;
     233           0 :                 nTargetPointCount++;
     234             :             }
     235           0 :             pSourceX++; pSourceY++; pSourceZ++;
     236             :         }
     237             : 
     238             :         //free unused space
     239           0 :         if( nTargetPointCount<nPointCount )
     240             :         {
     241           0 :             pOuterTargetX->realloc(nTargetPointCount);
     242           0 :             pOuterTargetY->realloc(nTargetPointCount);
     243           0 :             pOuterTargetZ->realloc(nTargetPointCount);
     244             :         }
     245             : 
     246           0 :         pOuterSourceX->realloc(0);
     247           0 :         pOuterSourceY->realloc(0);
     248           0 :         pOuterSourceZ->realloc(0);
     249             :     }
     250             : 
     251             :     //free space
     252           0 :     rPolyPoly.SequenceX.realloc(nPolyCount);
     253           0 :     rPolyPoly.SequenceY.realloc(nPolyCount);
     254           0 :     rPolyPoly.SequenceZ.realloc(nPolyCount);
     255             : 
     256           0 :     rPolyPoly=aTmp;
     257             : }
     258             : 
     259           0 : bool AreaChart::create_stepped_line( drawing::PolyPolygonShape3D aStartPoly, chart2::CurveStyle eCurveStyle, PlottingPositionHelper* pPosHelper, drawing::PolyPolygonShape3D &aPoly )
     260             : {
     261           0 :     drawing::PolyPolygonShape3D aSteppedPoly;
     262             : 
     263           0 :     aSteppedPoly.SequenceX.realloc(0);
     264           0 :     aSteppedPoly.SequenceY.realloc(0);
     265           0 :     aSteppedPoly.SequenceZ.realloc(0);
     266             : 
     267           0 :     sal_uInt32 nOuterCount = aStartPoly.SequenceX.getLength();
     268           0 :     if ( !nOuterCount )
     269           0 :         return false;
     270             : 
     271           0 :     aSteppedPoly.SequenceX.realloc(nOuterCount);
     272           0 :     aSteppedPoly.SequenceY.realloc(nOuterCount);
     273           0 :     aSteppedPoly.SequenceZ.realloc(nOuterCount);
     274           0 :     for( sal_uInt32 nOuter = 0; nOuter < nOuterCount; ++nOuter )
     275             :     {
     276           0 :         if( aStartPoly.SequenceX[nOuter].getLength() <= 1 )
     277           0 :             continue; //we need at least two points
     278             : 
     279           0 :         sal_uInt32 nMaxIndexPoints = aStartPoly.SequenceX[nOuter].getLength()-1; // is >1
     280           0 :         sal_uInt32 nNewIndexPoints = 0;
     281           0 :         if ( CurveStyle_STEP_START==eCurveStyle || CurveStyle_STEP_END==eCurveStyle)
     282           0 :             nNewIndexPoints = nMaxIndexPoints * 2 + 1;
     283             :         else
     284           0 :             nNewIndexPoints = nMaxIndexPoints * 3 + 1;
     285             : 
     286           0 :         const double* pOldX = aStartPoly.SequenceX[nOuter].getConstArray();
     287           0 :         const double* pOldY = aStartPoly.SequenceY[nOuter].getConstArray();
     288           0 :         const double* pOldZ = aStartPoly.SequenceZ[nOuter].getConstArray();
     289             : 
     290           0 :         aSteppedPoly.SequenceX[nOuter].realloc( nNewIndexPoints );
     291           0 :         aSteppedPoly.SequenceY[nOuter].realloc( nNewIndexPoints );
     292           0 :         aSteppedPoly.SequenceZ[nOuter].realloc( nNewIndexPoints );
     293             : 
     294           0 :         double* pNewX = aSteppedPoly.SequenceX[nOuter].getArray();
     295           0 :         double* pNewY = aSteppedPoly.SequenceY[nOuter].getArray();
     296           0 :         double* pNewZ = aSteppedPoly.SequenceZ[nOuter].getArray();
     297             : 
     298           0 :         pNewX[0] = pOldX[0];
     299           0 :         pNewY[0] = pOldY[0];
     300           0 :         pNewZ[0] = pOldZ[0];
     301           0 :         for( sal_uInt32 oi = 0; oi < nMaxIndexPoints; oi++ )
     302             :         {
     303           0 :             switch ( eCurveStyle )
     304             :             {
     305             :                 case CurveStyle_STEP_START:
     306             :                      /**           O
     307             :                                    |
     308             :                                    |
     309             :                                    |
     310             :                              O-----+
     311             :                      */
     312             :                     // create the intermediate point
     313           0 :                     pNewX[1+oi*2] = pOldX[oi+1];
     314           0 :                     pNewY[1+oi*2] = pOldY[oi];
     315           0 :                     pNewZ[1+oi*2] = pOldZ[oi];
     316             :                     // and now the normal one
     317           0 :                     pNewX[1+oi*2+1] = pOldX[oi+1];
     318           0 :                     pNewY[1+oi*2+1] = pOldY[oi+1];
     319           0 :                     pNewZ[1+oi*2+1] = pOldZ[oi+1];
     320           0 :                     break;
     321             :                 case CurveStyle_STEP_END:
     322             :                      /**    +------O
     323             :                             |
     324             :                             |
     325             :                             |
     326             :                             O
     327             :                      */
     328             :                     // create the intermediate point
     329           0 :                     pNewX[1+oi*2] = pOldX[oi];
     330           0 :                     pNewY[1+oi*2] = pOldY[oi+1];
     331           0 :                     pNewZ[1+oi*2] = pOldZ[oi];
     332             :                     // and now the normal one
     333           0 :                     pNewX[1+oi*2+1] = pOldX[oi+1];
     334           0 :                     pNewY[1+oi*2+1] = pOldY[oi+1];
     335           0 :                     pNewZ[1+oi*2+1] = pOldZ[oi+1];
     336           0 :                     break;
     337             :                 case CurveStyle_STEP_CENTER_X:
     338             :                      /**        +--O
     339             :                                 |
     340             :                                 |
     341             :                                 |
     342             :                              O--+
     343             :                      */
     344             :                     // create the first intermediate point
     345           0 :                     pNewX[1+oi*3] = (pOldX[oi]+pOldX[oi+1])/2;
     346           0 :                     pNewY[1+oi*3] = pOldY[oi];
     347           0 :                     pNewZ[1+oi*3] = pOldZ[oi];
     348             :                     // create the second intermediate point
     349           0 :                     pNewX[1+oi*3+1] = (pOldX[oi]+pOldX[oi+1])/2;
     350           0 :                     pNewY[1+oi*3+1] = pOldY[oi+1];
     351           0 :                     pNewZ[1+oi*3+1] = pOldZ[oi];
     352             :                     // and now the normal one
     353           0 :                     pNewX[1+oi*3+2] = pOldX[oi+1];
     354           0 :                     pNewY[1+oi*3+2] = pOldY[oi+1];
     355           0 :                     pNewZ[1+oi*3+2] = pOldZ[oi+1];
     356           0 :                     break;
     357             :                 case CurveStyle_STEP_CENTER_Y:
     358             :                      /**           O
     359             :                                    |
     360             :                              +-----+
     361             :                              |
     362             :                              O
     363             :                      */
     364             :                     // create the first intermediate point
     365           0 :                     pNewX[1+oi*3] = pOldX[oi];
     366           0 :                     pNewY[1+oi*3] = (pOldY[oi]+pOldY[oi+1])/2;
     367           0 :                     pNewZ[1+oi*3] = pOldZ[oi];
     368             :                     // create the second intermediate point
     369           0 :                     pNewX[1+oi*3+1] = pOldX[oi+1];
     370           0 :                     pNewY[1+oi*3+1] = (pOldY[oi]+pOldY[oi+1])/2;
     371           0 :                     pNewZ[1+oi*3+1] = pOldZ[oi];
     372             :                     // and now the normal one
     373           0 :                     pNewX[1+oi*3+2] = pOldX[oi+1];
     374           0 :                     pNewY[1+oi*3+2] = pOldY[oi+1];
     375           0 :                     pNewZ[1+oi*3+2] = pOldZ[oi+1];
     376           0 :                     break;
     377             :                 default:
     378             :                     // this should never be executed
     379             :                     OSL_FAIL("Unknown curvestyle in AreaChart::create_stepped_line");
     380             :             }
     381             :         }
     382             :     }
     383           0 :     Clipping::clipPolygonAtRectangle( aSteppedPoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
     384             : 
     385           0 :     return true;
     386             : }
     387             : 
     388         151 : bool AreaChart::impl_createLine( VDataSeries* pSeries
     389             :                 , drawing::PolyPolygonShape3D* pSeriesPoly
     390             :                 , PlottingPositionHelper* pPosHelper )
     391             : {
     392             :     //return true if a line was created successfully
     393         151 :     uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
     394             : 
     395         302 :     drawing::PolyPolygonShape3D aPoly;
     396         151 :     if(CurveStyle_CUBIC_SPLINES==m_eCurveStyle)
     397             :     {
     398           0 :         drawing::PolyPolygonShape3D aSplinePoly;
     399           0 :         SplineCalculater::CalculateCubicSplines( *pSeriesPoly, aSplinePoly, m_nCurveResolution );
     400           0 :         lcl_removeDuplicatePoints( aSplinePoly, *pPosHelper );
     401           0 :         Clipping::clipPolygonAtRectangle( aSplinePoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
     402             :     }
     403         151 :     else if(CurveStyle_B_SPLINES==m_eCurveStyle)
     404             :     {
     405           0 :         drawing::PolyPolygonShape3D aSplinePoly;
     406           0 :         SplineCalculater::CalculateBSplines( *pSeriesPoly, aSplinePoly, m_nCurveResolution, m_nSplineOrder );
     407           0 :         lcl_removeDuplicatePoints( aSplinePoly, *pPosHelper );
     408           0 :         Clipping::clipPolygonAtRectangle( aSplinePoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
     409             :     }
     410         302 :     else if (CurveStyle_STEP_START==m_eCurveStyle ||
     411         302 :              CurveStyle_STEP_END==m_eCurveStyle ||
     412         302 :              CurveStyle_STEP_CENTER_Y==m_eCurveStyle ||
     413         151 :              CurveStyle_STEP_CENTER_X==m_eCurveStyle
     414             :             )
     415             :     {
     416           0 :         if (!create_stepped_line(*pSeriesPoly, m_eCurveStyle, pPosHelper, aPoly))
     417             :         {
     418           0 :             return false;
     419             :         }
     420             :     }
     421             :     else
     422             :     { // default to creating a straight line
     423             :         SAL_WARN_IF(CurveStyle_LINES != m_eCurveStyle, "chart2.areachart", "Unknown curve style");
     424         151 :         Clipping::clipPolygonAtRectangle( *pSeriesPoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
     425             :     }
     426             : 
     427         151 :     if(!AbstractShapeFactory::hasPolygonAnyLines(aPoly))
     428           0 :         return false;
     429             : 
     430             :     //transformation 3) -> 4)
     431         151 :     pPosHelper->transformScaledLogicToScene( aPoly );
     432             : 
     433             :     //create line:
     434         302 :     uno::Reference< drawing::XShape > xShape(NULL);
     435         151 :     if(m_nDimension==3)
     436             :     {
     437           9 :         double fDepth = this->getTransformedDepth();
     438           9 :         sal_Int32 nPolyCount = aPoly.SequenceX.getLength();
     439          18 :         for(sal_Int32 nPoly=0;nPoly<nPolyCount;nPoly++)
     440             :         {
     441           9 :             sal_Int32 nPointCount = aPoly.SequenceX[nPoly].getLength();
     442         117 :             for(sal_Int32 nPoint=0;nPoint<nPointCount-1;nPoint++)
     443             :             {
     444         108 :                 drawing::Position3D aPoint1, aPoint2;
     445         108 :                 aPoint1.PositionX = aPoly.SequenceX[nPoly][nPoint+1];
     446         108 :                 aPoint1.PositionY = aPoly.SequenceY[nPoly][nPoint+1];
     447         108 :                 aPoint1.PositionZ = aPoly.SequenceZ[nPoly][nPoint+1];
     448             : 
     449         108 :                 aPoint2.PositionX = aPoly.SequenceX[nPoly][nPoint];
     450         108 :                 aPoint2.PositionY = aPoly.SequenceY[nPoly][nPoint];
     451         108 :                 aPoint2.PositionZ = aPoly.SequenceZ[nPoly][nPoint];
     452             : 
     453         108 :                 Stripe aStripe( aPoint1, aPoint2, fDepth );
     454             : 
     455             :                 m_pShapeFactory->createStripe(xSeriesGroupShape_Shapes
     456             :                     , Stripe( aPoint1, aPoint2, fDepth )
     457         108 :                     , pSeries->getPropertiesOfSeries(), PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), true, 1 );
     458             :             }
     459             :         }
     460             :     }
     461             :     else //m_nDimension!=3
     462             :     {
     463         426 :         xShape = m_pShapeFactory->createLine2D( xSeriesGroupShape_Shapes
     464         284 :                 , PolyToPointSequence( aPoly ) );
     465             :         this->setMappedProperties( xShape
     466             :                 , pSeries->getPropertiesOfSeries()
     467         142 :                 , PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
     468             :         //because of this name this line will be used for marking
     469         142 :         m_pShapeFactory->setShapeName(xShape, "MarkHandles");
     470             :     }
     471         302 :     return true;
     472             : }
     473             : 
     474           0 : bool AreaChart::impl_createArea( VDataSeries* pSeries
     475             :                 , drawing::PolyPolygonShape3D* pSeriesPoly
     476             :                 , drawing::PolyPolygonShape3D* pPreviousSeriesPoly
     477             :                 , PlottingPositionHelper* pPosHelper )
     478             : {
     479             :     //return true if an area was created successfully
     480             : 
     481           0 :     uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
     482           0 :     double zValue = pSeries->m_fLogicZPos;
     483             : 
     484           0 :     drawing::PolyPolygonShape3D aPoly( *pSeriesPoly );
     485             :     //add second part to the polygon (grounding points or previous series points)
     486           0 :     if(!pPreviousSeriesPoly)
     487             :     {
     488           0 :         double fMinX = pSeries->m_fLogicMinX;
     489           0 :         double fMaxX = pSeries->m_fLogicMaxX;
     490           0 :         double fY = pPosHelper->getBaseValueY();//logic grounding
     491           0 :         if( m_nDimension==3 )
     492           0 :             fY = pPosHelper->getLogicMinY();
     493             : 
     494             :         //clip to scale
     495           0 :         if(fMaxX<pPosHelper->getLogicMinX() || fMinX>pPosHelper->getLogicMaxX())
     496           0 :             return false;//no visible shape needed
     497           0 :         pPosHelper->clipLogicValues( &fMinX, &fY, 0 );
     498           0 :         pPosHelper->clipLogicValues( &fMaxX, 0, 0 );
     499             : 
     500             :         //apply scaling
     501             :         {
     502           0 :             pPosHelper->doLogicScaling( &fMinX, &fY, &zValue );
     503           0 :             pPosHelper->doLogicScaling( &fMaxX, 0, 0 );
     504             :         }
     505             : 
     506           0 :         AddPointToPoly( aPoly, drawing::Position3D( fMaxX,fY,zValue) );
     507           0 :         AddPointToPoly( aPoly, drawing::Position3D( fMinX,fY,zValue) );
     508             :     }
     509             :     else
     510             :     {
     511           0 :         appendPoly( aPoly, *pPreviousSeriesPoly );
     512             :     }
     513           0 :     AbstractShapeFactory::closePolygon(aPoly);
     514             : 
     515             :     //apply clipping
     516             :     {
     517           0 :         drawing::PolyPolygonShape3D aClippedPoly;
     518           0 :         Clipping::clipPolygonAtRectangle( aPoly, pPosHelper->getScaledLogicClipDoubleRect(), aClippedPoly, false );
     519           0 :         AbstractShapeFactory::closePolygon(aClippedPoly); //again necessary after clipping
     520           0 :         aPoly = aClippedPoly;
     521             :     }
     522             : 
     523           0 :     if(!AbstractShapeFactory::hasPolygonAnyLines(aPoly))
     524           0 :         return false;
     525             : 
     526             :     //transformation 3) -> 4)
     527           0 :     pPosHelper->transformScaledLogicToScene( aPoly );
     528             : 
     529             :     //create area:
     530           0 :     uno::Reference< drawing::XShape > xShape(NULL);
     531           0 :     if(m_nDimension==3)
     532             :     {
     533           0 :         xShape = m_pShapeFactory->createArea3D( xSeriesGroupShape_Shapes
     534           0 :                 , aPoly, this->getTransformedDepth() );
     535             :     }
     536             :     else //m_nDimension!=3
     537             :     {
     538           0 :         xShape = m_pShapeFactory->createArea2D( xSeriesGroupShape_Shapes
     539           0 :                 , aPoly );
     540             :     }
     541             :     this->setMappedProperties( xShape
     542             :                 , pSeries->getPropertiesOfSeries()
     543           0 :                 , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
     544             :     //because of this name this line will be used for marking
     545           0 :     m_pShapeFactory->setShapeName(xShape, "MarkHandles");
     546           0 :     return true;
     547             : }
     548             : 
     549          52 : void AreaChart::impl_createSeriesShapes()
     550             : {
     551             :     //the polygon shapes for each series need to be created before
     552             : 
     553             :     //iterate through all series again to create the series shapes
     554          52 :     ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator            aZSlotIter = m_aZSlots.begin();
     555          52 :     const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
     556         128 :     for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; ++aZSlotIter, ++nZ )
     557             :     {
     558          76 :         ::std::vector< VDataSeriesGroup >::iterator             aXSlotIter = aZSlotIter->begin();
     559          76 :         const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
     560             : 
     561         236 :         for( ; aXSlotIter != aXSlotEnd; ++aXSlotIter )
     562             :         {
     563         160 :             ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
     564             : 
     565         160 :             ::std::vector< VDataSeries* >::const_iterator       aSeriesIter = pSeriesList->begin();
     566         160 :             const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd  = pSeriesList->end();
     567             : 
     568         160 :             std::map< sal_Int32, drawing::PolyPolygonShape3D* > aPreviousSeriesPolyMap;//a PreviousSeriesPoly for each different nAttachedAxisIndex
     569         160 :             drawing::PolyPolygonShape3D* pSeriesPoly = NULL;
     570             : 
     571             :             //iterate through all series
     572         311 :             for( ; aSeriesIter != aSeriesEnd; ++aSeriesIter )
     573             :             {
     574         151 :                 sal_Int32 nAttachedAxisIndex = (*aSeriesIter)->getAttachedAxisIndex();
     575         151 :                 PlottingPositionHelper* pPosHelper = &(this->getPlottingPositionHelper( nAttachedAxisIndex ));
     576         151 :                 if(!pPosHelper)
     577           0 :                     pPosHelper = m_pMainPosHelper;
     578         151 :                 PlotterBase::m_pPosHelper = pPosHelper;
     579             : 
     580         151 :                 createRegressionCurvesShapes( **aSeriesIter, m_xErrorBarTarget, m_xRegressionCurveEquationTarget,
     581         302 :                                               m_pPosHelper->maySkipPointsInRegressionCalculation());
     582             : 
     583         151 :                 pSeriesPoly = &(*aSeriesIter)->m_aPolyPolygonShape3D;
     584         151 :                 if( m_bArea )
     585             :                 {
     586           0 :                     if( !impl_createArea( *aSeriesIter, pSeriesPoly, aPreviousSeriesPolyMap[nAttachedAxisIndex], pPosHelper ) )
     587           0 :                         continue;
     588             :                 }
     589         151 :                 if( m_bLine )
     590             :                 {
     591         151 :                     if( !impl_createLine( *aSeriesIter, pSeriesPoly, pPosHelper ) )
     592           0 :                         continue;
     593             :                 }
     594         151 :                 aPreviousSeriesPolyMap[nAttachedAxisIndex] = pSeriesPoly;
     595             :             }//next series in x slot (next y slot)
     596         160 :         }//next x slot
     597             :     }//next z slot
     598          52 : }
     599             : 
     600             : namespace
     601             : {
     602             : 
     603          18 : void lcl_reorderSeries( ::std::vector< ::std::vector< VDataSeriesGroup > >&  rZSlots )
     604             : {
     605          18 :     ::std::vector< ::std::vector< VDataSeriesGroup > >  aRet( rZSlots.size() );
     606             : 
     607          18 :     ::std::vector< ::std::vector< VDataSeriesGroup > >::reverse_iterator aZIt( rZSlots.rbegin() );
     608          18 :     ::std::vector< ::std::vector< VDataSeriesGroup > >::reverse_iterator aZEnd( rZSlots.rend() );
     609          36 :     for( ; aZIt != aZEnd; ++aZIt )
     610             :     {
     611          18 :         ::std::vector< VDataSeriesGroup > aXSlot( aZIt->size() );
     612             : 
     613          18 :         ::std::vector< VDataSeriesGroup >::reverse_iterator aXIt( aZIt->rbegin() );
     614          18 :         ::std::vector< VDataSeriesGroup >::reverse_iterator aXEnd( aZIt->rend() );
     615          36 :         for( ; aXIt != aXEnd; ++aXIt )
     616          18 :             aXSlot.push_back(*aXIt);
     617             : 
     618          18 :         aRet.push_back(aXSlot);
     619          18 :     }
     620             : 
     621          18 :     rZSlots.clear();
     622          18 :     rZSlots = aRet;
     623          18 : }
     624             : 
     625             : }//anonymous namespace
     626             : 
     627             : //better performance for big data
     628             : struct FormerPoint
     629             : {
     630        1116 :     FormerPoint( double fX, double fY, double fZ )
     631        1116 :         : m_fX(fX), m_fY(fY), m_fZ(fZ)
     632        1116 :         {}
     633         151 :     FormerPoint()
     634             :     {
     635         151 :         ::rtl::math::setNan( &m_fX );
     636         151 :         ::rtl::math::setNan( &m_fY );
     637         151 :         ::rtl::math::setNan( &m_fZ );
     638         151 :     }
     639             : 
     640             :     double m_fX;
     641             :     double m_fY;
     642             :     double m_fZ;
     643             : };
     644             : 
     645          52 : void AreaChart::createShapes()
     646             : {
     647          52 :     if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
     648           0 :         return;
     649             : 
     650          52 :     if( m_nDimension == 2 && ( m_bArea || !m_bCategoryXAxis ) )
     651          18 :         lcl_reorderSeries( m_aZSlots );
     652             : 
     653             :     OSL_ENSURE(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"AreaChart is not proper initialized");
     654          52 :     if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
     655           0 :         return;
     656             : 
     657             :     //the text labels should be always on top of the other series shapes
     658             :     //for area chart the error bars should be always on top of the other series shapes
     659             : 
     660             :     //therefore create an own group for the texts and the error bars to move them to front
     661             :     //(because the text group is created after the series group the texts are displayed on top)
     662          52 :     m_xSeriesTarget   = createGroupShape( m_xLogicTarget,OUString() );
     663          52 :     if( m_bArea )
     664           0 :         m_xErrorBarTarget = createGroupShape( m_xLogicTarget,OUString() );
     665             :     else
     666          52 :         m_xErrorBarTarget = m_xSeriesTarget;
     667          52 :     m_xTextTarget     = m_pShapeFactory->createGroup2D( m_xFinalTarget,OUString() );
     668          52 :     m_xRegressionCurveEquationTarget = m_pShapeFactory->createGroup2D( m_xFinalTarget,OUString() );
     669             : 
     670             :     //check necessary here that different Y axis can not be stacked in the same group? ... hm?
     671             : 
     672             :     //update/create information for current group
     673          52 :     double fLogicZ        = 1.0;//as defined
     674             : 
     675          52 :     sal_Int32 nStartIndex = 0; // inclusive       ;..todo get somehow from x scale
     676          52 :     sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
     677          52 :     if(nEndIndex<=0)
     678           0 :         nEndIndex=1;
     679             : 
     680             :     //better performance for big data
     681          52 :     std::map< VDataSeries*, FormerPoint > aSeriesFormerPointMap;
     682          52 :     m_bPointsWereSkipped = false;
     683          52 :     sal_Int32 nSkippedPoints = 0;
     684          52 :     sal_Int32 nCreatedPoints = 0;
     685             : 
     686             : 
     687          52 :     bool bDateCategory = (m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis());
     688             : 
     689          52 :     ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
     690          52 :     const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
     691             : 
     692         104 :     std::vector<std::map< sal_Int32, double > > aLogicYSumMapByX(nEndIndex);//one for each different nAttachedAxisIndex
     693         128 :     for( ; aZSlotIter != aZSlotEnd; ++aZSlotIter )
     694             :     {
     695          76 :         ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
     696          76 :         const ::std::vector< VDataSeriesGroup >::iterator aXSlotEnd = aZSlotIter->end();
     697             : 
     698             :         //iterate through all x slots in this category to get 100percent sum
     699         236 :         for( ; aXSlotIter != aXSlotEnd; ++aXSlotIter )
     700             :         {
     701         160 :             std::vector<VDataSeries*>& rSeriesList = aXSlotIter->m_aSeriesVector;
     702         160 :             std::vector<VDataSeries*>::iterator aSeriesIter = rSeriesList.begin();
     703         160 :             std::vector<VDataSeries*>::iterator aSeriesEnd  = rSeriesList.end();
     704             : 
     705         311 :             for( ; aSeriesIter != aSeriesEnd; ++aSeriesIter )
     706             :             {
     707         151 :                 VDataSeries* pSeries( *aSeriesIter );
     708         151 :                 if(!pSeries)
     709           0 :                     continue;
     710             : 
     711         151 :                 if (bDateCategory)
     712           0 :                     pSeries->doSortByXValues();
     713             : 
     714        1267 :                 for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
     715             :                 {
     716        1116 :                     std::map< sal_Int32, double >& rLogicYSumMap = aLogicYSumMapByX[nIndex];
     717        1116 :                     sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
     718        1116 :                     if( rLogicYSumMap.find(nAttachedAxisIndex)==rLogicYSumMap.end() )
     719         408 :                         rLogicYSumMap[nAttachedAxisIndex]=0.0;
     720             : 
     721        1116 :                     PlottingPositionHelper* pPosHelper = &(this->getPlottingPositionHelper( nAttachedAxisIndex ));
     722        1116 :                     if(!pPosHelper)
     723           0 :                         pPosHelper = m_pMainPosHelper;
     724        1116 :                     PlotterBase::m_pPosHelper = pPosHelper;
     725             : 
     726        1116 :                     double fAdd = pSeries->getYValue( nIndex );
     727        1116 :                     if( !::rtl::math::isNan(fAdd) && !::rtl::math::isInf(fAdd) )
     728        1116 :                         rLogicYSumMap[nAttachedAxisIndex] += fabs( fAdd );
     729             :                 }
     730             :             }
     731             :         }
     732             :     }
     733             : 
     734          52 :     aZSlotIter = m_aZSlots.begin();
     735         128 :     for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; ++aZSlotIter, ++nZ )
     736             :     {
     737          76 :         ::std::vector< VDataSeriesGroup >::const_iterator aXSlotIter = aZSlotIter->begin();
     738          76 :         ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
     739             : 
     740             :         //for the area chart there should be at most one x slot (no side by side stacking available)
     741             :         //attention different: xSlots are always interpreted as independent areas one behind the other: @todo this doesn't work why not???
     742         236 :         for( sal_Int32 nX=0; aXSlotIter != aXSlotEnd; ++aXSlotIter, ++nX )
     743             :         {
     744         160 :             const std::vector<VDataSeries*>& rSeriesList = aXSlotIter->m_aSeriesVector;
     745         160 :             std::vector<VDataSeries*>::const_iterator aSeriesIter = rSeriesList.begin();
     746         160 :             const std::vector<VDataSeries*>::const_iterator aSeriesEnd  = rSeriesList.end();
     747             : 
     748         160 :             std::vector<std::map< sal_Int32, double > > aLogicYForNextSeriesMapByX(nEndIndex); //one for each different nAttachedAxisIndex
     749             :             //iterate through all series
     750         311 :             for( sal_Int32 nSeriesIndex = 0; aSeriesIter != aSeriesEnd; ++aSeriesIter, ++nSeriesIndex )
     751             :             {
     752         151 :                 VDataSeries* pSeries( *aSeriesIter );
     753         151 :                 if(!pSeries)
     754           0 :                     continue;
     755             : 
     756         151 :                 uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeFrontChild(*aSeriesIter, m_xSeriesTarget);
     757             : 
     758         151 :                 sal_Int32 nAttachedAxisIndex = (*aSeriesIter)->getAttachedAxisIndex();
     759         151 :                 PlottingPositionHelper* pPosHelper = &(this->getPlottingPositionHelper( nAttachedAxisIndex ));
     760         151 :                 if(!pPosHelper)
     761           0 :                     pPosHelper = m_pMainPosHelper;
     762         151 :                 PlotterBase::m_pPosHelper = pPosHelper;
     763             : 
     764         151 :                 if(m_nDimension==3)
     765           9 :                     fLogicZ = nZ+0.5;
     766         151 :                 (*aSeriesIter)->m_fLogicZPos = fLogicZ;
     767             : 
     768        1267 :                 for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
     769             :                 {
     770             : 
     771             :                     /*  #i70133# ignore points outside of series length in standard area
     772             :                         charts. Stacked area charts will use missing points as zeros. In
     773             :                         standard charts, pSeriesList contains only one series. */
     774        1116 :                     if( m_bArea && (rSeriesList.size() == 1) && (nIndex >= (*aSeriesIter)->getTotalPointCount()) )
     775         256 :                         continue;
     776             : 
     777             :                     //collect data point information (logic coordinates, style ):
     778        1116 :                     double fLogicX = (*aSeriesIter)->getXValue(nIndex);
     779        1116 :                     if (bDateCategory)
     780           0 :                         fLogicX = DateHelper::RasterizeDateValue( fLogicX, m_aNullDate, m_nTimeResolution );
     781        1116 :                     double fLogicY = (*aSeriesIter)->getYValue(nIndex);
     782             : 
     783        1116 :                     if( m_nDimension==3 && m_bArea && rSeriesList.size()!=1 )
     784           0 :                         fLogicY = fabs( fLogicY );
     785             : 
     786        1116 :                     std::map< sal_Int32, double >& rLogicYSumMap = aLogicYSumMapByX[nIndex];
     787        1116 :                     if( pPosHelper->isPercentY() && !::rtl::math::approxEqual( rLogicYSumMap[nAttachedAxisIndex], 0.0 ) )
     788             :                     {
     789          39 :                         fLogicY = fabs( fLogicY )/rLogicYSumMap[nAttachedAxisIndex];
     790             :                     }
     791             : 
     792        3348 :                     if(    ::rtl::math::isNan(fLogicX) || ::rtl::math::isInf(fLogicX)
     793        1116 :                             || ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY)
     794        2232 :                             || ::rtl::math::isNan(fLogicZ) || ::rtl::math::isInf(fLogicZ) )
     795             :                     {
     796           0 :                         if( (*aSeriesIter)->getMissingValueTreatment() == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
     797             :                         {
     798           0 :                             drawing::PolyPolygonShape3D& rPolygon = (*aSeriesIter)->m_aPolyPolygonShape3D;
     799           0 :                             sal_Int32& rIndex = (*aSeriesIter)->m_nPolygonIndex;
     800           0 :                             if( 0<= rIndex && rIndex < rPolygon.SequenceX.getLength() )
     801             :                             {
     802           0 :                                 if( rPolygon.SequenceX[ rIndex ].getLength() )
     803           0 :                                     rIndex++; //start a new polygon for the next point if the current poly is not empty
     804             :                             }
     805             :                         }
     806           0 :                         continue;
     807             :                     }
     808             : 
     809        1116 :                     std::map< sal_Int32, double >& rLogicYForNextSeriesMap = aLogicYForNextSeriesMapByX[nIndex];
     810        1116 :                     if( rLogicYForNextSeriesMap.find(nAttachedAxisIndex) == rLogicYForNextSeriesMap.end() )
     811         999 :                         rLogicYForNextSeriesMap[nAttachedAxisIndex] = 0.0;
     812             : 
     813        1116 :                     double fLogicValueForLabeDisplay = fLogicY;
     814             : 
     815        1116 :                     fLogicY += rLogicYForNextSeriesMap[nAttachedAxisIndex];
     816        1116 :                     rLogicYForNextSeriesMap[nAttachedAxisIndex] = fLogicY;
     817             : 
     818        1116 :                     bool bIsVisible = pPosHelper->isLogicVisible( fLogicX, fLogicY, fLogicZ );
     819             : 
     820             :                     //remind minimal and maximal x values for area 'grounding' points
     821             :                     //only for filled area
     822             :                     {
     823        1116 :                         double& rfMinX = (*aSeriesIter)->m_fLogicMinX;
     824        1116 :                         if(!nIndex||fLogicX<rfMinX)
     825         151 :                             rfMinX=fLogicX;
     826        1116 :                         double& rfMaxX = (*aSeriesIter)->m_fLogicMaxX;
     827        1116 :                         if(!nIndex||fLogicX>rfMaxX)
     828        1116 :                             rfMaxX=fLogicX;
     829             :                     }
     830             : 
     831        1116 :                     drawing::Position3D aUnscaledLogicPosition( fLogicX, fLogicY, fLogicZ );
     832        1116 :                     drawing::Position3D aScaledLogicPosition(aUnscaledLogicPosition);
     833        1116 :                     pPosHelper->doLogicScaling( aScaledLogicPosition );
     834             : 
     835             :                     //transformation 3) -> 4)
     836        1116 :                     drawing::Position3D aScenePosition( pPosHelper->transformLogicToScene( fLogicX,fLogicY,fLogicZ, false ) );
     837             : 
     838             :                     //better performance for big data
     839        1116 :                     FormerPoint aFormerPoint( aSeriesFormerPointMap[pSeries] );
     840        1116 :                     pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution );
     841        2232 :                     if( !pSeries->isAttributedDataPoint(nIndex)
     842        2219 :                             &&
     843             :                             pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ
     844        1103 :                                 , aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ ) )
     845             :                     {
     846           0 :                         ++nSkippedPoints;
     847           0 :                         m_bPointsWereSkipped = true;
     848           0 :                         continue;
     849             :                     }
     850        1116 :                     aSeriesFormerPointMap[pSeries] = FormerPoint(aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ);
     851             : 
     852             : 
     853             :                     //store point information for series polygon
     854             :                     //for area and/or line (symbols only do not need this)
     855        1116 :                     if( isValidPosition(aScaledLogicPosition) )
     856             :                     {
     857        1116 :                         AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aScaledLogicPosition, (*aSeriesIter)->m_nPolygonIndex );
     858             :                     }
     859             : 
     860             :                     //create a single datapoint if point is visible
     861             :                     //apply clipping:
     862        1116 :                     if( !bIsVisible )
     863           0 :                         continue;
     864             : 
     865        1116 :                     bool bCreateYErrorBar = false, bCreateXErrorBar = false;
     866             :                     {
     867        1116 :                         uno::Reference< beans::XPropertySet > xErrorBarProp(pSeries->getYErrorBarProperties(nIndex));
     868        1116 :                         if( xErrorBarProp.is() )
     869             :                         {
     870         452 :                             bool bShowPositive = false;
     871         452 :                             bool bShowNegative = false;
     872         452 :                             xErrorBarProp->getPropertyValue("ShowPositiveError") >>= bShowPositive;
     873         452 :                             xErrorBarProp->getPropertyValue("ShowNegativeError") >>= bShowNegative;
     874         452 :                             bCreateYErrorBar = bShowPositive || bShowNegative;
     875             :                         }
     876             : 
     877        1116 :                         xErrorBarProp = pSeries->getXErrorBarProperties(nIndex);
     878        1116 :                         if ( xErrorBarProp.is() )
     879             :                         {
     880           0 :                             bool bShowPositive = false;
     881           0 :                             bool bShowNegative = false;
     882           0 :                             xErrorBarProp->getPropertyValue("ShowPositiveError") >>= bShowPositive;
     883           0 :                             xErrorBarProp->getPropertyValue("ShowNegativeError") >>= bShowNegative;
     884           0 :                             bCreateXErrorBar = bShowPositive || bShowNegative;
     885        1116 :                         }
     886             :                     }
     887             : 
     888        1116 :                     Symbol* pSymbolProperties = m_bSymbol ? (*aSeriesIter)->getSymbolProperties( nIndex ) : 0;
     889        1116 :                     bool bCreateSymbol = pSymbolProperties && (pSymbolProperties->Style != SymbolStyle_NONE);
     890             : 
     891        3992 :                     if( !bCreateSymbol && !bCreateYErrorBar &&
     892        2642 :                             !bCreateXErrorBar && !pSeries->getDataPointLabelIfLabel(nIndex) )
     893         256 :                         continue;
     894             : 
     895             :                     //create a group shape for this point and add to the series shape:
     896             :                     OUString aPointCID = ObjectIdentifier::createPointCID(
     897         860 :                             (*aSeriesIter)->getPointCID_Stub(), nIndex );
     898             :                     uno::Reference< drawing::XShapes > xPointGroupShape_Shapes(
     899        1720 :                             createGroupShape(xSeriesGroupShape_Shapes,aPointCID) );
     900             :                     uno::Reference<drawing::XShape> xPointGroupShape_Shape =
     901        1720 :                         uno::Reference<drawing::XShape>( xPointGroupShape_Shapes, uno::UNO_QUERY );
     902             : 
     903             :                     {
     904         860 :                         nCreatedPoints++;
     905             : 
     906             :                         //create data point
     907         860 :                         drawing::Direction3D aSymbolSize(0,0,0);
     908         860 :                         if( bCreateSymbol )
     909             :                         {
     910         119 :                             if(m_nDimension!=3)
     911             :                             {
     912         119 :                                 if( pSymbolProperties )
     913             :                                 {
     914         119 :                                     if( pSymbolProperties->Style != SymbolStyle_NONE )
     915             :                                     {
     916         119 :                                         aSymbolSize.DirectionX = pSymbolProperties->Size.Width;
     917         119 :                                         aSymbolSize.DirectionY = pSymbolProperties->Size.Height;
     918             :                                     }
     919             : 
     920         119 :                                     if( pSymbolProperties->Style == SymbolStyle_STANDARD )
     921             :                                     {
     922         119 :                                         sal_Int32 nSymbol = pSymbolProperties->StandardSymbol;
     923             :                                         m_pShapeFactory->createSymbol2D( xPointGroupShape_Shapes
     924             :                                                 , aScenePosition, aSymbolSize
     925             :                                                 , nSymbol
     926             :                                                 , pSymbolProperties->BorderColor
     927         119 :                                                 , pSymbolProperties->FillColor );
     928             :                                     }
     929           0 :                                     else if( pSymbolProperties->Style == SymbolStyle_GRAPHIC )
     930             :                                     {
     931             :                                         m_pShapeFactory->createGraphic2D( xPointGroupShape_Shapes
     932             :                                                 , aScenePosition , aSymbolSize
     933           0 :                                                 , pSymbolProperties->Graphic );
     934             :                                     }
     935             :                                     //@todo other symbol styles
     936             :                                 }
     937             :                             }
     938             :                         }
     939             :                         //create error bars
     940         860 :                         if (bCreateXErrorBar)
     941           0 :                             createErrorBar_X( aUnscaledLogicPosition, **aSeriesIter, nIndex, m_xErrorBarTarget );
     942             : 
     943         860 :                         if (bCreateYErrorBar)
     944         257 :                             createErrorBar_Y( aUnscaledLogicPosition, **aSeriesIter, nIndex, m_xErrorBarTarget );
     945             : 
     946             :                         //create data point label
     947         860 :                         if( (**aSeriesIter).getDataPointLabelIfLabel(nIndex) )
     948             :                         {
     949         741 :                             LabelAlignment eAlignment = LABEL_ALIGN_TOP;
     950             :                             drawing::Position3D aScenePosition3D( aScenePosition.PositionX
     951             :                                     , aScenePosition.PositionY
     952         741 :                                     , aScenePosition.PositionZ+this->getTransformedDepth() );
     953             : 
     954         741 :                             sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nIndex, m_xChartTypeModel, m_nDimension, pPosHelper->isSwapXAndY() );
     955             : 
     956         741 :                             switch(nLabelPlacement)
     957             :                             {
     958             :                                 case ::com::sun::star::chart::DataLabelPlacement::TOP:
     959         741 :                                     aScenePosition3D.PositionY -= (aSymbolSize.DirectionY/2+1);
     960         741 :                                     eAlignment = LABEL_ALIGN_TOP;
     961         741 :                                     break;
     962             :                                 case ::com::sun::star::chart::DataLabelPlacement::BOTTOM:
     963           0 :                                     aScenePosition3D.PositionY += (aSymbolSize.DirectionY/2+1);
     964           0 :                                     eAlignment = LABEL_ALIGN_BOTTOM;
     965           0 :                                     break;
     966             :                                 case ::com::sun::star::chart::DataLabelPlacement::LEFT:
     967           0 :                                     aScenePosition3D.PositionX -= (aSymbolSize.DirectionX/2+1);
     968           0 :                                     eAlignment = LABEL_ALIGN_LEFT;
     969           0 :                                     break;
     970             :                                 case ::com::sun::star::chart::DataLabelPlacement::RIGHT:
     971           0 :                                     aScenePosition3D.PositionX += (aSymbolSize.DirectionX/2+1);
     972           0 :                                     eAlignment = LABEL_ALIGN_RIGHT;
     973           0 :                                     break;
     974             :                                 case ::com::sun::star::chart::DataLabelPlacement::CENTER:
     975           0 :                                     eAlignment = LABEL_ALIGN_CENTER;
     976             :                                     //todo implement this different for area charts
     977           0 :                                     break;
     978             :                                 default:
     979             :                                     OSL_FAIL("this label alignment is not implemented yet");
     980           0 :                                     aScenePosition3D.PositionY -= (aSymbolSize.DirectionY/2+1);
     981           0 :                                     eAlignment = LABEL_ALIGN_TOP;
     982           0 :                                     break;
     983             :                             }
     984             : 
     985         741 :                             awt::Point aScreenPosition2D;//get the screen position for the labels
     986         741 :                             sal_Int32 nOffset = 100; //todo maybe calculate this font height dependent
     987             :                             {
     988         741 :                                 if(LABEL_ALIGN_CENTER==eAlignment || m_nDimension == 3 )
     989         117 :                                     nOffset = 0;
     990             :                                 aScreenPosition2D = awt::Point( LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory)
     991         741 :                                         .transformSceneToScreenPosition( aScenePosition3D ) );
     992             :                             }
     993             : 
     994         741 :                             this->createDataLabel( m_xTextTarget, **aSeriesIter, nIndex
     995             :                                     , fLogicValueForLabeDisplay
     996        1482 :                                     , rLogicYSumMap[nAttachedAxisIndex], aScreenPosition2D, eAlignment, nOffset );
     997             :                         }
     998             :                     }
     999             : 
    1000             :                     //remove PointGroupShape if empty
    1001         860 :                     if(!xPointGroupShape_Shapes->getCount())
    1002         741 :                         xSeriesGroupShape_Shapes->remove(xPointGroupShape_Shape);
    1003         860 :                 }
    1004             : 
    1005         151 :             }//next series in x slot (next y slot)
    1006         160 :         }//next x slot
    1007             :     }//next z slot
    1008             : 
    1009          52 :     impl_createSeriesShapes();
    1010             : 
    1011             :     /* @todo remove series shapes if empty
    1012             :     //remove and delete point-group-shape if empty
    1013             :     if(!xSeriesGroupShape_Shapes->getCount())
    1014             :     {
    1015             :         (*aSeriesIter)->m_xShape.set(NULL);
    1016             :         m_xLogicTarget->remove(xSeriesGroupShape_Shape);
    1017             :     }
    1018             :     */
    1019             : 
    1020             :     //remove and delete series-group-shape if empty
    1021             : 
    1022             :     //... todo
    1023             : 
    1024          52 :     OSL_TRACE( "\nPPPPPPPPP<<<<<<<<<<<< area chart :: createShapes():: skipped points: %d created points: %d", nSkippedPoints, nCreatedPoints );
    1025             : }
    1026             : 
    1027             : } //namespace chart
    1028             : 
    1029             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10