1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PlottingPositionHelper.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
33 #include "PlottingPositionHelper.hxx"
34 #include "CommonConverters.hxx"
35 #include "ViewDefines.hxx"
36 #include "Linear3DTransformation.hxx"
37 #include "VPolarTransformation.hxx"
39 #include "ShapeFactory.hxx"
40 #include "PropertyMapper.hxx"
41 #include <com/sun/star/drawing/DoubleSequence.hpp>
42 #include <com/sun/star/drawing/Position3D.hpp>
43 #include <com/sun/star/chart2/AxisType.hpp>
45 #include <rtl/math.hxx>
47 //.............................................................................
50 //.............................................................................
51 using namespace ::com::sun::star
;
52 using namespace ::com::sun::star::chart2
;
54 PlottingPositionHelper::PlottingPositionHelper()
56 , m_aMatrixScreenToScene()
57 , m_xTransformationLogicToScene(NULL
)
58 , m_bSwapXAndY( false )
59 , m_nXResolution( 1000 )
60 , m_nYResolution( 1000 )
61 , m_nZResolution( 1000 )
62 , m_bMaySkipPointsInRegressionCalculation( true )
65 PlottingPositionHelper::PlottingPositionHelper( const PlottingPositionHelper
& rSource
)
66 : m_aScales( rSource
.m_aScales
)
67 , m_aMatrixScreenToScene( rSource
.m_aMatrixScreenToScene
)
68 , m_xTransformationLogicToScene( NULL
) //should be recalculated
69 , m_bSwapXAndY( rSource
.m_bSwapXAndY
)
70 , m_nXResolution( rSource
.m_nXResolution
)
71 , m_nYResolution( rSource
.m_nYResolution
)
72 , m_nZResolution( rSource
.m_nZResolution
)
73 , m_bMaySkipPointsInRegressionCalculation( rSource
.m_bMaySkipPointsInRegressionCalculation
)
77 PlottingPositionHelper::~PlottingPositionHelper()
82 PlottingPositionHelper
* PlottingPositionHelper::clone() const
84 PlottingPositionHelper
* pRet
= new PlottingPositionHelper(*this);
88 PlottingPositionHelper
* PlottingPositionHelper::createSecondaryPosHelper( const ExplicitScaleData
& rSecondaryScale
)
90 PlottingPositionHelper
* pRet
= this->clone();
91 pRet
->m_aScales
[1]=rSecondaryScale
;
95 void PlottingPositionHelper::setTransformationSceneToScreen( const drawing::HomogenMatrix
& rMatrix
)
97 m_aMatrixScreenToScene
= HomogenMatrixToB3DHomMatrix(rMatrix
);
98 m_xTransformationLogicToScene
= NULL
;
101 void PlottingPositionHelper::setScales( const uno::Sequence
< ExplicitScaleData
>& rScales
, sal_Bool bSwapXAndYAxis
)
104 m_bSwapXAndY
= bSwapXAndYAxis
;
105 m_xTransformationLogicToScene
= NULL
;
107 const uno::Sequence
< ExplicitScaleData
>& PlottingPositionHelper::getScales() const
112 uno::Reference
< XTransformation
> PlottingPositionHelper::getTransformationScaledLogicToScene() const
114 //this is a standard transformation for a cartesian coordinate system
116 //transformation from 2) to 4) //@todo 2) and 4) need a ink to a document
118 //we need to apply this transformation to each geometric object because of a bug/problem
119 //of the old drawing layer (the UNO_NAME_3D_EXTRUDE_DEPTH is an integer value instead of an double )
120 if(!m_xTransformationLogicToScene
.is())
122 ::basegfx::B3DHomMatrix aMatrix
;
123 double MinX
= getLogicMinX();
124 double MinY
= getLogicMinY();
125 double MinZ
= getLogicMinZ();
126 double MaxX
= getLogicMaxX();
127 double MaxY
= getLogicMaxY();
128 double MaxZ
= getLogicMaxZ();
130 AxisOrientation nXAxisOrientation
= m_aScales
[0].Orientation
;
131 AxisOrientation nYAxisOrientation
= m_aScales
[1].Orientation
;
132 AxisOrientation nZAxisOrientation
= m_aScales
[2].Orientation
;
135 doLogicScaling( &MinX
, &MinY
, &MinZ
);
136 doLogicScaling( &MaxX
, &MaxY
, &MaxZ
);
140 std::swap(MinX
,MinY
);
141 std::swap(MaxX
,MaxY
);
142 std::swap(nXAxisOrientation
,nYAxisOrientation
);
145 double fWidthX
= MaxX
- MinX
;
146 double fWidthY
= MaxY
- MinY
;
147 double fWidthZ
= MaxZ
- MinZ
;
149 double fScaleDirectionX
= AxisOrientation_MATHEMATICAL
==nXAxisOrientation
? 1.0 : -1.0;
150 double fScaleDirectionY
= AxisOrientation_MATHEMATICAL
==nYAxisOrientation
? 1.0 : -1.0;
151 double fScaleDirectionZ
= AxisOrientation_MATHEMATICAL
==nZAxisOrientation
? -1.0 : 1.0;
153 double fScaleX
= fScaleDirectionX
*FIXED_SIZE_FOR_3D_CHART_VOLUME
/fWidthX
;
154 double fScaleY
= fScaleDirectionY
*FIXED_SIZE_FOR_3D_CHART_VOLUME
/fWidthY
;
155 double fScaleZ
= fScaleDirectionZ
*FIXED_SIZE_FOR_3D_CHART_VOLUME
/fWidthZ
;
157 aMatrix
.scale(fScaleX
, fScaleY
, fScaleZ
);
159 if( AxisOrientation_MATHEMATICAL
==nXAxisOrientation
)
160 aMatrix
.translate(-MinX
*fScaleX
, 0.0, 0.0);
162 aMatrix
.translate(-MaxX
*fScaleX
, 0.0, 0.0);
163 if( AxisOrientation_MATHEMATICAL
==nYAxisOrientation
)
164 aMatrix
.translate(0.0, -MinY
*fScaleY
, 0.0);
166 aMatrix
.translate(0.0, -MaxY
*fScaleY
, 0.0);
167 if( AxisOrientation_MATHEMATICAL
==nZAxisOrientation
)
168 aMatrix
.translate(0.0, 0.0, -MaxZ
*fScaleZ
);//z direction in draw is reverse mathematical direction
170 aMatrix
.translate(0.0, 0.0, -MinZ
*fScaleZ
);
172 aMatrix
= m_aMatrixScreenToScene
*aMatrix
;
174 m_xTransformationLogicToScene
= new Linear3DTransformation(B3DHomMatrixToHomogenMatrix( aMatrix
),m_bSwapXAndY
);
176 return m_xTransformationLogicToScene
;
179 drawing::Position3D
PlottingPositionHelper::transformLogicToScene(
180 double fX
, double fY
, double fZ
, bool bClip
) const
183 this->clipLogicValues( &fX
,&fY
,&fZ
);
184 this->doLogicScaling( &fX
,&fY
,&fZ
);
186 return this->transformScaledLogicToScene( fX
, fY
, fZ
, false );
189 drawing::Position3D
PlottingPositionHelper::transformScaledLogicToScene(
190 double fX
, double fY
, double fZ
, bool bClip
) const
193 this->clipScaledLogicValues( &fX
,&fY
,&fZ
);
195 drawing::Position3D
aPos( fX
, fY
, fZ
);
197 uno::Reference
< XTransformation
> xTransformation
=
198 this->getTransformationScaledLogicToScene();
199 uno::Sequence
< double > aSeq
=
200 xTransformation
->transform( Position3DToSequence(aPos
) );
201 return SequenceToPosition3D(aSeq
);
205 awt::Point
PlottingPositionHelper::transformSceneToScreenPosition( const drawing::Position3D
& rScenePosition3D
206 , const uno::Reference
< drawing::XShapes
>& xSceneTarget
207 , ShapeFactory
* pShapeFactory
208 , sal_Int32 nDimensionCount
)
210 //@todo would like to have a cheaper method to do this transformation
211 awt::Point
aScreenPoint( static_cast<sal_Int32
>(rScenePosition3D
.PositionX
), static_cast<sal_Int32
>(rScenePosition3D
.PositionY
) );
213 //transformation from scene to screen (only neccessary for 3D):
214 if(3==nDimensionCount
)
216 //create 3D anchor shape
217 tPropertyNameMap aDummyPropertyNameMap
;
218 uno::Reference
< drawing::XShape
> xShape3DAnchor
= pShapeFactory
->createCube( xSceneTarget
219 , rScenePosition3D
,drawing::Direction3D(1,1,1)
220 , 0, 0, aDummyPropertyNameMap
);
221 //get 2D position from xShape3DAnchor
222 aScreenPoint
= xShape3DAnchor
->getPosition();
223 xSceneTarget
->remove(xShape3DAnchor
);
228 void PlottingPositionHelper::transformScaledLogicToScene( drawing::PolyPolygonShape3D
& rPolygon
) const
230 drawing::Position3D aScenePosition
;
231 for( sal_Int32 nS
= rPolygon
.SequenceX
.getLength(); nS
--;)
233 drawing::DoubleSequence
& xValues
= rPolygon
.SequenceX
[nS
];
234 drawing::DoubleSequence
& yValues
= rPolygon
.SequenceY
[nS
];
235 drawing::DoubleSequence
& zValues
= rPolygon
.SequenceZ
[nS
];
236 for( sal_Int32 nP
= xValues
.getLength(); nP
--; )
238 double& fX
= xValues
[nP
];
239 double& fY
= yValues
[nP
];
240 double& fZ
= zValues
[nP
];
241 aScenePosition
= this->transformScaledLogicToScene( fX
,fY
,fZ
,true );
242 fX
= aScenePosition
.PositionX
;
243 fY
= aScenePosition
.PositionY
;
244 fZ
= aScenePosition
.PositionZ
;
250 void PlottingPositionHelper::clipScaledLogicValues( double* pX
, double* pY
, double* pZ
) const
252 //get logic clip values:
253 double MinX
= getLogicMinX();
254 double MinY
= getLogicMinY();
255 double MinZ
= getLogicMinZ();
256 double MaxX
= getLogicMaxX();
257 double MaxY
= getLogicMaxY();
258 double MaxZ
= getLogicMaxZ();
261 doLogicScaling( &MinX
, &MinY
, &MinZ
);
262 doLogicScaling( &MaxX
, &MaxY
, &MaxZ
);
268 else if( *pX
> MaxX
)
275 else if( *pY
> MaxY
)
282 else if( *pZ
> MaxZ
)
287 basegfx::B2DRectangle
PlottingPositionHelper::getScaledLogicClipDoubleRect() const
289 //get logic clip values:
290 double MinX
= getLogicMinX();
291 double MinY
= getLogicMinY();
292 double MinZ
= getLogicMinZ();
293 double MaxX
= getLogicMaxX();
294 double MaxY
= getLogicMaxY();
295 double MaxZ
= getLogicMaxZ();
298 doLogicScaling( &MinX
, &MinY
, &MinZ
);
299 doLogicScaling( &MaxX
, &MaxY
, &MaxZ
);
301 basegfx::B2DRectangle
aRet( MinX
, MaxY
, MaxX
, MinY
);
305 drawing::Direction3D
PlottingPositionHelper::getScaledLogicWidth() const
307 drawing::Direction3D aRet
;
309 double MinX
= getLogicMinX();
310 double MinY
= getLogicMinY();
311 double MinZ
= getLogicMinZ();
312 double MaxX
= getLogicMaxX();
313 double MaxY
= getLogicMaxY();
314 double MaxZ
= getLogicMaxZ();
316 doLogicScaling( &MinX
, &MinY
, &MinZ
);
317 doLogicScaling( &MaxX
, &MaxY
, &MaxZ
);
319 aRet
.DirectionX
= MaxX
- MinX
;
320 aRet
.DirectionY
= MaxY
- MinY
;
321 aRet
.DirectionZ
= MaxZ
- MinZ
;
325 //-----------------------------------------------------------------------------
326 //-----------------------------------------------------------------------------
327 //-----------------------------------------------------------------------------
329 PolarPlottingPositionHelper::PolarPlottingPositionHelper( NormalAxis eNormalAxis
)
330 : m_fRadiusOffset(0.0)
331 , m_fAngleDegreeOffset(90.0)
332 , m_aUnitCartesianToScene()
333 , m_eNormalAxis(eNormalAxis
)
335 m_bMaySkipPointsInRegressionCalculation
= false;
338 PolarPlottingPositionHelper::PolarPlottingPositionHelper( const PolarPlottingPositionHelper
& rSource
)
339 : PlottingPositionHelper(rSource
)
340 , m_fRadiusOffset( rSource
.m_fRadiusOffset
)
341 , m_fAngleDegreeOffset( rSource
.m_fAngleDegreeOffset
)
342 , m_aUnitCartesianToScene( rSource
.m_aUnitCartesianToScene
)
343 , m_eNormalAxis( rSource
.m_eNormalAxis
)
347 PolarPlottingPositionHelper::~PolarPlottingPositionHelper()
351 PlottingPositionHelper
* PolarPlottingPositionHelper::clone() const
353 PolarPlottingPositionHelper
* pRet
= new PolarPlottingPositionHelper(*this);
357 void PolarPlottingPositionHelper::setTransformationSceneToScreen( const drawing::HomogenMatrix
& rMatrix
)
359 PlottingPositionHelper::setTransformationSceneToScreen( rMatrix
);
360 m_aUnitCartesianToScene
=impl_calculateMatrixUnitCartesianToScene( m_aMatrixScreenToScene
);
362 void PolarPlottingPositionHelper::setScales( const uno::Sequence
< ExplicitScaleData
>& rScales
, sal_Bool bSwapXAndYAxis
)
364 PlottingPositionHelper::setScales( rScales
, bSwapXAndYAxis
);
365 m_aUnitCartesianToScene
=impl_calculateMatrixUnitCartesianToScene( m_aMatrixScreenToScene
);
368 ::basegfx::B3DHomMatrix
PolarPlottingPositionHelper::impl_calculateMatrixUnitCartesianToScene( const ::basegfx::B3DHomMatrix
& rMatrixScreenToScene
) const
370 ::basegfx::B3DHomMatrix aRet
;
372 if( !m_aScales
.getLength() )
375 double fTranslate
=1.0;
376 double fScale
=FIXED_SIZE_FOR_3D_CHART_VOLUME
/2.0;
378 double fTranslateLogicZ
=fTranslate
;
379 double fScaleLogicZ
=fScale
;
381 double fScaleDirectionZ
= AxisOrientation_MATHEMATICAL
==m_aScales
[2].Orientation
? 1.0 : -1.0;
382 double MinZ
= getLogicMinZ();
383 double MaxZ
= getLogicMaxZ();
384 doLogicScaling( 0, 0, &MinZ
);
385 doLogicScaling( 0, 0, &MaxZ
);
386 double fWidthZ
= MaxZ
- MinZ
;
388 if( AxisOrientation_MATHEMATICAL
==m_aScales
[2].Orientation
)
389 fTranslateLogicZ
=MinZ
;
391 fTranslateLogicZ
=MaxZ
;
392 fScaleLogicZ
= fScaleDirectionZ
*FIXED_SIZE_FOR_3D_CHART_VOLUME
/fWidthZ
;
395 double fTranslateX
= fTranslate
;
396 double fTranslateY
= fTranslate
;
397 double fTranslateZ
= fTranslate
;
399 double fScaleX
= fScale
;
400 double fScaleY
= fScale
;
401 double fScaleZ
= fScale
;
403 switch(m_eNormalAxis
)
407 fTranslateX
= fTranslateLogicZ
;
408 fScaleX
= fScaleLogicZ
;
413 fTranslateY
= fTranslateLogicZ
;
414 fScaleY
= fScaleLogicZ
;
417 default: //NormalAxis_Z:
419 fTranslateZ
= fTranslateLogicZ
;
420 fScaleZ
= fScaleLogicZ
;
425 aRet
.translate(fTranslateX
, fTranslateY
, fTranslateZ
);//x first
426 aRet
.scale(fScaleX
, fScaleY
, fScaleZ
);//x first
428 aRet
= rMatrixScreenToScene
* aRet
;
432 ::basegfx::B3DHomMatrix
PolarPlottingPositionHelper::getUnitCartesianToScene() const
434 return m_aUnitCartesianToScene
;
437 uno::Reference
< XTransformation
> PolarPlottingPositionHelper::getTransformationScaledLogicToScene() const
439 if( !m_xTransformationLogicToScene
.is() )
440 m_xTransformationLogicToScene
= new VPolarTransformation(*this);
441 return m_xTransformationLogicToScene
;
444 double PolarPlottingPositionHelper::getWidthAngleDegree( double& fStartLogicValueOnAngleAxis
, double& fEndLogicValueOnAngleAxis
) const
446 const ExplicitScaleData
& rAngleScale
= m_bSwapXAndY
? m_aScales
[1] : m_aScales
[0];
447 if( AxisOrientation_MATHEMATICAL
!= rAngleScale
.Orientation
)
449 double fHelp
= fEndLogicValueOnAngleAxis
;
450 fEndLogicValueOnAngleAxis
= fStartLogicValueOnAngleAxis
;
451 fStartLogicValueOnAngleAxis
= fHelp
;
454 double fStartAngleDegree
= this->transformToAngleDegree( fStartLogicValueOnAngleAxis
);
455 double fEndAngleDegree
= this->transformToAngleDegree( fEndLogicValueOnAngleAxis
);
456 double fWidthAngleDegree
= fEndAngleDegree
- fStartAngleDegree
;
458 if( ::rtl::math::approxEqual( fStartAngleDegree
, fEndAngleDegree
)
459 && !::rtl::math::approxEqual( fStartLogicValueOnAngleAxis
, fEndLogicValueOnAngleAxis
) )
460 fWidthAngleDegree
= 360.0;
462 while(fWidthAngleDegree
<0.0)
463 fWidthAngleDegree
+=360.0;
464 while(fWidthAngleDegree
>360.0)
465 fWidthAngleDegree
-=360.0;
467 return fWidthAngleDegree
;
470 double PolarPlottingPositionHelper::transformToAngleDegree( double fLogicValueOnAngleAxis
, bool bDoScaling
) const
474 double fAxisAngleScaleDirection
= 1.0;
476 const ExplicitScaleData
& rScale
= m_bSwapXAndY
? m_aScales
[1] : m_aScales
[0];
477 if(AxisOrientation_MATHEMATICAL
!= rScale
.Orientation
)
478 fAxisAngleScaleDirection
*= -1.0;
481 double MinAngleValue
= 0.0;
482 double MaxAngleValue
= 0.0;
484 double MinX
= getLogicMinX();
485 double MinY
= getLogicMinY();
486 double MaxX
= getLogicMaxX();
487 double MaxY
= getLogicMaxY();
488 double MinZ
= getLogicMinZ();
489 double MaxZ
= getLogicMaxZ();
491 doLogicScaling( &MinX
, &MinY
, &MinZ
);
492 doLogicScaling( &MaxX
, &MaxY
, &MaxZ
);
494 MinAngleValue
= m_bSwapXAndY
? MinY
: MinX
;
495 MaxAngleValue
= m_bSwapXAndY
? MaxY
: MaxX
;
498 double fScaledLogicAngleValue
= 0.0;
501 double fX
= m_bSwapXAndY
? getLogicMaxX() : fLogicValueOnAngleAxis
;
502 double fY
= m_bSwapXAndY
? fLogicValueOnAngleAxis
: getLogicMaxY();
503 double fZ
= getLogicMaxZ();
504 clipLogicValues( &fX
, &fY
, &fZ
);
505 doLogicScaling( &fX
, &fY
, &fZ
);
506 fScaledLogicAngleValue
= m_bSwapXAndY
? fY
: fX
;
509 fScaledLogicAngleValue
= fLogicValueOnAngleAxis
;
511 fRet
= m_fAngleDegreeOffset
512 + fAxisAngleScaleDirection
*(fScaledLogicAngleValue
-MinAngleValue
)*360.0
513 /fabs(MaxAngleValue
-MinAngleValue
);
521 double PolarPlottingPositionHelper::transformToRadius( double fLogicValueOnRadiusAxis
, bool bDoScaling
) const
523 double fNormalRadius
= 0.0;
525 double fScaledLogicRadiusValue
= 0.0;
526 double fX
= m_bSwapXAndY
? fLogicValueOnRadiusAxis
: getLogicMaxX();
527 double fY
= m_bSwapXAndY
? getLogicMaxY() : fLogicValueOnRadiusAxis
;
529 doLogicScaling( &fX
, &fY
, 0 );
531 fScaledLogicRadiusValue
= m_bSwapXAndY
? fX
: fY
;
533 bool bMinIsInnerRadius
= true;
534 const ExplicitScaleData
& rScale
= m_bSwapXAndY
? m_aScales
[0] : m_aScales
[1];
535 if(AxisOrientation_MATHEMATICAL
!= rScale
.Orientation
)
536 bMinIsInnerRadius
= false;
538 double fInnerScaledLogicRadius
=0.0;
539 double fOuterScaledLogicRadius
=0.0;
541 double MinX
= getLogicMinX();
542 double MinY
= getLogicMinY();
543 doLogicScaling( &MinX
, &MinY
, 0 );
544 double MaxX
= getLogicMaxX();
545 double MaxY
= getLogicMaxY();
546 doLogicScaling( &MaxX
, &MaxY
, 0 );
548 double fMin
= m_bSwapXAndY
? MinX
: MinY
;
549 double fMax
= m_bSwapXAndY
? MaxX
: MaxY
;
551 fInnerScaledLogicRadius
= bMinIsInnerRadius
? fMin
: fMax
;
552 fOuterScaledLogicRadius
= bMinIsInnerRadius
? fMax
: fMin
;
555 if( bMinIsInnerRadius
)
556 fInnerScaledLogicRadius
-= fabs(m_fRadiusOffset
);
558 fInnerScaledLogicRadius
+= fabs(m_fRadiusOffset
);
559 fNormalRadius
= (fScaledLogicRadiusValue
-fInnerScaledLogicRadius
)/(fOuterScaledLogicRadius
-fInnerScaledLogicRadius
);
561 return fNormalRadius
;
564 drawing::Position3D
PolarPlottingPositionHelper::transformLogicToScene( double fX
, double fY
, double fZ
, bool bClip
) const
567 this->clipLogicValues( &fX
,&fY
,&fZ
);
568 double fLogicValueOnAngleAxis
= m_bSwapXAndY
? fY
: fX
;
569 double fLogicValueOnRadiusAxis
= m_bSwapXAndY
? fX
: fY
;
570 return this->transformAngleRadiusToScene( fLogicValueOnAngleAxis
, fLogicValueOnRadiusAxis
, fZ
, true );
573 drawing::Position3D
PolarPlottingPositionHelper::transformScaledLogicToScene( double fX
, double fY
, double fZ
, bool bClip
) const
576 this->clipScaledLogicValues( &fX
,&fY
,&fZ
);
577 double fLogicValueOnAngleAxis
= m_bSwapXAndY
? fY
: fX
;
578 double fLogicValueOnRadiusAxis
= m_bSwapXAndY
? fX
: fY
;
579 return this->transformAngleRadiusToScene( fLogicValueOnAngleAxis
, fLogicValueOnRadiusAxis
, fZ
, false );
581 drawing::Position3D
PolarPlottingPositionHelper::transformUnitCircleToScene( double fUnitAngleDegree
, double fUnitRadius
582 , double fLogicZ
, bool /* bDoScaling */ ) const
584 double fAnglePi
= fUnitAngleDegree
*F_PI
/180.0;
586 double fX
=fUnitRadius
*rtl::math::cos(fAnglePi
);
587 double fY
=fUnitRadius
*rtl::math::sin(fAnglePi
);
590 switch(m_eNormalAxis
)
599 default: //NormalAxis_Z
603 //!! applying matrix to vector does ignore translation, so it is important to use a B3DPoint here instead of B3DVector
604 ::basegfx::B3DPoint
aPoint(fX
,fY
,fZ
);
605 ::basegfx::B3DPoint aRet
= m_aUnitCartesianToScene
* aPoint
;
606 return B3DPointToPosition3D(aRet
);
609 drawing::Position3D
PolarPlottingPositionHelper::transformAngleRadiusToScene( double fLogicValueOnAngleAxis
, double fLogicValueOnRadiusAxis
, double fLogicZ
, bool bDoScaling
) const
611 double fUnitAngleDegree
= this->transformToAngleDegree(fLogicValueOnAngleAxis
,bDoScaling
);
612 double fUnitRadius
= this->transformToRadius(fLogicValueOnRadiusAxis
,bDoScaling
);
614 return transformUnitCircleToScene( fUnitAngleDegree
, fUnitRadius
, fLogicZ
, bDoScaling
);
618 double PolarPlottingPositionHelper::getInnerLogicRadius() const
620 const ExplicitScaleData
& rScale
= m_bSwapXAndY
? m_aScales
[0] : m_aScales
[1];
621 if( AxisOrientation_MATHEMATICAL
==rScale
.Orientation
)
622 return rScale
.Minimum
;
624 return rScale
.Maximum
;
628 double PolarPlottingPositionHelper::getOuterLogicRadius() const
630 const ExplicitScaleData
& rScale
= m_bSwapXAndY
? m_aScales
[0] : m_aScales
[1];
631 if( AxisOrientation_MATHEMATICAL
==rScale
.Orientation
)
632 return rScale
.Maximum
;
634 return rScale
.Minimum
;
637 bool PlottingPositionHelper::isPercentY() const
639 return m_aScales
[1].AxisType
==AxisType::PERCENT
;
642 double PlottingPositionHelper::getBaseValueY() const
644 return m_aScales
[1].Origin
;
648 // ____ XTransformation ____
649 uno::Sequence< double > SAL_CALL PolarPlottingPositionHelper::transform(
650 const uno::Sequence< double >& rSourceValues )
651 throw (uno::RuntimeException, lang::IllegalArgumentException)
653 uno::Sequence< double > aSourceValues(3);
654 return aSourceValues;
657 sal_Int32 SAL_CALL PolarPlottingPositionHelper::getSourceDimension() throw (uno::RuntimeException)
662 sal_Int32 SAL_CALL PolarPlottingPositionHelper::getTargetDimension() throw (uno::RuntimeException)
668 //.............................................................................
670 //.............................................................................