summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorIngrid Halama <iha@openoffice.org>2004-01-23 13:48:24 +0000
committerIngrid Halama <iha@openoffice.org>2004-01-23 13:48:24 +0000
commita3044235f809c5e34f34f16c819539505e7a9867 (patch)
treeca298830eb8f6dc91a74c294eb8d141c99fe0edd /chart2
parent5edc57ee4f08dab7c66d4f48cffabe002ec8521d (diff)
integrated net chart
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/view/charttypes/AreaChart.cxx164
-rw-r--r--chart2/source/view/charttypes/AreaChart.hxx9
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx5
-rw-r--r--chart2/source/view/inc/Clipping.hxx3
-rw-r--r--chart2/source/view/inc/PlotterBase.hxx6
-rw-r--r--chart2/source/view/inc/PlottingPositionHelper.hxx16
-rw-r--r--chart2/source/view/main/Clipping.cxx8
-rw-r--r--chart2/source/view/main/PlottingPositionHelper.cxx59
8 files changed, 119 insertions, 151 deletions
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index a72bacbdb321..e0ad8333acfb 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -48,62 +48,12 @@ using namespace ::com::sun::star;
using namespace ::rtl::math;
using namespace ::drafts::com::sun::star::chart2;
-class AreaPositionHelper : public PlottingPositionHelper
-{
-public:
- AreaPositionHelper(); //@todo
- virtual ~AreaPositionHelper();
-
- //double getSlotPos( double fCategoryX ) const;
-
- double getTransformedDepth() const;
-
- double getLogicGrounding() const;
-
-private: //member
-};
-
-AreaPositionHelper::AreaPositionHelper()
-{
-}
-
-AreaPositionHelper::~AreaPositionHelper()
-{
-}
-
-double AreaPositionHelper::getTransformedDepth() const
-{
- //return the depth for a logic 1
- double MinZ = getLogicMinZ();
- double MaxZ = getLogicMaxZ();
- if(m_aScales[2].Scaling.is())
- MinZ = m_aScales[2].Scaling->doScaling(MinZ);
- if(m_aScales[2].Scaling.is())
- MaxZ = m_aScales[2].Scaling->doScaling(MaxZ);
-
- return FIXED_SIZE_FOR_3D_CHART_VOLUME/(MaxZ-MinZ);
-}
-
-double AreaPositionHelper::getLogicGrounding() const
-{
- //@todo get this from model axis crosses at if that value is between min and max
- //@todo get this for other directions - so far only y
- double fRet=0.0;
- uno::Reference< lang::XServiceName > xServiceName( m_aScales[1].Scaling, uno::UNO_QUERY );
- bool bIsLogarithm = ( xServiceName.is() && (xServiceName->getServiceName()).equals(
- C2U( "com.sun.star.chart2.LogarithmicScaling" )));
- if( bIsLogarithm )
- fRet = m_aScales[1].Minimum;
- return fRet;
-}
-
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel, bool bCategoryXAxis, bool bNoArea )
+AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel, bool bCategoryXAxis, bool bNoArea, PlottingPositionHelper* pPlottingPositionHelper )
: VSeriesPlotter( xChartTypeModel, bCategoryXAxis )
- , m_pPosHelper( new AreaPositionHelper() )
, m_bArea(!bNoArea)
, m_bLine(bNoArea)
, m_bSymbol( ChartTypeHelper::isSupportingSymbolProperties(xChartTypeModel) )
@@ -114,6 +64,11 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel, bool bC
, m_xErrorBarTarget(0)
, m_xTextTarget(0)
{
+ if( pPlottingPositionHelper )
+ m_pPosHelper = pPlottingPositionHelper;
+ else
+ m_pPosHelper = new PlottingPositionHelper();
+
try
{
if( m_xChartTypeModelProps.is() )
@@ -125,12 +80,9 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel, bool bC
}
catch( uno::Exception& e )
{
- if(!m_bArea)
- {
- ASSERT_EXCEPTION( e );
- }
+ //the above properties are not supported by all charttypes supported by this class (e.g. area or net chart)
+ //in that cases this exception is ok
}
- PlotterBase::m_pPosHelper = m_pPosHelper;
}
AreaChart::~AreaChart()
@@ -146,6 +98,23 @@ double AreaChart::getMaximumZ()
return m_aXSlots.size()-0.5;
}
+double AreaChart::getTransformedDepth() const
+{
+ //return the depth for a logic 1
+ double MinZ = m_pPosHelper->getLogicMinZ();
+ double MaxZ = m_pPosHelper->getLogicMaxZ();
+ m_pPosHelper->doLogicScaling( 0, 0, &MinZ );
+ m_pPosHelper->doLogicScaling( 0, 0, &MaxZ );
+ return FIXED_SIZE_FOR_3D_CHART_VOLUME/(MaxZ-MinZ);
+}
+
+double AreaChart::getLogicGrounding() const
+{
+ //@todo get this from model axis crosses at if that value is between min and max
+ double fRet=0.0;
+ return fRet;
+}
+
//-----------------------------------------------------------------
// lang::XServiceInfo
//-----------------------------------------------------------------
@@ -287,35 +256,38 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries
{
drawing::PolyPolygonShape3D aSplinePoly;
SplineCalculater::CalculateCubicSplines( *pSeriesPoly, aSplinePoly, m_nCurveResolution );
- Clipping::clipPolygonAtRectangle( aSplinePoly, m_pPosHelper->getTransformedClipDoubleRect(), aPoly );
+ Clipping::clipPolygonAtRectangle( aSplinePoly, m_pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
}
else if(CurveStyle_B_SPLINES==m_eCurveStyle)
{
drawing::PolyPolygonShape3D aSplinePoly;
SplineCalculater::CalculateBSplines( *pSeriesPoly, aSplinePoly, m_nCurveResolution, m_nSplineOrder );
- Clipping::clipPolygonAtRectangle( aSplinePoly, m_pPosHelper->getTransformedClipDoubleRect(), aPoly );
+ Clipping::clipPolygonAtRectangle( aSplinePoly, m_pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
}
else
{
- Clipping::clipPolygonAtRectangle( *pSeriesPoly, m_pPosHelper->getTransformedClipDoubleRect(), aPoly );
+ Clipping::clipPolygonAtRectangle( *pSeriesPoly, m_pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
}
if(isPolygonEmptyOrSinglePoint(aPoly))
return false;
+ //transformation 3) -> 4)
+ m_pPosHelper->transformScaledLogicToScene( aPoly );
+
//create line:
uno::Reference< drawing::XShape > xShape(NULL);
if(m_nDimension==3)
{
xShape = create3DLine( xSeriesGroupShape_Shapes, m_xShapeFactory
- , aPoly, m_pPosHelper->getTransformedDepth() );
+ , aPoly, this->getTransformedDepth() );
this->setMappedProperties( xShape
, pSeries->getPropertiesOfSeries()
, m_aShapePropertyMapForArea );
//createBorder
{
drawing::PolyPolygonShape3D aBorderPoly = createBorderPolygon(
- aPoly, m_pPosHelper->getTransformedDepth() );
+ aPoly, this->getTransformedDepth() );
VLineProperties aLineProperties;
aLineProperties.initFromPropertySet( pSeries->getPropertiesOfSeries(), true );
uno::Reference< drawing::XShape > xBorder =
@@ -353,28 +325,22 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries
{
double fMinX = pSeries->m_fLogicMinX;
double fMaxX = pSeries->m_fLogicMaxX;
+ double fY = this->getLogicGrounding();
+
//clip to scale
if(fMaxX<m_pPosHelper->getLogicMinX() || fMinX>m_pPosHelper->getLogicMaxX())
return false;//no visible shape needed
- if(fMaxX > m_pPosHelper->getLogicMaxX())
- fMaxX = m_pPosHelper->getLogicMaxX();
- if(fMinX < m_pPosHelper->getLogicMinX())
- fMinX = m_pPosHelper->getLogicMinX();
+ m_pPosHelper->clipLogicValues( &fMinX, &fY, 0 );
+ m_pPosHelper->clipLogicValues( &fMaxX, 0, 0 );
//apply scaling
{
- m_pPosHelper->doLogicScaling( &fMinX, NULL, &zValue );
- m_pPosHelper->doLogicScaling( &fMaxX, NULL, NULL );
+ m_pPosHelper->doLogicScaling( &fMinX, &fY, &zValue );
+ m_pPosHelper->doLogicScaling( &fMaxX, 0, 0 );
}
- double fY = m_pPosHelper->getLogicGrounding();
- drawing::Position3D aScaledLogicPosition2( fMaxX,fY,zValue);
- drawing::Position3D aTransformedPosition2( SequenceToPosition3D( m_pPosHelper->getTransformationLogicToScene()->transform( Position3DToSequence(aScaledLogicPosition2) ) ) );
- AddPointToPoly( aPoly, aTransformedPosition2 );
-
- drawing::Position3D aScaledLogicPosition( fMinX,fY,zValue);
- drawing::Position3D aTransformedPosition( SequenceToPosition3D( m_pPosHelper->getTransformationLogicToScene()->transform( Position3DToSequence(aScaledLogicPosition) ) ) );
- AddPointToPoly( aPoly, aTransformedPosition );
+ AddPointToPoly( aPoly, drawing::Position3D( fMaxX,fY,zValue) );
+ AddPointToPoly( aPoly, drawing::Position3D( fMinX,fY,zValue) );
}
else
{
@@ -383,24 +349,25 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries
closePolygon(aPoly);
//apply clipping
- //(for more accurat clipping it would be better to first clip and than scale and transform,
- //but as long as we only have integer Polygon clipping we need to apply scaling and transformation first ) see QQQ
{
- Polygon aToolsPoly = PolyToToolsPoly( aPoly );
- aToolsPoly.Clip( m_pPosHelper->getTransformedClipRect() );
- aPoly = ToolsPolyToPoly( aToolsPoly, zValue );
- closePolygon(aPoly); //again necessary after clipping
+ drawing::PolyPolygonShape3D aClippedPoly;
+ Clipping::clipPolygonAtRectangle( aPoly, m_pPosHelper->getScaledLogicClipDoubleRect(), aClippedPoly, false );
+ closePolygon(aClippedPoly); //again necessary after clipping
+ aPoly = aClippedPoly;
}
if(isPolygonEmptyOrSinglePoint(aPoly))
return false;
+ //transformation 3) -> 4)
+ m_pPosHelper->transformScaledLogicToScene( aPoly );
+
//create area:
uno::Reference< drawing::XShape > xShape(NULL);
if(m_nDimension==3)
{
xShape = m_pShapeFactory->createArea3D( xSeriesGroupShape_Shapes
- , aPoly, m_pPosHelper->getTransformedDepth() );
+ , aPoly, this->getTransformedDepth() );
}
else //m_nDimension!=3
{
@@ -439,10 +406,9 @@ void AreaChart::impl_createSeriesShapes()
//iterate through all series
for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ )
{
- pSeriesPoly = &(*aSeriesIter)->m_aPolyPolygonShape3D;
-
createRegressionCurvesShapes( **aSeriesIter, m_xErrorBarTarget );
+ pSeriesPoly = &(*aSeriesIter)->m_aPolyPolygonShape3D;
if( m_bArea )
{
if( !impl_createArea( *aSeriesIter, pSeriesPoly, pPreviousSeriesPoly ) )
@@ -558,9 +524,10 @@ void AreaChart::createShapes()
drawing::Position3D aUnscaledLogicPosition( fLogicX, fLogicY, fLogicZ );
//apply scaling
- //(for more accurat clipping it would be better to first clip and than scale and transform,
- //but as long as we only have integer Polygon clipping we need to apply scaling and transformation first ) see QQQ
m_pPosHelper->doLogicScaling( &fLogicX, &fLogicY, &fLogicZ );
+ drawing::Position3D aScaledLogicPosition(fLogicX,fLogicY,fLogicZ);
+ //transformation 3) -> 4)
+ drawing::Position3D aScenePosition( m_pPosHelper->transformLogicToScene( fLogicX,fLogicY,fLogicZ, false ) );
//store point information for series polygon
//for area and/or line (symbols only do not need this)
@@ -569,13 +536,7 @@ void AreaChart::createShapes()
&& !::rtl::math::isNan(fLogicZ) && !::rtl::math::isInf(fLogicZ) )
{
drawing::PolyPolygonShape3D& rSeriesPoly = (*aSeriesIter)->m_aPolyPolygonShape3D;
- drawing::Position3D aScaledLogicPosition( fLogicX, fLogicY,fLogicZ);
- //transformation 3) -> 4)
- drawing::Position3D aTransformedPosition(
- SequenceToPosition3D(
- m_pPosHelper->getTransformationLogicToScene()->transform(
- Position3DToSequence(aScaledLogicPosition) ) ) );
- AddPointToPoly( rSeriesPoly, aTransformedPosition );
+ AddPointToPoly( rSeriesPoly, aScaledLogicPosition );
}
//create a single datapoint if point is visible
@@ -592,13 +553,6 @@ void AreaChart::createShapes()
uno::Reference<drawing::XShape>( xPointGroupShape_Shapes, uno::UNO_QUERY );
{
- DataPointGeometry aLogicGeom( drawing::Position3D(fLogicX,fLogicY,fLogicZ)
- , drawing::Direction3D(1,1,1) );
- //transformation 3) -> 4)
- DataPointGeometry aTransformedGeom(
- TransformationHelper::transformLogicGeom(
- aLogicGeom,m_pPosHelper->getTransformationLogicToScene()) );
-
//create data point
drawing::Direction3D aSymbolSize(0,0,0);
if( m_bSymbol )
@@ -607,7 +561,7 @@ void AreaChart::createShapes()
{
/* //no symbols for 3D
m_pShapeFactory->createSymbol3D( xPointGroupShape_Shapes
- , aTransformedGeom.m_aPosition, aTransformedGeom.m_aSize
+ , aScenePosition, aTransformedGeom.m_aSize
, (*aSeriesIter)->getSymbolTypeOfPoint( nIndex ) );
*/
}
@@ -621,7 +575,7 @@ void AreaChart::createShapes()
aSymbolSize.DirectionX = pSymbolProperties->aSize.Width;
aSymbolSize.DirectionY = pSymbolProperties->aSize.Height;
m_pShapeFactory->createSymbol2D( xPointGroupShape_Shapes
- , aTransformedGeom.m_aPosition, aSymbolSize
+ , aScenePosition, aSymbolSize
, pSymbolProperties->nStandardSymbol
, pSymbolProperties->nFillColor );
}
@@ -636,9 +590,9 @@ void AreaChart::createShapes()
if( (**aSeriesIter).getDataPointLabelIfLabel(nIndex) )
{
LabelAlignment eAlignment = LABEL_ALIGN_TOP;
- drawing::Position3D aScenePosition3D( aTransformedGeom.m_aPosition.PositionX
- , aTransformedGeom.m_aPosition.PositionY-aSymbolSize.DirectionY/2-1
- , aTransformedGeom.m_aPosition.PositionZ+m_pPosHelper->getTransformedDepth() );
+ drawing::Position3D aScenePosition3D( aScenePosition.PositionX
+ , aScenePosition.PositionY-aSymbolSize.DirectionY/2-1
+ , aScenePosition.PositionZ+this->getTransformedDepth() );
awt::Point aScreenPosition2D( LabelPositionHelper(m_pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory)
.transformSceneToScreenPosition( aScenePosition3D ) );
this->createDataLabel( m_xTextTarget, **aSeriesIter, nIndex
diff --git a/chart2/source/view/charttypes/AreaChart.hxx b/chart2/source/view/charttypes/AreaChart.hxx
index ac6b1e8a4e2a..111923895d9d 100644
--- a/chart2/source/view/charttypes/AreaChart.hxx
+++ b/chart2/source/view/charttypes/AreaChart.hxx
@@ -21,7 +21,9 @@ class AreaChart : public VSeriesPlotter
public:
AreaChart( const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::chart2::XChartType >& xChartTypeModel
- , bool bCategoryXAxis, bool bNoArea=false );
+ , bool bCategoryXAxis, bool bNoArea=false
+ , PlottingPositionHelper* pPlottingPositionHelper=NULL //takes owner ship
+ );
virtual ~AreaChart();
//-------------------------------------------------------------------------
@@ -56,9 +58,10 @@ private: //methods
bool impl_createLine( VDataSeries* pSeries
, ::com::sun::star::drawing::PolyPolygonShape3D* pSeriesPoly );
-private: //member
- AreaPositionHelper* m_pPosHelper;
+ double getTransformedDepth() const;
+ double getLogicGrounding() const;
+private: //member
bool m_bArea;//false -> line or symbol only
bool m_bLine;
bool m_bSymbol;
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index cc779debaa1f..df68f1357455 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -692,8 +692,9 @@ void VSeriesPlotter::createRegressionCurvesShapes( const VDataSeries& rVDataSeri
aRegressionPoly.SequenceZ[0].realloc(nRealPointCount);
drawing::PolyPolygonShape3D aClippedPoly;
- Clipping::clipPolygonAtRectangle( aRegressionPoly, m_pPosHelper->getTransformedClipDoubleRect(), aClippedPoly );
+ Clipping::clipPolygonAtRectangle( aRegressionPoly, m_pPosHelper->getScaledLogicClipDoubleRect(), aClippedPoly );
aRegressionPoly = aClippedPoly;
+ m_pPosHelper->transformScaledLogicToScene( aRegressionPoly );
if( !aRegressionPoly.SequenceX.getLength() || !aRegressionPoly.SequenceX[0].getLength() )
continue;
@@ -1036,7 +1037,7 @@ VSeriesPlotter* VSeriesPlotter::createSeriesPlotter( const uno::Reference<XChart
else if( aChartType.equalsIgnoreAsciiCase(C2U("com.sun.star.chart2.PieChart")) )
pRet = new PieChart(xChartTypeModel);
else if( aChartType.equalsIgnoreAsciiCase(C2U("com.sun.star.chart2.NetChart")) )
- pRet = 0;
+ pRet = new AreaChart(xChartTypeModel,true,true,new PolarPlottingPositionHelper(false) );
else
{
//@todo create other charttypes
diff --git a/chart2/source/view/inc/Clipping.hxx b/chart2/source/view/inc/Clipping.hxx
index 51484398e937..f4b304157fc2 100644
--- a/chart2/source/view/inc/Clipping.hxx
+++ b/chart2/source/view/inc/Clipping.hxx
@@ -36,7 +36,8 @@ public:
static void clipPolygonAtRectangle(
const ::com::sun::star::drawing::PolyPolygonShape3D& rPolygon
, const DoubleRectangle& rRectangle
- , ::com::sun::star::drawing::PolyPolygonShape3D& aResult );
+ , ::com::sun::star::drawing::PolyPolygonShape3D& aResult
+ , bool bSplitPiecesToDifferentPolygons = true );
};
//.............................................................................
diff --git a/chart2/source/view/inc/PlotterBase.hxx b/chart2/source/view/inc/PlotterBase.hxx
index b76df8291090..c81e70c6406a 100644
--- a/chart2/source/view/inc/PlotterBase.hxx
+++ b/chart2/source/view/inc/PlotterBase.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: PlotterBase.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: iha $ $Date: 2004-01-17 13:10:02 $
+ * last change: $Author: iha $ $Date: 2004-01-23 14:48:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -172,7 +172,7 @@ protected: //member
//::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xCC;
sal_Int32 m_nDimension;
- // needs to be created by the derived class
+ // needs to be created and deleted by the derived class
PlottingPositionHelper* m_pPosHelper;
};
//.............................................................................
diff --git a/chart2/source/view/inc/PlottingPositionHelper.hxx b/chart2/source/view/inc/PlottingPositionHelper.hxx
index f619142d330d..1092d54798b6 100644
--- a/chart2/source/view/inc/PlottingPositionHelper.hxx
+++ b/chart2/source/view/inc/PlottingPositionHelper.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: PlottingPositionHelper.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: iha $ $Date: 2004-01-22 19:20:38 $
+ * last change: $Author: iha $ $Date: 2004-01-23 14:48:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -73,6 +73,9 @@
#ifndef _COM_SUN_STAR_DRAWING_HOMOGENMATRIX_HPP_
#include <com/sun/star/drawing/HomogenMatrix.hpp>
#endif
+#ifndef _COM_SUN_STAR_DRAWING_POLYPOLYGONSHAPE3D_HPP_
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#endif
#ifndef _COM_SUN_STAR_DRAWING_POSITION3D_HPP_
#include <com/sun/star/drawing/Position3D.hpp>
#endif
@@ -105,6 +108,8 @@ public:
void setScales( const ::com::sun::star::uno::Sequence<
::drafts::com::sun::star::chart2::ExplicitScaleData >& rScales );
+ const ::com::sun::star::uno::Sequence<
+ ::drafts::com::sun::star::chart2::ExplicitScaleData >& getScales() const;
inline bool isLogicVisible( double fX, double fY, double fZ ) const;
inline void doLogicScaling( double* pX, double* pY, double* pZ ) const;
@@ -116,6 +121,8 @@ public:
virtual ::com::sun::star::drawing::Position3D
transformLogicToScene( double fX, double fY, double fZ, bool bClip ) const;
+ void transformScaledLogicToScene( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly ) const;
+
inline double getLogicMinX() const;
inline double getLogicMinY() const;
inline double getLogicMinZ() const;
@@ -127,8 +134,7 @@ public:
inline bool isMathematicalOrientationY() const;
inline bool isMathematicalOrientationZ() const;
- Rectangle getTransformedClipRect() const;
- DoubleRectangle getTransformedClipDoubleRect() const;
+ DoubleRectangle getScaledLogicClipDoubleRect() const;
protected: //member
::com::sun::star::uno::Sequence<
@@ -168,8 +174,6 @@ public:
double getInnerLogicRadius() const;
double getOuterLogicRadius() const;
- const ::com::sun::star::uno::Sequence<
- ::drafts::com::sun::star::chart2::ExplicitScaleData >& getScales() const;
/*
// ____ XTransformation ____
/// @see ::drafts::com::sun::star::chart2::XTransformation
diff --git a/chart2/source/view/main/Clipping.cxx b/chart2/source/view/main/Clipping.cxx
index 4d6c2b1fced6..b64681f51de4 100644
--- a/chart2/source/view/main/Clipping.cxx
+++ b/chart2/source/view/main/Clipping.cxx
@@ -125,7 +125,10 @@ bool lcl_clip2d_(drawing::Position3D& rPoint0, drawing::Position3D& rPoint1, con
}//end anonymous namespace
-void Clipping::clipPolygonAtRectangle( const drawing::PolyPolygonShape3D& rPolygon, const DoubleRectangle& rRectangle, drawing::PolyPolygonShape3D& aResult )
+void Clipping::clipPolygonAtRectangle( const drawing::PolyPolygonShape3D& rPolygon
+ , const DoubleRectangle& rRectangle
+ , drawing::PolyPolygonShape3D& aResult
+ , bool bSplitPiecesToDifferentPolygons )
{
//rPolygon: XPolygon --> drawing::PolyPolygonShape3D
//aResult: XPolyPolygon --> drawing::PolyPolygonShape3D
@@ -160,7 +163,8 @@ void Clipping::clipPolygonAtRectangle( const drawing::PolyPolygonShape3D& rPolyg
}
else
{
- nNewPoly++;
+ if( bSplitPiecesToDifferentPolygons || nNewPoly<0)
+ nNewPoly++;
AddPointToPoly( aResult, aFrom, nNewPoly );
if( !(aTo==aFrom) )
AddPointToPoly( aResult, aTo, nNewPoly );
diff --git a/chart2/source/view/main/PlottingPositionHelper.cxx b/chart2/source/view/main/PlottingPositionHelper.cxx
index 5a20be6d3bf1..acfa483647c0 100644
--- a/chart2/source/view/main/PlottingPositionHelper.cxx
+++ b/chart2/source/view/main/PlottingPositionHelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: PlottingPositionHelper.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: iha $ $Date: 2004-01-22 19:20:40 $
+ * last change: $Author: iha $ $Date: 2004-01-23 14:48:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -63,6 +63,9 @@
#include "ViewDefines.hxx"
#include "Linear3DTransformation.hxx"
+#ifndef _COM_SUN_STAR_DRAWING_DOUBLESEQUENCE_HPP_
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+#endif
#ifndef _COM_SUN_STAR_DRAWING_POSITION3D_HPP_
#include <com/sun/star/drawing/Position3D.hpp>
#endif
@@ -98,6 +101,10 @@ void PlottingPositionHelper::setScales( const uno::Sequence< ExplicitScaleData >
m_aScales = rScales;
m_xTransformationLogicToScene = NULL;
}
+const uno::Sequence< ExplicitScaleData >& PlottingPositionHelper::getScales() const
+{
+ return m_aScales;
+}
uno::Reference< XTransformation > PlottingPositionHelper::getTransformationLogicToScene() const
{
@@ -168,17 +175,28 @@ drawing::Position3D PlottingPositionHelper::transformLogicToScene(
return SequenceToPosition3D(aSeq);
}
-Rectangle PlottingPositionHelper::getTransformedClipRect() const
+void PlottingPositionHelper::transformScaledLogicToScene( drawing::PolyPolygonShape3D& rPolygon ) const
{
- DoubleRectangle aDoubleRect( this->getTransformedClipDoubleRect() );
-
- Rectangle aRet( static_cast<long>(aDoubleRect.Left)
- , static_cast<long>(aDoubleRect.Top)
- , static_cast<long>(aDoubleRect.Right)
- , static_cast<long>(aDoubleRect.Bottom) );
- return aRet;
+ drawing::Position3D aScenePosition;
+ for( sal_Int32 nS = rPolygon.SequenceX.getLength(); nS--;)
+ {
+ drawing::DoubleSequence& xValues = rPolygon.SequenceX[nS];
+ drawing::DoubleSequence& yValues = rPolygon.SequenceY[nS];
+ drawing::DoubleSequence& zValues = rPolygon.SequenceZ[nS];
+ for( sal_Int32 nP = xValues.getLength(); nP--; )
+ {
+ double& fX = xValues[nP];
+ double& fY = yValues[nP];
+ double& fZ = zValues[nP];
+ aScenePosition = this->transformLogicToScene( fX,fY,fZ, false );
+ fX = aScenePosition.PositionX;
+ fY = aScenePosition.PositionY;
+ fZ = aScenePosition.PositionZ;
+ }
+ }
}
-DoubleRectangle PlottingPositionHelper::getTransformedClipDoubleRect() const
+
+DoubleRectangle PlottingPositionHelper::getScaledLogicClipDoubleRect() const
{
//get logic clip values:
double MinX = getLogicMinX();
@@ -192,19 +210,7 @@ DoubleRectangle PlottingPositionHelper::getTransformedClipDoubleRect() const
doLogicScaling( &MinX, &MinY, &MinZ );
doLogicScaling( &MaxX, &MaxY, &MaxZ);
- drawing::Position3D aMimimum( MinX, MinY, MinZ);
- drawing::Position3D aMaximum( MaxX, MaxY, MaxZ);
-
- //transform to screen coordinates
- aMimimum = SequenceToPosition3D( getTransformationLogicToScene()
- ->transform( Position3DToSequence(aMimimum) ) );
- aMaximum = SequenceToPosition3D( getTransformationLogicToScene()
- ->transform( Position3DToSequence(aMaximum) ) );
-
- DoubleRectangle aRet( aMimimum.PositionX
- , aMaximum.PositionY
- , aMaximum.PositionX
- , aMimimum.PositionY );
+ DoubleRectangle aRet( MinX, MaxY, MaxX, MinY );
return aRet;
}
@@ -223,11 +229,6 @@ PolarPlottingPositionHelper::~PolarPlottingPositionHelper()
{
}
-const uno::Sequence< ExplicitScaleData >& PolarPlottingPositionHelper::getScales() const
-{
- return m_aScales;
-}
-
uno::Reference< XTransformation > PolarPlottingPositionHelper::getTransformationLogicToScene() const
{
//transformation from 2) to 4) //@todo 2) and 4) need a ink to a document