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::Geometry Class Reference

#include <cartotype_geometry.h>

Inheritance diagram for CartoTypeCore::Geometry:
CartoTypeCore::GeneralGeometry< OutlinePointFP >

Public Member Functions

 Geometry (const MapObject &aMapObject)
 
PathIntersectionType IntersectionType (const MapObject &aMapObject) const
 
PathIntersectionInfo IntersectionInfo (const MapObject &aMapObject) const
 
std::vector< PathIntersectionTypeIntersectionType (std::function< const MapObject *(size_t)> aObject, size_t aObjectCount) const
 
std::vector< PathIntersectionTypeIntersectionType (const MapObjectArray &aMapObjectArray) const
 
std::vector< PathIntersectionInfoIntersectionInfo (std::function< const MapObject *(size_t)> aObject, size_t aObjectCount) const
 
std::vector< PathIntersectionInfoIntersectionInfo (const MapObjectArray &aMapObjectArray) const
 
bool Intersects (const MapObject &aMapObject) const
 
bool Contains (const MapObject &aMapObject) const
 
bool Contained (const MapObject &aMapObject) const
 
Geometry Clip (ClipOperation aClipOperation, const MapObject &aMapObject) const
 
std::vector< GeometryClip (ClipOperation aClipOperation, const MapObjectArray &aMapObjectArray) const
 
std::vector< GeometryClip (ClipOperation aClipOperation, std::function< const MapObject *(size_t)> aObject, size_t aObjectCount) const
 
Result ConvertLinesToGreatCircles (double aMaxDistanceInMeters)
 
 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)
 
- Public Member Functions inherited from CartoTypeCore::GeneralGeometry< OutlinePointFP >
 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 OutlinePointFP &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 OutlinePointFPPoint (size_t aContourIndex, size_t aPointIndex) const
 
OutlinePointFPPoint (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 OutlinePointFP &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)
 

Static Public Member Functions

static Geometry Envelope (const MapObject &aMapObject, double aOffsetInMeters)
 

Additional Inherited Members

- Public Types inherited from CartoTypeCore::GeneralGeometry< OutlinePointFP >
using contour_t = std::vector< OutlinePointFP >
 

Detailed Description

A geometry class for creating map objects and specifying view areas.

There are also functions for the determining distance and intersection type between a geometry object and map objects. Those functions do not work with geometry objects in display coordinates, or map objects with no known projection, for which they give a path intersection type of Unknown. If the geometry is in map units or map meters the caller is responsible for ensuring that the units are the same as those of the map object or objects.

Constructor & Destructor Documentation

◆ Geometry()

CartoTypeCore::Geometry::Geometry ( const MapObject aMapObject)
explicit

Creates a geometry object containing the geometry of a map object. The geometry object is closed if the map object is a polygon or array (i.e., a texture), otherwise open.

Member Function Documentation

◆ Clip() [1/3]

Geometry CartoTypeCore::Geometry::Clip ( ClipOperation  aClipOperation,
const MapObject aMapObject 
) const

Returns the result of clipping a map object using this geometry, which must be closed. Supports intersection, union, difference and exclusive-or operations. All operations except difference are commutative. The difference operation subtracts this geometry from aMapObject.

The returned geometry object is in degrees.

◆ Clip() [2/3]

std::vector< Geometry > CartoTypeCore::Geometry::Clip ( ClipOperation  aClipOperation,
const MapObjectArray aMapObjectArray 
) const

Returns the results of clipping an array of map objects using this geometry, which must be closed. Supports intersection, union, difference and exclusive-or operations. All operations except difference are commutative. The difference operation subtracts this geometry from the map objects.

The returned geometry objects are in degrees.

◆ Clip() [3/3]

std::vector< Geometry > CartoTypeCore::Geometry::Clip ( ClipOperation  aClipOperation,
std::function< const MapObject *(size_t)>  aObject,
size_t  aObjectCount 
) const

Returns the results of clipping a sequence of map objects returned by a function using this geometry, which must be closed. Returns an empty array if this geometry is not closed. Supports intersection, union, difference and exclusive-or operations. All operations except difference are commutative. The difference operation subtracts this geometry from the map objects.

The returned geometry objects are in degrees.

◆ Contained()

bool CartoTypeCore::Geometry::Contained ( const MapObject aMapObject) const
inline

Returns true if this geometry is contained by the map object aMapObject.

◆ Contains()

bool CartoTypeCore::Geometry::Contains ( const MapObject aMapObject) const
inline

Returns true if this geometry contains the map object aMapObject.

◆ ConvertLinesToGreatCircles()

Result CartoTypeCore::Geometry::ConvertLinesToGreatCircles ( double  aMaxDistanceInMeters)

Interpolates points at a maximum distance apart to convert lines to great circles. Works only with degree coordinates, and with on-curve points.

◆ Envelope()

Geometry CartoTypeCore::Geometry::Envelope ( const MapObject aMapObject,
double  aOffsetInMeters 
)
static

Returns a geometry that is the envelope of a map object, created by offsetting the path by aOffset. The offset may be negative if the subject path is made of polygons only.

The returned geometry object is in degrees.

◆ GeneralGeometry() [1/6]

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

Creates an empty open geometry object using map coordinates.

◆ GeneralGeometry() [2/6]

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]

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

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

◆ GeneralGeometry() [4/6]

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() [5/6]

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]

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

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

◆ IntersectionInfo() [1/3]

PathIntersectionInfo CartoTypeCore::Geometry::IntersectionInfo ( const MapObject aMapObject) const

Returns information about the intersection of this geometry with a map object. The nearest positions are in degrees (X = longitude, Y = latitude) and the the distance is in meters.

◆ IntersectionInfo() [2/3]

std::vector< PathIntersectionInfo > CartoTypeCore::Geometry::IntersectionInfo ( const MapObjectArray aMapObjectArray) const

Returns information about the intersection of this geometry with an array of map objects. The nearest positions are in degrees (X = longitude, Y = latitude) and the the distances are in meters.

◆ IntersectionInfo() [3/3]

std::vector< PathIntersectionInfo > CartoTypeCore::Geometry::IntersectionInfo ( std::function< const MapObject *(size_t)>  aObject,
size_t  aObjectCount 
) const

Returns information about the intersection of this geometry with a sequence of map objects returned by a function. The nearest positions are in degrees (X = longitude, Y = latitude) and the the distances are in meters.

◆ IntersectionType() [1/3]

PathIntersectionType CartoTypeCore::Geometry::IntersectionType ( const MapObject aMapObject) const

Returns the intersection type of this geometry with a map object.

◆ IntersectionType() [2/3]

std::vector< PathIntersectionType > CartoTypeCore::Geometry::IntersectionType ( const MapObjectArray aMapObjectArray) const

Returns the intersection types of this geometry with an array of map objects.

◆ IntersectionType() [3/3]

std::vector< PathIntersectionType > CartoTypeCore::Geometry::IntersectionType ( std::function< const MapObject *(size_t)>  aObject,
size_t  aObjectCount 
) const

Returns the intersection types of this geometry with an sequence of map objects returned by a function.

◆ Intersects()

bool CartoTypeCore::Geometry::Intersects ( const MapObject aMapObject) const
inline

Returns true if this geometry intersects, contains or is contained by the map object aMapObject.


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