summaryrefslogtreecommitdiff
path: root/chart2/source/tools
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-08-03 13:05:24 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-08-03 21:57:23 +0200
commit81302f33073e7629d724ed269f1fa21dad29e141 (patch)
tree59c1a5422fee301751c170e6ea24a3ca9b0caddc /chart2/source/tools
parent83b25e4b9fa8f95c24759a64f8cb9716ee34a4a3 (diff)
Move angle normalization code from various places to tools
Also rename svx angle normalization functions in include/svx/svdtrans.hxx, that deal with 100ths of degree, to avoid confusion: NormAngle180 -> NormAngle18000; NormAngle360 -> NormAngle36000. Some places were fixed that previously returned inclusive ranges (i.e., both 0 and 360), see changes in these files: chart2/source/view/main/PlottingPositionHelper.cxx chart2/source/view/main/PolarLabelPositionHelper.cxx chart2/source/view/main/ShapeFactory.cxx filter/source/graphicfilter/idxf/dxf2mtf.cxx sw/source/core/graphic/grfatr.cxx (the latter now matches the comment in the function). Change-Id: I9f274bbb4168360d60dceff02aeba6332c519a59 Reviewed-on: https://gerrit.libreoffice.org/58556 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'chart2/source/tools')
-rw-r--r--chart2/source/tools/ThreeDHelper.cxx27
1 files changed, 5 insertions, 22 deletions
diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx
index 25da0b374de3..3967ce42868d 100644
--- a/chart2/source/tools/ThreeDHelper.cxx
+++ b/chart2/source/tools/ThreeDHelper.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/drawing/ShadeMode.hpp>
#include <tools/diagnose_ex.h>
+#include <tools/helpers.hxx>
#include <sal/log.hxx>
namespace chart
@@ -369,24 +370,6 @@ double lcl_shiftAngleToIntervalMinusPiToPi( double fAngleRad )
return fAngleRad;
}
-void lcl_shiftAngleToIntervalMinus180To180( sal_Int32& rnAngleDegree )
-{
- //valid range: ]-180,180]
- while( rnAngleDegree<=-180 )
- rnAngleDegree+=360;
- while( rnAngleDegree>180 )
- rnAngleDegree-=360;
-}
-
-void lcl_shiftAngleToIntervalZeroTo360( sal_Int32& rnAngleDegree )
-{
- //valid range: [0,360[
- while( rnAngleDegree<0 )
- rnAngleDegree+=360;
- while( rnAngleDegree>=360 )
- rnAngleDegree-=360;
-}
-
void lcl_ensureIntervalMinus1To1( double& rSinOrCos )
{
if (rSinOrCos < -1.0)
@@ -414,8 +397,8 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad(
//https://bz.apache.org/ooo/show_bug.cgi?id=72994
//https://bz.apache.org/ooo/attachment.cgi?id=50608
- lcl_shiftAngleToIntervalZeroTo360( nElevationDeg );
- lcl_shiftAngleToIntervalZeroTo360( nRotationDeg );
+ nElevationDeg = NormAngle360(nElevationDeg);
+ nRotationDeg = NormAngle360(nRotationDeg);
double& x = rfXAngleRad;
double& y = rfYAngleRad;
@@ -1053,8 +1036,8 @@ void ThreeDHelper::getRotationFromDiagram( const uno::Reference< beans::XPropert
// nZRotation = basegfx::fround(-1.0 * basegfx::rad2deg(fZAngle));
}
- lcl_shiftAngleToIntervalMinus180To180( rnHorizontalAngleDegree );
- lcl_shiftAngleToIntervalMinus180To180( rnVerticalAngleDegree );
+ rnHorizontalAngleDegree = NormAngle180(rnHorizontalAngleDegree);
+ rnVerticalAngleDegree = NormAngle180(rnVerticalAngleDegree);
}
void ThreeDHelper::setRotationToDiagram( const uno::Reference< beans::XPropertySet >& xSceneProperties