CartoType C++ API 7.8.2, 2022-03-25
for Windows, Linux, Qt and other platforms supporting C++ development
Public Types | Public Member Functions | Protected Attributes | List of all members
CartoType::CContourBase< T > Class Template Referenceabstract

#include <cartotype_path.h>

Inheritance diagram for CartoType::CContourBase< T >:
CartoType::MWritableContour CartoType::MContour CartoType::MPath

Public Types

using vector_t = std::vector< T >
 

Public Member Functions

size_t Contours () const override
 
TContour Contour (size_t) const override
 
size_t Points () const override
 
TOutlinePoint Point (size_t aIndex) const override
 
bool Closed () const override
 
void SetPoint (size_t aIndex, const TOutlinePoint &aPoint) override
 
void ReduceSizeTo (size_t aPoints) override
 
void SetSize (size_t aSize) override
 
void SetClosed (bool aClosed) override
 
void AppendPoint (const TOutlinePoint &aPoint) override=0
 
void AppendPointEvenIfSame (const T &aPoint)
 
void AppendPoint (double aX, double aY)
 
void AppendPoints (const T *aPoint, size_t aPoints)
 
void InsertPoint (const T &aPoint, size_t aIndex)
 
void InsertPoints (const T *aPoint, size_t aPoints, size_t aIndex)
 
void Clear ()
 
void SetSizeToZero ()
 
void RemovePoint (size_t aIndex)
 
void RemovePoints (size_t aIndex, size_t aCount)
 
void Offset (int32_t aDx, int32_t aDy)
 
void ReservePoints (size_t aCount)
 
void Reverse ()
 
vector_t::iterator begin ()
 
vector_t::iterator end ()
 
vector_t::const_iterator begin () const
 
vector_t::const_iterator end () const
 
- Public Member Functions inherited from CartoType::MWritableContour
MWritableContouroperator= (const MContour &aContour)
 
virtual void SetPoint (size_t aIndex, const TOutlinePoint &aPoint)=0
 
virtual void ReduceSizeTo (size_t aPoints)=0
 
virtual void SetSize (size_t aPoints)=0
 
virtual void SetClosed (bool aClosed)=0
 
virtual void AppendPoint (const TOutlinePoint &aPoint)=0
 
virtual TOutlinePointOutlinePointData ()=0
 
virtual TPointPointData ()=0
 
void Offset (int32_t aDx, int32_t aDy)
 
void AppendContour (const TContour &aContour)
 
void SetLastPoint (const TOutlinePoint &aPoint)
 
void Simplify (double aResolutionArea)
 
void AppendCircularArc (const TPoint &aCenter, const TPoint &aStart, const TPoint &aEnd, TEllipseAngleType aAngleType=TEllipseAngleType::Shortest, bool aAppendStart=false)
 
void AppendHalfCircle (const TPoint &aCenter, const TPoint &aStart, const TPoint &aEnd, TEllipseAngleType aAngleType=TEllipseAngleType::Shortest, bool aAppendStart=false)
 
void AppendHalfCircle (double aCx, double aCy, double aSx, double aSy, double aEx, double aEy, double aRadius, bool aAppendStart, bool aIsExactHalfCircle, bool aClockwise)
 
void AppendQuadrant (double aCx, double aCy, double aSx, double aSy, double aEx, double aEy, double aRadius, bool aAppendStart, bool aIsExactQuadrant, bool aClockwise)
 
- Public Member Functions inherited from CartoType::MContour
virtual size_t Points () const =0
 
virtual TOutlinePoint Point (size_t aIndex) const =0
 
virtual bool Closed () const =0
 
 operator TContour () const
 
size_t Contours () const
 
TOutlinePoint LastPoint () const
 
TOutlinePoint FractionalPoint (double aIndex) const
 
bool IsGridOrientedRectangle (TRect *aRect=nullptr) const
 
bool Anticlockwise () const
 
bool Contains (double aX, double aY) const
 
bool Contains (const TPoint &aPoint) const
 
COutline ClippedContour (const TRect &aClip) const
 
void AppendClippedContour (COutline &aDest, const TRect &aClip) const
 
size_t AppendSplitContour (COutline &aDest, const TPointFP &aLineStart, const TPointFP &aLineVector)
 
CContour TruncatedContour (double aStart, double aEnd) const
 
CContour SubContourBetweenFractionalPoints (double aStartIndex, double aEndIndex) const
 
CContour SubContourBetweenNearestPoints (const TPointFP *aStartPoint, const TPointFP *aEndPoint) const
 
CContour CentralPath (std::shared_ptr< CEngine > aEngine, const TRect &aClip, bool aFractionalPixels, TLine &aFallbackLine, bool aFallbackMustBeHorizontal) const
 
CContour Smooth (double aRadius) const
 
bool MayIntersect (const TRect &aRect) const
 
bool Intersects (const TRect &aRect) const
 
TPathIntersectionType IntersectionType (const MContour &aOther, double *aDistance=nullptr, TPointFP *aNearest1=nullptr, TPointFP *aNearest2=nullptr) const
 
TPathIntersectionInfo IntersectionInfo (const MContour &aOther) const
 
double DistanceFrom (const MContour &aOther, TPointFP *aNearest1=nullptr, TPointFP *aNearest2=nullptr, TPathIntersectionType *aType=nullptr) const
 
double DistanceFromPoint (const TPointFP &aPoint, TPointFP *aNearest=nullptr, double *aNearestLength=nullptr, bool *aLeft=nullptr, size_t *aLineIndex=nullptr, double *aFractionalLineIndex=nullptr, bool aTreatAsOpen=false) const
 
TPointFP PointAtLength (double aLength, double aOffset=0, int32_t *aLineIndex=nullptr) const
 
void GetOrientation (const TPoint &aCenter, TPoint &aOrientation) const
 
void GetPrincipalAxis (TPointFP &aCenter, TPointFP &aVector) const
 
void Write (TDataOutputStream &aOutput) const
 
void GetAngles (double aDistance, double &aStartAngle, double &aEndAngle)
 
- Public Member Functions inherited from CartoType::MPath
virtual ~MPath ()
 
virtual size_t Contours () const =0
 
virtual TContour Contour (size_t aIndex) const =0
 
virtual bool MayHaveCurves () const =0
 
template<class MPathTraverser >
void Traverse (MPathTraverser &aTraverser, const TRect &aClip) const
 
template<class MPathTraverser >
void Traverse (MPathTraverser &aTraverser, const TRect *aClip=nullptr) const
 
bool operator== (const MPath &aOther) const
 
TRect CBox () const
 
bool CBoxBiggerThan (int32_t aSize) const
 
bool IsContainedIn (const TRect &aRect) const
 
bool Contains (double aX, double aY) const
 
bool Contains (const TPoint &aPoint) const
 
bool Contains (const TPointFP &aPoint) const
 
bool MayIntersect (const TRect &aRect) const
 
bool MayIntersect (const TRect &aRect, int32_t aBorder) const
 
bool Intersects (const TRect &aRect) const
 
bool Intersects (const MPath &aPath, const TRect *aBounds=nullptr) const
 
int32_t MaxDistanceFromOrigin () const
 
TPathIntersectionType IntersectionType (const MPath &aOther, double *aDistance=nullptr, TPointFP *aNearest1=nullptr, TPointFP *aNearest2=nullptr) const
 
TPathIntersectionInfo IntersectionInfo (const MPath &aOther) const
 
double DistanceFrom (const MPath &aOther, TPointFP *aNearest1=nullptr, TPointFP *aNearest2=nullptr, TPathIntersectionType *aType=nullptr) const
 
double DistanceFromPoint (const TPointFP &aPoint, TPointFP *aNearest=nullptr, size_t *aContourIndex=nullptr, size_t *aLineIndex=nullptr, double *aFractionaLineIndex=nullptr, bool aTreatAsOpen=false) const
 
bool IsClippingNeeded (const TRect &aClip) const
 
COutline Copy () const
 
COutline ClippedPath (const TRect &aClip) const
 
COutline ClippedPath (const MPath &aClip) const
 
COutline ClippedPath (const TClipRegion &aClip) const
 
COutline Clip (TClipOperation aClipOperation, const MPath &aClip) const
 
COutline Envelope (double aOffset) const
 
bool IsSmoothingNeeded () const
 
COutline SmoothPath () const
 
COutline FlatPath (double aMaxDistance) const
 
COutline TruncatedPath (double aStart, double aEnd) const
 
COutline OffsetPath (double aOffset) const
 
COutline TransformedPath (const TTransform &aTransform) const
 
COutline TransformedPath (TDrawResult &aError, MPointTransformer &aTransformer, int32_t aFractionalBits) const
 
std::array< TLine, 3 > GetHorizontalPaths (int32_t aPathLength, int32_t aLabelHeight, const TPointFP &aUpVector, const TRect *aBounds, const TRect *aClip) const
 
TPointFP CenterOfGravity () const
 
void GetCenterOfGravity (TPoint &aCenter) const
 
double Length () const
 
double Area () const
 
TPointFP PointAtLength (double aPos) const
 
std::pair< TPoint, bool > End () const
 
void Write (TDataOutputStream &aOutput) const
 
bool IsEmpty () const
 
bool IsPoint () const
 
bool IsGridOrientedRectangle (TRect *aRect=nullptr) const
 
void GetSphericalAreaAndLength (const CProjection &aProjection, double *aArea, double *aLength) const
 
TClipType ClipType (const TRect &aRect) const
 
bool HasCurves () const
 
ConstIter begin () const
 
ConstIter end () const
 

Protected Attributes

vector_t iPoint
 
bool iClosed = false
 

Detailed Description

template<class T>
class CartoType::CContourBase< T >

An abstract base class for the writable contour classes CContour and COnCurveContour.

Member Typedef Documentation

◆ vector_t

template<class T >
using CartoType::CContourBase< T >::vector_t = std::vector<T>

Returns an iterator pointing to the first point of the contour.

Member Function Documentation

◆ AppendPoint() [1/2]

template<class T >
void CartoType::CContourBase< T >::AppendPoint ( const TOutlinePoint aPoint)
overridepure virtual

Appends a point.

Implements CartoType::MWritableContour.

Implemented in CartoType::CContour, and CartoType::COnCurveContour.

◆ AppendPoint() [2/2]

template<class T >
void CartoType::CContourBase< T >::AppendPoint ( double  aX,
double  aY 
)
inline

Appends a point to the contour whether or not it differs from the previous point.

◆ AppendPointEvenIfSame()

template<class T >
void CartoType::CContourBase< T >::AppendPointEvenIfSame ( const T &  aPoint)
inline

Appends a point to the contour whether or not it differs from the previous point.

◆ AppendPoints()

template<class T >
void CartoType::CContourBase< T >::AppendPoints ( const T *  aPoint,
size_t  aPoints 
)
inline

Appends some points to the contour.

◆ begin() [1/2]

template<class T >
vector_t::iterator CartoType::CContourBase< T >::begin ( )
inline

Returns an iterator pointing to the first point of the contour.

◆ begin() [2/2]

template<class T >
vector_t::const_iterator CartoType::CContourBase< T >::begin ( ) const
inline

Returns a constant iterator pointing to the first point of the contour.

◆ Clear()

template<class T >
void CartoType::CContourBase< T >::Clear ( )
inline

Sets the path to its newly constructed state: empty and open.

◆ Closed()

template<class T >
bool CartoType::CContourBase< T >::Closed ( ) const
inlineoverridevirtual

Returns true if this contour is closed.

Implements CartoType::MContour.

◆ Contour()

template<class T >
TContour CartoType::CContourBase< T >::Contour ( size_t  ) const
inlineoverridevirtual

Returns the single contour of this object.

Implements CartoType::MPath.

◆ Contours()

template<class T >
size_t CartoType::CContourBase< T >::Contours ( ) const
inlineoverridevirtual

Returns the number of contours, which is one.

Reimplemented from CartoType::MContour.

◆ end() [1/2]

template<class T >
vector_t::iterator CartoType::CContourBase< T >::end ( )
inline

Returns an iterator pointing just after the last point of the contour.

◆ end() [2/2]

template<class T >
vector_t::const_iterator CartoType::CContourBase< T >::end ( ) const
inline

Returns a constant iterator pointing just after the last point of the contour.

◆ InsertPoint()

template<class T >
void CartoType::CContourBase< T >::InsertPoint ( const T &  aPoint,
size_t  aIndex 
)
inline

Inserts a point at the specified index.

◆ InsertPoints()

template<class T >
void CartoType::CContourBase< T >::InsertPoints ( const T *  aPoint,
size_t  aPoints,
size_t  aIndex 
)
inline

Inserts some points at the specified index.

◆ Offset()

template<class T >
void CartoType::CContourBase< T >::Offset ( int32_t  aDx,
int32_t  aDy 
)
inline

Applies an offset to every point in a contour.

◆ Point()

template<class T >
TOutlinePoint CartoType::CContourBase< T >::Point ( size_t  aIndex) const
inlineoverridevirtual

Returns a point selected by its index.

Implements CartoType::MContour.

◆ Points()

template<class T >
size_t CartoType::CContourBase< T >::Points ( ) const
inlineoverridevirtual

Returns the number of points.

Implements CartoType::MContour.

◆ ReduceSizeTo()

template<class T >
void CartoType::CContourBase< T >::ReduceSizeTo ( size_t  aPoints)
inlineoverridevirtual

Reduces the number of points to aPoints. The address of the points does not change.

Implements CartoType::MWritableContour.

◆ RemovePoint()

template<class T >
void CartoType::CContourBase< T >::RemovePoint ( size_t  aIndex)
inline

Removes a point specified by an index.

◆ RemovePoints()

template<class T >
void CartoType::CContourBase< T >::RemovePoints ( size_t  aIndex,
size_t  aCount 
)
inline

Removes a series of aCount points starting at aIndex.

◆ ReservePoints()

template<class T >
void CartoType::CContourBase< T >::ReservePoints ( size_t  aCount)
inline

Pre-allocates enough space to hold at least aCount points. This function has no effect on behavior but may increase speed.

◆ Reverse()

template<class T >
void CartoType::CContourBase< T >::Reverse ( )
inline

Reverses the order of the points in the contour.

◆ SetClosed()

template<class T >
void CartoType::CContourBase< T >::SetClosed ( bool  aClosed)
inlineoverridevirtual

Sets this contour's closed attribute. Does nothing if that is not possible.

Implements CartoType::MWritableContour.

◆ SetPoint()

template<class T >
void CartoType::CContourBase< T >::SetPoint ( size_t  aIndex,
const TOutlinePoint aPoint 
)
inlineoverridevirtual

Sets a point.

Implements CartoType::MWritableContour.

◆ SetSize()

template<class T >
void CartoType::CContourBase< T >::SetSize ( size_t  aSize)
inlineoverridevirtual

Sets the number of points to aPoints. The address of the points may change.

Implements CartoType::MWritableContour.

◆ SetSizeToZero()

template<class T >
void CartoType::CContourBase< T >::SetSizeToZero ( )
inline

Reduces the number of points to zero.

Member Data Documentation

◆ iClosed

template<class T >
bool CartoType::CContourBase< T >::iClosed = false
protected

True if the contour is closed.

◆ iPoint

template<class T >
vector_t CartoType::CContourBase< T >::iPoint
protected

An array containing the points of the contour.


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