LibreOffice Module svx (master) 1
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
XPolygon Class Referencefinal

#include <xpoly.hxx>

Collaboration diagram for XPolygon:
[legend]

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 Pointoperator[] (sal_uInt16 nPos) const
 
Pointoperator[] (sal_uInt16 nPos)
 
XPolygonoperator= (const XPolygon &)
 
XPolygonoperator= (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< ImpXPolygonpImpXPolygon
 

Detailed Description

Definition at line 45 of file xpoly.hxx.

Constructor & Destructor Documentation

◆ XPolygon() [1/7]

XPolygon::XPolygon ( sal_uInt16  nSize = 16)

Definition at line 198 of file _xpoly.cxx.

◆ XPolygon() [2/7]

XPolygon::XPolygon ( const XPolygon )
default

◆ XPolygon() [3/7]

XPolygon::XPolygon ( XPolygon &&  )
default

◆ XPolygon() [4/7]

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() [5/7]

XPolygon::XPolygon ( const tools::Rectangle rRect,
tools::Long  nRx = 0,
tools::Long  nRy = 0 
)

◆ XPolygon() [6/7]

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.

◆ ~XPolygon()

XPolygon::~XPolygon ( )
default

References Insert(), Move, and Remove.

◆ XPolygon() [7/7]

XPolygon::XPolygon ( const basegfx::B2DPolygon rPolygon)
explicit

Definition at line 821 of file _xpoly.cxx.

References tools::Polygon::GetFlags(), tools::Polygon::GetSize(), i, pImpXPolygon, and Polygon.

Member Function Documentation

◆ CalcDistance()

double XPolygon::CalcDistance ( sal_uInt16  nP1,
sal_uInt16  nP2 
)

calculate the euclidean distance between two points

Parameters
nP1The first point
nP2The second point

Definition at line 483 of file _xpoly.cxx.

References pImpXPolygon, Point::X(), and Point::Y().

Referenced by CalcSmoothJoin(), CalcTangent(), and PointsToBezier().

◆ CalcSmoothJoin()

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.

Parameters
nCenterThe 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.
nDragThe moved point that specifies the relocation.
nPntThe 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().

◆ CalcTangent()

void XPolygon::CalcTangent ( sal_uInt16  nCenter,
sal_uInt16  nPrev,
sal_uInt16  nNext 
)

Calculate tangent between two Bézier curves.

Parameters
nCenterstart or end point of the curves
nPrevprevious reference point
nNextnext 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().

◆ CheckAngles()

bool XPolygon::CheckAngles ( Degree100 nStart,
Degree100  nEnd,
Degree100 nA1,
Degree100 nA2 
)
staticprivate

◆ Distort()

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

◆ GenBezArc()

void XPolygon::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 
)
private

◆ getB2DPolygon()

basegfx::B2DPolygon XPolygon::getB2DPolygon ( ) const

◆ GetBoundRect()

tools::Rectangle XPolygon::GetBoundRect ( ) const

◆ GetFlags()

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

◆ GetPointCount()

sal_uInt16 XPolygon::GetPointCount ( ) const

◆ GetSize()

sal_uInt16 XPolygon::GetSize ( ) const

Definition at line 340 of file _xpoly.cxx.

References pImpXPolygon.

◆ Insert() [1/2]

void XPolygon::Insert ( sal_uInt16  nPos,
const Point rPt,
PolyFlags  eFlags 
)

◆ Insert() [2/2]

void XPolygon::Insert ( sal_uInt16  nPos,
const XPolygon rXPoly 
)

◆ IsControl()

bool XPolygon::IsControl ( sal_uInt16  nPos) const

◆ IsSmooth()

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.

◆ Move()

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

◆ operator=() [1/2]

XPolygon & XPolygon::operator= ( const XPolygon )
default

◆ operator=() [2/2]

XPolygon & XPolygon::operator= ( XPolygon &&  )
default

References operator==(), Scale, and SetFlags().

◆ operator==()

bool XPolygon::operator== ( const XPolygon rXPoly) const

Definition at line 445 of file _xpoly.cxx.

References pImpXPolygon.

◆ operator[]() [1/2]

Point & XPolygon::operator[] ( sal_uInt16  nPos)

Definition at line 426 of file _xpoly.cxx.

References DBG_ASSERT, nPos, and pImpXPolygon.

◆ operator[]() [2/2]

const Point & XPolygon::operator[] ( sal_uInt16  nPos) const

Definition at line 418 of file _xpoly.cxx.

References DBG_ASSERT, nPos, and pImpXPolygon.

◆ PointsToBezier()

void XPolygon::PointsToBezier ( sal_uInt16  nFirst)

◆ Remove()

void XPolygon::Remove ( sal_uInt16  nPos,
sal_uInt16  nCount 
)

◆ Scale()

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

◆ SetFlags()

void XPolygon::SetFlags ( sal_uInt16  nPos,
PolyFlags  eFlags 
)

◆ SetPointCount()

void XPolygon::SetPointCount ( sal_uInt16  nPoints)

◆ SubdivideBezier()

void XPolygon::SubdivideBezier ( sal_uInt16  nPos,
bool  bCalcFirst,
double  fT 
)
private

Member Data Documentation

◆ pImpXPolygon

o3tl::cow_wrapper< ImpXPolygon > XPolygon::pImpXPolygon
private

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