22 #include <rtl/ustring.hxx>
46 inline void RotatePoint(Point& rPnt,
const Point& rRef,
double sn,
double cs);
51 void MirrorPoint(Point& rPnt,
const Point& rRef1,
const Point& rRef2);
54 inline void ShearPoint(Point& rPnt,
const Point& rRef,
double tn,
bool bVShear =
false);
64 inline double GetCrookAngle(Point& rPnt,
const Point& rCenter,
const Point& rRad,
bool bVertical);
73 double CrookRotateXPoint(Point& rPnt, Point* pC1, Point* pC2,
const Point& rCenter,
74 const Point& rRad,
double& rSin,
double& rCos,
bool bVert);
75 double CrookSlantXPoint(Point& rPnt, Point* pC1, Point* pC2,
const Point& rCenter,
76 const Point& rRad,
double& rSin,
double& rCos,
bool bVert);
78 const Point& rRad,
double& rSin,
double& rCos,
bool bVert,
95 double nxFract = xFract.
IsValid() ?
static_cast<double>(xFract) : 1.0;
96 double nyFract = yFract.
IsValid() ?
static_cast<double>(yFract) : 1.0;
97 rPnt.setX(rRef.X() +
FRound( (rPnt.X() - rRef.X()) * nxFract ));
98 rPnt.setY(rRef.Y() +
FRound( (rPnt.Y() - rRef.Y()) * nyFract ));
101 inline void RotatePoint(Point& rPnt,
const Point& rRef,
double sn,
double cs)
105 rPnt.setX(
FRound(rRef.X()+dx*cs+dy*sn));
106 rPnt.setY(
FRound(rRef.Y()+dy*cs-dx*sn));
109 inline void ShearPoint(Point& rPnt,
const Point& rRef,
double tn,
bool bVShear)
112 if (rPnt.Y()!=rRef.Y()) {
113 rPnt.AdjustX(-
FRound((rPnt.Y()-rRef.Y())*tn));
116 if (rPnt.X()!=rRef.X()) {
117 rPnt.AdjustY(-
FRound((rPnt.X()-rRef.X())*tn));
122 inline double GetCrookAngle(Point& rPnt,
const Point& rCenter,
const Point& rRad,
bool bVertical)
127 nAngle=
static_cast<double>(dy)/static_cast<double>(rRad.Y());
128 rPnt.setY(rCenter.Y());
131 nAngle=
static_cast<double>(dx)/static_cast<double>(rRad.X());
132 rPnt.setX(rCenter.X());
209 GeoStat(): nRotationAngle(0),nShearAngle(0),mfTanShearAngle(0.0),mfSinRotationAngle(0.0),mfCosRotationAngle(1.0) {}
217 void OrthoDistance8(
const Point& rPt0, Point& rPt,
bool bBigOrtho);
218 void OrthoDistance4(
const Point& rPt0, Point& rPt,
bool bBigOrtho);
243 return (eU==MapUnit::Map100thMM || eU==MapUnit::Map10thMM || eU==MapUnit::MapMM || eU==MapUnit::MapCM);
247 return (eU==MapUnit::Map1000thInch || eU==MapUnit::Map100thInch || eU==MapUnit::Map10thInch || eU==MapUnit::MapInch ||
248 eU==MapUnit::MapPoint || eU==MapUnit::MapTwip);
252 return (eU == FieldUnit::MM || eU == FieldUnit::CM || eU == FieldUnit::M
253 || eU == FieldUnit::KM || eU == FieldUnit::MM_100TH);
257 return (eU == FieldUnit::TWIP || eU == FieldUnit::POINT
258 || eU == FieldUnit::PICA || eU == FieldUnit::INCH
259 || eU == FieldUnit::FOOT || eU == FieldUnit::MILE);
282 static OUString GetUnitStr(
MapUnit eUnit);
283 static OUString GetUnitStr(
FieldUnit eUnit);
void MoveXPoly(XPolygon &rPoly, const Size &S)
void OrthoDistance4(const Point &rPt0, Point &rPt, bool bBigOrtho)
SVXCORE_DLLPUBLIC void RotatePoly(tools::Polygon &rPoly, const Point &rRef, double sn, double cs)
FrPair(tools::Long nMul, tools::Long nDiv)
void ShearPoint(Point &rPnt, const Point &rRef, double tn, bool bVShear=false)
tools::Long GetLen(const Point &rPnt)
Determine sector within the cartesian coordinate system.
double GetCrookAngle(Point &rPnt, const Point &rCenter, const Point &rRad, bool bVertical)
rPnt.X/rPnt.Y is set to rCenter.X or rCenter.Y! We then only need to rotate rPnt by rCenter...
void ResizePoint(Point &rPnt, const Point &rRef, const Fraction &xFract, const Fraction &yFract)
constexpr Degree100 SDRMAXSHEAR(8900)
SVXCORE_DLLPUBLIC void ResizeRect(tools::Rectangle &rRect, const Point &rRef, const Fraction &xFact, const Fraction &yFact)
double mfSinRotationAngle
void ResizePoly(tools::Polygon &rPoly, const Point &rRef, const Fraction &xFact, const Fraction &yFact)
void ResizeXPoly(XPolygon &rPoly, const Point &rRef, const Fraction &xFact, const Fraction &yFact)
void RotateXPoly(XPolygon &rPoly, const Point &rRef, double sn, double cs)
bool IsMetric(MapUnit eU)
SVXCORE_DLLPUBLIC tools::Long BigMulDiv(tools::Long nVal, tools::Long nMul, tools::Long nDiv)
FrPair(tools::Long xMul, tools::Long xDiv, tools::Long yMul, tools::Long yDiv)
constexpr tools::Long Width() const
SVXCORE_DLLPUBLIC void ShearPoly(tools::Polygon &rPoly, const Point &rRef, double tn)
The transformation of a rectangle into a polygon, by using angle parameters from GeoStat.
void MirrorXPoly(XPolygon &rPoly, const Point &rRef1, const Point &rRef2)
void ShearXPoly(XPolygon &rPoly, const Point &rRef, double tn, bool bVShear=false)
void MirrorPoint(Point &rPnt, const Point &rRef1, const Point &rRef2)
void OrthoDistance8(const Point &rPt0, Point &rPt, bool bBigOrtho)
SVXCORE_DLLPUBLIC Degree100 NormAngle36000(Degree100 a)
Normalize angle to -180.00..179.99.
void Poly2Rect(const tools::Polygon &rPol, tools::Rectangle &rRect, GeoStat &rGeo)
const Fraction & Y() const
tools::Long FRound(double fVal)
Degree100 NormAngle18000(Degree100 a)
FrPair(const Fraction &rBoth)
const Fraction & X() const
void CrookStretchPoly(XPolygon &rPoly, const Point &rCenter, const Point &rRad, bool bVert, const tools::Rectangle &rRefRect)
sal_uInt16 GetAngleSector(Degree100 nAngle)
Normalize angle to 0.00..359.99.
tools::Polygon Rect2Poly(const tools::Rectangle &rRect, const GeoStat &rGeo)
double CrookStretchXPoint(Point &rPnt, Point *pC1, Point *pC2, const Point &rCenter, const Point &rRad, double &rSin, double &rCos, bool bVert, const tools::Rectangle &rRefRect)
void MovePoly(tools::Polygon &rPoly, const Size &S)
SVXCORE_DLLPUBLIC FrPair GetMapFactor(MapUnit eS, MapUnit eD)
void RotatePoint(Point &rPnt, const Point &rRef, double sn, double cs)
constexpr tools::Long Height() const
FrPair(const Fraction &rX, const Fraction &rY)
#define SVXCORE_DLLPUBLIC
double mfCosRotationAngle
double CrookSlantXPoint(Point &rPnt, Point *pC1, Point *pC2, const Point &rCenter, const Point &rRad, double &rSin, double &rCos, bool bVert)
double CrookRotateXPoint(Point &rPnt, Point *pC1, Point *pC2, const Point &rCenter, const Point &rRad, double &rSin, double &rCos, bool bVert)
The following methods accept a point of an XPolygon, whereas the neighbouring control points of the a...
void CrookRotatePoly(XPolygon &rPoly, const Point &rCenter, const Point &rRad, bool bVert)
void CrookSlantPoly(XPolygon &rPoly, const Point &rCenter, const Point &rRad, bool bVert)
SVXCORE_DLLPUBLIC Degree100 GetAngle(const Point &rPnt)
The Y axis points down! The function negates the Y axis, when calculating the angle, such that GetAngle(Point(0,-1))=90 deg.