CartoType .NET API 8.8-7-gb35e4dc71
for development in C#, Visual Basic and other .NET languages
CartoTypeGeometry.h
1/*
2CartoTypeGeometry.h
3Copyright (C) CartoType Ltd 2021-2023.
4See www.cartotype.com for more information.
5*/
6
7#pragma once
8
9using namespace System;
10using namespace System::Collections::Generic;
11
12namespace CartoTypeCore
13{
14class PathIntersectionInfo;
15class Geometry;
16}
17
18namespace CartoType
19{
20ref class GeometryList;
21ref class MapObject;
22ref class MapObjectList;
23
25public ref class Point
26 {
27 public:
29 Point() { }
31 Point(double aX, double aY) { X = aX; Y = aY; }
33 Point(Point^ aPoint) { if (aPoint) { X = aPoint->X; Y = aPoint->Y; } }
35 property double X;
37 property double Y;
38 };
39
41public value struct PointValue
42 {
44 double X;
46 double Y;
47 };
48
50public enum class PointType
51 {
53 OnCurve,
57 Cubic
58 };
59
61public ref class PathPoint
62 {
63 public:
67 PathPoint(double aX,double aY,PointType aType) { X = aX; Y = aY; Type = aType; }
69 PathPoint(PathPoint^ aPoint) { if (aPoint) { X = aPoint->X; Y = aPoint->Y; Type = aPoint->Type; } }
70
72 property double X;
74 property double Y;
76 property PointType Type;
77 };
78
83public ref class Rect
84 {
85 public:
89 Rect(double aMinX,double aMinY,double aMaxX,double aMaxY);
90
92 property double MinX;
94 property double MinY;
96 property double MaxX;
98 property double MaxY;
99 };
100
103 {
107 Union,
111 Xor
112 };
113
115public interface class Path
116 {
120 int PointCount(int aContourIndex);
122 PathPoint^ Point(int aContourIndex,int aPointIndex);
123 };
124
126public enum class CoordType
127 {
129 Degree,
131 Display,
133 Screen = Display,
135 Map,
138 };
139
141public enum class PathIntersectionType
142 {
144 Unknown,
146 Separate,
150 Contains,
153 };
154
156public ref class PathIntersectionTypeList: List<PathIntersectionType>
157 {
158 };
159
164public ref class PathIntersectionInfo
165 {
166 public:
168
170 property PathIntersectionType Type;
172 property double Distance;
174 property double NearestX1;
176 property double NearestY1;
178 property double NearestX2;
180 property double NearestY2;
181
182 internal:
183 void Set(const CartoTypeCore::PathIntersectionInfo& aInfo);
184 };
185
187public ref class PathIntersectionInfoList: List<PathIntersectionInfo^>
188 {
189 };
190
204public ref class Geometry: public Path
205 {
206 public:
208 Geometry(CoordType aCoordType,bool aClosed);
210 Geometry(MapObject^ aMapObject);
212 Geometry(Rect^ aRect,CoordType aCoordType);
214 Geometry(Geometry^ aOther,int aContourIndex);
216 bool ContourIsOuter(int aIndex);
218 void Clear();
220 property CoordType CoordType { CartoType::CoordType get(); }
222 void AppendPoint(Point^ aPoint);
224 void AppendPoint(PathPoint^ aPoint);
226 void AppendPoint(double aX,double aY);
228 void AppendPoint(double aX,double aY,PointType aPointType);
232 virtual int ContourCount();
234 virtual int PointCount(int aContourIndex);
236 virtual PathPoint^ Point(int aContourIndex,int aPointIndex);
238 property bool IsEmpty { bool get(); };
240 property bool IsClosed { bool get(); };
242 void SetClosed(bool aClosed);
244 void Reverse();
260 bool Intersects(MapObject^ aMapObject);
262 bool Contains(MapObject^ aMapObject);
264 bool Contained(MapObject^ aMapObject);
273 Geometry^ Clip(ClipOperation aClipOperation,MapObject^ aMapObject);
283 GeometryList^ Clip(ClipOperation aClipOperation,MapObjectList^ aMapObjectList);
291 static Geometry^ Envelope(MapObject^ aMapObject,double aOffsetInMeters);
293 Result ConvertLinesToGreatCircles(double aMaxDistanceInMeters);
294
295 protected:
296 !Geometry();
297
298 internal:
299 Geometry(CartoTypeCore::Geometry* aGeometry);
300 ~Geometry();
301
302 CartoTypeCore::Geometry* m_geometry = nullptr;
303 };
304
306public ref class GeometryList: List<Geometry^>
307 {
308 };
309
310}
A geometry class for creating map objects and specifying view areas. There are also functions for the...
Definition: CartoTypeGeometry.h:205
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.
Definition: CartoTypeGeometry.h:238
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.
virtual PathPoint ^ Point(int aContourIndex, int aPointIndex)
Returns a certain point.
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.
Geometry(Rect^ aRect, CoordType aCoordType)
Creates a geometry object from a grid-aligned rectangle.
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.
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.
bool IsClosed
Returns true if the Geometry object is made of closed contours.
Definition: CartoTypeGeometry.h:240
Geometry(MapObject^ aMapObject)
Creates a geometry object containing the geometry of a map object.
Result ConvertLinesToGreatCircles(double aMaxDistanceInMeters)
Interpolates points at a maximum distance apart to convert lines to great circles....
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:307
A map object: a point, linear object, polygon object, or array (texture).
Definition: CartoTypeWrapper.h:210
A type for lists of map objects returned by search functions.
Definition: CartoTypeWrapper.h:984
Information about the intersection of two paths and their distance apart. For functions involving map...
Definition: CartoTypeGeometry.h:165
double NearestY2
The Y coordinate of the nearest point on the second path.
Definition: CartoTypeGeometry.h:180
double NearestY1
The Y coordinate of the nearest point on the first path.
Definition: CartoTypeGeometry.h:176
PathIntersectionType Type
The intersection type.
Definition: CartoTypeGeometry.h:170
double NearestX2
The X coordinate of the nearest point on the second path.
Definition: CartoTypeGeometry.h:178
double Distance
The distance between the paths.
Definition: CartoTypeGeometry.h:172
double NearestX1
The X coordinate of the nearest point on the first path.
Definition: CartoTypeGeometry.h:174
A type for lists of path intersection information objects returned by Geometry functions.
Definition: CartoTypeGeometry.h:188
A type for lists of path intersection types returned by Geometry functions.
Definition: CartoTypeGeometry.h:157
An on-curve or off-curve point for use in paths.
Definition: CartoTypeGeometry.h:62
PathPoint(double aX, double aY, PointType aType)
Creates the point (aX,aY,aType).
Definition: CartoTypeGeometry.h:67
double X
The X coordinate.
Definition: CartoTypeGeometry.h:72
PathPoint(PathPoint^ aPoint)
Creates a point by copying aPoint.
Definition: CartoTypeGeometry.h:69
double Y
The Y coordinate
Definition: CartoTypeGeometry.h:74
PointType Type
The point type: on-curve, or a quadratic or cubic spline control point.
Definition: CartoTypeGeometry.h:76
PathPoint()
Creates the point (0,0,OnCurve).
Definition: CartoTypeGeometry.h:65
A 2D point using floating-point coordinates.
Definition: CartoTypeGeometry.h:26
Point(Point^ aPoint)
Creates a point by copying aPoint.
Definition: CartoTypeGeometry.h:33
Point(double aX, double aY)
Creates the point (aX,aY).
Definition: CartoTypeGeometry.h:31
double Y
The Y coordinate.
Definition: CartoTypeGeometry.h:37
Point()
Creates the point (0,0).
Definition: CartoTypeGeometry.h:29
double X
The X coordinate.
Definition: CartoTypeGeometry.h:35
A grid-aligned rectangle with double-precision coordinates suitable for map points.
Definition: CartoTypeGeometry.h:84
double MaxX
The maximum X coordinate: the right edge.
Definition: CartoTypeGeometry.h:96
double MinY
The minimum Y coordinate: usually the bottom edge.
Definition: CartoTypeGeometry.h:94
double MinX
The minimum X coordinate: the left edge.
Definition: CartoTypeGeometry.h:92
double MaxY
The maximum Y coordinate: usually the top edge.
Definition: CartoTypeGeometry.h:98
Rect()
Creates the rectangle (0,0,0,0).
A path defining a set of open and closed curves.
Definition: CartoTypeGeometry.h:116
PathPoint ^ Point(int aContourIndex, int aPointIndex)
Returns a point given its contour and point indexes.
int PointCount(int aContourIndex)
Returns the number of points in a contour.
int ContourCount()
Returns the number of contours (sub-paths).
Definition: CartoTypeWrapper.h:41
CoordType
Coordinate types.
Definition: CartoTypeGeometry.h:127
@ Screen
A synonym for Display. Pixels on the display: X increases to the right and Y increases downwards.
@ Map
Map coordinates: 32nds of projected meters. X increases to the east and Y increases to the north.
@ Degree
Longitude (X) and latitude (Y) in degrees. X increases to the east and Y increases to the north.
@ MapMeter
Map meters: projected meters. X increases to the east and Y increases to the north.
@ Display
Pixels on the display: X increases to the right and Y increases downwards.
Result
Result codes returned by CartoType API functions.
Definition: CartoTypeResult.h:15
PointType
Types used by PathPoint.
Definition: CartoTypeGeometry.h:51
@ 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:103
@ 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:142
@ 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.
@ Intersects
The paths intersect or are identical.
Definition: CartoTypeGeometry.h:42
double Y
The Y coordinate.
Definition: CartoTypeGeometry.h:46
double X
The X coordinate.
Definition: CartoTypeGeometry.h:44