diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-10-10 05:41:34 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-11-19 13:47:35 +0100 |
commit | ab95314c70451ac81adf4f16d738a74f40ae7c9f (patch) | |
tree | 4cc857a892cc9be99778d8f10dfc387d8f2d7184 /chart2 | |
parent | f09352fa6db57b9c88c334053f5843f1a73fb448 (diff) |
simplify AreaChart now that it does not deal with net charts
Change-Id: I4ff556a43b65d54954b3d057b86dbb1fe7e66ac6
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.cxx | 95 | ||||
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.hxx | 9 |
2 files changed, 5 insertions, 99 deletions
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index d3af561b9956..195b70669268 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -53,20 +53,12 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel , sal_Int32 nDimensionCount , bool bCategoryXAxis , bool bNoArea - , PlottingPositionHelper* pPlottingPositionHelper - , bool bConnectLastToFirstPoint - , bool bExpandIfValuesCloseToBorder - , sal_Int32 nKeepAspectRatio ) : VSeriesPlotter( xChartTypeModel, nDimensionCount, bCategoryXAxis ) - , m_pMainPosHelper(pPlottingPositionHelper) + , m_pMainPosHelper(new PlottingPositionHelper()) , m_bArea(!bNoArea) , m_bLine(bNoArea) , m_bSymbol( ChartTypeHelper::isSupportingSymbolProperties(xChartTypeModel,nDimensionCount) ) - , m_bIsPolarCooSys( bConnectLastToFirstPoint ) - , m_bConnectLastToFirstPoint( bConnectLastToFirstPoint ) - , m_bExpandIfValuesCloseToBorder( bExpandIfValuesCloseToBorder ) - , m_nKeepAspectRatio(nKeepAspectRatio) , m_eCurveStyle(CurveStyle_LINES) , m_nCurveResolution(20) , m_nSplineOrder(3) @@ -75,9 +67,6 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel , m_xTextTarget(0) , m_xRegressionCurveEquationTarget(0) { - if( !m_pMainPosHelper ) - m_pMainPosHelper = new PlottingPositionHelper(); - m_pMainPosHelper->AllowShiftXAxisPos(true); m_pMainPosHelper->AllowShiftZAxisPos(true); @@ -109,15 +98,12 @@ AreaChart::~AreaChart() double AreaChart::getMaximumX() { double fMax = VSeriesPlotter::getMaximumX(); - if( m_bCategoryXAxis && m_bIsPolarCooSys )//the angle axis in net charts needs a different autoscaling - fMax += 1.0; return fMax; } bool AreaChart::isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex ) { - return m_bExpandIfValuesCloseToBorder && - VSeriesPlotter::isExpandIfValuesCloseToBorder( nDimensionIndex ); + return VSeriesPlotter::isExpandIfValuesCloseToBorder( nDimensionIndex ); } bool AreaChart::isSeparateStackingForDifferentSigns( sal_Int32 /*nDimensionIndex*/ ) @@ -148,8 +134,6 @@ uno::Any AreaChart::getExplicitSymbol( const VDataSeries& rSeries, sal_Int32 nPo drawing::Direction3D AreaChart::getPreferredDiagramAspectRatio() const { - if( m_nKeepAspectRatio == 1 ) - return drawing::Direction3D(1,1,1); drawing::Direction3D aRet(1,-1,1); if( m_nDimension == 2 ) aRet = drawing::Direction3D(-1,-1,-1); @@ -167,10 +151,6 @@ drawing::Direction3D AreaChart::getPreferredDiagramAspectRatio() const bool AreaChart::keepAspectRatio() const { - if( m_nKeepAspectRatio == 0 ) - return false; - if( m_nKeepAspectRatio == 1 ) - return true; if( m_nDimension == 2 ) { if( !m_bSymbol ) @@ -181,7 +161,7 @@ bool AreaChart::keepAspectRatio() const void AreaChart::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot ) { - if( m_bArea && !m_bIsPolarCooSys && pSeries ) + if( m_bArea && pSeries ) { sal_Int32 nMissingValueTreatment = pSeries->getMissingValueTreatment(); if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP ) @@ -441,28 +421,7 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries else { // default to creating a straight line SAL_WARN_IF(CurveStyle_LINES != m_eCurveStyle, "chart2.areachart", "Unknown curve style"); - bool bIsClipped = false; - if( m_bConnectLastToFirstPoint && !AbstractShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) ) - { - // do NOT connect last and first point, if one is NAN, and NAN handling is NAN_AS_GAP - double fFirstY = pSeries->getYValue( 0 ); - double fLastY = pSeries->getYValue( VSeriesPlotter::getPointCount() - 1 ); - if( (pSeries->getMissingValueTreatment() != ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP) - || (::rtl::math::isFinite( fFirstY ) && ::rtl::math::isFinite( fLastY )) ) - { - // connect last point in last polygon with first point in first polygon - ::basegfx::B2DRectangle aScaledLogicClipDoubleRect( pPosHelper->getScaledLogicClipDoubleRect() ); - drawing::PolyPolygonShape3D aTmpPoly(*pSeriesPoly); - drawing::Position3D aLast(aScaledLogicClipDoubleRect.getMaxX(),aTmpPoly.SequenceY[0][0],aTmpPoly.SequenceZ[0][0]); - // add connector line to last polygon - AddPointToPoly( aTmpPoly, aLast, pSeriesPoly->SequenceX.getLength() - 1 ); - Clipping::clipPolygonAtRectangle( aTmpPoly, aScaledLogicClipDoubleRect, aPoly ); - bIsClipped = true; - } - } - - if( !bIsClipped ) - Clipping::clipPolygonAtRectangle( *pSeriesPoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly ); + Clipping::clipPolygonAtRectangle( *pSeriesPoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly ); } if(!AbstractShapeFactory::hasPolygonAnyLines(aPoly)) @@ -524,12 +483,7 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries drawing::PolyPolygonShape3D aPoly( *pSeriesPoly ); //add second part to the polygon (grounding points or previous series points) - if( m_bConnectLastToFirstPoint && !AbstractShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) ) - { - if( pPreviousSeriesPoly ) - addPolygon( aPoly, *pPreviousSeriesPoly ); - } - else if(!pPreviousSeriesPoly) + if(!pPreviousSeriesPoly) { double fMinX = pSeries->m_fLogicMinX; double fMaxX = pSeries->m_fLogicMaxX; @@ -822,22 +776,6 @@ void AreaChart::createShapes() fLogicX = DateHelper::RasterizeDateValue( fLogicX, m_aNullDate, m_nTimeResolution ); double fLogicY = (*aSeriesIter)->getYValue(nIndex); - if( m_bIsPolarCooSys && m_bArea && - ( ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY) ) ) - { - if( (*aSeriesIter)->getMissingValueTreatment() == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP ) - { - if( rSeriesList.size() == 1 || nSeriesIndex == 0 ) - { - fLogicY = pPosHelper->getLogicMinY(); - if( !pPosHelper->isMathematicalOrientationY() ) - fLogicY = pPosHelper->getLogicMaxY(); - } - else - fLogicY = 0.0; - } - } - if( m_nDimension==3 && m_bArea && rSeriesList.size()!=1 ) fLogicY = fabs( fLogicY ); @@ -911,18 +849,6 @@ void AreaChart::createShapes() if( isValidPosition(aScaledLogicPosition) ) { AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aScaledLogicPosition, (*aSeriesIter)->m_nPolygonIndex ); - - //prepare clipping for filled net charts - if( !bIsVisible && m_bIsPolarCooSys && m_bArea ) - { - drawing::Position3D aClippedPos(aScaledLogicPosition); - pPosHelper->clipScaledLogicValues( 0, &aClippedPos.PositionY, 0 ); - if( pPosHelper->isLogicVisible( aClippedPos.PositionX, aClippedPos.PositionY, aClippedPos.PositionZ ) ) - { - AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aClippedPos, (*aSeriesIter)->m_nPolygonIndex ); - AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aScaledLogicPosition, (*aSeriesIter)->m_nPolygonIndex ); - } - } } //create a single datapoint if point is visible @@ -1052,17 +978,6 @@ void AreaChart::createShapes() awt::Point aScreenPosition2D;//get the screen position for the labels sal_Int32 nOffset = 100; //todo maybe calculate this font height dependent - if( m_bIsPolarCooSys && nLabelPlacement == ::com::sun::star::chart::DataLabelPlacement::OUTSIDE ) - { - PolarPlottingPositionHelper* pPolarPosHelper = dynamic_cast<PolarPlottingPositionHelper*>(pPosHelper); - if( pPolarPosHelper ) - { - PolarLabelPositionHelper aPolarLabelPositionHelper(pPolarPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory); - aScreenPosition2D = awt::Point( aPolarLabelPositionHelper.getLabelScreenPositionAndAlignmentForLogicValues( - eAlignment, fLogicX, fLogicY, fLogicZ, nOffset )); - } - } - else { if(LABEL_ALIGN_CENTER==eAlignment || m_nDimension == 3 ) nOffset = 0; diff --git a/chart2/source/view/charttypes/AreaChart.hxx b/chart2/source/view/charttypes/AreaChart.hxx index 423cbb25032c..7e8fe7e2fe5e 100644 --- a/chart2/source/view/charttypes/AreaChart.hxx +++ b/chart2/source/view/charttypes/AreaChart.hxx @@ -34,10 +34,6 @@ public: ::com::sun::star::chart2::XChartType >& xChartTypeModel , sal_Int32 nDimensionCount , bool bCategoryXAxis, bool bNoArea=false - , PlottingPositionHelper* pPlottingPositionHelper=NULL //takes owner ship - , bool bConnectLastToFirstPoint=false - , bool bExpandIfValuesCloseToBorder=true - , sal_Int32 nKeepAspectRatio=-1 //0->no 1->yes other value->automatic ); virtual ~AreaChart(); @@ -78,11 +74,6 @@ private: //member bool m_bArea;//false -> line or symbol only bool m_bLine; bool m_bSymbol; - bool m_bIsPolarCooSys;//used e.g. for net chart (the data labels need to be placed different) - bool m_bConnectLastToFirstPoint;//used e.g. for net chart - bool m_bExpandIfValuesCloseToBorder; // e.g. false for net charts - - sal_Int32 m_nKeepAspectRatio; //0->no 1->yes other value->automatic //Properties for splines: ::com::sun::star::chart2::CurveStyle m_eCurveStyle; |