LibreOffice Module chart2 (master) 1
|
#include <PlottingPositionHelper.hxx>
Public Member Functions | |
PolarPlottingPositionHelper () | |
PolarPlottingPositionHelper (const PolarPlottingPositionHelper &rSource) | |
virtual | ~PolarPlottingPositionHelper () override |
virtual std::unique_ptr< PlottingPositionHelper > | clone () const override |
virtual void | setTransformationSceneToScreen (const css::drawing::HomogenMatrix &rMatrix) override |
virtual void | setScales (std::vector< ExplicitScaleData > &&rScales, bool bSwapXAndYAxis) override |
const ::basegfx::B3DHomMatrix & | getUnitCartesianToScene () const |
virtual ::chart::XTransformation2 * | getTransformationScaledLogicToScene () 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< PlottingPositionHelper > | clone () const |
std::unique_ptr< PlottingPositionHelper > | createSecondaryPosHelper (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::XTransformation2 * | getTransformationScaledLogicToScene () 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< ExplicitScaleData > | m_aScales |
::basegfx::B3DHomMatrix | m_aMatrixScreenToScene |
std::unique_ptr< ::chart::XTransformation2 > | m_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 |
Definition at line 183 of file PlottingPositionHelper.hxx.
chart::PolarPlottingPositionHelper::PolarPlottingPositionHelper | ( | ) |
Definition at line 333 of file PlottingPositionHelper.cxx.
References chart::PlottingPositionHelper::m_bMaySkipPointsInRegressionCalculation.
chart::PolarPlottingPositionHelper::PolarPlottingPositionHelper | ( | const PolarPlottingPositionHelper & | rSource | ) |
Definition at line 340 of file PlottingPositionHelper.cxx.
|
overridevirtual |
Definition at line 348 of file PlottingPositionHelper.cxx.
|
overridevirtual |
Reimplemented from chart::PlottingPositionHelper.
Definition at line 352 of file PlottingPositionHelper.cxx.
double chart::PolarPlottingPositionHelper::getOuterLogicRadius | ( | ) | const |
Definition at line 648 of file PlottingPositionHelper.cxx.
References chart::PlottingPositionHelper::m_aScales, chart::PlottingPositionHelper::m_bSwapXAndY, chart::ExplicitScaleData::Maximum, chart::ExplicitScaleData::Minimum, and chart::ExplicitScaleData::Orientation.
|
override |
Definition at line 410 of file PlottingPositionHelper.cxx.
References chart::PlottingPositionHelper::m_xTransformationLogicToScene.
|
inline |
Definition at line 195 of file PlottingPositionHelper.hxx.
References m_aUnitCartesianToScene.
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().
|
private |
Definition at line 368 of file PlottingPositionHelper.cxx.
References chart::PlottingPositionHelper::doLogicScaling(), FIXED_SIZE_FOR_3D_CHART_VOLUME, chart::PlottingPositionHelper::getLogicMaxZ(), chart::PlottingPositionHelper::getLogicMinZ(), chart::PlottingPositionHelper::m_aScales, basegfx::B3DHomMatrix::scale(), and basegfx::B3DHomMatrix::translate().
Referenced by setScales(), and setTransformationSceneToScreen().
|
inline |
Definition at line 262 of file PlottingPositionHelper.hxx.
References chart::PlottingPositionHelper::m_aScales, chart::PlottingPositionHelper::m_bSwapXAndY, and chart::ExplicitScaleData::Orientation.
|
inline |
Definition at line 269 of file PlottingPositionHelper.hxx.
References chart::PlottingPositionHelper::m_aScales, chart::PlottingPositionHelper::m_bSwapXAndY, and chart::ExplicitScaleData::Orientation.
Referenced by chart::PiePositionHelper::getInnerAndOuterRadius().
|
overridevirtual |
Reimplemented from chart::PlottingPositionHelper.
Definition at line 362 of file PlottingPositionHelper.cxx.
References impl_calculateMatrixUnitCartesianToScene(), chart::PlottingPositionHelper::m_aMatrixScreenToScene, m_aUnitCartesianToScene, and chart::PlottingPositionHelper::setScales().
|
overridevirtual |
Reimplemented from chart::PlottingPositionHelper.
Definition at line 357 of file PlottingPositionHelper.cxx.
References impl_calculateMatrixUnitCartesianToScene(), chart::PlottingPositionHelper::m_aMatrixScreenToScene, m_aUnitCartesianToScene, and chart::PlottingPositionHelper::setTransformationSceneToScreen().
drawing::Position3D chart::PolarPlottingPositionHelper::transformAngleRadiusToScene | ( | double | fLogicValueOnAngleAxis, |
double | fLogicValueOnRadiusAxis, | ||
double | fLogicZ, | ||
bool | bDoScaling = true |
||
) | const |
Definition at line 640 of file PlottingPositionHelper.cxx.
References transformToAngleDegree(), transformToRadius(), and transformUnitCircleToScene().
Referenced by chart::VPolarGrid::createLinePointSequence_ForAngleAxis(), transformLogicToScene(), and transformScaledLogicToScene().
|
overridevirtual |
Reimplemented from chart::PlottingPositionHelper.
Definition at line 608 of file PlottingPositionHelper.cxx.
References chart::PlottingPositionHelper::clipLogicValues(), chart::PlottingPositionHelper::m_bSwapXAndY, and transformAngleRadiusToScene().
void chart::PlottingPositionHelper::transformScaledLogicToScene | ( | css::drawing::PolyPolygonShape3D & | rPoly | ) | const |
|
virtual |
Reimplemented from chart::PlottingPositionHelper.
Definition at line 122 of file PlottingPositionHelper.cxx.
|
overridevirtual |
Reimplemented from chart::PlottingPositionHelper.
Definition at line 617 of file PlottingPositionHelper.cxx.
References chart::PlottingPositionHelper::clipScaledLogicValues(), chart::PlottingPositionHelper::m_bSwapXAndY, and transformAngleRadiusToScene().
void chart::PlottingPositionHelper::transformScaledLogicToScene | ( | std::vector< std::vector< css::drawing::Position3D > > & | rPoly | ) | const |
Definition at line 125 of file PlottingPositionHelper.cxx.
double chart::PolarPlottingPositionHelper::transformToAngleDegree | ( | double | fLogicValueOnAngleAxis, |
bool | bDoScaling = true |
||
) | const |
Given a value in the angle axis scale range (e.g.
[0,1] for pie charts) this method returns the related angle in degree.
Definition at line 444 of file PlottingPositionHelper.cxx.
References chart::PlottingPositionHelper::clipLogicValues(), chart::PlottingPositionHelper::doLogicScaling(), chart::PlottingPositionHelper::getLogicMaxX(), chart::PlottingPositionHelper::getLogicMaxY(), chart::PlottingPositionHelper::getLogicMaxZ(), chart::PlottingPositionHelper::getLogicMinX(), chart::PlottingPositionHelper::getLogicMinY(), chart::PlottingPositionHelper::getLogicMinZ(), chart::PlottingPositionHelper::m_aScales, chart::PlottingPositionHelper::m_bSwapXAndY, m_fAngleDegreeOffset, and chart::ExplicitScaleData::Orientation.
Referenced by chart::PolarLabelPositionHelper::getLabelScreenPositionAndAlignmentForLogicValues(), getWidthAngleDegree(), chart::VPolarTransformation::transform(), and transformAngleRadiusToScene().
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().
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().
|
private |
Definition at line 257 of file PlottingPositionHelper.hxx.
Referenced by getUnitCartesianToScene(), setScales(), setTransformationSceneToScreen(), and transformUnitCircleToScene().
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().
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().