CartoType C++ API 8.8-7-gb35e4dc71
for Windows, Linux, Qt and other platforms supporting C++ development
Public Types | Public Member Functions | Protected Attributes | List of all members
CartoTypeCore::ContourBase< T > Class Template Referenceabstract

#include <cartotype_path.h>

Inheritance diagram for CartoTypeCore::ContourBase< T >:
CartoTypeCore::MWritableContour CartoTypeCore::MContour CartoTypeCore::MPath

Public Types

using vector_t = std::vector< T >
 

Public Member Functions

size_t Contours () const override
 
ContourView ContourByIndex (size_t) const override
 
size_t Points () const override
 
OutlinePoint Point (size_t aIndex) const override
 
bool Closed () const override
 
void SetPoint (size_t aIndex, const OutlinePoint &aPoint) override
 
void ReduceSizeTo (size_t aPoints) override
 
void SetSize (size_t aSize) override
 
void SetClosed (bool aClosed) override
 
void AppendPoint (const OutlinePoint &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 CartoTypeCore::MWritableContour
MWritableContouroperator= (const MContour &aContour)
 
virtual void SetPoint (size_t aIndex, const OutlinePoint &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 OutlinePoint &aPoint)=0
 
virtual OutlinePointOutlinePointData ()=0
 
virtual CartoTypeCore::PointPointData ()=0
 
void Offset (int32_t aDx, int32_t aDy)
 
void AppendContour (const ContourView &aContour)
 
void SetLastPoint (const OutlinePoint &aPoint)
 
void Simplify (double aResolutionArea)
 
void AppendCircularArc (const CartoTypeCore::Point &aCenter, const CartoTypeCore::Point &aStart, const CartoTypeCore::Point &aEnd, EllipseAngleType aAngleType=EllipseAngleType::Shortest, bool aAppendStart=false)
 
void AppendHalfCircle (const CartoTypeCore::Point &aCenter, const CartoTypeCore::Point &aStart, const CartoTypeCore::Point &aEnd, EllipseAngleType aAngleType=EllipseAngleType::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 CartoTypeCore::MContour
virtual size_t Points () const =0
 
virtual OutlinePoint Point (size_t aIndex) const =0
 
virtual bool Closed () const =0
 
 operator ContourView () const
 
size_t Contours () const
 
OutlinePoint LastPoint () const
 
OutlinePoint FractionalPoint (double aIndex) const
 
bool IsGridOrientedRectangle (Rect *aRect=nullptr) const
 
bool Anticlockwise () const
 
PolygonOrientation Orientation () const
 
bool Contains (double aX, double aY) const
 
bool Contains (const CartoTypeCore::Point &aPoint) const
 
Outline ClippedContour (const Rect &aClip) const
 
void AppendClippedContour (Outline &aDest, const Rect &aClip) const
 
size_t AppendSplitContour (Outline &aDest, const PointFP &aLineStart, const PointFP &aLineVector)
 
Contour TruncatedContour (double aStart, double aEnd) const
 
Contour SubContourBetweenFractionalPoints (double aStartIndex, double aEndIndex) const
 
Contour SubContourBetweenNearestPoints (const PointFP *aStartPoint, const PointFP *aEndPoint) const
 
Contour CentralPath (std::shared_ptr< CEngine > aEngine, const Rect &aClip, bool aFractionalPixels, Line &aFallbackLine, bool aFallbackMustBeHorizontal) const
 
Contour Smooth (double aRadius) const
 
Contour ConcaveHull (double aMaxEdgeLength, PolygonOrientation aAssumedOrientation=PolygonOrientation::None) const
 
bool MayIntersect (const Rect &aRect) const
 
bool Intersects (const Rect &aRect) const
 
PathIntersectionType IntersectionType (const MContour &aOther, double *aDistance=nullptr, PointFP *aNearest1=nullptr, PointFP *aNearest2=nullptr) const
 
PathIntersectionInfo IntersectionInfo (const MContour &aOther) const
 
double DistanceFrom (const MContour &aOther, PointFP *aNearest1=nullptr, PointFP *aNearest2=nullptr, PathIntersectionType *aType=nullptr) const
 
double DistanceFromPoint (const PointFP &aPoint, PointFP *aNearest=nullptr, double *aNearestLength=nullptr, bool *aLeft=nullptr, size_t *aLineIndex=nullptr, double *aFractionalLineIndex=nullptr, bool aTreatAsOpen=false) const
 
PointFP PointAtLength (double aLength, double aOffset=0, int32_t *aLineIndex=nullptr) const
 
CartoTypeCore::Point Orientation (const CartoTypeCore::Point &aCenter) const
 
void GetPrincipalAxis (PointFP &aCenter, PointFP &aVector) const
 
void Write (OutputStream &aOutput) const
 
void GetAngles (double aDistance, double &aStartAngle, double &aEndAngle)
 
- Public Member Functions inherited from CartoTypeCore::MPath
virtual ~MPath ()
 
virtual size_t Contours () const =0
 
virtual ContourView ContourByIndex (size_t aIndex) const =0
 
virtual bool MayHaveCurves () const =0
 
template<class MPathTraverser >
void Traverse (MPathTraverser &aTraverser, const Rect &aClip) const
 
template<class MPathTraverser >
void Traverse (MPathTraverser &aTraverser, const Rect *aClip=nullptr) const
 
bool operator== (const MPath &aOther) const
 
Rect CBox () const
 
bool CBoxBiggerThan (int32_t aSize) const
 
bool IsContainedIn (const Rect &aRect) const
 
bool Contains (double aX, double aY) const
 
bool Contains (const Point &aPoint) const
 
bool Contains (const PointFP &aPoint) const
 
bool MayIntersect (const Rect &aRect) const
 
bool MayIntersect (const Rect &aRect, int32_t aBorder) const
 
bool Intersects (const Rect &aRect) const
 
bool Intersects (const MPath &aPath, const Rect *aBounds=nullptr) const
 
int32_t MaxDistanceFromOrigin () const
 
PathIntersectionType IntersectionType (const MPath &aOther, double *aDistance=nullptr, PointFP *aNearest1=nullptr, PointFP *aNearest2=nullptr) const
 
PathIntersectionInfo IntersectionInfo (const MPath &aOther) const
 
double DistanceFrom (const MPath &aOther, PointFP *aNearest1=nullptr, PointFP *aNearest2=nullptr, PathIntersectionType *aType=nullptr) const
 
double DistanceFromPoint (const PointFP &aPoint, PointFP *aNearest=nullptr, size_t *aContourIndex=nullptr, size_t *aLineIndex=nullptr, double *aFractionaLineIndex=nullptr, bool aTreatAsOpen=false) const
 
bool IsClippingNeeded (const Rect &aClip) const
 
Outline Copy () const
 
Outline ClippedPath (const Rect &aClip) const
 
Outline ClippedPath (const MPath &aClip) const
 
Outline ClippedPath (const ClipRegion &aClip) const
 
Outline Clip (ClipOperation aClipOperation, const MPath &aClip) const
 
Outline Envelope (double aOffset) const
 
Outline ConcaveHull (double aMaxEdgeLength, PolygonOrientation aAssumedOrientation=PolygonOrientation::None) const
 
bool IsSmoothingNeeded () const
 
Outline SmoothPath () const
 
Outline FlatPath (double aMaxDistance) const
 
Outline TruncatedPath (double aStart, double aEnd) const
 
Outline OffsetPath (double aOffset) const
 
Outline TransformedPath (const AffineTransform &aTransform) const
 
Outline TransformedPath (DrawResult &aError, MPointTransformer &aTransformer, int32_t aFractionalBits) const
 
Outline Interpolate (int32_t aGranularity) const
 
std::array< Line, 3 > HorizontalPaths (GraphicsContext *aGc, int32_t aPathLength, int32_t aLabelAscent, int32_t aLabelDescent, const PointFP &aUpVector, const Rect *aBounds, const Rect *aClip) const
 
PointFP CenterOfGravity () const
 
double Length () const
 
double Area () const
 
PointFP PointAtLength (double aPos) const
 
std::pair< Point, bool > End () const
 
void Write (OutputStream &aOutput) const
 
void WriteAsXml (OutputStream &aOutput) const
 
bool IsEmpty () const
 
bool IsPoint () const
 
bool IsGridOrientedRectangle (Rect *aRect=nullptr) const
 
void GetSphericalAreaAndLength (const Projection &aProjection, double *aArea, double *aLength) const
 
CartoTypeCore::ClipType ClipType (const Rect &aRect) const
 
bool HasCurves () const
 
size_t PointCount () const
 
ConstIter begin () const
 
ConstIter end () const
 

Protected Attributes

vector_t iPoint
 
bool iClosed = false
 

Detailed Description

template<class T>
class CartoTypeCore::ContourBase< T >

An abstract base class for the writable contour classes Contour and OnCurveContour.

Member Typedef Documentation

◆ vector_t

template<class T >
using CartoTypeCore::ContourBase< 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 CartoTypeCore::ContourBase< T >::AppendPoint ( const OutlinePoint aPoint)
overridepure virtual

◆ AppendPoint() [2/2]

template<class T >
void CartoTypeCore::ContourBase< 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 CartoTypeCore::ContourBase< 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 CartoTypeCore::ContourBase< T >::AppendPoints ( const T *  aPoint,
size_t  aPoints 
)
inline

Appends some points to the contour.

◆ begin() [1/2]

template<class T >
vector_t::iterator CartoTypeCore::ContourBase< T >::begin ( )
inline

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

◆ begin() [2/2]

template<class T >
vector_t::const_iterator CartoTypeCore::ContourBase< T >::begin ( ) const
inline

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

◆ Clear()

template<class T >
void CartoTypeCore::ContourBase< T >::Clear ( )
inline

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

◆ Closed()

template<class T >
bool CartoTypeCore::ContourBase< T >::Closed ( ) const
inlineoverridevirtual

Returns true if this contour is closed.

Implements CartoTypeCore::MContour.

◆ ContourByIndex()

template<class T >
ContourView CartoTypeCore::ContourBase< T >::ContourByIndex ( size_t  ) const
inlineoverridevirtual

Returns the single contour of this object.

Implements CartoTypeCore::MPath.

◆ Contours()

template<class T >
size_t CartoTypeCore::ContourBase< T >::Contours ( ) const
inlineoverridevirtual

Returns the number of contours, which is one.

Reimplemented from CartoTypeCore::MContour.

◆ end() [1/2]

template<class T >
vector_t::iterator CartoTypeCore::ContourBase< 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 CartoTypeCore::ContourBase< T >::end ( ) const
inline

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

◆ InsertPoint()

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

Inserts a point at the specified index.

◆ InsertPoints()

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

Inserts some points at the specified index.

◆ Offset()

template<class T >
void CartoTypeCore::ContourBase< T >::Offset ( int32_t  aDx,
int32_t  aDy 
)
inline

Applies an offset to every point in a contour.

◆ Point()

template<class T >
OutlinePoint CartoTypeCore::ContourBase< T >::Point ( size_t  aIndex) const
inlineoverridevirtual

Returns a point selected by its index.

Implements CartoTypeCore::MContour.

◆ Points()

template<class T >
size_t CartoTypeCore::ContourBase< T >::Points ( ) const
inlineoverridevirtual

Returns the number of points.

Implements CartoTypeCore::MContour.

◆ ReduceSizeTo()

template<class T >
void CartoTypeCore::ContourBase< T >::ReduceSizeTo ( size_t  aPoints)
inlineoverridevirtual

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

Implements CartoTypeCore::MWritableContour.

◆ RemovePoint()

template<class T >
void CartoTypeCore::ContourBase< T >::RemovePoint ( size_t  aIndex)
inline

Removes a point specified by an index.

◆ RemovePoints()

template<class T >
void CartoTypeCore::ContourBase< T >::RemovePoints ( size_t  aIndex,
size_t  aCount 
)
inline

Removes a series of aCount points starting at aIndex.

◆ ReservePoints()

template<class T >
void CartoTypeCore::ContourBase< 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 CartoTypeCore::ContourBase< T >::Reverse ( )
inline

Reverses the order of the points in the contour.

◆ SetClosed()

template<class T >
void CartoTypeCore::ContourBase< T >::SetClosed ( bool  aClosed)
inlineoverridevirtual

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

Implements CartoTypeCore::MWritableContour.

◆ SetPoint()

template<class T >
void CartoTypeCore::ContourBase< T >::SetPoint ( size_t  aIndex,
const OutlinePoint aPoint 
)
inlineoverridevirtual

Sets a point.

Implements CartoTypeCore::MWritableContour.

◆ SetSize()

template<class T >
void CartoTypeCore::ContourBase< T >::SetSize ( size_t  aSize)
inlineoverridevirtual

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

Implements CartoTypeCore::MWritableContour.

◆ SetSizeToZero()

template<class T >
void CartoTypeCore::ContourBase< T >::SetSizeToZero ( )
inline

Reduces the number of points to zero.

Member Data Documentation

◆ iClosed

template<class T >
bool CartoTypeCore::ContourBase< T >::iClosed = false
protected

True if the contour is closed.

◆ iPoint

template<class T >
vector_t CartoTypeCore::ContourBase< T >::iPoint
protected

An array containing the points of the contour.


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