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

#include <cartotype_geometry.h>

Public Types

using contour_t = std::vector< point_t >
 

Public Member Functions

 CGeneralGeometry ()
 
 CGeneralGeometry (TCoordType aCoordType, bool aClosed=false)
 
 CGeneralGeometry (const MPath &aPath, TCoordType aCoordType, bool aClosed)
 
 CGeneralGeometry (const TRectFP &aRect, TCoordType aCoordType)
 
 CGeneralGeometry (const point_t &aPoint, TCoordType aCoordType)
 
 CGeneralGeometry (const CGeneralGeometry &aOther, size_t aContourIndex)
 
 operator COutline () const
 
void Clear ()
 
TCoordType CoordType () const
 
size_t ContourCount () const
 
const contour_tContour (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)
 
TWritableCoordSet CoordSet (size_t aContourIndex)
 
TCoordSet CoordSet (size_t aContourIndex) const
 
TRectFP Bounds () const
 
void AppendPoint (const point_t &aPoint)
 
void AppendPoint (double aX, double aY)
 
void AppendPoint (double aX, double aY, TPointType aPointType)
 
void BeginContour ()
 
void Reverse ()
 
void ConvertCoords (TCoordType aToCoordType, std::function< void(TWritableCoordSet &aCoordSet)> aConvertFunction)
 

Detailed Description

template<class point_t>
class CartoType::CGeneralGeometry< 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 TOutlinePointFP.

Member Typedef Documentation

◆ contour_t

template<class point_t >
using CartoType::CGeneralGeometry< point_t >::contour_t = std::vector<point_t>

The type for contours: an array of points.

Constructor & Destructor Documentation

◆ CGeneralGeometry() [1/6]

template<class point_t >
CartoType::CGeneralGeometry< point_t >::CGeneralGeometry ( )
inline

Creates an empty open geometry object using map coordinates.

◆ CGeneralGeometry() [2/6]

template<class point_t >
CartoType::CGeneralGeometry< point_t >::CGeneralGeometry ( TCoordType  aCoordType,
bool  aClosed = false 
)
inlineexplicit

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

◆ CGeneralGeometry() [3/6]

template<class point_t >
CartoType::CGeneralGeometry< point_t >::CGeneralGeometry ( const MPath aPath,
TCoordType  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.

◆ CGeneralGeometry() [4/6]

template<class point_t >
CartoType::CGeneralGeometry< point_t >::CGeneralGeometry ( const TRectFP aRect,
TCoordType  aCoordType 
)
inline

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

◆ CGeneralGeometry() [5/6]

template<class point_t >
CartoType::CGeneralGeometry< point_t >::CGeneralGeometry ( const point_t &  aPoint,
TCoordType  aCoordType 
)
inline

Creates an open geometry object containing a single point.

◆ CGeneralGeometry() [6/6]

template<class point_t >
CartoType::CGeneralGeometry< point_t >::CGeneralGeometry ( const CGeneralGeometry< 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 CartoType::CGeneralGeometry< 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 CartoType::CGeneralGeometry< 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 CartoType::CGeneralGeometry< point_t >::AppendPoint ( double  aX,
double  aY,
TPointType  aPointType 
)
inline

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

◆ BeginContour()

template<class point_t >
void CartoType::CGeneralGeometry< point_t >::BeginContour ( )
inline

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

◆ Bounds()

template<class point_t >
TRectFP CartoType::CGeneralGeometry< point_t >::Bounds ( ) const
inline

Returns the bounds as an axis-aligned rectangle.

◆ Clear()

template<class point_t >
void CartoType::CGeneralGeometry< point_t >::Clear ( )
inline

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

◆ Contour()

template<class point_t >
const contour_t & CartoType::CGeneralGeometry< point_t >::Contour ( size_t  aIndex) const
inline

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

◆ ContourCount()

template<class point_t >
size_t CartoType::CGeneralGeometry< point_t >::ContourCount ( ) const
inline

Returns the number of contours.

◆ ContourIsOuter()

template<class point_t >
bool CartoType::CGeneralGeometry< 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 CartoType::CGeneralGeometry< point_t >::ConvertCoords ( TCoordType  aToCoordType,
std::function< void(TWritableCoordSet &aCoordSet)>  aConvertFunction 
)
inline

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

◆ CoordSet() [1/2]

template<class point_t >
TWritableCoordSet CartoType::CGeneralGeometry< point_t >::CoordSet ( size_t  aContourIndex)
inline

Returns a writable coordinate set referring to this geometry.

◆ CoordSet() [2/2]

template<class point_t >
TCoordSet CartoType::CGeneralGeometry< point_t >::CoordSet ( size_t  aContourIndex) const
inline

Returns a coordinate set referring to this geometry.

◆ CoordType()

template<class point_t >
TCoordType CartoType::CGeneralGeometry< point_t >::CoordType ( ) const
inline

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

◆ IsClosed()

template<class point_t >
bool CartoType::CGeneralGeometry< point_t >::IsClosed ( ) const
inline

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

◆ IsEmpty()

template<class point_t >
bool CartoType::CGeneralGeometry< point_t >::IsEmpty ( ) const
inline

Returns true if the geometry is empty.

◆ operator COutline()

template<class point_t >
CartoType::CGeneralGeometry< point_t >::operator COutline ( ) const
inline

Returns a COutline object containing this geometry.

◆ Point() [1/2]

template<class point_t >
point_t & CartoType::CGeneralGeometry< 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 & CartoType::CGeneralGeometry< 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 CartoType::CGeneralGeometry< point_t >::PointCount ( size_t  aContourIndex) const
inline

Returns the number of points in a given contour.

◆ Reverse()

template<class point_t >
void CartoType::CGeneralGeometry< 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 CartoType::CGeneralGeometry< point_t >::SetClosed ( bool  aClosed)
inline

Sets the open/closed status.


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