LibreOffice Module svx (master) 1
|
#include <xpoly.hxx>
Public Member Functions | |
XPolygon (sal_uInt16 nSize=16) | |
XPolygon (const XPolygon &) | |
XPolygon (XPolygon &&) | |
XPolygon (const tools::Polygon &rPoly) | |
create a XPolygon out of a standard polygon More... | |
XPolygon (const tools::Rectangle &rRect, tools::Long nRx=0, tools::Long nRy=0) | |
create a rectangle (also with rounded corners) as a Bézier polygon More... | |
XPolygon (const Point &rCenter, tools::Long nRx, tools::Long nRy, Degree100 nStartAngle=0_deg100, Degree100 nEndAngle=36000_deg100, bool bClose=true) | |
create an ellipse (curve) as Bézier polygon More... | |
~XPolygon () | |
sal_uInt16 | GetSize () const |
void | SetPointCount (sal_uInt16 nPoints) |
sal_uInt16 | GetPointCount () const |
void | Insert (sal_uInt16 nPos, const Point &rPt, PolyFlags eFlags) |
void | Insert (sal_uInt16 nPos, const XPolygon &rXPoly) |
void | Remove (sal_uInt16 nPos, sal_uInt16 nCount) |
void | Move (tools::Long nHorzMove, tools::Long nVertMove) |
tools::Rectangle | GetBoundRect () const |
const Point & | operator[] (sal_uInt16 nPos) const |
Point & | operator[] (sal_uInt16 nPos) |
XPolygon & | operator= (const XPolygon &) |
XPolygon & | operator= (XPolygon &&) |
bool | operator== (const XPolygon &rXPoly) const |
PolyFlags | GetFlags (sal_uInt16 nPos) const |
get the flags for the point at the given position More... | |
void | SetFlags (sal_uInt16 nPos, PolyFlags eFlags) |
set the flags for the point at the given position More... | |
bool | IsControl (sal_uInt16 nPos) const |
short path to read the CONTROL flag directly (TODO: better explain what the sense behind this flag is!) More... | |
bool | IsSmooth (sal_uInt16 nPos) const |
short path to read the SMOOTH and SYMMTR flag directly (TODO: better explain what the sense behind these flags is!) More... | |
double | CalcDistance (sal_uInt16 nP1, sal_uInt16 nP2) |
calculate the euclidean distance between two points More... | |
void | CalcSmoothJoin (sal_uInt16 nCenter, sal_uInt16 nDrag, sal_uInt16 nPnt) |
Calculate a smooth transition to connect two Bézier curves. More... | |
void | CalcTangent (sal_uInt16 nCenter, sal_uInt16 nPrev, sal_uInt16 nNext) |
Calculate tangent between two Bézier curves. More... | |
void | PointsToBezier (sal_uInt16 nFirst) |
convert four polygon points into a Bézier curve More... | |
void | Scale (double fSx, double fSy) |
scale in X- and/or Y-direction More... | |
void | Distort (const tools::Rectangle &rRefRect, const XPolygon &rDistortedRect) |
Distort a polygon by scaling its coordinates relative to a reference rectangle into an arbitrary rectangle. More... | |
basegfx::B2DPolygon | getB2DPolygon () const |
XPolygon (const basegfx::B2DPolygon &rPolygon) | |
Private Member Functions | |
void | SubdivideBezier (sal_uInt16 nPos, bool bCalcFirst, double fT) |
void | GenBezArc (const Point &rCenter, tools::Long nRx, tools::Long nRy, tools::Long nXHdl, tools::Long nYHdl, Degree100 nStart, Degree100 nEnd, sal_uInt16 nQuad, sal_uInt16 nFirst) |
Generate a Bézier arc. More... | |
Static Private Member Functions | |
static bool | CheckAngles (Degree100 &nStart, Degree100 nEnd, Degree100 &nA1, Degree100 &nA2) |
Private Attributes | |
o3tl::cow_wrapper< ImpXPolygon > | pImpXPolygon |
XPolygon::XPolygon | ( | sal_uInt16 | nSize = 16 | ) |
Definition at line 198 of file _xpoly.cxx.
|
default |
|
default |
XPolygon::XPolygon | ( | const tools::Polygon & | rPoly | ) |
create a XPolygon out of a standard polygon
Definition at line 208 of file _xpoly.cxx.
References tools::Polygon::GetFlags(), tools::Polygon::GetSize(), i, and pImpXPolygon.
XPolygon::XPolygon | ( | const tools::Rectangle & | rRect, |
tools::Long | nRx = 0 , |
||
tools::Long | nRy = 0 |
||
) |
create a rectangle (also with rounded corners) as a Bézier polygon
Definition at line 222 of file _xpoly.cxx.
References Point::AdjustX(), Point::AdjustY(), tools::Rectangle::BottomLeft(), tools::Rectangle::BottomRight(), GenBezArc(), tools::Rectangle::GetHeight(), tools::Rectangle::GetWidth(), nPos, pImpXPolygon, tools::Rectangle::TopLeft(), and tools::Rectangle::TopRight().
XPolygon::XPolygon | ( | const Point & | rCenter, |
tools::Long | nRx, | ||
tools::Long | nRy, | ||
Degree100 | nStartAngle = 0_deg100 , |
||
Degree100 | nEndAngle = 36000_deg100 , |
||
bool | bClose = true |
||
) |
create an ellipse (curve) as Bézier polygon
Definition at line 282 of file _xpoly.cxx.
References CheckAngles(), GenBezArc(), o3tl::strong_int< typename UNDERLYING_TYPE, typename PHANTOM_TYPE >::get(), nPos, and pImpXPolygon.
|
explicit |
Definition at line 821 of file _xpoly.cxx.
References tools::Polygon::GetFlags(), tools::Polygon::GetSize(), i, pImpXPolygon, and Polygon.
double XPolygon::CalcDistance | ( | sal_uInt16 | nP1, |
sal_uInt16 | nP2 | ||
) |
calculate the euclidean distance between two points
nP1 | The first point |
nP2 | The second point |
Definition at line 483 of file _xpoly.cxx.
References pImpXPolygon, Point::X(), and Point::Y().
Referenced by CalcSmoothJoin(), CalcTangent(), and PointsToBezier().
void XPolygon::CalcSmoothJoin | ( | sal_uInt16 | nCenter, |
sal_uInt16 | nDrag, | ||
sal_uInt16 | nPnt | ||
) |
Calculate a smooth transition to connect two Bézier curves.
This is done by projecting the corresponding point onto a line between two other points.
nCenter | The point at the end or beginning of the curve. If nCenter is at the end of the polygon the point is moved to the opposite side. |
nDrag | The moved point that specifies the relocation. |
nPnt | The point to modify. |
Definition at line 615 of file _xpoly.cxx.
References CalcDistance(), o3tl::cow_wrapper< typename T, class MTPolicy >::get(), GetFlags(), IsControl(), pImpXPolygon, Point::setX(), Point::setY(), Point::X(), and Point::Y().
void XPolygon::CalcTangent | ( | sal_uInt16 | nCenter, |
sal_uInt16 | nPrev, | ||
sal_uInt16 | nNext | ||
) |
Calculate tangent between two Bézier curves.
nCenter | start or end point of the curves |
nPrev | previous reference point |
nNext | next reference point |
Definition at line 644 of file _xpoly.cxx.
References CalcDistance(), GetFlags(), pImpXPolygon, Point::setX(), Point::setY(), Point::X(), and Point::Y().
Referenced by ImpPathForDragAndCreate::EndCreate(), and ImpPathForDragAndCreate::MovCreate().
|
staticprivate |
Definition at line 587 of file _xpoly.cxx.
References o3tl::strong_int< typename UNDERLYING_TYPE, typename PHANTOM_TYPE >::get().
Referenced by XPolygon().
void XPolygon::Distort | ( | const tools::Rectangle & | rRefRect, |
const XPolygon & | rDistortedRect | ||
) |
Distort a polygon by scaling its coordinates relative to a reference rectangle into an arbitrary rectangle.
Mapping between polygon corners and reference rectangle: 0: top left 0-—1 1: top right | | 2: bottom right 3-—2 3: bottom left
Definition at line 762 of file _xpoly.cxx.
References DBG_ASSERT, tools::Rectangle::GetHeight(), tools::Rectangle::GetWidth(), i, tools::Rectangle::Left(), pImpXPolygon, Point::setX(), Point::setY(), tools::Rectangle::Top(), Point::X(), X1, X2, Point::Y(), Y1, and Y2.
Referenced by SdrEditView::ImpDistortObj().
|
private |
Generate a Bézier arc.
Definition at line 539 of file _xpoly.cxx.
References Point::AdjustX(), Point::AdjustY(), o3tl::cow_wrapper< typename T, class MTPolicy >::get(), o3tl::strong_int< typename UNDERLYING_TYPE, typename PHANTOM_TYPE >::get(), get(), pImpXPolygon, SetFlags(), and SubdivideBezier().
Referenced by XPolygon().
basegfx::B2DPolygon XPolygon::getB2DPolygon | ( | ) | const |
Definition at line 811 of file _xpoly.cxx.
References o3tl::cow_wrapper< typename T, class MTPolicy >::get(), tools::Polygon::getB2DPolygon(), GetPointCount(), and pImpXPolygon.
Referenced by SdrRectObj::DoConvertToPolyObj(), XPolyPolygon::getB2DPolyPolygon(), GetBoundRect(), and SdrEdgeObj::ImplAddConnectorOverlay().
tools::Rectangle XPolygon::GetBoundRect | ( | ) | const |
Definition at line 396 of file _xpoly.cxx.
References FRound(), getB2DPolygon(), basegfx::Range2D< typename TYPE, typename TRAITS >::getMaxX(), basegfx::Range2D< typename TYPE, typename TRAITS >::getMaxY(), basegfx::Range2D< typename TYPE, typename TRAITS >::getMinX(), basegfx::Range2D< typename TYPE, typename TRAITS >::getMinY(), basegfx::utils::getRange(), and pImpXPolygon.
Referenced by XPolyPolygon::GetBoundRect(), SdrCircObj::RecalcSnapRect(), and SdrRectObj::RecalcSnapRect().
PolyFlags XPolygon::GetFlags | ( | sal_uInt16 | nPos | ) | const |
get the flags for the point at the given position
Definition at line 452 of file _xpoly.cxx.
References nPos, and pImpXPolygon.
Referenced by SdrPathObj::AddToHdlList(), SdrPathObj::AddToPlusHdlList(), CalcSmoothJoin(), CalcTangent(), ImpPathForDragAndCreate::getSpecialDragPoly(), and SdrRectObj::ImpCalcXPoly().
sal_uInt16 XPolygon::GetPointCount | ( | ) | const |
Definition at line 346 of file _xpoly.cxx.
References pImpXPolygon.
Referenced by SdrPathObj::AddToHdlList(), SdrPathObj::AddToPlusHdlList(), ImpPathForDragAndCreate::BckCreate(), CrookRotatePoly(), CrookSlantPoly(), CrookStretchPoly(), SdrRectObj::DoConvertToPolyObj(), ImpPathForDragAndCreate::EndCreate(), ImpPathForDragAndCreate::endPathDrag(), getB2DPolygon(), ImpPathForDragAndCreate::getSpecialDragComment(), ImpPathForDragAndCreate::getSpecialDragPoly(), SdrEdgeObj::GetTailPoint(), SdrEdgeObj::ImpCalcEdgeTrack(), SdrEdgeObj::ImpCalcObjToCenter(), SdrRectObj::ImpCalcXPoly(), SdrEdgeInfoRec::ImpGetPolyIdx(), SdrEdgeInfoRec::ImpIsHorzLine(), SdrEdgeObj::ImplAddConnectorOverlay(), Insert(), MirrorXPoly(), SdrDragCrook::MovAllPoints(), ImpPathForDragAndCreate::MovCreate(), ImpPathForDragAndCreate::movePathDrag(), ResizeXPoly(), RotateXPoly(), and ShearXPoly().
sal_uInt16 XPolygon::GetSize | ( | ) | const |
Definition at line 340 of file _xpoly.cxx.
References pImpXPolygon.
Definition at line 352 of file _xpoly.cxx.
References nPos, and pImpXPolygon.
Referenced by ImpPathForDragAndCreate::EndCreate(), ImpPathForDragAndCreate::getSpecialDragPoly(), SdrEdgeObj::ImpCalcEdgeTrack(), and SdrEdgeObj::ImpCalcObjToCenter().
void XPolygon::Insert | ( | sal_uInt16 | nPos, |
const XPolygon & | rXPoly | ||
) |
Definition at line 360 of file _xpoly.cxx.
References o3tl::cow_wrapper< typename T, class MTPolicy >::get(), GetPointCount(), nPos, and pImpXPolygon.
bool XPolygon::IsControl | ( | sal_uInt16 | nPos | ) | const |
short path to read the CONTROL flag directly (TODO: better explain what the sense behind this flag is!)
Definition at line 466 of file _xpoly.cxx.
References nPos, and pImpXPolygon.
Referenced by ImpPathForDragAndCreate::BckCreate(), CalcSmoothJoin(), CrookRotatePoly(), CrookSlantPoly(), CrookStretchPoly(), ImpPathForDragAndCreate::EndCreate(), ImpPathForDragAndCreate::getSpecialDragComment(), ImpPathForDragAndCreate::getSpecialDragPoly(), SdrDragCrook::MovAllPoints(), ImpPathForDragAndCreate::MovCreate(), ImpPathForDragAndCreate::movePathDrag(), and PointsToBezier().
bool XPolygon::IsSmooth | ( | sal_uInt16 | nPos | ) | const |
short path to read the SMOOTH and SYMMTR flag directly (TODO: better explain what the sense behind these flags is!)
Definition at line 472 of file _xpoly.cxx.
References nPos, and pImpXPolygon.
void XPolygon::Move | ( | tools::Long | nHorzMove, |
tools::Long | nVertMove | ||
) |
Definition at line 381 of file _xpoly.cxx.
References Point::AdjustX(), Point::AdjustY(), i, nCount, and pImpXPolygon.
Referenced by MoveXPoly().
References operator==(), Scale, and SetFlags().
bool XPolygon::operator== | ( | const XPolygon & | rXPoly | ) | const |
Definition at line 445 of file _xpoly.cxx.
References pImpXPolygon.
Point & XPolygon::operator[] | ( | sal_uInt16 | nPos | ) |
Definition at line 426 of file _xpoly.cxx.
References DBG_ASSERT, nPos, and pImpXPolygon.
const Point & XPolygon::operator[] | ( | sal_uInt16 | nPos | ) | const |
Definition at line 418 of file _xpoly.cxx.
References DBG_ASSERT, nPos, and pImpXPolygon.
void XPolygon::PointsToBezier | ( | sal_uInt16 | nFirst | ) |
convert four polygon points into a Bézier curve
Definition at line 671 of file _xpoly.cxx.
References CalcDistance(), o3tl::cow_wrapper< typename T, class MTPolicy >::get(), IsControl(), pImpXPolygon, SetFlags(), Point::X(), and Point::Y().
Referenced by ImpPathForDragAndCreate::EndCreate(), and ImpPathForDragAndCreate::MovCreate().
void XPolygon::Remove | ( | sal_uInt16 | nPos, |
sal_uInt16 | nCount | ||
) |
Definition at line 376 of file _xpoly.cxx.
References nCount, nPos, and pImpXPolygon.
Referenced by ImpPathForDragAndCreate::BckCreate(), SdrRectObj::DoConvertToPolyObj(), ImpPathForDragAndCreate::EndCreate(), ImpPathForDragAndCreate::getSpecialDragPoly(), and SdrEdgeObj::ImpCalcEdgeTrack().
void XPolygon::Scale | ( | double | fSx, |
double | fSy | ||
) |
scale in X- and/or Y-direction
Definition at line 738 of file _xpoly.cxx.
References i, pImpXPolygon, Point::setX(), Point::setY(), Point::X(), and Point::Y().
void XPolygon::SetFlags | ( | sal_uInt16 | nPos, |
PolyFlags | eFlags | ||
) |
set the flags for the point at the given position
Definition at line 459 of file _xpoly.cxx.
References nPos, and pImpXPolygon.
Referenced by ImpPathForDragAndCreate::EndCreate(), GenBezArc(), ImpPathForDragAndCreate::getSpecialDragPoly(), SdrEdgeObj::ImpCalcEdgeTrack(), SdrRectObj::ImpCalcXPoly(), ImpPathForDragAndCreate::MovCreate(), and PointsToBezier().
void XPolygon::SetPointCount | ( | sal_uInt16 | nPoints | ) |
Definition at line 323 of file _xpoly.cxx.
References o3tl::cow_wrapper< typename T, class MTPolicy >::get(), and pImpXPolygon.
|
private |
Definition at line 492 of file _xpoly.cxx.
References o3tl::cow_wrapper< typename T, class MTPolicy >::get(), nPos, pImpXPolygon, Point::setX(), Point::setY(), X, and Y.
Referenced by GenBezArc().
|
private |
Definition at line 47 of file xpoly.hxx.
Referenced by CalcDistance(), CalcSmoothJoin(), CalcTangent(), Distort(), GenBezArc(), getB2DPolygon(), GetBoundRect(), GetFlags(), GetPointCount(), GetSize(), Insert(), IsControl(), IsSmooth(), Move(), operator==(), operator[](), PointsToBezier(), Remove(), Scale(), SetFlags(), SetPointCount(), SubdivideBezier(), and XPolygon().