LibreOffice Module tools (master) 1
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
tools::Polygon Class Reference

#include <poly.hxx>

Collaboration diagram for tools::Polygon:
[legend]

Public Types

typedef o3tl::cow_wrapper< ImplPolygonImplType
 

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 PointGetPoint (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 Pointoperator[] (sal_uInt16 nPos) const
 
Pointoperator[] (sal_uInt16 nPos)
 
tools::Polygonoperator= (const tools::Polygon &rPoly)
 
tools::Polygonoperator= (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
 
PointGetPointAry ()
 
const PointGetConstPointAry () const
 
const PolyFlagsGetConstFlagAry () 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 SvStreamReadPolygon (SvStream &rIStream, tools::Polygon &rPoly)
 
TOOLS_DLLPUBLIC friend SvStreamWritePolygon (SvStream &rOStream, const tools::Polygon &rPoly)
 

Detailed Description

Definition at line 72 of file poly.hxx.

Member Typedef Documentation

◆ ImplType

Definition at line 75 of file poly.hxx.

Constructor & Destructor Documentation

◆ Polygon() [1/11]

tools::Polygon::Polygon ( )

Definition at line 882 of file poly.cxx.

◆ Polygon() [2/11]

tools::Polygon::Polygon ( sal_uInt16  nSize)
explicit

Definition at line 886 of file poly.cxx.

◆ Polygon() [3/11]

tools::Polygon::Polygon ( sal_uInt16  nPoints,
const Point pPtAry,
const PolyFlags pFlagAry = nullptr 
)

Definition at line 890 of file poly.cxx.

◆ Polygon() [4/11]

tools::Polygon::Polygon ( const tools::Rectangle rRect)
explicit

Definition at line 903 of file poly.cxx.

◆ Polygon() [5/11]

tools::Polygon::Polygon ( const tools::Rectangle rRect,
sal_uInt32  nHorzRound,
sal_uInt32  nVertRound 
)

Definition at line 907 of file poly.cxx.

◆ Polygon() [6/11]

tools::Polygon::Polygon ( const Point rCenter,
tools::Long  nRadX,
tools::Long  nRadY 
)

Definition at line 912 of file poly.cxx.

◆ Polygon() [7/11]

tools::Polygon::Polygon ( const tools::Rectangle rBound,
const Point rStart,
const Point rEnd,
PolyStyle  ePolyStyle = PolyStyle::Arc,
const bool  bClockWiseArcDirection = false 
)

Definition at line 917 of file poly.cxx.

◆ Polygon() [8/11]

tools::Polygon::Polygon ( const Point rBezPt1,
const Point rCtrlPt1,
const Point rBezPt2,
const Point rCtrlPt2,
sal_uInt16  nPoints 
)

Definition at line 923 of file poly.cxx.

◆ Polygon() [9/11]

tools::Polygon::Polygon ( const tools::Polygon rPoly)

Definition at line 894 of file poly.cxx.

◆ Polygon() [10/11]

tools::Polygon::Polygon ( tools::Polygon &&  rPoly)
noexcept

Definition at line 898 of file poly.cxx.

◆ ~Polygon()

tools::Polygon::~Polygon ( )

Definition at line 929 of file poly.cxx.

◆ Polygon() [11/11]

tools::Polygon::Polygon ( const ::basegfx::B2DPolygon rPolygon)
explicit

Member Function Documentation

◆ AdaptiveSubdivide()

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.

Parameters
rResultThe resulting subdivided polygon
dThis 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().

◆ CalcDistance()

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().

◆ Clear()

void tools::Polygon::Clear ( )

Definition at line 1023 of file poly.cxx.

References mpImplPolygon.

Referenced by Optimize().

◆ Clip()

void tools::Polygon::Clip ( const tools::Rectangle rRect)

◆ Contains()

bool tools::Polygon::Contains ( const Point rPt) const

◆ getB2DPolygon()

basegfx::B2DPolygon tools::Polygon::getB2DPolygon ( ) const

◆ GetBoundRect()

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().

◆ GetConstFlagAry()

const PolyFlags * tools::Polygon::GetConstFlagAry ( ) const

◆ GetConstPointAry()

const Point * tools::Polygon::GetConstPointAry ( ) const

◆ GetFlags()

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().

◆ GetPoint()

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().

◆ GetPointAry()

Point * tools::Polygon::GetPointAry ( )

◆ GetSize()

sal_uInt16 tools::Polygon::GetSize ( ) const

◆ HasFlags()

bool tools::Polygon::HasFlags ( ) const

Definition at line 987 of file poly.cxx.

References mpImplPolygon.

Referenced by Clip().

◆ ImplRead()

void tools::Polygon::ImplRead ( SvStream rIStream)

◆ ImplReduceEdges()

void tools::Polygon::ImplReduceEdges ( tools::Polygon rPoly,
const double &  rArea,
sal_uInt16  nPercent 
)
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().

◆ ImplWrite()

void tools::Polygon::ImplWrite ( SvStream rOStream) const

◆ Insert() [1/2]

void tools::Polygon::Insert ( sal_uInt16  nPos,
const Point rPt 
)

Definition at line 1555 of file poly.cxx.

References mpImplPolygon, and nPos.

◆ Insert() [2/2]

void tools::Polygon::Insert ( sal_uInt16  nPos,
const tools::Polygon rPoly 
)

◆ IsEqual()

bool tools::Polygon::IsEqual ( const tools::Polygon rPoly) const

Definition at line 1604 of file poly.cxx.

References GetFlags(), GetPoint(), GetSize(), and i.

◆ IsRect()

bool tools::Polygon::IsRect ( ) const

Definition at line 992 of file poly.cxx.

References mpImplPolygon.

◆ Move()

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.

◆ operator!=()

bool tools::Polygon::operator!= ( const tools::Polygon rPoly) const
inline

Definition at line 162 of file poly.hxx.

References operator==().

◆ operator=() [1/2]

tools::Polygon & tools::Polygon::operator= ( const tools::Polygon rPoly)

Definition at line 1587 of file poly.cxx.

References mpImplPolygon.

◆ operator=() [2/2]

tools::Polygon & tools::Polygon::operator= ( tools::Polygon &&  rPoly)
noexcept

Definition at line 1593 of file poly.cxx.

◆ operator==()

bool tools::Polygon::operator== ( const tools::Polygon rPoly) const

Definition at line 1599 of file poly.cxx.

References mpImplPolygon.

Referenced by operator!=().

◆ operator[]() [1/2]

Point & tools::Polygon::operator[] ( sal_uInt16  nPos)

Definition at line 1580 of file poly.cxx.

References mpImplPolygon, and nPos.

◆ operator[]() [2/2]

const Point & tools::Polygon::operator[] ( sal_uInt16  nPos) const
inline

Definition at line 156 of file poly.hxx.

References nPos.

◆ Optimize()

void tools::Polygon::Optimize ( PolyOptimizeFlags  nOptimizeFlags)

◆ Read()

void tools::Polygon::Read ( SvStream rIStream)

Definition at line 1687 of file poly.cxx.

References ImplRead().

◆ Rotate() [1/2]

void tools::Polygon::Rotate ( const Point rCenter,
Degree10  nAngle10 
)

Definition at line 1413 of file poly.cxx.

References Rotate(), and toRadians().

◆ Rotate() [2/2]

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().

◆ Scale()

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().

◆ SetFlags()

void tools::Polygon::SetFlags ( sal_uInt16  nPos,
PolyFlags  eFlags 
)

Definition at line 956 of file poly.cxx.

References DBG_ASSERT, mpImplPolygon, Normal, and nPos.

◆ SetPoint()

void tools::Polygon::SetPoint ( const Point rPt,
sal_uInt16  nPos 
)

Definition at line 948 of file poly.cxx.

References DBG_ASSERT, mpImplPolygon, and nPos.

◆ SetSize()

void tools::Polygon::SetSize ( sal_uInt16  nNewSize)

Definition at line 1010 of file poly.cxx.

References mpImplPolygon.

Referenced by ImplReduceEdges(), and Optimize().

◆ SubdivideBezier()

tools::Polygon tools::Polygon::SubdivideBezier ( const Polygon rPoly)
static

Definition at line 872 of file poly.cxx.

References AdaptiveSubdivide().

Referenced by tools::PolyPolygon::SubdivideBezier().

◆ Translate()

void tools::Polygon::Translate ( const Point rTrans)

Definition at line 1397 of file poly.cxx.

References i, mpImplPolygon, and nCount.

◆ Write()

void tools::Polygon::Write ( SvStream rOStream) const

Definition at line 1704 of file poly.cxx.

References ImplWrite().

Friends And Related Function Documentation

◆ ReadPolygon

TOOLS_DLLPUBLIC friend SvStream & ReadPolygon ( SvStream rIStream,
tools::Polygon rPoly 
)
friend

Definition at line 1625 of file poly.cxx.

Referenced by ImplRead().

◆ WritePolygon

TOOLS_DLLPUBLIC friend SvStream & WritePolygon ( SvStream rOStream,
const tools::Polygon rPoly 
)
friend

Definition at line 1652 of file poly.cxx.

Referenced by ImplWrite().

Member Data Documentation

◆ mpImplPolygon

ImplType tools::Polygon::mpImplPolygon
private

The documentation for this class was generated from the following files: