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

#include <cartotype_geometry.h>

Public Types

using contour_t = std::vector< point_t >
 

Public Member Functions

 GeneralGeometry ()
 
 GeneralGeometry (CartoTypeCore::CoordType aCoordType, bool aClosed=false)
 
 GeneralGeometry (const MPath &aPath, CartoTypeCore::CoordType aCoordType, bool aClosed)
 
 GeneralGeometry (const RectFP &aRect, CartoTypeCore::CoordType aCoordType)
 
 GeneralGeometry (const point_t &aPoint, CartoTypeCore::CoordType aCoordType)
 
 GeneralGeometry (const GeneralGeometry &aOther, size_t aContourIndex)
 
 operator Outline () const
 
void Clear ()
 
CartoTypeCore::CoordType CoordType () const
 
size_t ContourCount () const
 
const contour_tContourByIndex (size_t aIndex) const
 
bool ContourIsOuter (size_t aIndex) const
 
size_t PointCount (size_t aContourIndex) const
 
const point_t & Point (size_t aContourIndex, size_t aPointIndex) const
 
point_t & Point (size_t aContourIndex, size_t aPointIndex)
 
bool IsEmpty () const
 
bool IsClosed () const
 
void SetClosed (bool aClosed)
 
WritableCoordSet CoordSet (size_t aContourIndex)
 
CartoTypeCore::CoordSet CoordSet (size_t aContourIndex) const
 
RectFP Bounds () const
 
void AppendPoint (const point_t &aPoint)
 
void AppendPoint (double aX, double aY)
 
void AppendPoint (double aX, double aY, PointType aPointType)
 
void BeginContour ()
 
void Reverse ()
 
void ConvertCoords (CartoTypeCore::CoordType aToCoordType, std::function< void(WritableCoordSet &aCoordSet)> aConvertFunction)
 

Detailed Description

template<class point_t>
class CartoTypeCore::GeneralGeometry< point_t >

A template class to hold geometry objects containing various types of point. The point type must be derived from or trivially convertible to OutlinePointFP.

Member Typedef Documentation

◆ contour_t

template<class point_t >
using CartoTypeCore::GeneralGeometry< point_t >::contour_t = std::vector<point_t>

The type for contours: an array of points.

Constructor & Destructor Documentation

◆ GeneralGeometry() [1/6]

template<class point_t >
CartoTypeCore::GeneralGeometry< point_t >::GeneralGeometry ( )
inline

Creates an empty open geometry object using map coordinates.

◆ GeneralGeometry() [2/6]

template<class point_t >
CartoTypeCore::GeneralGeometry< point_t >::GeneralGeometry ( CartoTypeCore::CoordType  aCoordType,
bool  aClosed = false 
)
inlineexplicit

Creates a geometry object with given coordinates and open/closed status.

◆ GeneralGeometry() [3/6]

template<class point_t >
CartoTypeCore::GeneralGeometry< point_t >::GeneralGeometry ( const MPath aPath,
CartoTypeCore::CoordType  aCoordType,
bool  aClosed 
)
inline

Creates a geometry object by copying a path, using given coordinates and open/closed status. Ignores the open/closed status of individual contours in the path.

◆ GeneralGeometry() [4/6]

template<class point_t >
CartoTypeCore::GeneralGeometry< point_t >::GeneralGeometry ( const RectFP aRect,
CartoTypeCore::CoordType  aCoordType 
)
inline

Creates a closed geometry object from an axis-aligned rectangle.

◆ GeneralGeometry() [5/6]

template<class point_t >
CartoTypeCore::GeneralGeometry< point_t >::GeneralGeometry ( const point_t &  aPoint,
CartoTypeCore::CoordType  aCoordType 
)
inline

Creates an open geometry object containing a single point.

◆ GeneralGeometry() [6/6]

template<class point_t >
CartoTypeCore::GeneralGeometry< point_t >::GeneralGeometry ( const GeneralGeometry< point_t > &  aOther,
size_t  aContourIndex 
)
inline

Creates a geometry object representing a single contour of another geometry object.

Member Function Documentation

◆ AppendPoint() [1/3]

template<class point_t >
void CartoTypeCore::GeneralGeometry< point_t >::AppendPoint ( const point_t &  aPoint)
inline

Appends a point to the current (last) contour in this geometry.

◆ AppendPoint() [2/3]

template<class point_t >
void CartoTypeCore::GeneralGeometry< point_t >::AppendPoint ( double  aX,
double  aY 
)
inline

Appends a point to the last contour in this geometry.

◆ AppendPoint() [3/3]

template<class point_t >
void CartoTypeCore::GeneralGeometry< point_t >::AppendPoint ( double  aX,
double  aY,
PointType  aPointType 
)
inline

Appends a point to the last contour in this geometry, specifying the point type.

◆ BeginContour()

template<class point_t >
void CartoTypeCore::GeneralGeometry< point_t >::BeginContour ( )
inline

Starts a new contour. Does nothing if the current (last) contour is empty.

◆ Bounds()

template<class point_t >
RectFP CartoTypeCore::GeneralGeometry< point_t >::Bounds ( ) const
inline

Returns the bounds as an axis-aligned rectangle.

◆ Clear()

template<class point_t >
void CartoTypeCore::GeneralGeometry< point_t >::Clear ( )
inline

Deletes all points, leaving the geometry with a single empty contour and its original coordinate type and open/closed state.

◆ ContourByIndex()

template<class point_t >
const contour_t & CartoTypeCore::GeneralGeometry< point_t >::ContourByIndex ( size_t  aIndex) const
inline

Returns a contour selected by its index as a vector of points.

◆ ContourCount()

template<class point_t >
size_t CartoTypeCore::GeneralGeometry< point_t >::ContourCount ( ) const
inline

Returns the number of contours.

◆ ContourIsOuter()

template<class point_t >
bool CartoTypeCore::GeneralGeometry< point_t >::ContourIsOuter ( size_t  aIndex) const
inline

Returns true if a contour is an outer contour, defined as being anti-clockwise, that is, having a positive area when treating all points as on-curve. Useful only for closed geometries.

◆ ConvertCoords()

template<class point_t >
void CartoTypeCore::GeneralGeometry< point_t >::ConvertCoords ( CartoTypeCore::CoordType  aToCoordType,
std::function< void(WritableCoordSet &aCoordSet)>  aConvertFunction 
)
inline

Converts the coordinates to aToCoordType using the function aConvertFunction. For internal use only.

◆ CoordSet() [1/2]

template<class point_t >
WritableCoordSet CartoTypeCore::GeneralGeometry< point_t >::CoordSet ( size_t  aContourIndex)
inline

Returns a writable coordinate set referring to this geometry.

◆ CoordSet() [2/2]

template<class point_t >
CartoTypeCore::CoordSet CartoTypeCore::GeneralGeometry< point_t >::CoordSet ( size_t  aContourIndex) const
inline

Returns a coordinate set referring to this geometry.

◆ CoordType()

template<class point_t >
CartoTypeCore::CoordType CartoTypeCore::GeneralGeometry< point_t >::CoordType ( ) const
inline

Returns the coordinate type used for all points in this geometry.

◆ IsClosed()

template<class point_t >
bool CartoTypeCore::GeneralGeometry< point_t >::IsClosed ( ) const
inline

Returns true if the geometry is closed (formed of closed paths).

◆ IsEmpty()

template<class point_t >
bool CartoTypeCore::GeneralGeometry< point_t >::IsEmpty ( ) const
inline

Returns true if the geometry is empty.

◆ operator Outline()

template<class point_t >
CartoTypeCore::GeneralGeometry< point_t >::operator Outline ( ) const
inline

Returns an Outline object containing this geometry.

◆ Point() [1/2]

template<class point_t >
point_t & CartoTypeCore::GeneralGeometry< point_t >::Point ( size_t  aContourIndex,
size_t  aPointIndex 
)
inline

Returns a non-const reference to a point identified by its contour index and point index.

◆ Point() [2/2]

template<class point_t >
const point_t & CartoTypeCore::GeneralGeometry< point_t >::Point ( size_t  aContourIndex,
size_t  aPointIndex 
) const
inline

Returns a point identified by its contour index and point index.

◆ PointCount()

template<class point_t >
size_t CartoTypeCore::GeneralGeometry< point_t >::PointCount ( size_t  aContourIndex) const
inline

Returns the number of points in a given contour.

◆ Reverse()

template<class point_t >
void CartoTypeCore::GeneralGeometry< point_t >::Reverse ( )
inline

Reverses the order of the contours and the order of the points in each contour.

◆ SetClosed()

template<class point_t >
void CartoTypeCore::GeneralGeometry< point_t >::SetClosed ( bool  aClosed)
inline

Sets the open/closed status.


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