CartoType C++ API 8.8-7-gb35e4dc71
for Windows, Linux, Qt and other platforms supporting C++ development
Public Member Functions | Static Public Member Functions | List of all members
CartoTypeCore::Contour Class Reference

#include <cartotype_path.h>

Inheritance diagram for CartoTypeCore::Contour:
CartoTypeCore::ContourBase< OutlinePoint > CartoTypeCore::MWritableContour CartoTypeCore::MContour CartoTypeCore::MPath

Public Member Functions

 Contour (const MContour &aContour)
 
Contouroperator= (const MContour &aContour)
 
bool MayHaveCurves () const override
 
CartoTypeCore::PointPointData () override
 
OutlinePointOutlinePointData () override
 
const OutlinePointOutlinePointData () const
 
void AppendPoint (const OutlinePoint &aPoint) override
 
void AppendPoint (double aX, double aY, PointType aPointType=PointType::OnCurve)
 
void AppendTransformedPoint64ths (const AffineTransform &aTransform, const PointFP &aPoint, PointType aPointType)
 
void AppendPoint64ths (const PointFP &aPoint, PointType aPointType)
 
void MakeCircle (double aX, double aY, double aRadius)
 
void MakeEllipse (double aX, double aY, double aRadiusX, double aRadiusY, double aRotationDegrees)
 
void MakePolygon (double aX, double aY, double aRadius, int32_t aSides)
 
void MakeRoundedRectangle (double aX1, double aY1, double aX2, double aY2, double aWidth, double aRadius)
 
- Public Member Functions inherited from CartoTypeCore::ContourBase< OutlinePoint >
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 AppendPoint (double aX, double aY)
 
void AppendPointEvenIfSame (const OutlinePoint &aPoint)
 
void AppendPoints (const OutlinePoint *aPoint, size_t aPoints)
 
void InsertPoint (const OutlinePoint &aPoint, size_t aIndex)
 
void InsertPoints (const OutlinePoint *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::const_iterator begin () const
 
vector_t::iterator end ()
 
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
 

Static Public Member Functions

static Contour RoundedRectangle (const CartoTypeCore::Point &aTopLeft, double aWidth, double aHeight, double aRX, double aRY)
 
static Contour Rectangle (const CartoTypeCore::Point &aTopLeft, double aWidth, double aHeight)
 
static Contour Read (InputStream &aInput)
 

Additional Inherited Members

- Public Types inherited from CartoTypeCore::ContourBase< OutlinePoint >
using vector_t = std::vector< OutlinePoint >
 
- Protected Attributes inherited from CartoTypeCore::ContourBase< OutlinePoint >
vector_t iPoint
 
bool iClosed
 

Detailed Description

A contour consisting of owned points with integer coordinates, which may be on-curve or off-curve. Off-curve points are control points for quadratic or cubic spline curves. A contour may be open or closed.

Constructor & Destructor Documentation

◆ Contour()

CartoTypeCore::Contour::Contour ( const MContour aContour)
inlineexplicit

Creates a contour by copying another contour.

Member Function Documentation

◆ AppendPoint() [1/2]

void CartoTypeCore::Contour::AppendPoint ( const OutlinePoint aPoint)
inlineoverridevirtual

Appends a point to the contour, but only if it differs from the previous point or is a control point.

Implements CartoTypeCore::ContourBase< OutlinePoint >.

◆ AppendPoint() [2/2]

void CartoTypeCore::Contour::AppendPoint ( double  aX,
double  aY,
PointType  aPointType = PointType::OnCurve 
)
inline

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

◆ AppendPoint64ths()

void CartoTypeCore::Contour::AppendPoint64ths ( const PointFP aPoint,
PointType  aPointType 
)
inline

Converts a point from floating-point to point in 64ths and appends it.

◆ AppendTransformedPoint64ths()

void CartoTypeCore::Contour::AppendTransformedPoint64ths ( const AffineTransform aTransform,
const PointFP aPoint,
PointType  aPointType 
)

Applies a transform to a point, converts it from floating-point to 64ths, and appends it.

◆ MakeCircle()

void CartoTypeCore::Contour::MakeCircle ( double  aX,
double  aY,
double  aRadius 
)

Set the contour to a circle with the center (aX,aY) and the radius aRadius.

◆ MakeEllipse()

void CartoTypeCore::Contour::MakeEllipse ( double  aX,
double  aY,
double  aRadiusX,
double  aRadiusY,
double  aRotationDegrees 
)

Set the contour to an ellipse with the center (aX,aY), radii aRadiusX and aRadiusY, and rotation aRotationDegrees. The rotation is clockwise if positive.

◆ MakePolygon()

void CartoTypeCore::Contour::MakePolygon ( double  aX,
double  aY,
double  aRadius,
int32_t  aSides 
)

Set the contour to a regular polygon with a certain number of sides, which must be at least 3.

◆ MakeRoundedRectangle()

void CartoTypeCore::Contour::MakeRoundedRectangle ( double  aX1,
double  aY1,
double  aX2,
double  aY2,
double  aWidth,
double  aRadius 
)

Set the contour to a rounded rectangle based on a stroke of width aWidth from (aX1,aY1) to (aX2,aY2) with corners of radius aRadius.

A radius of less than zero is treated as zero, as is a width of less than zero. The maximum radius is the minimum of half aWidth and half the distance between the two points.

◆ MayHaveCurves()

bool CartoTypeCore::Contour::MayHaveCurves ( ) const
inlineoverridevirtual

Returns true if the path may have off-curve points.

Implements CartoTypeCore::MPath.

◆ operator=()

Contour & CartoTypeCore::Contour::operator= ( const MContour aContour)
inline

The assignment operator.

◆ OutlinePointData() [1/2]

const OutlinePoint * CartoTypeCore::Contour::OutlinePointData ( ) const
inline

Returns a constant pointer to the start of the points.

◆ OutlinePointData() [2/2]

OutlinePoint * CartoTypeCore::Contour::OutlinePointData ( )
inlineoverridevirtual

Returns a writable pointer to OutlinePoint data if possible.

Implements CartoTypeCore::MWritableContour.

◆ PointData()

CartoTypeCore::Point * CartoTypeCore::Contour::PointData ( )
inlineoverridevirtual

Returns a writable pointer to Point data if possible.

Implements CartoTypeCore::MWritableContour.

◆ Read()

Contour CartoTypeCore::Contour::Read ( InputStream aInput)
static

Reads a serialized contour from a stream.

◆ Rectangle()

Contour CartoTypeCore::Contour::Rectangle ( const CartoTypeCore::Point aTopLeft,
double  aWidth,
double  aHeight 
)
static

Create a contour that is a rectangle. The top left corner is specified in 64ths of pixels.

◆ RoundedRectangle()

Contour CartoTypeCore::Contour::RoundedRectangle ( const CartoTypeCore::Point aTopLeft,
double  aWidth,
double  aHeight,
double  aRX,
double  aRY 
)
static

Create a contour that is a rounded rectangle. The top left corner is specified in 64ths of pixels.


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