36 double nX = rPoint.
X - rCenter.
X;
37 double nY = rPoint.
Y - rCenter.
Y;
39 double fSqrt = std::hypot(nX, nY);
40 double fOrientation = fSqrt != 0.0 ?
basegfx::rad2deg(acos(nX / fSqrt)) : 0.0;
42 fOrientation = 360 - fOrientation;
52 rStartAngle = rEndAngle;
61 for ( sal_uInt32
i = 0;
i < 4;
i++ )
68 for ( sal_uInt32
i = 0;
i < 4;
i++ )
90 aPoint1.
X -= rCenter.
X;
91 aPoint1.
Y -= rCenter.
Y;
92 rRadius.
X = std::hypot(aPoint1.
X, aPoint1.
Y);
93 aPoint2.
X -= rCenter.
X;
94 aPoint2.
Y -= rCenter.
Y;
95 rRadius.
Y = std::hypot(aPoint2.
X, aPoint2.
Y);
99 if ( ( fRot1 - fRot2 ) < 180 )
104 if ( ( fRot2 - fRot1 ) > 180 )
131 for ( sal_uInt32
i = 0;
i < nPoints;
i++)
146 sal_uInt16 nPoints = sal::static_int_cast< sal_uInt16 >(
148 if ( ! ( nPoints & 1 ) )
155 for ( sal_uInt16
i = 0;
i < nPoints;
i++ )
166 for ( sal_uInt16
i = 0;
i < nPoints;
i++ )
193 throw css::uno::Exception(
"attempt to read past end of input",
nullptr);
230 throw css::uno::Exception(
"attempt to read past end of input",
nullptr);
247 throw css::uno::Exception(
"attempt to read past end of input",
nullptr);
261 sal_uInt16 nPoints = sal::static_int_cast< sal_uInt16 >(
264 for ( sal_uInt16
i = 0;
i < nPoints;
i++)
279 std::vector<Point> aPoints;
294 mpOutAct->DrawPolyPolygon( aPolyPolygon );
305 std::unique_ptr<CGMBitmap> xBmpDesc(
mpBitmapInUse->GetNext());
308 mpOutAct->DrawBitmap(xBmpDesc->GetBitmap());
333 mpOutAct->DrawRectangle( aFloatRect );
342 double fRotation = 0;
350 aRadius.
Y = aRadius.
X;
351 mpOutAct->DrawEllipse( aCenter, aRadius, fRotation );
357 FloatPoint aStartingPoint, aIntermediatePoint, aEndingPoint;
362 double fA = aIntermediatePoint.
X - aStartingPoint.
X;
363 double fB = aIntermediatePoint.
Y - aStartingPoint.
Y;
364 double fC = aEndingPoint.
X - aStartingPoint.
X;
365 double fD = aEndingPoint.
Y - aStartingPoint.
Y;
367 double fE = fA * ( aStartingPoint.
X + aIntermediatePoint.
X ) + fB * ( aStartingPoint.
Y + aIntermediatePoint.
Y );
368 double fF = fC * ( aStartingPoint.
X + aEndingPoint.
X ) + fD * ( aStartingPoint.
Y + aEndingPoint.
Y );
370 double fG = 2.0 * ( fA * ( aEndingPoint.
Y - aIntermediatePoint.
Y ) - fB * ( aEndingPoint.
X - aIntermediatePoint.
X ) );
372 bool bUseless = fG == 0;
377 aCenterPoint.
X = ( fD * fE - fB * fF ) / fG;
378 aCenterPoint.
Y = ( fA * fF - fC * fE ) / fG;
393 if ( fStartAngle > fEndAngle )
396 aIntermediatePoint = aEndingPoint;
397 aEndingPoint = aStartingPoint;
398 aStartingPoint = aIntermediatePoint;
400 fStartAngle = fEndAngle;
403 if ( ! ( fInterAngle > fStartAngle ) && ( fInterAngle < fEndAngle ) )
406 aIntermediatePoint = aEndingPoint;
407 aEndingPoint = aStartingPoint;
408 aStartingPoint = aIntermediatePoint;
410 fStartAngle = fEndAngle;
413 double fRadius = std::hypot(aStartingPoint.
X - aCenterPoint.
X, aStartingPoint.
Y - aCenterPoint.
Y);
417 double fLeft = aCenterPoint.
X - fRadius;
418 double fTop = aCenterPoint.
Y - fRadius;
419 double fRight = fLeft + (2 * fRadius);
420 double fBottom = fTop + (2 * fRadius);
424 double fCenterCalc = fLeft + fRight;
430 double fCenterCalc = fTop + fBottom;
439 mpOutAct->RegPolyLine( aPolygon,
true );
448 aRadius.
X = aRadius.
Y = fRadius;
449 mpOutAct->DrawEllipticalArc( aCenterPoint, aRadius, fG, 2, fStartAngle, fEndAngle );
460 FloatPoint aStartingPoint, aIntermediatePoint, aEndingPoint;
465 double fA = aIntermediatePoint.
X - aStartingPoint.
X;
466 double fB = aIntermediatePoint.
Y - aStartingPoint.
Y;
467 double fC = aEndingPoint.
X - aStartingPoint.
X;
468 double fD = aEndingPoint.
Y - aStartingPoint.
Y;
470 double fE = fA * ( aStartingPoint.
X + aIntermediatePoint.
X ) + fB * ( aStartingPoint.
Y + aIntermediatePoint.
Y );
471 double fF = fC * ( aStartingPoint.
X + aEndingPoint.
X ) + fD * ( aStartingPoint.
Y + aEndingPoint.
Y );
473 double fG = 2.0 * ( fA * ( aEndingPoint.
Y - aIntermediatePoint.
Y ) - fB * ( aEndingPoint.
X - aIntermediatePoint.
X ) );
478 aCenterPoint.
X = ( fD * fE - fB * fF ) / fG;
479 aCenterPoint.
Y = ( fA * fF - fC * fE ) / fG;
484 if ( fStartAngle > fEndAngle )
486 aIntermediatePoint = aEndingPoint;
487 aEndingPoint = aStartingPoint;
488 aStartingPoint = aIntermediatePoint;
490 fStartAngle = fEndAngle;
493 if ( ! ( fInterAngle > fStartAngle ) && ( fInterAngle < fEndAngle ) )
495 aIntermediatePoint = aEndingPoint;
496 aEndingPoint = aStartingPoint;
497 aStartingPoint = aIntermediatePoint;
499 fStartAngle = fEndAngle;
503 fRadius.
Y = fRadius.
X = std::hypot(aStartingPoint.
X - aCenterPoint.
X, aStartingPoint.
Y - aCenterPoint.
Y);
511 double fOrientation = 0;
512 mpOutAct->DrawEllipticalArc( aCenterPoint, fRadius, fOrientation,
nType, fStartAngle, fEndAngle );
519 double fStartAngle, fEndAngle, vector[ 4 ];
538 aRadius.
Y = aRadius.
X;
543 const double fStartSqrt = std::hypot(vector[0], vector[1]);
544 fStartAngle = fStartSqrt != 0.0 ?
basegfx::rad2deg(acos(vector[0] / fStartSqrt)) : 0.0;
545 const double fEndSqrt = std::hypot(vector[2], vector[3]);
546 fEndAngle = fEndSqrt != 0.0 ?
basegfx::rad2deg(acos(vector[ 2 ] / fEndSqrt)) : 0.0;
548 if ( vector[ 1 ] > 0 )
549 fStartAngle = 360 - fStartAngle;
550 if ( vector[ 3 ] > 0 )
551 fEndAngle = 360 - fEndAngle;
558 double fLeft = aCenter.
X - aRadius.
X;
559 double fTop = aCenter.
Y - aRadius.
X;
560 double fRight = fLeft + (2 * aRadius.
X);
561 double fBottom = fTop + (2 * aRadius.
X);
565 double fCenterCalc = fLeft + fRight;
571 double fCenterCalc = fTop + fBottom;
586 double fOrientation = 0;
587 mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation, 2, fStartAngle, fEndAngle );
597 double fOrientation, vector[ 4 ];
614 aRadius.
Y = aRadius.
X;
621 const double fStartSqrt = std::hypot(vector[0], vector[1]);
622 double fStartAngle = fStartSqrt ?
basegfx::rad2deg(acos(vector[0] / fStartSqrt)) : 0.0;
623 const double fEndSqrt = std::hypot(vector[2], vector[3]);
624 double fEndAngle = fEndSqrt ?
basegfx::rad2deg(acos(vector[2] / fEndSqrt)) : 0.0;
626 if ( vector[ 1 ] > 0 )
627 fStartAngle = 360 - fStartAngle;
628 if ( vector[ 3 ] > 0 )
629 fEndAngle = 360 - fEndAngle;
640 mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation,
641 nType, fStartAngle, fEndAngle );
657 mpOutAct->DrawEllipse( aCenter, aRadius, fOrientation ) ;
666 double fOrientation, fStartAngle, fEndAngle, vector[ 4 ];
672 bool bDirection =
ImplGetEllipse( aCenter, aRadius, fOrientation );
678 double fStartSqrt = std::hypot(vector[0], vector[1]);
679 fStartAngle = fStartSqrt ?
basegfx::rad2deg(acos(vector[0] / fStartSqrt)) : 0.0;
680 double fEndSqrt = std::hypot(vector[2], vector[3]);
683 if ( vector[ 1 ] > 0 )
684 fStartAngle = 360 - fStartAngle;
685 if ( vector[ 3 ] > 0 )
686 fEndAngle = 360 - fEndAngle;
689 mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation,
690 2, fStartAngle, fEndAngle );
692 mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation,
693 2, fEndAngle, fStartAngle);
700 double fOrientation, fStartAngle, fEndAngle, vector[ 4 ];
706 bool bDirection =
ImplGetEllipse( aCenter, aRadius, fOrientation );
714 double fStartSqrt = std::hypot(vector[0], vector[1]);
715 fStartAngle = fStartSqrt ?
basegfx::rad2deg(acos(vector[0] / fStartSqrt)) : 0.0;
716 double fEndSqrt = std::hypot(vector[2], vector[3]);
719 if ( vector[ 1 ] > 0 )
720 fStartAngle = 360 - fStartAngle;
721 if ( vector[ 3 ] > 0 )
722 fEndAngle = 360 - fEndAngle;
730 mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation,
731 nType, fStartAngle, fEndAngle );
733 mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation,
734 nType, fEndAngle, fStartAngle);
782 for ( sal_uInt16
i = 0;
i < nNumberOfPoints;
i++)
790 for ( sal_uInt16
i = 0;
i < nNumberOfPoints;
i++ )
792 if ( (
i % 3 ) == 0 )
793 aPolygon.
SetFlags(
i, PolyFlags::Normal );
795 aPolygon.
SetFlags(
i, PolyFlags::Control );
800 for ( sal_uInt16
i = 0;
i < nNumberOfPoints;
i++ )
805 case 3 : aPolygon.
SetFlags(
i, PolyFlags::Normal );
break;
806 default : aPolygon.
SetFlags(
i, PolyFlags::Control );
break;
813 mpOutAct->DrawPolybezier( aPolygon );
bool useless(double value)
std::unique_ptr< CGMBitmap > mpBitmapInUse
static double ImplGetOrientation(FloatPoint const &rCenter, FloatPoint const &rPoint)
std::unique_ptr< CGMChart > mpChart
static void ImplSwitchStartEndAngle(double &rStartAngle, double &rEndAngle)
std::unique_ptr< CGMImpressOutAct > mpOutAct
double ImplGetFloat(RealPrecision, sal_uInt32 nRealSize)
bool ImplGetEllipse(FloatPoint &rCenter, FloatPoint &rRadius, double &rOrientation)
void ImplGetVector(double *)
sal_Int32 ImplGetI(sal_uInt32 nPrecision)
void ImplMapDouble(double &)
void ImplGetPoint(FloatPoint &rFloatPoint, bool bMap=false)
void ImplGetRectangle(FloatRect &, bool bMap=false)
sal_uInt8 * mpEndValidSource
sal_uInt32 ImplGetUI(sal_uInt32 nPrecision)
std::unique_ptr< CGMElements > pElement
sal_uInt32 ImplGetPointSize()
constexpr double rad2deg(double v)
Shape IDs per cluster in DGG atom.
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
constexpr std::enable_if_t< std::is_floating_point_v< F > &&std::is_integral_v< I >, bool > convertsToAtLeast(F value, I min)
constexpr std::enable_if_t< std::is_floating_point_v< F > &&std::is_integral_v< I >, bool > convertsToAtMost(F value, I max)