LibreOffice Module tools (master) 1
|
#include <poly.hxx>
Public Types | |
typedef o3tl::cow_wrapper< ImplPolygon > | ImplType |
Public Member Functions | |
void | ImplRead (SvStream &rIStream) |
void | ImplWrite (SvStream &rOStream) const |
Polygon () | |
Polygon (sal_uInt16 nSize) | |
Polygon (sal_uInt16 nPoints, const Point *pPtAry, const PolyFlags *pFlagAry=nullptr) | |
Polygon (const tools::Rectangle &rRect) | |
Polygon (const tools::Rectangle &rRect, sal_uInt32 nHorzRound, sal_uInt32 nVertRound) | |
Polygon (const Point &rCenter, tools::Long nRadX, tools::Long nRadY) | |
Polygon (const tools::Rectangle &rBound, const Point &rStart, const Point &rEnd, PolyStyle ePolyStyle=PolyStyle::Arc, const bool bClockWiseArcDirection=false) | |
Polygon (const Point &rBezPt1, const Point &rCtrlPt1, const Point &rBezPt2, const Point &rCtrlPt2, sal_uInt16 nPoints) | |
Polygon (const tools::Polygon &rPoly) | |
Polygon (tools::Polygon &&rPoly) noexcept | |
~Polygon () | |
void | SetPoint (const Point &rPt, sal_uInt16 nPos) |
const Point & | GetPoint (sal_uInt16 nPos) const |
void | SetFlags (sal_uInt16 nPos, PolyFlags eFlags) |
PolyFlags | GetFlags (sal_uInt16 nPos) const |
bool | HasFlags () const |
bool | IsRect () const |
void | SetSize (sal_uInt16 nNewSize) |
sal_uInt16 | GetSize () const |
void | Clear () |
tools::Rectangle | GetBoundRect () const |
bool | Contains (const Point &rPt) const |
double | CalcDistance (sal_uInt16 nPt1, sal_uInt16 nPt2) const |
void | Clip (const tools::Rectangle &rRect) |
void | Optimize (PolyOptimizeFlags nOptimizeFlags) |
void | AdaptiveSubdivide (tools::Polygon &rResult, const double d=1.0) const |
Adaptive subdivision of polygons with curves. More... | |
void | Move (tools::Long nHorzMove, tools::Long nVertMove) |
void | Translate (const Point &rTrans) |
void | Scale (double fScaleX, double fScaleY) |
void | Rotate (const Point &rCenter, double fSin, double fCos) |
void | Rotate (const Point &rCenter, Degree10 nAngle10) |
void | Insert (sal_uInt16 nPos, const Point &rPt) |
void | Insert (sal_uInt16 nPos, const tools::Polygon &rPoly) |
const Point & | operator[] (sal_uInt16 nPos) const |
Point & | operator[] (sal_uInt16 nPos) |
tools::Polygon & | operator= (const tools::Polygon &rPoly) |
tools::Polygon & | operator= (tools::Polygon &&rPoly) noexcept |
bool | operator== (const tools::Polygon &rPoly) const |
bool | operator!= (const tools::Polygon &rPoly) const |
bool | IsEqual (const tools::Polygon &rPoly) const |
void | Read (SvStream &rIStream) |
void | Write (SvStream &rOStream) const |
Point * | GetPointAry () |
const Point * | GetConstPointAry () const |
const PolyFlags * | GetConstFlagAry () const |
::basegfx::B2DPolygon | getB2DPolygon () const |
Polygon (const ::basegfx::B2DPolygon &rPolygon) | |
Static Public Member Functions | |
static void | ImplReduceEdges (tools::Polygon &rPoly, const double &rArea, sal_uInt16 nPercent) |
static Polygon | SubdivideBezier (const Polygon &rPoly) |
Private Attributes | |
ImplType | mpImplPolygon |
Friends | |
TOOLS_DLLPUBLIC friend SvStream & | ReadPolygon (SvStream &rIStream, tools::Polygon &rPoly) |
TOOLS_DLLPUBLIC friend SvStream & | WritePolygon (SvStream &rOStream, const tools::Polygon &rPoly) |
|
explicit |
tools::Polygon::Polygon | ( | const tools::Rectangle & | rRect, |
sal_uInt32 | nHorzRound, | ||
sal_uInt32 | nVertRound | ||
) |
tools::Polygon::Polygon | ( | const Point & | rCenter, |
tools::Long | nRadX, | ||
tools::Long | nRadY | ||
) |
tools::Polygon::Polygon | ( | const tools::Rectangle & | rBound, |
const Point & | rStart, | ||
const Point & | rEnd, | ||
PolyStyle | ePolyStyle = PolyStyle::Arc , |
||
const bool | bClockWiseArcDirection = false |
||
) |
tools::Polygon::Polygon | ( | const tools::Polygon & | rPoly | ) |
|
noexcept |
|
explicit |
void tools::Polygon::AdaptiveSubdivide | ( | tools::Polygon & | rResult, |
const double | d = 1.0 |
||
) | const |
Adaptive subdivision of polygons with curves.
This method adaptively subdivides bezier arcs within the polygon to straight line segments and returns the resulting polygon.
rResult | The resulting subdivided polygon |
d | This parameter controls the amount of subdivision. The original curve is guaranteed to not differ by more than this amount per bezier segment from the subdivided lines. Concretely, if the polygon is in device coordinates and d equals 1.0, then the difference between the subdivided and the original polygon is guaranteed to be smaller than one pixel. |
Definition at line 1187 of file poly.cxx.
References Control, d, o3tl::cow_wrapper< typename T, class MTPolicy >::get(), GetSize(), i, tools::ImplAdaptiveSubdivide(), mpImplPolygon, Normal, P1, SAL_MAX_UINT16, Smooth, and Symmetric.
Referenced by SubdivideBezier().
double tools::Polygon::CalcDistance | ( | sal_uInt16 | nPt1, |
sal_uInt16 | nPt2 | ||
) | const |
Definition at line 1028 of file poly.cxx.
References DBG_ASSERT, mpImplPolygon, Point::X(), and Point::Y().
void tools::Polygon::Clear | ( | ) |
void tools::Polygon::Clip | ( | const tools::Rectangle & | rRect | ) |
Definition at line 1440 of file poly.cxx.
References tools::Rectangle::Bottom(), EDGE_HORZ, EDGE_VERT, HasFlags(), i, tools::Rectangle::Left(), mpImplPolygon, tools::Rectangle::Normalize(), tools::Rectangle::Right(), and tools::Rectangle::Top().
bool tools::Polygon::Contains | ( | const Point & | rPt | ) | const |
Definition at line 1507 of file poly.cxx.
References tools::Rectangle::Contains(), DBG_ASSERT, GetBoundRect(), i, tools::Line::Intersection(), mpImplPolygon, nCount, tools::Rectangle::Right(), and Point::Y().
basegfx::B2DPolygon tools::Polygon::getB2DPolygon | ( | ) | const |
Definition at line 1773 of file poly.cxx.
References a, basegfx::B2DPolygon::append(), basegfx::B2DPolygon::appendBezierSegment(), basegfx::utils::checkClosed(), Control, basegfx::B2DPolygon::count(), tools::impCorrectContinuity(), basegfx::B2DPolygon::isClosed(), mpImplPolygon, nCount, Point::X(), and Point::Y().
Referenced by tools::PolyPolygon::getB2DPolyPolygon().
tools::Rectangle tools::Polygon::GetBoundRect | ( | ) | const |
Definition at line 1467 of file poly.cxx.
References i, mpImplPolygon, nCount, Point::X(), and Point::Y().
Referenced by Contains(), and Optimize().
const PolyFlags * tools::Polygon::GetConstFlagAry | ( | ) | const |
Definition at line 943 of file poly.cxx.
References o3tl::cow_wrapper< typename T, class MTPolicy >::get(), and mpImplPolygon.
const Point * tools::Polygon::GetConstPointAry | ( | ) | const |
Definition at line 938 of file poly.cxx.
References o3tl::cow_wrapper< typename T, class MTPolicy >::get(), and mpImplPolygon.
Referenced by tools::PolyPolygon::GetBoundRect(), and ImplPolygon::ImplPolygon().
PolyFlags tools::Polygon::GetFlags | ( | sal_uInt16 | nPos | ) | const |
Definition at line 978 of file poly.cxx.
References DBG_ASSERT, mpImplPolygon, Normal, and nPos.
Referenced by IsEqual().
const Point & tools::Polygon::GetPoint | ( | sal_uInt16 | nPos | ) | const |
Definition at line 970 of file poly.cxx.
References DBG_ASSERT, mpImplPolygon, and nPos.
Referenced by IsEqual().
Point * tools::Polygon::GetPointAry | ( | ) |
Definition at line 933 of file poly.cxx.
References o3tl::cow_wrapper< typename T, class MTPolicy >::get(), and mpImplPolygon.
sal_uInt16 tools::Polygon::GetSize | ( | ) | const |
Definition at line 1018 of file poly.cxx.
References mpImplPolygon.
Referenced by AdaptiveSubdivide(), tools::PolyPolygon::GetBoundRect(), ImplPolygon::ImplPolygon(), ImplPolyPolygon::ImplPolyPolygon(), ImplReduceEdges(), and IsEqual().
bool tools::Polygon::HasFlags | ( | ) | const |
void tools::Polygon::ImplRead | ( | SvStream & | rIStream | ) |
Definition at line 1668 of file poly.cxx.
References o3tl::cow_wrapper< typename T, class MTPolicy >::get(), mpImplPolygon, SvStream::ReadBytes(), ReadPolygon, SvStream::ReadUChar(), and SAL_WARN.
Referenced by Read(), and tools::PolyPolygon::Read().
|
static |
Definition at line 1280 of file poly.cxx.
References FSQRT2, GetSize(), n, basegfx::rad2deg(), SetSize(), and SMALL_DVALUE.
Referenced by Optimize(), and tools::PolyPolygon::Optimize().
void tools::Polygon::ImplWrite | ( | SvStream & | rOStream | ) | const |
Definition at line 1694 of file poly.cxx.
References o3tl::cow_wrapper< typename T, class MTPolicy >::get(), mpImplPolygon, SvStream::WriteBool(), SvStream::WriteBytes(), and WritePolygon.
Referenced by Write().
void tools::Polygon::Insert | ( | sal_uInt16 | nPos, |
const Point & | rPt | ||
) |
Definition at line 1555 of file poly.cxx.
References mpImplPolygon, and nPos.
void tools::Polygon::Insert | ( | sal_uInt16 | nPos, |
const tools::Polygon & | rPoly | ||
) |
Definition at line 1564 of file poly.cxx.
References o3tl::cow_wrapper< typename T, class MTPolicy >::get(), mpImplPolygon, and nPos.
bool tools::Polygon::IsEqual | ( | const tools::Polygon & | rPoly | ) | const |
Definition at line 1604 of file poly.cxx.
References GetFlags(), GetPoint(), GetSize(), and i.
bool tools::Polygon::IsRect | ( | ) | const |
Definition at line 992 of file poly.cxx.
References mpImplPolygon.
void tools::Polygon::Move | ( | tools::Long | nHorzMove, |
tools::Long | nVertMove | ||
) |
Definition at line 1381 of file poly.cxx.
References Point::AdjustX(), Point::AdjustY(), i, mpImplPolygon, and nCount.
|
inline |
Definition at line 162 of file poly.hxx.
References operator==().
tools::Polygon & tools::Polygon::operator= | ( | const tools::Polygon & | rPoly | ) |
Definition at line 1587 of file poly.cxx.
References mpImplPolygon.
|
noexcept |
bool tools::Polygon::operator== | ( | const tools::Polygon & | rPoly | ) | const |
Point & tools::Polygon::operator[] | ( | sal_uInt16 | nPos | ) |
Definition at line 1580 of file poly.cxx.
References mpImplPolygon, and nPos.
|
inline |
void tools::Polygon::Optimize | ( | PolyOptimizeFlags | nOptimizeFlags | ) |
Definition at line 1043 of file poly.cxx.
References Clear(), CLOSE, EDGES, GetBoundRect(), tools::Rectangle::GetHeight(), tools::Rectangle::GetWidth(), i, ImplReduceEdges(), mpImplPolygon, NO_SAME, Optimize(), and SetSize().
Referenced by Optimize().
void tools::Polygon::Read | ( | SvStream & | rIStream | ) |
Definition at line 1687 of file poly.cxx.
References ImplRead().
Definition at line 1413 of file poly.cxx.
References Rotate(), and toRadians().
void tools::Polygon::Rotate | ( | const Point & | rCenter, |
double | fSin, | ||
double | fCos | ||
) |
Definition at line 1424 of file poly.cxx.
References FRound(), i, mpImplPolygon, nCount, Point::setX(), Point::setY(), Point::X(), and Point::Y().
Referenced by Rotate().
void tools::Polygon::Scale | ( | double | fScaleX, |
double | fScaleY | ||
) |
Definition at line 1403 of file poly.cxx.
References i, mpImplPolygon, nCount, Point::setX(), Point::setY(), Point::X(), and Point::Y().
void tools::Polygon::SetFlags | ( | sal_uInt16 | nPos, |
PolyFlags | eFlags | ||
) |
Definition at line 956 of file poly.cxx.
References DBG_ASSERT, mpImplPolygon, Normal, and nPos.
void tools::Polygon::SetPoint | ( | const Point & | rPt, |
sal_uInt16 | nPos | ||
) |
Definition at line 948 of file poly.cxx.
References DBG_ASSERT, mpImplPolygon, and nPos.
void tools::Polygon::SetSize | ( | sal_uInt16 | nNewSize | ) |
Definition at line 1010 of file poly.cxx.
References mpImplPolygon.
Referenced by ImplReduceEdges(), and Optimize().
|
static |
Definition at line 872 of file poly.cxx.
References AdaptiveSubdivide().
Referenced by tools::PolyPolygon::SubdivideBezier().
void tools::Polygon::Translate | ( | const Point & | rTrans | ) |
Definition at line 1397 of file poly.cxx.
References i, mpImplPolygon, and nCount.
void tools::Polygon::Write | ( | SvStream & | rOStream | ) | const |
Definition at line 1704 of file poly.cxx.
References ImplWrite().
|
friend |
Definition at line 1625 of file poly.cxx.
Referenced by ImplRead().
|
friend |
Definition at line 1652 of file poly.cxx.
Referenced by ImplWrite().
|
private |
Definition at line 77 of file poly.hxx.
Referenced by AdaptiveSubdivide(), CalcDistance(), Clear(), Clip(), Contains(), getB2DPolygon(), GetBoundRect(), GetConstFlagAry(), GetConstPointAry(), GetFlags(), GetPoint(), GetPointAry(), GetSize(), HasFlags(), ImplRead(), ImplWrite(), Insert(), IsRect(), Move(), operator=(), operator==(), operator[](), Optimize(), Rotate(), Scale(), SetFlags(), SetPoint(), SetSize(), and Translate().