LibreOffice Module chart2 (master) 1
PlottingPositionHelper.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
21#include <CommonConverters.hxx>
24#include <ShapeFactory.hxx>
25#include <PropertyMapper.hxx>
26#include <defines.hxx>
27
28#include <com/sun/star/chart/TimeUnit.hpp>
29#include <com/sun/star/chart2/AxisType.hpp>
30#include <com/sun/star/drawing/Position3D.hpp>
31
32#include <rtl/math.hxx>
33
34namespace chart
35{
36using namespace ::com::sun::star;
37using namespace ::com::sun::star::chart2;
38
40
42 : m_bSwapXAndY( false )
43 , m_nXResolution( 1000 )
44 , m_nYResolution( 1000 )
45 , m_nZResolution( 1000 )
46 , m_bMaySkipPointsInRegressionCalculation( true )
47 , m_bDateAxis(false)
48 , m_nTimeResolution( css::chart::TimeUnit::DAY )
49 , m_aNullDate(30,12,1899)
50 , m_fScaledCategoryWidth(1.0)
51 , m_bAllowShiftXAxisPos(false)
52 , m_bAllowShiftZAxisPos(false)
53{
54}
56 : m_aScales( rSource.m_aScales )
57 , m_aMatrixScreenToScene( rSource.m_aMatrixScreenToScene )
58 // m_xTransformationLogicToScene( nullptr ) //should be recalculated
59 , m_bSwapXAndY( rSource.m_bSwapXAndY )
60 , m_nXResolution( rSource.m_nXResolution )
61 , m_nYResolution( rSource.m_nYResolution )
62 , m_nZResolution( rSource.m_nZResolution )
63 , m_bMaySkipPointsInRegressionCalculation( rSource.m_bMaySkipPointsInRegressionCalculation )
64 , m_bDateAxis( rSource.m_bDateAxis )
65 , m_nTimeResolution( rSource.m_nTimeResolution )
66 , m_aNullDate( rSource.m_aNullDate )
67 , m_fScaledCategoryWidth( rSource.m_fScaledCategoryWidth )
68 , m_bAllowShiftXAxisPos( rSource.m_bAllowShiftXAxisPos )
69 , m_bAllowShiftZAxisPos( rSource.m_bAllowShiftZAxisPos )
70{
71}
72
74{
75
76}
77
78std::unique_ptr<PlottingPositionHelper> PlottingPositionHelper::clone() const
79{
80 return std::make_unique<PlottingPositionHelper>(*this);
81}
82
83std::unique_ptr<PlottingPositionHelper> PlottingPositionHelper::createSecondaryPosHelper( const ExplicitScaleData& rSecondaryScale )
84{
85 auto pRet = clone();
86 pRet->m_aScales[1]=rSecondaryScale;
87 return pRet;
88}
89
90void PlottingPositionHelper::setTransformationSceneToScreen( const drawing::HomogenMatrix& rMatrix)
91{
94}
95
96void PlottingPositionHelper::setScales( std::vector< ExplicitScaleData >&& rScales, bool bSwapXAndYAxis )
97{
98 m_aScales = std::move(rScales);
99 m_bSwapXAndY = bSwapXAndYAxis;
101}
102
104{
105 //this is a standard transformation for a cartesian coordinate system
106
107 //transformation from 2) to 4) //@todo 2) and 4) need an ink to a document
108
109 //we need to apply this transformation to each geometric object because of a bug/problem
110 //of the old drawing layer (the UNO_NAME_3D_EXTRUDE_DEPTH is an integer value instead of a double )
112 {
114 double MinX = getLogicMinX();
115 double MinY = getLogicMinY();
116 double MinZ = getLogicMinZ();
117 double MaxX = getLogicMaxX();
118 double MaxY = getLogicMaxY();
119 double MaxZ = getLogicMaxZ();
120
121 AxisOrientation nXAxisOrientation = m_aScales[0].Orientation;
122 AxisOrientation nYAxisOrientation = m_aScales[1].Orientation;
123 AxisOrientation nZAxisOrientation = m_aScales[2].Orientation;
124
125 //apply scaling
126 doUnshiftedLogicScaling( &MinX, &MinY, &MinZ );
127 doUnshiftedLogicScaling( &MaxX, &MaxY, &MaxZ);
128
129 if(m_bSwapXAndY)
130 {
131 std::swap(MinX,MinY);
132 std::swap(MaxX,MaxY);
133 std::swap(nXAxisOrientation,nYAxisOrientation);
134 }
135
136 double fWidthX = MaxX - MinX;
137 double fWidthY = MaxY - MinY;
138 double fWidthZ = MaxZ - MinZ;
139
140 double fScaleDirectionX = nXAxisOrientation==AxisOrientation_MATHEMATICAL ? 1.0 : -1.0;
141 double fScaleDirectionY = nYAxisOrientation==AxisOrientation_MATHEMATICAL ? 1.0 : -1.0;
142 double fScaleDirectionZ = nZAxisOrientation==AxisOrientation_MATHEMATICAL ? -1.0 : 1.0;
143
144 double fScaleX = fScaleDirectionX*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthX;
145 double fScaleY = fScaleDirectionY*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthY;
146 double fScaleZ = fScaleDirectionZ*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthZ;
147
148 aMatrix.scale(fScaleX, fScaleY, fScaleZ);
149
150 if( nXAxisOrientation==AxisOrientation_MATHEMATICAL )
151 aMatrix.translate(-MinX*fScaleX, 0.0, 0.0);
152 else
153 aMatrix.translate(-MaxX*fScaleX, 0.0, 0.0);
154 if( nYAxisOrientation==AxisOrientation_MATHEMATICAL )
155 aMatrix.translate(0.0, -MinY*fScaleY, 0.0);
156 else
157 aMatrix.translate(0.0, -MaxY*fScaleY, 0.0);
158 if( nZAxisOrientation==AxisOrientation_MATHEMATICAL )
159 aMatrix.translate(0.0, 0.0, -MaxZ*fScaleZ);//z direction in draw is reverse mathematical direction
160 else
161 aMatrix.translate(0.0, 0.0, -MinZ*fScaleZ);
162
163 aMatrix = m_aMatrixScreenToScene*aMatrix;
164
166 }
168}
169
171 double fX, double fY, double fZ, bool bClip ) const
172{
173 doLogicScaling( &fX,&fY,&fZ );
174 if(bClip)
175 clipScaledLogicValues( &fX,&fY,&fZ );
176
177 return transformScaledLogicToScene( fX, fY, fZ, false );
178}
179
181 double fX, double fY, double fZ, bool bClip ) const
182{
183 if( bClip )
184 clipScaledLogicValues( &fX,&fY,&fZ );
185
186 drawing::Position3D aPos( fX, fY, fZ);
187
188 ::chart::XTransformation2* pTransformation =
190 return pTransformation->transform( aPos );
191}
192
193awt::Point PlottingPositionHelper::transformSceneToScreenPosition( const drawing::Position3D& rScenePosition3D
194 , const rtl::Reference<SvxShapeGroupAnyD>& xSceneTarget
195 , sal_Int32 nDimensionCount )
196{
197 //@todo would like to have a cheaper method to do this transformation
198 awt::Point aScreenPoint( static_cast<sal_Int32>(rScenePosition3D.PositionX), static_cast<sal_Int32>(rScenePosition3D.PositionY) );
199
200 //transformation from scene to screen (only necessary for 3D):
201 if(nDimensionCount==3)
202 {
203 //create 3D anchor shape
204 tPropertyNameMap aDummyPropertyNameMap;
206 , rScenePosition3D,drawing::Direction3D(1,1,1)
207 , 0, nullptr, aDummyPropertyNameMap);
208 //get 2D position from xShape3DAnchor
209 aScreenPoint = xShape3DAnchor->getPosition();
210 xSceneTarget->remove(xShape3DAnchor);
211 }
212 return aScreenPoint;
213}
214
215void PlottingPositionHelper::transformScaledLogicToScene( drawing::PolyPolygonShape3D& rPolygon ) const
216{
217 drawing::Position3D aScenePosition;
218 auto SequenceXRange = asNonConstRange(rPolygon.SequenceX);
219 auto SequenceYRange = asNonConstRange(rPolygon.SequenceY);
220 auto SequenceZRange = asNonConstRange(rPolygon.SequenceZ);
221 for( sal_Int32 nS = rPolygon.SequenceX.getLength(); nS--;)
222 {
223 auto xValuesRange = asNonConstRange(SequenceXRange[nS]);
224 auto yValuesRange = asNonConstRange(SequenceYRange[nS]);
225 auto zValuesRange = asNonConstRange(SequenceZRange[nS]);
226 for( sal_Int32 nP = SequenceXRange[nS].getLength(); nP--; )
227 {
228 double& fX = xValuesRange[nP];
229 double& fY = yValuesRange[nP];
230 double& fZ = zValuesRange[nP];
231 aScenePosition = transformScaledLogicToScene( fX,fY,fZ,true );
232 fX = aScenePosition.PositionX;
233 fY = aScenePosition.PositionY;
234 fZ = aScenePosition.PositionZ;
235 }
236 }
237}
238
239void PlottingPositionHelper::transformScaledLogicToScene( std::vector<std::vector<css::drawing::Position3D>>& rPolygon ) const
240{
241 drawing::Position3D aScenePosition;
242 for( sal_Int32 nS = static_cast<sal_Int32>(rPolygon.size()); nS--;)
243 {
244 auto valuesRange = rPolygon[nS].data();
245 for( sal_Int32 nP = rPolygon[nS].size(); nP--; )
246 {
247 double& fX = valuesRange[nP].PositionX;
248 double& fY = valuesRange[nP].PositionY;
249 double& fZ = valuesRange[nP].PositionZ;
250 aScenePosition = transformScaledLogicToScene( fX,fY,fZ,true );
251 fX = aScenePosition.PositionX;
252 fY = aScenePosition.PositionY;
253 fZ = aScenePosition.PositionZ;
254 }
255 }
256}
257
258void PlottingPositionHelper::clipScaledLogicValues( double* pX, double* pY, double* pZ ) const
259{
260 //get logic clip values:
261 double MinX = getLogicMinX();
262 double MinY = getLogicMinY();
263 double MinZ = getLogicMinZ();
264 double MaxX = getLogicMaxX();
265 double MaxY = getLogicMaxY();
266 double MaxZ = getLogicMaxZ();
267
268 //apply scaling
269 doUnshiftedLogicScaling( &MinX, &MinY, &MinZ );
270 doUnshiftedLogicScaling( &MaxX, &MaxY, &MaxZ);
271
272 if(pX)
273 {
274 if( *pX < MinX )
275 *pX = MinX;
276 else if( *pX > MaxX )
277 *pX = MaxX;
278 }
279 if(pY)
280 {
281 if( *pY < MinY )
282 *pY = MinY;
283 else if( *pY > MaxY )
284 *pY = MaxY;
285 }
286 if(pZ)
287 {
288 if( *pZ < MinZ )
289 *pZ = MinZ;
290 else if( *pZ > MaxZ )
291 *pZ = MaxZ;
292 }
293}
294
296{
297 //get logic clip values:
298 double MinX = getLogicMinX();
299 double MinY = getLogicMinY();
300 double MinZ = getLogicMinZ();
301 double MaxX = getLogicMaxX();
302 double MaxY = getLogicMaxY();
303 double MaxZ = getLogicMaxZ();
304
305 //apply scaling
306 doUnshiftedLogicScaling( &MinX, &MinY, &MinZ );
307 doUnshiftedLogicScaling( &MaxX, &MaxY, &MaxZ);
308
309 basegfx::B2DRectangle aRet( MinX, MaxY, MaxX, MinY );
310 return aRet;
311}
312
314{
315 drawing::Direction3D aRet;
316
317 double MinX = getLogicMinX();
318 double MinY = getLogicMinY();
319 double MinZ = getLogicMinZ();
320 double MaxX = getLogicMaxX();
321 double MaxY = getLogicMaxY();
322 double MaxZ = getLogicMaxZ();
323
324 doLogicScaling( &MinX, &MinY, &MinZ );
325 doLogicScaling( &MaxX, &MaxY, &MaxZ);
326
327 aRet.DirectionX = MaxX - MinX;
328 aRet.DirectionY = MaxY - MinY;
329 aRet.DirectionZ = MaxZ - MinZ;
330 return aRet;
331}
332
334 : m_fRadiusOffset(0.0)
335 , m_fAngleDegreeOffset(90.0)
336{
338}
339
341 : PlottingPositionHelper(rSource)
342 , m_fRadiusOffset( rSource.m_fRadiusOffset )
343 , m_fAngleDegreeOffset( rSource.m_fAngleDegreeOffset )
344 , m_aUnitCartesianToScene( rSource.m_aUnitCartesianToScene )
345{
346}
347
349{
350}
351
352std::unique_ptr<PlottingPositionHelper> PolarPlottingPositionHelper::clone() const
353{
354 return std::make_unique<PolarPlottingPositionHelper>(*this);
355}
356
357void PolarPlottingPositionHelper::setTransformationSceneToScreen( const drawing::HomogenMatrix& rMatrix)
358{
361}
362void PolarPlottingPositionHelper::setScales( std::vector< ExplicitScaleData >&& rScales, bool bSwapXAndYAxis )
363{
364 PlottingPositionHelper::setScales( std::move(rScales), bSwapXAndYAxis );
366}
367
369{
371
372 if( m_aScales.empty() )
373 return aRet;
374
375 double fTranslate =1.0;
376 double fScale =FIXED_SIZE_FOR_3D_CHART_VOLUME/2.0;
377
378 double fTranslateLogicZ;
379 double fScaleLogicZ;
380 {
381 double fScaleDirectionZ = m_aScales[2].Orientation==AxisOrientation_MATHEMATICAL ? 1.0 : -1.0;
382 double MinZ = getLogicMinZ();
383 double MaxZ = getLogicMaxZ();
384 doLogicScaling( nullptr, nullptr, &MinZ );
385 doLogicScaling( nullptr, nullptr, &MaxZ );
386 double fWidthZ = MaxZ - MinZ;
387
388 if( m_aScales[2].Orientation==AxisOrientation_MATHEMATICAL )
389 fTranslateLogicZ=MinZ;
390 else
391 fTranslateLogicZ=MaxZ;
392 fScaleLogicZ = fScaleDirectionZ*FIXED_SIZE_FOR_3D_CHART_VOLUME/fWidthZ;
393 }
394
395 double fTranslateX = fTranslate;
396 double fTranslateY = fTranslate;
397 double fTranslateZ = fTranslateLogicZ;
398
399 double fScaleX = fScale;
400 double fScaleY = fScale;
401 double fScaleZ = fScaleLogicZ;
402
403 aRet.translate(fTranslateX, fTranslateY, fTranslateZ);//x first
404 aRet.scale(fScaleX, fScaleY, fScaleZ);//x first
405
406 aRet = rMatrixScreenToScene * aRet;
407 return aRet;
408}
409
411{
415}
416
417double PolarPlottingPositionHelper::getWidthAngleDegree( double& fStartLogicValueOnAngleAxis, double& fEndLogicValueOnAngleAxis ) const
418{
419 const ExplicitScaleData& rAngleScale = m_bSwapXAndY ? m_aScales[1] : m_aScales[0];
420 if( rAngleScale.Orientation != AxisOrientation_MATHEMATICAL )
421 std::swap( fStartLogicValueOnAngleAxis, fEndLogicValueOnAngleAxis );
422
423 double fStartAngleDegree = transformToAngleDegree( fStartLogicValueOnAngleAxis );
424 double fEndAngleDegree = transformToAngleDegree( fEndLogicValueOnAngleAxis );
425 double fWidthAngleDegree = fEndAngleDegree - fStartAngleDegree;
426
427 if( ::rtl::math::approxEqual( fStartAngleDegree, fEndAngleDegree )
428 && !::rtl::math::approxEqual( fStartLogicValueOnAngleAxis, fEndLogicValueOnAngleAxis ) )
429 fWidthAngleDegree = 360.0;
430
431 // tdf#123504: both 0 and 360 are valid and different values here!
432 while (fWidthAngleDegree < 0.0)
433 fWidthAngleDegree += 360.0;
434 while (fWidthAngleDegree > 360.0)
435 fWidthAngleDegree -= 360.0;
436
437 return fWidthAngleDegree;
438}
439
440//This method does a lot of computation for understanding which scale to
441//utilize and if reverse orientation should be used. Indeed, for a pie or donut,
442//the final result is as simple as multiplying by 360 and adding
443//`m_fAngleDegreeOffset`.
444double PolarPlottingPositionHelper::transformToAngleDegree( double fLogicValueOnAngleAxis, bool bDoScaling ) const
445{
446 double fRet=0.0;
447
448 double fAxisAngleScaleDirection = 1.0;
449 {
450 const ExplicitScaleData& rScale = m_bSwapXAndY ? m_aScales[1] : m_aScales[0];
451 if(rScale.Orientation != AxisOrientation_MATHEMATICAL)
452 fAxisAngleScaleDirection *= -1.0;
453 }
454
455 double MinAngleValue = 0.0;
456 double MaxAngleValue = 0.0;
457 {
458 double MinX = getLogicMinX();
459 double MinY = getLogicMinY();
460 double MaxX = getLogicMaxX();
461 double MaxY = getLogicMaxY();
462 double MinZ = getLogicMinZ();
463 double MaxZ = getLogicMaxZ();
464
465 doLogicScaling( &MinX, &MinY, &MinZ );
466 doLogicScaling( &MaxX, &MaxY, &MaxZ);
467
468 MinAngleValue = m_bSwapXAndY ? MinY : MinX;
469 MaxAngleValue = m_bSwapXAndY ? MaxY : MaxX;
470 }
471
472 double fScaledLogicAngleValue = 0.0;
473 if(bDoScaling)
474 {
475 double fX = m_bSwapXAndY ? getLogicMaxX() : fLogicValueOnAngleAxis;
476 double fY = m_bSwapXAndY ? fLogicValueOnAngleAxis : getLogicMaxY();
477 double fZ = getLogicMaxZ();
478 clipLogicValues( &fX, &fY, &fZ );
479 doLogicScaling( &fX, &fY, &fZ );
480 fScaledLogicAngleValue = m_bSwapXAndY ? fY : fX;
481 }
482 else
483 fScaledLogicAngleValue = fLogicValueOnAngleAxis;
484
486 + fAxisAngleScaleDirection*(fScaledLogicAngleValue-MinAngleValue)*360.0
487 /fabs(MaxAngleValue-MinAngleValue);
488 // tdf#123504: both 0 and 360 are valid and different values here!
489 while (fRet > 360.0)
490 fRet -= 360.0;
491 while (fRet < 0)
492 fRet += 360.0;
493 return fRet;
494}
495
565double PolarPlottingPositionHelper::transformToRadius( double fLogicValueOnRadiusAxis, bool bDoScaling ) const
566{
567 double fNormalRadius = 0.0;
568 {
569 double fScaledLogicRadiusValue = 0.0;
570 double fX = m_bSwapXAndY ? fLogicValueOnRadiusAxis: getLogicMaxX();
571 double fY = m_bSwapXAndY ? getLogicMaxY() : fLogicValueOnRadiusAxis;
572 if(bDoScaling)
573 doLogicScaling( &fX, &fY, nullptr );
574
575 fScaledLogicRadiusValue = m_bSwapXAndY ? fX : fY;
576
577 bool bMinIsInnerRadius = true;
578 const ExplicitScaleData& rScale = m_bSwapXAndY ? m_aScales[0] : m_aScales[1];
579 if(rScale.Orientation != AxisOrientation_MATHEMATICAL)
580 bMinIsInnerRadius = false;
581
582 double fInnerScaledLogicRadius=0.0;
583 double fOuterScaledLogicRadius=0.0;
584 {
585 double MinX = getLogicMinX();
586 double MinY = getLogicMinY();
587 doLogicScaling( &MinX, &MinY, nullptr );
588 double MaxX = getLogicMaxX();
589 double MaxY = getLogicMaxY();
590 doLogicScaling( &MaxX, &MaxY, nullptr );
591
592 double fMin = m_bSwapXAndY ? MinX : MinY;
593 double fMax = m_bSwapXAndY ? MaxX : MaxY;
594
595 fInnerScaledLogicRadius = bMinIsInnerRadius ? fMin : fMax;
596 fOuterScaledLogicRadius = bMinIsInnerRadius ? fMax : fMin;
597 }
598
599 if( bMinIsInnerRadius )
600 fInnerScaledLogicRadius -= fabs(m_fRadiusOffset);
601 else
602 fInnerScaledLogicRadius += fabs(m_fRadiusOffset);
603 fNormalRadius = (fScaledLogicRadiusValue-fInnerScaledLogicRadius)/(fOuterScaledLogicRadius-fInnerScaledLogicRadius);
604 }
605 return fNormalRadius;
606}
607
608drawing::Position3D PolarPlottingPositionHelper::transformLogicToScene( double fX, double fY, double fZ, bool bClip ) const
609{
610 if(bClip)
611 clipLogicValues( &fX,&fY,&fZ );
612 double fLogicValueOnAngleAxis = m_bSwapXAndY ? fY : fX;
613 double fLogicValueOnRadiusAxis = m_bSwapXAndY ? fX : fY;
614 return transformAngleRadiusToScene( fLogicValueOnAngleAxis, fLogicValueOnRadiusAxis, fZ );
615}
616
617drawing::Position3D PolarPlottingPositionHelper::transformScaledLogicToScene( double fX, double fY, double fZ, bool bClip ) const
618{
619 if(bClip)
620 clipScaledLogicValues( &fX,&fY,&fZ );
621 double fLogicValueOnAngleAxis = m_bSwapXAndY ? fY : fX;
622 double fLogicValueOnRadiusAxis = m_bSwapXAndY ? fX : fY;
623 return transformAngleRadiusToScene( fLogicValueOnAngleAxis, fLogicValueOnRadiusAxis, fZ, false );
624}
625drawing::Position3D PolarPlottingPositionHelper::transformUnitCircleToScene( double fUnitAngleDegree, double fUnitRadius
626 , double fLogicZ ) const
627{
628 double fAnglePi = basegfx::deg2rad(fUnitAngleDegree);
629
630 double fX=fUnitRadius*std::cos(fAnglePi);
631 double fY=fUnitRadius*std::sin(fAnglePi);
632 double fZ=fLogicZ;
633
635 ::basegfx::B3DPoint aPoint(fX,fY,fZ);
637 return B3DPointToPosition3D(aRet);
638}
639
640drawing::Position3D PolarPlottingPositionHelper::transformAngleRadiusToScene( double fLogicValueOnAngleAxis, double fLogicValueOnRadiusAxis, double fLogicZ, bool bDoScaling ) const
641{
642 double fUnitAngleDegree = transformToAngleDegree(fLogicValueOnAngleAxis,bDoScaling);
643 double fUnitRadius = transformToRadius(fLogicValueOnRadiusAxis,bDoScaling);
644
645 return transformUnitCircleToScene( fUnitAngleDegree, fUnitRadius, fLogicZ );
646}
647
649{
650 const ExplicitScaleData& rScale = m_bSwapXAndY ? m_aScales[0] : m_aScales[1];
651 if( rScale.Orientation==AxisOrientation_MATHEMATICAL )
652 return rScale.Maximum;
653 else
654 return rScale.Minimum;
655}
656
658{
659 return m_aScales[1].AxisType==AxisType::PERCENT;
660}
661
663{
664 return m_aScales[1].Origin;
665}
666
667void PlottingPositionHelper::setTimeResolution( tools::Long nTimeResolution, const Date& rNullDate )
668{
669 m_nTimeResolution = nTimeResolution;
670 m_aNullDate = rNullDate;
671
672 //adapt category width
673 double fCategoryWidth = 1.0;
674 if( !m_aScales.empty() )
675 {
676 if( m_aScales[0].AxisType == css::chart2::AxisType::DATE )
677 {
678 m_bDateAxis = true;
679 if( nTimeResolution == css::chart::TimeUnit::YEAR )
680 {
681 const double fMonthCount = 12.0;//todo: this depends on the DateScaling and must be adjusted in case we use more generic calendars in future
682 fCategoryWidth = fMonthCount;
683 }
684 }
685 }
686 setScaledCategoryWidth(fCategoryWidth);
687}
688
689void PlottingPositionHelper::setScaledCategoryWidth( double fScaledCategoryWidth )
690{
691 m_fScaledCategoryWidth = fScaledCategoryWidth;
692}
694{
695 m_bAllowShiftXAxisPos = bAllowShift;
696}
698{
699 m_bAllowShiftZAxisPos = bAllowShift;
700}
701
702}
703
704/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void translate(double fX, double fY, double fZ)
void scale(double fX, double fY, double fZ)
virtual ::chart::XTransformation2 * getTransformationScaledLogicToScene() const
css::drawing::Direction3D getScaledLogicWidth() const
::basegfx::B3DHomMatrix m_aMatrixScreenToScene
virtual void setScales(std::vector< ExplicitScaleData > &&rScales, bool bSwapXAndYAxis)
virtual void setTransformationSceneToScreen(const css::drawing::HomogenMatrix &rMatrix)
static css::awt::Point transformSceneToScreenPosition(const css::drawing::Position3D &rScenePosition3D, const rtl::Reference< SvxShapeGroupAnyD > &xSceneTarget, sal_Int32 nDimensionCount)
void AllowShiftZAxisPos(bool bAllowShift)
void clipScaledLogicValues(double *pX, double *pY, double *pZ) const
std::vector< ExplicitScaleData > m_aScales
::basegfx::B2DRectangle getScaledLogicClipDoubleRect() const
void AllowShiftXAxisPos(bool bAllowShift)
virtual std::unique_ptr< PlottingPositionHelper > clone() const
void doUnshiftedLogicScaling(double *pX, double *pY, double *pZ) const
virtual css::drawing::Position3D transformLogicToScene(double fX, double fY, double fZ, bool bClip) const
virtual void setScaledCategoryWidth(double fScaledCategoryWidth)
void doLogicScaling(double *pX, double *pY, double *pZ) const
virtual css::drawing::Position3D transformScaledLogicToScene(double fX, double fY, double fZ, bool bClip) const
std::unique_ptr< ::chart::XTransformation2 > m_xTransformationLogicToScene
void setTimeResolution(tools::Long nTimeResolution, const Date &rNullDate)
void clipLogicValues(double *pX, double *pY, double *pZ) const
std::unique_ptr< PlottingPositionHelper > createSecondaryPosHelper(const ExplicitScaleData &rSecondaryScale)
double transformToAngleDegree(double fLogicValueOnAngleAxis, bool bDoScaling=true) const
Given a value in the angle axis scale range (e.g.
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 cy...
::basegfx::B3DHomMatrix impl_calculateMatrixUnitCartesianToScene(const ::basegfx::B3DHomMatrix &rMatrixScreenToScene) const
virtual std::unique_ptr< PlottingPositionHelper > clone() const override
virtual ::chart::XTransformation2 * getTransformationScaledLogicToScene() const override
double m_fAngleDegreeOffset
Offset for angle axis in real degree.
virtual void setTransformationSceneToScreen(const css::drawing::HomogenMatrix &rMatrix) override
css::drawing::Position3D transformAngleRadiusToScene(double fLogicValueOnAngleAxis, double fLogicValueOnRadiusAxis, double fLogicZ, bool bDoScaling=true) const
virtual void setScales(std::vector< ExplicitScaleData > &&rScales, bool bSwapXAndYAxis) override
virtual css::drawing::Position3D transformScaledLogicToScene(double fX, double fY, double fZ, bool bClip) const override
double getWidthAngleDegree(double &fStartLogicValueOnAngleAxis, double &fEndLogicValueOnAngleAxis) const
Given 2 values in the angle axis scale range (e.g.
double transformToRadius(double fLogicValueOnRadiusAxis, bool bDoScaling=true) const
Given a value in the radius axis scale range, it returns the normalized value.
double m_fRadiusOffset
m_bSwapXAndY (inherited): by default the X axis (scale[0]) represents the angle axis and the Y axis (...
virtual css::drawing::Position3D transformLogicToScene(double fX, double fY, double fZ, bool bClip) const override
static rtl::Reference< Svx3DExtrudeObject > createCube(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const css::drawing::Position3D &rPosition, const css::drawing::Direction3D &rSize, sal_Int32 nRotateZAngleHundredthDegree, const css::uno::Reference< css::beans::XPropertySet > &xSourceProp, const tPropertyNameMap &rPropertyNameMap, bool bRounded=false)
allows the transformation of numeric values from one coordinate-system into another.
virtual css::drawing::Position3D transform(const css::drawing::Position3D &rSourceValues) const =0
transforms the given input data tuple, given in the source coordinate system, according to the intern...
constexpr double FIXED_SIZE_FOR_3D_CHART_VOLUME
Definition: defines.hxx:22
double getLength(const B2DPolygon &rCandidate)
constexpr double deg2rad(double v)
size
OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D B3DPointToPosition3D(const ::basegfx::B3DPoint &rPoint)
B3DPoint -> Position3D.
std::unordered_map< OUString, OUString > tPropertyNameMap
OOO_DLLPUBLIC_CHARTTOOLS css::drawing::HomogenMatrix B3DHomMatrixToHomogenMatrix(const ::basegfx::B3DHomMatrix &rM)
diverse methods for class conversions; e.g.
OOO_DLLPUBLIC_CHARTTOOLS::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix(const css::drawing::HomogenMatrix &rHM)
HomogenMatrix -> basegfx::B3DHomMatrix.
AxisType
long Long
Orientation
This structure contains the explicit values for a scale like Minimum and Maximum.
css::chart2::AxisOrientation Orientation