LCOV - code coverage report
Current view: top level - chart2/source/view/charttypes - AreaChart.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 388 519 74.8 %
Date: 2015-06-13 12:38:46 Functions: 18 20 90.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         142 : 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         142 :         , m_bArea(!bNoArea)
      60             :         , m_bLine(bNoArea)
      61         142 :         , 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         426 :         , m_xRegressionCurveEquationTarget(0)
      69             : {
      70         142 :     m_pMainPosHelper->AllowShiftXAxisPos(true);
      71         142 :     m_pMainPosHelper->AllowShiftZAxisPos(true);
      72             : 
      73         142 :     PlotterBase::m_pPosHelper = m_pMainPosHelper;
      74         142 :     VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper;
      75             : 
      76             :     try
      77             :     {
      78         142 :         if( m_xChartTypeModelProps.is() )
      79             :         {
      80         142 :             m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_CURVE_STYLE) >>= m_eCurveStyle;
      81         138 :             m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) >>= m_nCurveResolution;
      82         138 :             m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) >>= m_nSplineOrder;
      83             :         }
      84             :     }
      85           8 :     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           4 :         e.Context.is();//to have debug information without compilation warnings
      90             :     }
      91         142 : }
      92             : 
      93         426 : AreaChart::~AreaChart()
      94             : {
      95         142 :     delete m_pMainPosHelper;
      96         284 : }
      97             : 
      98         332 : double AreaChart::getMaximumX()
      99             : {
     100         332 :     double fMax = VSeriesPlotter::getMaximumX();
     101         332 :     return fMax;
     102             : }
     103             : 
     104         650 : bool AreaChart::isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex )
     105             : {
     106         650 :     return VSeriesPlotter::isExpandIfValuesCloseToBorder( nDimensionIndex );
     107             : }
     108             : 
     109        1036 : bool AreaChart::isSeparateStackingForDifferentSigns( sal_Int32 /*nDimensionIndex*/ )
     110             : {
     111             :     // no separate stacking in all types of line/area charts
     112        1036 :     return false;
     113             : }
     114             : 
     115         243 : LegendSymbolStyle AreaChart::getLegendSymbolStyle()
     116             : {
     117         243 :     if( m_bArea || m_nDimension == 3 )
     118          10 :         return LegendSymbolStyle_BOX;
     119         233 :     return LegendSymbolStyle_LINE;
     120             : }
     121             : 
     122         154 : uno::Any AreaChart::getExplicitSymbol( const VDataSeries& rSeries, sal_Int32 nPointIndex )
     123             : {
     124         154 :     uno::Any aRet;
     125             : 
     126         154 :     Symbol* pSymbolProperties = rSeries.getSymbolProperties( nPointIndex );
     127         154 :     if( pSymbolProperties )
     128             :     {
     129         154 :         aRet = uno::makeAny(*pSymbolProperties);
     130             :     }
     131             : 
     132         154 :     return aRet;
     133             : }
     134             : 
     135         142 : drawing::Direction3D AreaChart::getPreferredDiagramAspectRatio() const
     136             : {
     137         142 :     drawing::Direction3D aRet(1,-1,1);
     138         142 :     if( m_nDimension == 2 )
     139         135 :         aRet = drawing::Direction3D(-1,-1,-1);
     140           7 :     else if (m_pPosHelper)
     141             :     {
     142           7 :         drawing::Direction3D aScale( m_pPosHelper->getScaledLogicWidth() );
     143           7 :         aRet.DirectionZ = aScale.DirectionZ*0.2;
     144           7 :         if(aRet.DirectionZ>1.0)
     145           0 :             aRet.DirectionZ=1.0;
     146           7 :         if(aRet.DirectionZ>10)
     147           0 :             aRet.DirectionZ=10;
     148             :     }
     149         142 :     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         324 : void AreaChart::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot )
     163             : {
     164         324 :     if( m_bArea && pSeries )
     165             :     {
     166           6 :         sal_Int32 nMissingValueTreatment = pSeries->getMissingValueTreatment();
     167           6 :         if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP  )
     168           0 :             pSeries->setMissingValueTreatment( ::com::sun::star::chart::MissingValueTreatment::USE_ZERO );
     169             :     }
     170         324 :     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         324 :     VSeriesPlotter::addSeries( pSeries, zSlot, xSlot, ySlot );
     179         324 : }
     180             : 
     181          11 : void lcl_removeDuplicatePoints( drawing::PolyPolygonShape3D& rPolyPoly, PlottingPositionHelper& rPosHelper )
     182             : {
     183          11 :     sal_Int32 nPolyCount = rPolyPoly.SequenceX.getLength();
     184          11 :     if(!nPolyCount)
     185          11 :         return;
     186             : 
     187          11 :     drawing::PolyPolygonShape3D aTmp;
     188          11 :     aTmp.SequenceX.realloc(nPolyCount);
     189          11 :     aTmp.SequenceY.realloc(nPolyCount);
     190          11 :     aTmp.SequenceZ.realloc(nPolyCount);
     191             : 
     192          30 :     for( sal_Int32 nPolygonIndex = 0; nPolygonIndex<nPolyCount; nPolygonIndex++ )
     193             :     {
     194          19 :         drawing::DoubleSequence* pOuterSourceX = &rPolyPoly.SequenceX.getArray()[nPolygonIndex];
     195          19 :         drawing::DoubleSequence* pOuterSourceY = &rPolyPoly.SequenceY.getArray()[nPolygonIndex];
     196          19 :         drawing::DoubleSequence* pOuterSourceZ = &rPolyPoly.SequenceZ.getArray()[nPolygonIndex];
     197             : 
     198          19 :         drawing::DoubleSequence* pOuterTargetX = &aTmp.SequenceX.getArray()[nPolygonIndex];
     199          19 :         drawing::DoubleSequence* pOuterTargetY = &aTmp.SequenceY.getArray()[nPolygonIndex];
     200          19 :         drawing::DoubleSequence* pOuterTargetZ = &aTmp.SequenceZ.getArray()[nPolygonIndex];
     201             : 
     202          19 :         sal_Int32 nPointCount = pOuterSourceX->getLength();
     203          19 :         if( !nPointCount )
     204           4 :             continue;
     205             : 
     206          15 :         pOuterTargetX->realloc(nPointCount);
     207          15 :         pOuterTargetY->realloc(nPointCount);
     208          15 :         pOuterTargetZ->realloc(nPointCount);
     209             : 
     210          15 :         double* pSourceX = pOuterSourceX->getArray();
     211          15 :         double* pSourceY = pOuterSourceY->getArray();
     212          15 :         double* pSourceZ = pOuterSourceZ->getArray();
     213             : 
     214          15 :         double* pTargetX = pOuterTargetX->getArray();
     215          15 :         double* pTargetY = pOuterTargetY->getArray();
     216          15 :         double* pTargetZ = pOuterTargetZ->getArray();
     217             : 
     218             :         //copy first point
     219          15 :         *pTargetX=*pSourceX++;
     220          15 :         *pTargetY=*pSourceY++;
     221          15 :         *pTargetZ=*pSourceZ++;
     222          15 :         sal_Int32 nTargetPointCount=1;
     223             : 
     224         535 :         for( sal_Int32 nSource=1; nSource<nPointCount; nSource++ )
     225             :         {
     226         520 :             if( !rPosHelper.isSameForGivenResolution( *pTargetX, *pTargetY, *pTargetZ
     227         520 :                                                    , *pSourceX, *pSourceY, *pSourceZ ) )
     228             :             {
     229         520 :                 pTargetX++; pTargetY++; pTargetZ++;
     230         520 :                 *pTargetX=*pSourceX;
     231         520 :                 *pTargetY=*pSourceY;
     232         520 :                 *pTargetZ=*pSourceZ;
     233         520 :                 nTargetPointCount++;
     234             :             }
     235         520 :             pSourceX++; pSourceY++; pSourceZ++;
     236             :         }
     237             : 
     238             :         //free unused space
     239          15 :         if( nTargetPointCount<nPointCount )
     240             :         {
     241           0 :             pOuterTargetX->realloc(nTargetPointCount);
     242           0 :             pOuterTargetY->realloc(nTargetPointCount);
     243           0 :             pOuterTargetZ->realloc(nTargetPointCount);
     244             :         }
     245             : 
     246          15 :         pOuterSourceX->realloc(0);
     247          15 :         pOuterSourceY->realloc(0);
     248          15 :         pOuterSourceZ->realloc(0);
     249             :     }
     250             : 
     251             :     //free space
     252          11 :     rPolyPoly.SequenceX.realloc(nPolyCount);
     253          11 :     rPolyPoly.SequenceY.realloc(nPolyCount);
     254          11 :     rPolyPoly.SequenceZ.realloc(nPolyCount);
     255             : 
     256          11 :     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         318 : bool AreaChart::impl_createLine( VDataSeries* pSeries
     389             :                 , drawing::PolyPolygonShape3D* pSeriesPoly
     390             :                 , PlottingPositionHelper* pPosHelper )
     391             : {
     392             :     //return true if a line was created successfully
     393         318 :     uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
     394             : 
     395         636 :     drawing::PolyPolygonShape3D aPoly;
     396         318 :     if(CurveStyle_CUBIC_SPLINES==m_eCurveStyle)
     397             :     {
     398          11 :         drawing::PolyPolygonShape3D aSplinePoly;
     399          11 :         SplineCalculater::CalculateCubicSplines( *pSeriesPoly, aSplinePoly, m_nCurveResolution );
     400          11 :         lcl_removeDuplicatePoints( aSplinePoly, *pPosHelper );
     401          11 :         Clipping::clipPolygonAtRectangle( aSplinePoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
     402             :     }
     403         307 :     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         614 :     else if (CurveStyle_STEP_START==m_eCurveStyle ||
     411         614 :              CurveStyle_STEP_END==m_eCurveStyle ||
     412         614 :              CurveStyle_STEP_CENTER_Y==m_eCurveStyle ||
     413         307 :              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         307 :         Clipping::clipPolygonAtRectangle( *pSeriesPoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
     425             :     }
     426             : 
     427         318 :     if(!AbstractShapeFactory::hasPolygonAnyLines(aPoly))
     428           2 :         return false;
     429             : 
     430             :     //transformation 3) -> 4)
     431         316 :     pPosHelper->transformScaledLogicToScene( aPoly );
     432             : 
     433             :     //create line:
     434         632 :     uno::Reference< drawing::XShape > xShape(NULL);
     435         316 :     if(m_nDimension==3)
     436             :     {
     437          21 :         double fDepth = this->getTransformedDepth();
     438          21 :         sal_Int32 nPolyCount = aPoly.SequenceX.getLength();
     439          42 :         for(sal_Int32 nPoly=0;nPoly<nPolyCount;nPoly++)
     440             :         {
     441          21 :             sal_Int32 nPointCount = aPoly.SequenceX[nPoly].getLength();
     442         273 :             for(sal_Int32 nPoint=0;nPoint<nPointCount-1;nPoint++)
     443             :             {
     444         252 :                 drawing::Position3D aPoint1, aPoint2;
     445         252 :                 aPoint1.PositionX = aPoly.SequenceX[nPoly][nPoint+1];
     446         252 :                 aPoint1.PositionY = aPoly.SequenceY[nPoly][nPoint+1];
     447         252 :                 aPoint1.PositionZ = aPoly.SequenceZ[nPoly][nPoint+1];
     448             : 
     449         252 :                 aPoint2.PositionX = aPoly.SequenceX[nPoly][nPoint];
     450         252 :                 aPoint2.PositionY = aPoly.SequenceY[nPoly][nPoint];
     451         252 :                 aPoint2.PositionZ = aPoly.SequenceZ[nPoly][nPoint];
     452             : 
     453         252 :                 Stripe aStripe( aPoint1, aPoint2, fDepth );
     454             : 
     455             :                 m_pShapeFactory->createStripe(xSeriesGroupShape_Shapes
     456             :                     , Stripe( aPoint1, aPoint2, fDepth )
     457         252 :                     , pSeries->getPropertiesOfSeries(), PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), true, 1 );
     458             :             }
     459             :         }
     460             :     }
     461             :     else //m_nDimension!=3
     462             :     {
     463         885 :         xShape = m_pShapeFactory->createLine2D( xSeriesGroupShape_Shapes
     464         590 :                 , PolyToPointSequence( aPoly ) );
     465             :         setMappedProperties( xShape
     466             :                 , pSeries->getPropertiesOfSeries()
     467         295 :                 , PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
     468             :         //because of this name this line will be used for marking
     469         295 :         ::chart::AbstractShapeFactory::setShapeName(xShape, "MarkHandles");
     470             :     }
     471         634 :     return true;
     472             : }
     473             : 
     474           6 : 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           6 :     uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
     482           6 :     double zValue = pSeries->m_fLogicZPos;
     483             : 
     484          12 :     drawing::PolyPolygonShape3D aPoly( *pSeriesPoly );
     485             :     //add second part to the polygon (grounding points or previous series points)
     486           6 :     if(!pPreviousSeriesPoly)
     487             :     {
     488           4 :         double fMinX = pSeries->m_fLogicMinX;
     489           4 :         double fMaxX = pSeries->m_fLogicMaxX;
     490           4 :         double fY = pPosHelper->getBaseValueY();//logic grounding
     491           4 :         if( m_nDimension==3 )
     492           0 :             fY = pPosHelper->getLogicMinY();
     493             : 
     494             :         //clip to scale
     495           4 :         if(fMaxX<pPosHelper->getLogicMinX() || fMinX>pPosHelper->getLogicMaxX())
     496           0 :             return false;//no visible shape needed
     497           4 :         pPosHelper->clipLogicValues( &fMinX, &fY, 0 );
     498           4 :         pPosHelper->clipLogicValues( &fMaxX, 0, 0 );
     499             : 
     500             :         //apply scaling
     501             :         {
     502           4 :             pPosHelper->doLogicScaling( &fMinX, &fY, &zValue );
     503           4 :             pPosHelper->doLogicScaling( &fMaxX, 0, 0 );
     504             :         }
     505             : 
     506           4 :         AddPointToPoly( aPoly, drawing::Position3D( fMaxX,fY,zValue) );
     507           4 :         AddPointToPoly( aPoly, drawing::Position3D( fMinX,fY,zValue) );
     508             :     }
     509             :     else
     510             :     {
     511           2 :         appendPoly( aPoly, *pPreviousSeriesPoly );
     512             :     }
     513           6 :     AbstractShapeFactory::closePolygon(aPoly);
     514             : 
     515             :     //apply clipping
     516             :     {
     517           6 :         drawing::PolyPolygonShape3D aClippedPoly;
     518           6 :         Clipping::clipPolygonAtRectangle( aPoly, pPosHelper->getScaledLogicClipDoubleRect(), aClippedPoly, false );
     519           6 :         AbstractShapeFactory::closePolygon(aClippedPoly); //again necessary after clipping
     520           6 :         aPoly = aClippedPoly;
     521             :     }
     522             : 
     523           6 :     if(!AbstractShapeFactory::hasPolygonAnyLines(aPoly))
     524           0 :         return false;
     525             : 
     526             :     //transformation 3) -> 4)
     527           6 :     pPosHelper->transformScaledLogicToScene( aPoly );
     528             : 
     529             :     //create area:
     530          12 :     uno::Reference< drawing::XShape > xShape(NULL);
     531           6 :     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          18 :         xShape = m_pShapeFactory->createArea2D( xSeriesGroupShape_Shapes
     539          12 :                 , aPoly );
     540             :     }
     541             :     setMappedProperties( xShape
     542             :                 , pSeries->getPropertiesOfSeries()
     543           6 :                 , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
     544             :     //because of this name this line will be used for marking
     545           6 :     ::chart::AbstractShapeFactory::setShapeName(xShape, "MarkHandles");
     546          12 :     return true;
     547             : }
     548             : 
     549         142 : 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         142 :     ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator            aZSlotIter = m_aZSlots.begin();
     555         142 :     const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
     556         355 :     for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; ++aZSlotIter, ++nZ )
     557             :     {
     558         213 :         ::std::vector< VDataSeriesGroup >::iterator             aXSlotIter = aZSlotIter->begin();
     559         213 :         const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
     560             : 
     561         627 :         for( ; aXSlotIter != aXSlotEnd; ++aXSlotIter )
     562             :         {
     563         414 :             ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
     564             : 
     565         414 :             ::std::vector< VDataSeries* >::const_iterator       aSeriesIter = pSeriesList->begin();
     566         414 :             const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd  = pSeriesList->end();
     567             : 
     568         414 :             std::map< sal_Int32, drawing::PolyPolygonShape3D* > aPreviousSeriesPolyMap;//a PreviousSeriesPoly for each different nAttachedAxisIndex
     569         414 :             drawing::PolyPolygonShape3D* pSeriesPoly = NULL;
     570             : 
     571             :             //iterate through all series
     572         738 :             for( ; aSeriesIter != aSeriesEnd; ++aSeriesIter )
     573             :             {
     574         324 :                 sal_Int32 nAttachedAxisIndex = (*aSeriesIter)->getAttachedAxisIndex();
     575         324 :                 PlottingPositionHelper* pPosHelper = &(this->getPlottingPositionHelper( nAttachedAxisIndex ));
     576         324 :                 if(!pPosHelper)
     577           0 :                     pPosHelper = m_pMainPosHelper;
     578         324 :                 PlotterBase::m_pPosHelper = pPosHelper;
     579             : 
     580         324 :                 createRegressionCurvesShapes( **aSeriesIter, m_xErrorBarTarget, m_xRegressionCurveEquationTarget,
     581         648 :                                               m_pPosHelper->maySkipPointsInRegressionCalculation());
     582             : 
     583         324 :                 pSeriesPoly = &(*aSeriesIter)->m_aPolyPolygonShape3D;
     584         324 :                 if( m_bArea )
     585             :                 {
     586           6 :                     if( !impl_createArea( *aSeriesIter, pSeriesPoly, aPreviousSeriesPolyMap[nAttachedAxisIndex], pPosHelper ) )
     587           2 :                         continue;
     588             :                 }
     589         324 :                 if( m_bLine )
     590             :                 {
     591         318 :                     if( !impl_createLine( *aSeriesIter, pSeriesPoly, pPosHelper ) )
     592           2 :                         continue;
     593             :                 }
     594         322 :                 aPreviousSeriesPolyMap[nAttachedAxisIndex] = pSeriesPoly;
     595             :             }//next series in x slot (next y slot)
     596         414 :         }//next x slot
     597             :     }//next z slot
     598         142 : }
     599             : 
     600             : namespace
     601             : {
     602             : 
     603          57 : void lcl_reorderSeries( ::std::vector< ::std::vector< VDataSeriesGroup > >&  rZSlots )
     604             : {
     605          57 :     ::std::vector< ::std::vector< VDataSeriesGroup > >  aRet( rZSlots.size() );
     606             : 
     607          57 :     ::std::vector< ::std::vector< VDataSeriesGroup > >::reverse_iterator aZIt( rZSlots.rbegin() );
     608          57 :     ::std::vector< ::std::vector< VDataSeriesGroup > >::reverse_iterator aZEnd( rZSlots.rend() );
     609         114 :     for( ; aZIt != aZEnd; ++aZIt )
     610             :     {
     611          57 :         ::std::vector< VDataSeriesGroup > aXSlot( aZIt->size() );
     612             : 
     613          57 :         ::std::vector< VDataSeriesGroup >::reverse_iterator aXIt( aZIt->rbegin() );
     614          57 :         ::std::vector< VDataSeriesGroup >::reverse_iterator aXEnd( aZIt->rend() );
     615         157 :         for( ; aXIt != aXEnd; ++aXIt )
     616         100 :             aXSlot.push_back(*aXIt);
     617             : 
     618          57 :         aRet.push_back(aXSlot);
     619          57 :     }
     620             : 
     621          57 :     rZSlots.clear();
     622          57 :     rZSlots = aRet;
     623          57 : }
     624             : 
     625             : }//anonymous namespace
     626             : 
     627             : //better performance for big data
     628             : struct FormerPoint
     629             : {
     630        2125 :     FormerPoint( double fX, double fY, double fZ )
     631        2125 :         : m_fX(fX), m_fY(fY), m_fZ(fZ)
     632        2125 :         {}
     633         329 :     FormerPoint()
     634             :     {
     635         329 :         ::rtl::math::setNan( &m_fX );
     636         329 :         ::rtl::math::setNan( &m_fY );
     637         329 :         ::rtl::math::setNan( &m_fZ );
     638         329 :     }
     639             : 
     640             :     double m_fX;
     641             :     double m_fY;
     642             :     double m_fZ;
     643             : };
     644             : 
     645         142 : void AreaChart::createShapes()
     646             : {
     647         142 :     if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
     648           0 :         return;
     649             : 
     650         142 :     if( m_nDimension == 2 && ( m_bArea || !m_bCategoryXAxis ) )
     651          57 :         lcl_reorderSeries( m_aZSlots );
     652             : 
     653             :     OSL_ENSURE(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"AreaChart is not proper initialized");
     654         142 :     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         142 :     m_xSeriesTarget   = createGroupShape( m_xLogicTarget,OUString() );
     663         142 :     if( m_bArea )
     664           4 :         m_xErrorBarTarget = createGroupShape( m_xLogicTarget,OUString() );
     665             :     else
     666         138 :         m_xErrorBarTarget = m_xSeriesTarget;
     667         142 :     m_xTextTarget     = m_pShapeFactory->createGroup2D( m_xFinalTarget,OUString() );
     668         142 :     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         142 :     double fLogicZ        = 1.0;//as defined
     674             : 
     675         142 :     sal_Int32 nStartIndex = 0; // inclusive       ;..todo get somehow from x scale
     676         142 :     sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
     677         142 :     if(nEndIndex<=0)
     678           0 :         nEndIndex=1;
     679             : 
     680             :     //better performance for big data
     681         142 :     std::map< VDataSeries*, FormerPoint > aSeriesFormerPointMap;
     682         142 :     m_bPointsWereSkipped = false;
     683         142 :     sal_Int32 nSkippedPoints = 0;
     684         142 :     sal_Int32 nCreatedPoints = 0;
     685             : 
     686         142 :     bool bDateCategory = (m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis());
     687             : 
     688         142 :     ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
     689         142 :     const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
     690             : 
     691         284 :     std::vector<std::map< sal_Int32, double > > aLogicYSumMapByX(nEndIndex);//one for each different nAttachedAxisIndex
     692         355 :     for( ; aZSlotIter != aZSlotEnd; ++aZSlotIter )
     693             :     {
     694         213 :         ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
     695         213 :         const ::std::vector< VDataSeriesGroup >::iterator aXSlotEnd = aZSlotIter->end();
     696             : 
     697             :         //iterate through all x slots in this category to get 100percent sum
     698         627 :         for( ; aXSlotIter != aXSlotEnd; ++aXSlotIter )
     699             :         {
     700         414 :             std::vector<VDataSeries*>& rSeriesList = aXSlotIter->m_aSeriesVector;
     701         414 :             std::vector<VDataSeries*>::iterator aSeriesIter = rSeriesList.begin();
     702         414 :             std::vector<VDataSeries*>::iterator aSeriesEnd  = rSeriesList.end();
     703             : 
     704         738 :             for( ; aSeriesIter != aSeriesEnd; ++aSeriesIter )
     705             :             {
     706         324 :                 VDataSeries* pSeries( *aSeriesIter );
     707         324 :                 if(!pSeries)
     708           0 :                     continue;
     709             : 
     710         324 :                 if (bDateCategory)
     711           0 :                     pSeries->doSortByXValues();
     712             : 
     713        2489 :                 for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
     714             :                 {
     715        2165 :                     std::map< sal_Int32, double >& rLogicYSumMap = aLogicYSumMapByX[nIndex];
     716        2165 :                     sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
     717        2165 :                     if( rLogicYSumMap.find(nAttachedAxisIndex)==rLogicYSumMap.end() )
     718         929 :                         rLogicYSumMap[nAttachedAxisIndex]=0.0;
     719             : 
     720        2165 :                     PlottingPositionHelper* pPosHelper = &(this->getPlottingPositionHelper( nAttachedAxisIndex ));
     721        2165 :                     if(!pPosHelper)
     722           0 :                         pPosHelper = m_pMainPosHelper;
     723        2165 :                     PlotterBase::m_pPosHelper = pPosHelper;
     724             : 
     725        2165 :                     double fAdd = pSeries->getYValue( nIndex );
     726        2165 :                     if( !::rtl::math::isNan(fAdd) && !::rtl::math::isInf(fAdd) )
     727        2102 :                         rLogicYSumMap[nAttachedAxisIndex] += fabs( fAdd );
     728             :                 }
     729             :             }
     730             :         }
     731             :     }
     732             : 
     733         142 :     aZSlotIter = m_aZSlots.begin();
     734         355 :     for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; ++aZSlotIter, ++nZ )
     735             :     {
     736         213 :         ::std::vector< VDataSeriesGroup >::const_iterator aXSlotIter = aZSlotIter->begin();
     737         213 :         ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
     738             : 
     739             :         //for the area chart there should be at most one x slot (no side by side stacking available)
     740             :         //attention different: xSlots are always interpreted as independent areas one behind the other: @todo this doesn't work why not???
     741         627 :         for( sal_Int32 nX=0; aXSlotIter != aXSlotEnd; ++aXSlotIter, ++nX )
     742             :         {
     743         414 :             const std::vector<VDataSeries*>& rSeriesList = aXSlotIter->m_aSeriesVector;
     744         414 :             std::vector<VDataSeries*>::const_iterator aSeriesIter = rSeriesList.begin();
     745         414 :             const std::vector<VDataSeries*>::const_iterator aSeriesEnd  = rSeriesList.end();
     746             : 
     747         414 :             std::vector<std::map< sal_Int32, double > > aLogicYForNextSeriesMapByX(nEndIndex); //one for each different nAttachedAxisIndex
     748             :             //iterate through all series
     749         738 :             for( sal_Int32 nSeriesIndex = 0; aSeriesIter != aSeriesEnd; ++aSeriesIter, ++nSeriesIndex )
     750             :             {
     751         324 :                 VDataSeries* pSeries( *aSeriesIter );
     752         324 :                 if(!pSeries)
     753           0 :                     continue;
     754             : 
     755         324 :                 uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeFrontChild(*aSeriesIter, m_xSeriesTarget);
     756             : 
     757         324 :                 sal_Int32 nAttachedAxisIndex = (*aSeriesIter)->getAttachedAxisIndex();
     758         324 :                 PlottingPositionHelper* pPosHelper = &(this->getPlottingPositionHelper( nAttachedAxisIndex ));
     759         324 :                 if(!pPosHelper)
     760           0 :                     pPosHelper = m_pMainPosHelper;
     761         324 :                 PlotterBase::m_pPosHelper = pPosHelper;
     762             : 
     763         324 :                 if(m_nDimension==3)
     764          21 :                     fLogicZ = nZ+0.5;
     765         324 :                 (*aSeriesIter)->m_fLogicZPos = fLogicZ;
     766             : 
     767        2489 :                 for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
     768             :                 {
     769             : 
     770             :                     /*  #i70133# ignore points outside of series length in standard area
     771             :                         charts. Stacked area charts will use missing points as zeros. In
     772             :                         standard charts, pSeriesList contains only one series. */
     773        2165 :                     if( m_bArea && (rSeriesList.size() == 1) && (nIndex >= (*aSeriesIter)->getTotalPointCount()) )
     774         573 :                         continue;
     775             : 
     776             :                     //collect data point information (logic coordinates, style ):
     777        2165 :                     double fLogicX = (*aSeriesIter)->getXValue(nIndex);
     778        2165 :                     if (bDateCategory)
     779           0 :                         fLogicX = DateHelper::RasterizeDateValue( fLogicX, m_aNullDate, m_nTimeResolution );
     780        2165 :                     double fLogicY = (*aSeriesIter)->getYValue(nIndex);
     781             : 
     782        2165 :                     if( m_nDimension==3 && m_bArea && rSeriesList.size()!=1 )
     783           0 :                         fLogicY = fabs( fLogicY );
     784             : 
     785        2165 :                     std::map< sal_Int32, double >& rLogicYSumMap = aLogicYSumMapByX[nIndex];
     786        2165 :                     if( pPosHelper->isPercentY() && !::rtl::math::approxEqual( rLogicYSumMap[nAttachedAxisIndex], 0.0 ) )
     787             :                     {
     788          98 :                         fLogicY = fabs( fLogicY )/rLogicYSumMap[nAttachedAxisIndex];
     789             :                     }
     790             : 
     791        6494 :                     if(    ::rtl::math::isNan(fLogicX) || ::rtl::math::isInf(fLogicX)
     792        2164 :                             || ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY)
     793        4267 :                             || ::rtl::math::isNan(fLogicZ) || ::rtl::math::isInf(fLogicZ) )
     794             :                     {
     795          63 :                         if( (*aSeriesIter)->getMissingValueTreatment() == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
     796             :                         {
     797          63 :                             drawing::PolyPolygonShape3D& rPolygon = (*aSeriesIter)->m_aPolyPolygonShape3D;
     798          63 :                             sal_Int32& rIndex = (*aSeriesIter)->m_nPolygonIndex;
     799          63 :                             if( 0<= rIndex && rIndex < rPolygon.SequenceX.getLength() )
     800             :                             {
     801          12 :                                 if( rPolygon.SequenceX[ rIndex ].getLength() )
     802          12 :                                     rIndex++; //start a new polygon for the next point if the current poly is not empty
     803             :                             }
     804             :                         }
     805          63 :                         continue;
     806             :                     }
     807             : 
     808        2102 :                     std::map< sal_Int32, double >& rLogicYForNextSeriesMap = aLogicYForNextSeriesMapByX[nIndex];
     809        2102 :                     if( rLogicYForNextSeriesMap.find(nAttachedAxisIndex) == rLogicYForNextSeriesMap.end() )
     810        1988 :                         rLogicYForNextSeriesMap[nAttachedAxisIndex] = 0.0;
     811             : 
     812        2102 :                     double fLogicValueForLabeDisplay = fLogicY;
     813             : 
     814        2102 :                     fLogicY += rLogicYForNextSeriesMap[nAttachedAxisIndex];
     815        2102 :                     rLogicYForNextSeriesMap[nAttachedAxisIndex] = fLogicY;
     816             : 
     817        2102 :                     bool bIsVisible = pPosHelper->isLogicVisible( fLogicX, fLogicY, fLogicZ );
     818             : 
     819             :                     //remind minimal and maximal x values for area 'grounding' points
     820             :                     //only for filled area
     821             :                     {
     822        2102 :                         double& rfMinX = (*aSeriesIter)->m_fLogicMinX;
     823        2102 :                         if(!nIndex||fLogicX<rfMinX)
     824         322 :                             rfMinX=fLogicX;
     825        2102 :                         double& rfMaxX = (*aSeriesIter)->m_fLogicMaxX;
     826        2102 :                         if(!nIndex||fLogicX>rfMaxX)
     827        2102 :                             rfMaxX=fLogicX;
     828             :                     }
     829             : 
     830        2102 :                     drawing::Position3D aUnscaledLogicPosition( fLogicX, fLogicY, fLogicZ );
     831        2102 :                     drawing::Position3D aScaledLogicPosition(aUnscaledLogicPosition);
     832        2102 :                     pPosHelper->doLogicScaling( aScaledLogicPosition );
     833             : 
     834             :                     //transformation 3) -> 4)
     835        2102 :                     drawing::Position3D aScenePosition( pPosHelper->transformLogicToScene( fLogicX,fLogicY,fLogicZ, false ) );
     836             : 
     837             :                     //better performance for big data
     838        2102 :                     FormerPoint aFormerPoint( aSeriesFormerPointMap[pSeries] );
     839        2102 :                     pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution );
     840        4204 :                     if( !pSeries->isAttributedDataPoint(nIndex)
     841        4204 :                             &&
     842             :                             pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ
     843        2102 :                                 , aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ ) )
     844             :                     {
     845           0 :                         ++nSkippedPoints;
     846           0 :                         m_bPointsWereSkipped = true;
     847           0 :                         continue;
     848             :                     }
     849        2102 :                     aSeriesFormerPointMap[pSeries] = FormerPoint(aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ);
     850             : 
     851             :                     //store point information for series polygon
     852             :                     //for area and/or line (symbols only do not need this)
     853        2102 :                     if( isValidPosition(aScaledLogicPosition) )
     854             :                     {
     855        2102 :                         AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aScaledLogicPosition, (*aSeriesIter)->m_nPolygonIndex );
     856             :                     }
     857             : 
     858             :                     //create a single datapoint if point is visible
     859             :                     //apply clipping:
     860        2102 :                     if( !bIsVisible )
     861          18 :                         continue;
     862             : 
     863        2084 :                     bool bCreateYErrorBar = false, bCreateXErrorBar = false;
     864             :                     {
     865        2084 :                         uno::Reference< beans::XPropertySet > xErrorBarProp(pSeries->getYErrorBarProperties(nIndex));
     866        2084 :                         if( xErrorBarProp.is() )
     867             :                         {
     868         521 :                             bool bShowPositive = false;
     869         521 :                             bool bShowNegative = false;
     870         521 :                             xErrorBarProp->getPropertyValue("ShowPositiveError") >>= bShowPositive;
     871         521 :                             xErrorBarProp->getPropertyValue("ShowNegativeError") >>= bShowNegative;
     872         521 :                             bCreateYErrorBar = bShowPositive || bShowNegative;
     873             :                         }
     874             : 
     875        2084 :                         xErrorBarProp = pSeries->getXErrorBarProperties(nIndex);
     876        2084 :                         if ( xErrorBarProp.is() )
     877             :                         {
     878           0 :                             bool bShowPositive = false;
     879           0 :                             bool bShowNegative = false;
     880           0 :                             xErrorBarProp->getPropertyValue("ShowPositiveError") >>= bShowPositive;
     881           0 :                             xErrorBarProp->getPropertyValue("ShowNegativeError") >>= bShowNegative;
     882           0 :                             bCreateXErrorBar = bShowPositive || bShowNegative;
     883        2084 :                         }
     884             :                     }
     885             : 
     886        2084 :                     Symbol* pSymbolProperties = m_bSymbol ? (*aSeriesIter)->getSymbolProperties( nIndex ) : 0;
     887        2084 :                     bool bCreateSymbol = pSymbolProperties && (pSymbolProperties->Style != SymbolStyle_NONE);
     888             : 
     889        7258 :                     if( !bCreateSymbol && !bCreateYErrorBar &&
     890        4948 :                             !bCreateXErrorBar && !pSeries->getDataPointLabelIfLabel(nIndex) )
     891         492 :                         continue;
     892             : 
     893             :                     //create a group shape for this point and add to the series shape:
     894             :                     OUString aPointCID = ObjectIdentifier::createPointCID(
     895        1592 :                             (*aSeriesIter)->getPointCID_Stub(), nIndex );
     896             :                     uno::Reference< drawing::XShapes > xPointGroupShape_Shapes(
     897        3184 :                             createGroupShape(xSeriesGroupShape_Shapes,aPointCID) );
     898             :                     uno::Reference<drawing::XShape> xPointGroupShape_Shape =
     899        3184 :                         uno::Reference<drawing::XShape>( xPointGroupShape_Shapes, uno::UNO_QUERY );
     900             : 
     901             :                     {
     902        1592 :                         nCreatedPoints++;
     903             : 
     904             :                         //create data point
     905        1592 :                         drawing::Direction3D aSymbolSize(0,0,0);
     906        1592 :                         if( bCreateSymbol )
     907             :                         {
     908         426 :                             if(m_nDimension!=3)
     909             :                             {
     910         426 :                                 if( pSymbolProperties )
     911             :                                 {
     912         426 :                                     if( pSymbolProperties->Style != SymbolStyle_NONE )
     913             :                                     {
     914         426 :                                         aSymbolSize.DirectionX = pSymbolProperties->Size.Width;
     915         426 :                                         aSymbolSize.DirectionY = pSymbolProperties->Size.Height;
     916             :                                     }
     917             : 
     918         426 :                                     if( pSymbolProperties->Style == SymbolStyle_STANDARD )
     919             :                                     {
     920         426 :                                         sal_Int32 nSymbol = pSymbolProperties->StandardSymbol;
     921             :                                         m_pShapeFactory->createSymbol2D( xPointGroupShape_Shapes
     922             :                                                 , aScenePosition, aSymbolSize
     923             :                                                 , nSymbol
     924             :                                                 , pSymbolProperties->BorderColor
     925         426 :                                                 , pSymbolProperties->FillColor );
     926             :                                     }
     927           0 :                                     else if( pSymbolProperties->Style == SymbolStyle_GRAPHIC )
     928             :                                     {
     929             :                                         m_pShapeFactory->createGraphic2D( xPointGroupShape_Shapes
     930             :                                                 , aScenePosition , aSymbolSize
     931           0 :                                                 , pSymbolProperties->Graphic );
     932             :                                     }
     933             :                                     //@todo other symbol styles
     934             :                                 }
     935             :                             }
     936             :                         }
     937             :                         //create error bars
     938        1592 :                         if (bCreateXErrorBar)
     939           0 :                             createErrorBar_X( aUnscaledLogicPosition, **aSeriesIter, nIndex, m_xErrorBarTarget );
     940             : 
     941        1592 :                         if (bCreateYErrorBar)
     942         249 :                             createErrorBar_Y( aUnscaledLogicPosition, **aSeriesIter, nIndex, m_xErrorBarTarget );
     943             : 
     944             :                         //create data point label
     945        1592 :                         if( (**aSeriesIter).getDataPointLabelIfLabel(nIndex) )
     946             :                         {
     947        1161 :                             LabelAlignment eAlignment = LABEL_ALIGN_TOP;
     948             :                             drawing::Position3D aScenePosition3D( aScenePosition.PositionX
     949             :                                     , aScenePosition.PositionY
     950        1161 :                                     , aScenePosition.PositionZ+this->getTransformedDepth() );
     951             : 
     952        1161 :                             sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nIndex, m_xChartTypeModel, m_nDimension, pPosHelper->isSwapXAndY() );
     953             : 
     954        1161 :                             switch(nLabelPlacement)
     955             :                             {
     956             :                                 case ::com::sun::star::chart::DataLabelPlacement::TOP:
     957        1161 :                                     aScenePosition3D.PositionY -= (aSymbolSize.DirectionY/2+1);
     958        1161 :                                     eAlignment = LABEL_ALIGN_TOP;
     959        1161 :                                     break;
     960             :                                 case ::com::sun::star::chart::DataLabelPlacement::BOTTOM:
     961           0 :                                     aScenePosition3D.PositionY += (aSymbolSize.DirectionY/2+1);
     962           0 :                                     eAlignment = LABEL_ALIGN_BOTTOM;
     963           0 :                                     break;
     964             :                                 case ::com::sun::star::chart::DataLabelPlacement::LEFT:
     965           0 :                                     aScenePosition3D.PositionX -= (aSymbolSize.DirectionX/2+1);
     966           0 :                                     eAlignment = LABEL_ALIGN_LEFT;
     967           0 :                                     break;
     968             :                                 case ::com::sun::star::chart::DataLabelPlacement::RIGHT:
     969           0 :                                     aScenePosition3D.PositionX += (aSymbolSize.DirectionX/2+1);
     970           0 :                                     eAlignment = LABEL_ALIGN_RIGHT;
     971           0 :                                     break;
     972             :                                 case ::com::sun::star::chart::DataLabelPlacement::CENTER:
     973           0 :                                     eAlignment = LABEL_ALIGN_CENTER;
     974             :                                     //todo implement this different for area charts
     975           0 :                                     break;
     976             :                                 default:
     977             :                                     OSL_FAIL("this label alignment is not implemented yet");
     978           0 :                                     aScenePosition3D.PositionY -= (aSymbolSize.DirectionY/2+1);
     979           0 :                                     eAlignment = LABEL_ALIGN_TOP;
     980           0 :                                     break;
     981             :                             }
     982             : 
     983        1161 :                             awt::Point aScreenPosition2D;//get the screen position for the labels
     984        1161 :                             sal_Int32 nOffset = 100; //todo maybe calculate this font height dependent
     985             :                             {
     986        1161 :                                 if(LABEL_ALIGN_CENTER==eAlignment || m_nDimension == 3 )
     987         273 :                                     nOffset = 0;
     988             :                                 aScreenPosition2D = awt::Point( LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory)
     989        1161 :                                         .transformSceneToScreenPosition( aScenePosition3D ) );
     990             :                             }
     991             : 
     992        1161 :                             createDataLabel( m_xTextTarget, **aSeriesIter, nIndex
     993             :                                     , fLogicValueForLabeDisplay
     994        2322 :                                     , rLogicYSumMap[nAttachedAxisIndex], aScreenPosition2D, eAlignment, nOffset );
     995             :                         }
     996             :                     }
     997             : 
     998             :                     //remove PointGroupShape if empty
     999        1592 :                     if(!xPointGroupShape_Shapes->getCount())
    1000        1166 :                         xSeriesGroupShape_Shapes->remove(xPointGroupShape_Shape);
    1001        1592 :                 }
    1002             : 
    1003         324 :             }//next series in x slot (next y slot)
    1004         414 :         }//next x slot
    1005             :     }//next z slot
    1006             : 
    1007         142 :     impl_createSeriesShapes();
    1008             : 
    1009             :     /* @todo remove series shapes if empty
    1010             :     //remove and delete point-group-shape if empty
    1011             :     if(!xSeriesGroupShape_Shapes->getCount())
    1012             :     {
    1013             :         (*aSeriesIter)->m_xShape.set(NULL);
    1014             :         m_xLogicTarget->remove(xSeriesGroupShape_Shape);
    1015             :     }
    1016             :     */
    1017             : 
    1018             :     //remove and delete series-group-shape if empty
    1019             : 
    1020             :     //... todo
    1021             : 
    1022             :     SAL_INFO(
    1023             :         "chart2",
    1024             :         "skipped points: " << nSkippedPoints << " created points: "
    1025         142 :             << nCreatedPoints);
    1026             : }
    1027             : 
    1028             : } //namespace chart
    1029             : 
    1030             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11