LibreOffice Module chart2 (master) 1
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
chart::PolarPlottingPositionHelper Class Reference

#include <PlottingPositionHelper.hxx>

Inheritance diagram for chart::PolarPlottingPositionHelper:
[legend]
Collaboration diagram for chart::PolarPlottingPositionHelper:
[legend]

Public Member Functions

 PolarPlottingPositionHelper ()
 
 PolarPlottingPositionHelper (const PolarPlottingPositionHelper &rSource)
 
virtual ~PolarPlottingPositionHelper () override
 
virtual std::unique_ptr< PlottingPositionHelperclone () const override
 
virtual void setTransformationSceneToScreen (const css::drawing::HomogenMatrix &rMatrix) override
 
virtual void setScales (std::vector< ExplicitScaleData > &&rScales, bool bSwapXAndYAxis) override
 
const ::basegfx::B3DHomMatrixgetUnitCartesianToScene () const
 
virtual ::chart::XTransformation2getTransformationScaledLogicToScene () const override
 
double transformToRadius (double fLogicValueOnRadiusAxis, bool bDoScaling=true) const
 Given a value in the radius axis scale range, it returns the normalized value. More...
 
double transformToAngleDegree (double fLogicValueOnAngleAxis, bool bDoScaling=true) const
 Given a value in the angle axis scale range (e.g. More...
 
double getWidthAngleDegree (double &fStartLogicValueOnAngleAxis, double &fEndLogicValueOnAngleAxis) const
 Given 2 values in the angle axis scale range (e.g. More...
 
virtual css::drawing::Position3D transformLogicToScene (double fX, double fY, double fZ, bool bClip) const override
 
virtual css::drawing::Position3D transformScaledLogicToScene (double fX, double fY, double fZ, bool bClip) const override
 
css::drawing::Position3D transformAngleRadiusToScene (double fLogicValueOnAngleAxis, double fLogicValueOnRadiusAxis, double fLogicZ, bool bDoScaling=true) const
 
css::drawing::Position3D transformUnitCircleToScene (double fUnitAngleDegree, double fUnitRadius, double fLogicZ) const
 It returns the scene coordinates of the passed point: this point is described through a normalized cylindrical coordinate system. More...
 
double getOuterLogicRadius () const
 
bool isMathematicalOrientationAngle () const
 
bool isMathematicalOrientationRadius () const
 
virtual css::drawing::Position3D transformScaledLogicToScene (double fX, double fY, double fZ, bool bClip) const
 
void transformScaledLogicToScene (css::drawing::PolyPolygonShape3D &rPoly) const
 
void transformScaledLogicToScene (std::vector< std::vector< css::drawing::Position3D > > &rPoly) const
 
- Public Member Functions inherited from chart::PlottingPositionHelper
 PlottingPositionHelper ()
 
 PlottingPositionHelper (const PlottingPositionHelper &rSource)
 
virtual ~PlottingPositionHelper ()
 
virtual std::unique_ptr< PlottingPositionHelperclone () const
 
std::unique_ptr< PlottingPositionHelpercreateSecondaryPosHelper (const ExplicitScaleData &rSecondaryScale)
 
virtual void setTransformationSceneToScreen (const css::drawing::HomogenMatrix &rMatrix)
 
virtual void setScales (std::vector< ExplicitScaleData > &&rScales, bool bSwapXAndYAxis)
 
const std::vector< ExplicitScaleData > & getScales () const
 
void setCoordinateSystemResolution (const css::uno::Sequence< sal_Int32 > &rCoordinateSystemResolution)
 
bool isSameForGivenResolution (double fX, double fY, double fZ, double fX2, double fY2, double fZ2)
 
bool isStrongLowerRequested (sal_Int32 nDimensionIndex) const
 
bool isLogicVisible (double fX, double fY, double fZ) const
 
void doLogicScaling (double *pX, double *pY, double *pZ) const
 
void doUnshiftedLogicScaling (double *pX, double *pY, double *pZ) const
 
void clipLogicValues (double *pX, double *pY, double *pZ) const
 
void clipScaledLogicValues (double *pX, double *pY, double *pZ) const
 
bool clipYRange (double &rMin, double &rMax) const
 
void doLogicScaling (css::drawing::Position3D &rPos) const
 
virtual ::chart::XTransformation2getTransformationScaledLogicToScene () const
 
virtual css::drawing::Position3D transformLogicToScene (double fX, double fY, double fZ, bool bClip) const
 
virtual css::drawing::Position3D transformScaledLogicToScene (double fX, double fY, double fZ, bool bClip) const
 
void transformScaledLogicToScene (css::drawing::PolyPolygonShape3D &rPoly) const
 
void transformScaledLogicToScene (std::vector< std::vector< css::drawing::Position3D > > &rPoly) const
 
double getLogicMinX () const
 
double getLogicMinY () const
 
double getLogicMinZ () const
 
double getLogicMaxX () const
 
double getLogicMaxY () const
 
double getLogicMaxZ () const
 
bool isMathematicalOrientationX () const
 
bool isMathematicalOrientationY () const
 
bool isMathematicalOrientationZ () const
 
::basegfx::B2DRectangle getScaledLogicClipDoubleRect () const
 
css::drawing::Direction3D getScaledLogicWidth () const
 
bool isSwapXAndY () const
 
bool isPercentY () const
 
double getBaseValueY () const
 
bool maySkipPointsInRegressionCalculation () const
 
void setTimeResolution (tools::Long nTimeResolution, const Date &rNullDate)
 
virtual void setScaledCategoryWidth (double fScaledCategoryWidth)
 
void AllowShiftXAxisPos (bool bAllowShift)
 
void AllowShiftZAxisPos (bool bAllowShift)
 

Public Attributes

double m_fRadiusOffset
 m_bSwapXAndY (inherited): by default the X axis (scale[0]) represents the angle axis and the Y axis (scale[1]) represents the radius axis; when this parameter is true, the opposite happens (this is the case for pie charts). More...
 
double m_fAngleDegreeOffset
 Offset for angle axis in real degree. More...
 

Private Member Functions

::basegfx::B3DHomMatrix impl_calculateMatrixUnitCartesianToScene (const ::basegfx::B3DHomMatrix &rMatrixScreenToScene) const
 

Private Attributes

::basegfx::B3DHomMatrix m_aUnitCartesianToScene
 

Additional Inherited Members

- Static Public Member Functions inherited from chart::PlottingPositionHelper
static css::awt::Point transformSceneToScreenPosition (const css::drawing::Position3D &rScenePosition3D, const rtl::Reference< SvxShapeGroupAnyD > &xSceneTarget, sal_Int32 nDimensionCount)
 
- Protected Attributes inherited from chart::PlottingPositionHelper
std::vector< ExplicitScaleDatam_aScales
 
::basegfx::B3DHomMatrix m_aMatrixScreenToScene
 
std::unique_ptr< ::chart::XTransformation2m_xTransformationLogicToScene
 
bool m_bSwapXAndY
 
sal_Int32 m_nXResolution
 
sal_Int32 m_nYResolution
 
sal_Int32 m_nZResolution
 
bool m_bMaySkipPointsInRegressionCalculation
 
bool m_bDateAxis
 
tools::Long m_nTimeResolution
 
Date m_aNullDate
 
double m_fScaledCategoryWidth
 
bool m_bAllowShiftXAxisPos
 
bool m_bAllowShiftZAxisPos
 

Detailed Description

Definition at line 183 of file PlottingPositionHelper.hxx.

Constructor & Destructor Documentation

◆ PolarPlottingPositionHelper() [1/2]

chart::PolarPlottingPositionHelper::PolarPlottingPositionHelper ( )

◆ PolarPlottingPositionHelper() [2/2]

chart::PolarPlottingPositionHelper::PolarPlottingPositionHelper ( const PolarPlottingPositionHelper rSource)

Definition at line 340 of file PlottingPositionHelper.cxx.

◆ ~PolarPlottingPositionHelper()

chart::PolarPlottingPositionHelper::~PolarPlottingPositionHelper ( )
overridevirtual

Definition at line 348 of file PlottingPositionHelper.cxx.

Member Function Documentation

◆ clone()

std::unique_ptr< PlottingPositionHelper > chart::PolarPlottingPositionHelper::clone ( ) const
overridevirtual

Reimplemented from chart::PlottingPositionHelper.

Definition at line 352 of file PlottingPositionHelper.cxx.

◆ getOuterLogicRadius()

double chart::PolarPlottingPositionHelper::getOuterLogicRadius ( ) const

◆ getTransformationScaledLogicToScene()

chart::XTransformation2 * chart::PolarPlottingPositionHelper::getTransformationScaledLogicToScene ( ) const
override

◆ getUnitCartesianToScene()

const ::basegfx::B3DHomMatrix & chart::PolarPlottingPositionHelper::getUnitCartesianToScene ( ) const
inline

Definition at line 195 of file PlottingPositionHelper.hxx.

References m_aUnitCartesianToScene.

◆ getWidthAngleDegree()

double chart::PolarPlottingPositionHelper::getWidthAngleDegree ( double &  fStartLogicValueOnAngleAxis,
double &  fEndLogicValueOnAngleAxis 
) const

Given 2 values in the angle axis scale range (e.g.

[0,1] for pie charts) this method returns the angle between the 2 values keeping into account the correct axis orientation; (for instance, this method is used for computing the angle width of a pie slice).

Definition at line 417 of file PlottingPositionHelper.cxx.

References chart::PlottingPositionHelper::m_aScales, chart::PlottingPositionHelper::m_bSwapXAndY, chart::ExplicitScaleData::Orientation, and transformToAngleDegree().

◆ impl_calculateMatrixUnitCartesianToScene()

basegfx::B3DHomMatrix chart::PolarPlottingPositionHelper::impl_calculateMatrixUnitCartesianToScene ( const ::basegfx::B3DHomMatrix rMatrixScreenToScene) const
private

◆ isMathematicalOrientationAngle()

bool chart::PolarPlottingPositionHelper::isMathematicalOrientationAngle ( ) const
inline

◆ isMathematicalOrientationRadius()

bool chart::PolarPlottingPositionHelper::isMathematicalOrientationRadius ( ) const
inline

◆ setScales()

void chart::PolarPlottingPositionHelper::setScales ( std::vector< ExplicitScaleData > &&  rScales,
bool  bSwapXAndYAxis 
)
overridevirtual

◆ setTransformationSceneToScreen()

void chart::PolarPlottingPositionHelper::setTransformationSceneToScreen ( const css::drawing::HomogenMatrix &  rMatrix)
overridevirtual

◆ transformAngleRadiusToScene()

drawing::Position3D chart::PolarPlottingPositionHelper::transformAngleRadiusToScene ( double  fLogicValueOnAngleAxis,
double  fLogicValueOnRadiusAxis,
double  fLogicZ,
bool  bDoScaling = true 
) const

◆ transformLogicToScene()

drawing::Position3D chart::PolarPlottingPositionHelper::transformLogicToScene ( double  fX,
double  fY,
double  fZ,
bool  bClip 
) const
overridevirtual

◆ transformScaledLogicToScene() [1/4]

void chart::PlottingPositionHelper::transformScaledLogicToScene ( css::drawing::PolyPolygonShape3D &  rPoly) const

◆ transformScaledLogicToScene() [2/4]

drawing::Position3D chart::PlottingPositionHelper::transformScaledLogicToScene ( double  fX,
double  fY,
double  fZ,
bool  bClip 
) const
virtual

Reimplemented from chart::PlottingPositionHelper.

Definition at line 122 of file PlottingPositionHelper.cxx.

◆ transformScaledLogicToScene() [3/4]

drawing::Position3D chart::PolarPlottingPositionHelper::transformScaledLogicToScene ( double  fX,
double  fY,
double  fZ,
bool  bClip 
) const
overridevirtual

◆ transformScaledLogicToScene() [4/4]

void chart::PlottingPositionHelper::transformScaledLogicToScene ( std::vector< std::vector< css::drawing::Position3D > > &  rPoly) const

Definition at line 125 of file PlottingPositionHelper.cxx.

◆ transformToAngleDegree()

double chart::PolarPlottingPositionHelper::transformToAngleDegree ( double  fLogicValueOnAngleAxis,
bool  bDoScaling = true 
) const

◆ transformToRadius()

double chart::PolarPlottingPositionHelper::transformToRadius ( double  fLogicValueOnRadiusAxis,
bool  bDoScaling = true 
) const

Given a value in the radius axis scale range, it returns the normalized value.

Given a value in the radius axis scale range, it returns, in the simplest case (that is when m_fRadiusOffset is zero), the normalized value; when m_fRadiusOffset is not zero (e.g.

as in the case of a donut), the interval used for normalization is extended by m_fRadiusOffset: if the axis orientation is not reversed the new interval becomes [scale.Minimum - m_fRadiusOffset, scale.Maximum] else it becomes [scale.Minimum, scale.Maximum + m_fRadiusOffset]. Pay attention here! For the latter case, since the axis orientation is reversed, the normalization is reversed too. Indeed, we have transformToRadius(scale.Maximum + m_fRadiusOffset) = 0 and transformToRadius(scale.Minimum) = 1.

For a pie chart the radius axis scale range is initialized by the getMinimum and getMaximum methods of the PieChart object (see notes for VCoordinateSystem::prepareAutomaticAxisScaling). So we have scale.Minimum = 0.5 (always constant!) and scale.Maximum = 0.5 + number_of_rings + max_offset (see notes for PieChart::getMaxOffset). Hence we get the following general formulas for computing normalized inner and outer radius:

1- transformToRadius(inner_radius) = (number_of_rings - (ring_index + 1) + m_fRadiusOffset) / (number_of_rings + max_offset + m_fRadiusOffset)

2- transformToRadius(outer_radius) = (1 + number_of_rings - (ring_index + 1) + m_fRadiusOffset) / (number_of_rings + max_offset + m_fRadiusOffset).

Here you have to take into account that values for inner and outer radius are swapped since the radius axis is reversed (See notes for PiePositionHelper::getInnerAndOuterRadius). So indeed inner_radius is the outer and outer_radius is the inner. Anyway still because of the reverse orientation, the normalization performed by transformToRadius is reversed too, as we have seen above. Hence transformToRadius(inner_radius) is really the normalized inner radius and transformToRadius(outer_radius) is really the normalized outer radius.

Some basic examples where we apply the above formulas: 1- For a non-exploded pie chart we have: transformToRadius(inner_radius) = 0, transformToRadius(outer_radius) = 1. 2- For a non-exploded donut with a single ring we have: transformToRadius(inner_radius) = m_fRadiusOffset/(1 + m_fRadiusOffset), transformToRadius(outer_radius) = (1 + m_fRadiusOffset)/(1 + m_fRadiusOffset) = 1. 3- For an exploded pie chart we have: transformToRadius(inner_radius) = 0/(1 + max_offset) = 0, transformToRadius(outer_radius) = 1/(1 + max_offset).

The third example needs some remark. Both the logical inner and outer radius passed to transformToRadius are offset by max_offset. However the returned normalized values do not contain any (normalized) offset term at all, otherwise the returned values would be max_offset/(1 + max_offset) and 1. Hence, for exploded pie/donut, transformToRadius returns the normalized value of radii without any offset term. These values are smaller than in the non-exploded case by an amount equals to the value of the normalized maximum offset (max_offset/(1 + max_offset) in the example above). That is due to the fact that the normalization keeps into account the space needed for the offset. This is the correct behavior, in fact the offset for the current slice could be different from the maximum offset. These remarks should clarify why the PieChart::createDataPoint and PieChart::createTextLabelShape methods add the normalized offset (for the current slice) to the normalized radii in order to achieve the correct placement of slice and text shapes.

Definition at line 565 of file PlottingPositionHelper.cxx.

References chart::PlottingPositionHelper::doLogicScaling(), chart::PlottingPositionHelper::getLogicMaxX(), chart::PlottingPositionHelper::getLogicMaxY(), chart::PlottingPositionHelper::getLogicMinX(), chart::PlottingPositionHelper::getLogicMinY(), chart::PlottingPositionHelper::m_aScales, chart::PlottingPositionHelper::m_bSwapXAndY, m_fRadiusOffset, and chart::ExplicitScaleData::Orientation.

Referenced by chart::PolarLabelPositionHelper::getLabelScreenPositionAndAlignmentForLogicValues(), chart::VPolarTransformation::transform(), and transformAngleRadiusToScene().

◆ transformUnitCircleToScene()

drawing::Position3D chart::PolarPlottingPositionHelper::transformUnitCircleToScene ( double  fUnitAngleDegree,
double  fUnitRadius,
double  fLogicZ 
) const

It returns the scene coordinates of the passed point: this point is described through a normalized cylindrical coordinate system.

(For a pie chart the origin of the coordinate system is the pie center).

! applying matrix to vector does ignore translation, so it is important to use a B3DPoint here instead of B3DVector

Definition at line 625 of file PlottingPositionHelper.cxx.

References chart::B3DPointToPosition3D(), basegfx::deg2rad(), and m_aUnitCartesianToScene.

Referenced by chart::PolarLabelPositionHelper::getLabelScreenPositionAndAlignmentForUnitCircleValues(), and transformAngleRadiusToScene().

Member Data Documentation

◆ m_aUnitCartesianToScene

::basegfx::B3DHomMatrix chart::PolarPlottingPositionHelper::m_aUnitCartesianToScene
private

◆ m_fAngleDegreeOffset

double chart::PolarPlottingPositionHelper::m_fAngleDegreeOffset

Offset for angle axis in real degree.

For a pie it represents the angle offset at which the first slice have to start;

Definition at line 254 of file PlottingPositionHelper.hxx.

Referenced by chart::PiePositionHelper::PiePositionHelper(), and transformToAngleDegree().

◆ m_fRadiusOffset

double chart::PolarPlottingPositionHelper::m_fRadiusOffset

m_bSwapXAndY (inherited): by default the X axis (scale[0]) represents the angle axis and the Y axis (scale[1]) represents the radius axis; when this parameter is true, the opposite happens (this is the case for pie charts).

Offset for radius axis in absolute logic scaled values (1.0 == 1 category) For a donut, it represents the non-normalized inner radius (see notes for transformToRadius)

Definition at line 250 of file PlottingPositionHelper.hxx.

Referenced by chart::PiePositionHelper::PiePositionHelper(), and transformToRadius().


The documentation for this class was generated from the following files: