CartoType .NET API 7.8.2, 2022-03-25
for development in C#, Visual Basic and other .NET languages
CartoTypeGeometry.h
1/*
2CartoTypeGeometry.h
3Copyright (C) CartoType Ltd 2021.
4See www.cartotype.com for more information.
5*/
6
7#pragma once
8
9using namespace System;
10using namespace System::Collections::Generic;
11
12namespace CartoType
13{
14
15class TPathIntersectionInfo;
16class CGeometry;
17
18ref class GeometryList;
19ref class MapObject;
20ref class MapObjectList;
21
23public ref class Point
24 {
25 public:
27 Point() { }
29 Point(double aX, double aY) { X = aX; Y = aY; }
31 Point(Point^ aPoint) { if (aPoint) { X = aPoint->X; Y = aPoint->Y; } }
33 property double X;
35 property double Y;
36 };
37
39public value struct PointValue
40 {
42 double X;
44 double Y;
45 };
46
48public enum class PointType
49 {
51 OnCurve,
55 Cubic
56 };
57
59public ref class PathPoint
60 {
61 public:
65 PathPoint(double aX,double aY,PointType aType) { X = aX; Y = aY; Type = aType; }
67 PathPoint(PathPoint^ aPoint) { if (aPoint) { X = aPoint->X; Y = aPoint->Y; Type = aPoint->Type; } }
68
70 property double X;
72 property double Y;
74 property PointType Type;
75 };
76
81public ref class Rect
82 {
83 public:
87 Rect(double aMinX,double aMinY,double aMaxX,double aMaxY);
88
90 property double MinX;
92 property double MinY;
94 property double MaxX;
96 property double MaxY;
97 };
98
101 {
105 Union,
109 Xor
110 };
111
113public interface class Path
114 {
118 int PointCount(int aContourIndex);
120 void GetPoint(int aContourIndex,int aPointIndex,PathPoint^ aPoint);
121 };
122
124public enum class CoordType
125 {
127 Degree,
129 Screen,
131 Map,
134 };
135
137public enum class PathIntersectionType
138 {
140 Unknown,
142 Separate,
143 /* <summary> The paths intersect or are identical. </summary> */
144 Intersects,
146 Contains,
149 };
150
152public ref class PathIntersectionTypeList: List<PathIntersectionType>
153 {
154 };
155
160public ref class PathIntersectionInfo
161 {
162 public:
166 double m_distance = 0;
168 double m_nearest_x1 = 0;
170 double m_nearest_y1 = 0;
172 double m_nearest_x2 = 0;
174 double m_nearest_y2 = 0;
175
176 internal:
177 void Set(const TPathIntersectionInfo& aInfo);
178 };
179
181public ref class PathIntersectionInfoList: List<PathIntersectionInfo^>
182 {
183 };
184
198public ref class Geometry: public Path
199 {
200 public:
202 Geometry(CoordType aCoordType,bool aClosed);
204 Geometry(MapObject^ aMapObject);
206 Geometry(Rect^ aRect,CoordType aCoordType);
208 Geometry(Geometry^ aOther,int aContourIndex);
210 bool ContourIsOuter(int aIndex);
212 void Clear();
216 void AppendPoint(Point^ aPoint);
218 void AppendPoint(PathPoint^ aPoint);
220 void AppendPoint(double aX,double aY);
222 void AppendPoint(double aX,double aY,PointType aPointType);
226 virtual int ContourCount();
228 virtual int PointCount(int aContourIndex);
230 virtual void GetPoint(int aContourIndex,int aPointIndex,PathPoint^ aPoint);
232 bool IsEmpty();
234 bool IsClosed();
236 void SetClosed(bool aClosed);
238 void Reverse();
254 bool Intersects(MapObject^ aMapObject);
256 bool Contains(MapObject^ aMapObject);
258 bool Contained(MapObject^ aMapObject);
267 Geometry^ Clip(ClipOperation aClipOperation,MapObject^ aMapObject);
277 GeometryList^ Clip(ClipOperation aClipOperation,MapObjectList^ aMapObjectList);
285 static Geometry^ Envelope(MapObject^ aMapObject,double aOffsetInMeters);
286
287 protected:
288 !Geometry();
289
290 internal:
291 Geometry(CGeometry* aGeometry);
292 ~Geometry();
293
294 CGeometry* m_geometry = nullptr;
295 };
296
298public ref class GeometryList: List<Geometry^>
299 {
300 };
301
302}
A geometry class for creating map objects and specifying view areas. There are also functions for the...
Definition: CartoTypeGeometry.h:199
PathIntersectionInfo ^ IntersectionInfo(MapObject^ aMapObject)
Returns information about the intersection of this geometry with a map object. The nearest positions ...
bool ContourIsOuter(int aIndex)
Returns true if a contour is an outer contour, defined as being anti-clockwise, that is,...
bool Contains(MapObject^ aMapObject)
Returns true if this geometry contains the map object aMapObject.
bool Contained(MapObject^ aMapObject)
Returns true if this geometry is contained by the map object aMapObject.
bool IsEmpty()
Returns true if the Geometry object has no points.
PathIntersectionInfoList ^ IntersectionInfo(MapObjectList^ aMapObjectList)
Returns information about the intersection of this geometry with an array of map objects....
Geometry(Geometry^ aOther, int aContourIndex)
Creates a geometry object representing a contour selected by its index.
GeometryList ^ Clip(ClipOperation aClipOperation, MapObjectList^ aMapObjectList)
Returns the results of clipping a sequence of map objects returned by a function using this geometry,...
PathIntersectionType IntersectionType(MapObject^ aMapObject)
Returns the intersection type of this geometry with a map object.
virtual int PointCount(int aContourIndex)
Returns the number of points in a contour.
static Geometry ^ Envelope(MapObject^ aMapObject, double aOffsetInMeters)
Returns a geometry that is the envelope of a map object.
Geometry ^ Clip(ClipOperation aClipOperation, MapObject^ aMapObject)
Returns the result of clipping a map object using this geometry, which must be closed.
void AppendPoint(PathPoint^ aPoint)
Appends a point to the current contour.
virtual int ContourCount()
Returns the number of contours (separate lines or closed curves).
void BeginContour()
Begins a new contour. Use this function when creating a geometry object with more than one contour.
void Clear()
Deletes all points but retains the coordinate type and open/closed state.
void SetClosed(bool aClosed)
Sets whether the Geometry object is made of closed contours.
void AppendPoint(double aX, double aY, PointType aPointType)
Appends a point to the current contour.
CoordType GetCoordType()
Returns the coordinate type.
Geometry(Rect^ aRect, CoordType aCoordType)
Creates a geometry object from a grid-aligned rectangle.
virtual void GetPoint(int aContourIndex, int aPointIndex, PathPoint^ aPoint)
Returns a certain point.
void Reverse()
Reverses the order of the contours and the order of the points in each contour.
void AppendPoint(double aX, double aY)
Appends a point to the current contour.
bool IsClosed()
Returns true if the Geometry object is made of closed contours.
Geometry(CoordType aCoordType, bool aClosed)
Creates a geometry object using the specified coordinate type.
void AppendPoint(Point^ aPoint)
Appends a point to the current contour.
PathIntersectionTypeList ^ IntersectionType(MapObjectList^ aMapObjectList)
Returns the intersection types of this geometry with a list of map objects.
Geometry(MapObject^ aMapObject)
Creates a geometry object containing the geometry of a map object.
bool Intersects(MapObject^ aMapObject)
Returns true if this geometry intersects, contains or is contained by the map object aMapObject.
A type for lists of geometry objects returned by Geometry functions.
Definition: CartoTypeGeometry.h:299
A map object: a point, linear object, polygon object, or array (texture).
Definition: CartoTypeWrapper.h:564
A type for lists of map objects returned by search functions.
Definition: CartoTypeWrapper.h:1698
Information about the intersection of two paths and their distance apart. For functions involving map...
Definition: CartoTypeGeometry.h:161
PathIntersectionType m_type
The intersection type.
Definition: CartoTypeGeometry.h:164
double m_nearest_x2
The X coordinate of the nearest point on the second path.
Definition: CartoTypeGeometry.h:172
double m_nearest_y1
The Y coordinate of the nearest point on the first path.
Definition: CartoTypeGeometry.h:170
double m_nearest_x1
The X coordinate of the nearest point on the first path.
Definition: CartoTypeGeometry.h:168
double m_nearest_y2
The Y coordinate of the nearest point on the second path.
Definition: CartoTypeGeometry.h:174
double m_distance
The distance between the paths.
Definition: CartoTypeGeometry.h:166
A type for lists of path intersection information objects returned by Geometry functions.
Definition: CartoTypeGeometry.h:182
A type for lists of path intersection types returned by Geometry functions.
Definition: CartoTypeGeometry.h:153
An on-curve or off-curve point for use in paths.
Definition: CartoTypeGeometry.h:60
PathPoint(double aX, double aY, PointType aType)
Creates the point (aX,aY,aType).
Definition: CartoTypeGeometry.h:65
double X
The X coordinate.
Definition: CartoTypeGeometry.h:70
PathPoint(PathPoint^ aPoint)
Creates a point by copying aPoint.
Definition: CartoTypeGeometry.h:67
double Y
The Y coordinate
Definition: CartoTypeGeometry.h:72
PointType Type
The point type: on-curve, or a quadratic or cubic spline control point.
Definition: CartoTypeGeometry.h:74
PathPoint()
Creates the point (0,0,OnCurve).
Definition: CartoTypeGeometry.h:63
A 2D point using floating-point coordinates.
Definition: CartoTypeGeometry.h:24
Point(Point^ aPoint)
Creates a point by copying aPoint.
Definition: CartoTypeGeometry.h:31
Point(double aX, double aY)
Creates the point (aX,aY).
Definition: CartoTypeGeometry.h:29
double Y
The Y coordinate.
Definition: CartoTypeGeometry.h:35
Point()
Creates the point (0,0).
Definition: CartoTypeGeometry.h:27
double X
The X coordinate.
Definition: CartoTypeGeometry.h:33
A grid-aligned rectangle with double-precision coordinates suitable for map points.
Definition: CartoTypeGeometry.h:82
double MaxX
The maximum X coordinate: the right edge.
Definition: CartoTypeGeometry.h:94
double MinY
The minimum Y coordinate: usually the bottom edge.
Definition: CartoTypeGeometry.h:92
double MinX
The minimum X coordinate: the left edge.
Definition: CartoTypeGeometry.h:90
double MaxY
The maximum Y coordinate: usually the top edge.
Definition: CartoTypeGeometry.h:96
Rect()
Creates the rectangle (0,0,0,0).
A path defining a set of open and closed curves.
Definition: CartoTypeGeometry.h:114
int PointCount(int aContourIndex)
Gets the number of points in a contour.
void GetPoint(int aContourIndex, int aPointIndex, PathPoint^ aPoint)
Gets a point given its contour and point indexes.
int ContourCount()
Gets the number of contours (sub-paths).
Definition: CartoTypeWrapper.h:19
CoordType
Coordinate types.
Definition: CartoTypeGeometry.h:125
@ Screen
Pixels on the display: x increases to the right and y increases downwards.
@ Map
Map coordinates: projected meters, 32nds of meters or 64ths of meters, depending on the map.
@ Degree
Longitude (x) and latitude (y) in degrees.
@ MapMeter
Map meters: projected meters, not correcting for distortion introduced by the projection.
PointType
Types used by PathPoint.
Definition: CartoTypeGeometry.h:49
@ OnCurve
A point on the curve.
@ Quadratic
A control point for a quadratic (conic) Bezier spline curve.
@ Cubic
A control point for a cubic Bezier spline curve.
ClipOperation
Types of clipping done by Geometry.Clip.
Definition: CartoTypeGeometry.h:101
@ Difference
Returns the difference of two paths; non-commutative.
@ Xor
Returns the exclusive-or of the two paths; that is, any regions which are in neither path; commutativ...
@ Intersection
Returns the intersection of two paths; commutative.
@ Union
Returns the union of two paths; commutative.
PathIntersectionType
The ways two paths can intersect.
Definition: CartoTypeGeometry.h:138
@ Contained
The second path contains the first.
@ Separate
The paths do not intersect.
@ Unknown
The intersection type is unknown.
@ Contains
The first path contains the second.
Definition: CartoTypeGeometry.h:40
double Y
The Y coordinate.
Definition: CartoTypeGeometry.h:44
double X
The X coordinate.
Definition: CartoTypeGeometry.h:42