CartoType UWP API 9.6-4-g79291b60b
for development in C#, VB.NET and C++
CartoTypeGeometry.h
1/*
2CartoTypeGeometry.h
3Copyright (C) CartoType Ltd 2021-2023.
4See www.cartotype.com for more information.
5*/
6
7#pragma once
8
9#include <collection.h>
10
11using namespace Platform;
12using namespace Platform::Collections;
13using namespace Windows::Foundation::Collections;
14
15namespace CartoTypeCore
16{
17class PathIntersectionInfo;
18class Geometry;
19}
20
21namespace CartoType
22{
23ref class Geometry;
24ref class MapObject;
25
27using GeometryList = IVector<Geometry^>;
28
30using MapObjectList = IVector<MapObject^>;
31
33public ref class Point sealed
34 {
35 public:
37 Point() { }
39 Point(double aX, double aY) { X = aX; Y = aY; }
41 Point(Point^ aPoint) { if (aPoint) { X = aPoint->X; Y = aPoint->Y; } }
43 property double X;
45 property double Y;
46 };
47
49public value struct PointValue sealed
50 {
52 double X;
54 double Y;
55 };
56
58public enum class PointType
59 {
61 OnCurve,
65 Cubic
66 };
67
69public ref class PathPoint sealed
70 {
71 public:
75 PathPoint(double aX,double aY,PointType aType) { X = aX; Y = aY; Type = aType; }
77 PathPoint(PathPoint^ aPoint) { if (aPoint) { X = aPoint->X; Y = aPoint->Y; Type = aPoint->Type; } }
78
80 property double X;
82 property double Y;
84 property PointType Type;
85 };
86
88public ref class HeightProfilePoint sealed
89 {
90 public:
92 property double Longitude;
94 property double Latitude;
96 property double HeightInMeters;
98 property double TimeInSeconds;
100 property double DistanceInMeters;
101 };
102
107public ref class Rect sealed
108 {
109 public:
113 Rect(double aMinX,double aMinY,double aMaxX,double aMaxY);
114
116 property double MinX;
118 property double MinY;
120 property double MaxX;
122 property double MaxY;
123 };
124
126public enum class ClipOperation
127 {
131 Union,
135 Xor
136 };
137
139public interface class Path
140 {
144 int PointCount(int aContourIndex);
146 PathPoint^ Point(int aContourIndex,int aPointIndex);
147 };
148
150public enum class CoordType
151 {
153 Degree,
155 Display,
157 Screen = Display,
159 Map,
162 };
163
165public enum class PathIntersectionType
166 {
168 Unknown,
170 Separate,
171 /* <summary> The paths intersect or are identical. </summary> */
172 Intersects,
174 Contains,
177 };
178
180using PathIntersectionTypeList = IVector<PathIntersectionType>;
181
186public ref class PathIntersectionInfo sealed
187 {
188 public:
190
192 property PathIntersectionType Type;
194 property double Distance;
196 property double NearestX1;
198 property double NearestY1;
200 property double NearestX2;
202 property double NearestY2;
203
204 internal:
205 void Set(const CartoTypeCore::PathIntersectionInfo& aInfo);
206 };
207
209using PathIntersectionInfoList = IVector<PathIntersectionInfo^>;
210
224public ref class Geometry sealed: public Path
225 {
226 public:
228 Geometry(CoordType aCoordType,bool aClosed);
230 Geometry(MapObject^ aMapObject);
232 static Geometry^ RectGeometry(Rect^ aRect,CoordType aCoordType);
234 Geometry^ ContourGeometry(int aContourIndex);
236 bool ContourIsOuter(int aIndex);
238 void Clear();
240 property CoordType CoordType { CartoType::CoordType get(); }
242 void AppendPoint(Point^ aPoint);
246 void AppendPoint(double aX,double aY);
248 void AppendPoint(double aX,double aY,PointType aPointType);
252 virtual int ContourCount();
254 virtual int PointCount(int aContourIndex);
256 virtual PathPoint^ Point(int aContourIndex,int aPointIndex);
258 property bool IsEmpty { bool get(); };
260 property bool IsClosed { bool get(); };
262 void SetClosed(bool aClosed);
264 void Reverse();
280 bool Intersects(MapObject^ aMapObject);
282 bool Contains(MapObject^ aMapObject);
284 bool Contained(MapObject^ aMapObject);
293 Geometry^ Clip(ClipOperation aClipOperation,MapObject^ aMapObject);
303 GeometryList^ ClipMapObjects(ClipOperation aClipOperation,MapObjectList^ aMapObjectList);
311 static Geometry^ Envelope(MapObject^ aMapObject,double aOffsetInMeters);
313 Result ConvertLinesToGreatCircles(double aMaxDistanceInMeters);
314
315 internal:
316 Geometry(std::unique_ptr<CartoTypeCore::Geometry> aGeometry);
317
318 std::unique_ptr<CartoTypeCore::Geometry> m_geometry;
319 };
320
321}
A geometry class for creating map objects and specifying view areas. There are also functions for the...
Definition: CartoTypeGeometry.h:225
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:258
PathIntersectionInfoList ^ IntersectionInfos(MapObjectList^ aMapObjectList)
Returns information about the intersection of this geometry with an array of map objects....
GeometryList ^ ClipMapObjects(ClipOperation aClipOperation, MapObjectList^ aMapObjectList)
Returns the results of clipping a sequence of map objects returned by a function using this geometry,...
static Geometry ^ RectGeometry(Rect^ aRect, CoordType aCoordType)
Creates a geometry object from a grid-aligned rectangle.
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.
PathIntersectionTypeList ^ IntersectionTypes(MapObjectList^ aMapObjectList)
Returns the intersection types of this geometry with a list of map objects.
void AppendPathPoint(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.
void Reverse()
Reverses the order of the contours and the order of the points in each contour.
Geometry ^ ContourGeometry(int aContourIndex)
Creates a geometry object representing a contour selected by its index.
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.
bool IsClosed
Returns true if the Geometry object is made of closed contours.
Definition: CartoTypeGeometry.h:260
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 point on a height profile.
Definition: CartoTypeGeometry.h:89
double Latitude
The latitude of the position.
Definition: CartoTypeGeometry.h:94
double DistanceInMeters
The distance along the route from the start in meters.
Definition: CartoTypeGeometry.h:100
double TimeInSeconds
The estimated travel time from the start of the route in seconds.
Definition: CartoTypeGeometry.h:98
double Longitude
The longitude of the position.
Definition: CartoTypeGeometry.h:92
double HeightInMeters
The height above the standard datum (normalized sea level) in meters.
Definition: CartoTypeGeometry.h:96
A map object: a point, linear object, polygon object, or array (texture).
Definition: CartoTypeWrapper.h:236
Information about the intersection of two paths and their distance apart. For functions involving map...
Definition: CartoTypeGeometry.h:187
double NearestY2
The Y coordinate of the nearest point on the second path.
Definition: CartoTypeGeometry.h:202
double NearestY1
The Y coordinate of the nearest point on the first path.
Definition: CartoTypeGeometry.h:198
PathIntersectionType Type
The intersection type.
Definition: CartoTypeGeometry.h:192
double NearestX2
The X coordinate of the nearest point on the second path.
Definition: CartoTypeGeometry.h:200
double Distance
The distance between the paths.
Definition: CartoTypeGeometry.h:194
double NearestX1
The X coordinate of the nearest point on the first path.
Definition: CartoTypeGeometry.h:196
An on-curve or off-curve point for use in paths.
Definition: CartoTypeGeometry.h:70
PathPoint(double aX, double aY, PointType aType)
Creates the point (aX,aY,aType).
Definition: CartoTypeGeometry.h:75
double X
The X coordinate.
Definition: CartoTypeGeometry.h:80
double Y
The Y coordinate.
Definition: CartoTypeGeometry.h:82
PointType Type
The point type: on-curve, or a quadratic or cubic spline control point.
Definition: CartoTypeGeometry.h:84
PathPoint()
Creates the point (0,0,OnCurve).
Definition: CartoTypeGeometry.h:73
A 2D point using floating-point coordinates.
Definition: CartoTypeGeometry.h:34
Point(Point^ aPoint)
Creates a point by copying aPoint.
Definition: CartoTypeGeometry.h:41
Point(double aX, double aY)
Creates the point (aX,aY).
Definition: CartoTypeGeometry.h:39
double Y
The Y coordinate.
Definition: CartoTypeGeometry.h:45
Point()
Creates the point (0,0).
Definition: CartoTypeGeometry.h:37
double X
The X coordinate.
Definition: CartoTypeGeometry.h:43
A grid-aligned rectangle with double-precision coordinates suitable for map points.
Definition: CartoTypeGeometry.h:108
double MaxX
The maximum X coordinate: the right edge.
Definition: CartoTypeGeometry.h:120
double MinY
The minimum Y coordinate: usually the bottom edge.
Definition: CartoTypeGeometry.h:118
double MinX
The minimum X coordinate: the left edge.
Definition: CartoTypeGeometry.h:116
double MaxY
The maximum Y coordinate: usually the top edge.
Definition: CartoTypeGeometry.h:122
Rect()
Creates the rectangle (0,0,0,0).
A path defining a set of open and closed curves.
Definition: CartoTypeGeometry.h:140
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:69
CoordType
Coordinate types.
Definition: CartoTypeGeometry.h:151
@ 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:59
@ 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.
IVector< Geometry^> GeometryList
A type for lists of geometry objects returned by Geometry functions.
Definition: CartoTypeGeometry.h:27
ClipOperation
Types of clipping done by Geometry.Clip.
Definition: CartoTypeGeometry.h:127
@ 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.
IVector< MapObject^> MapObjectList
A type for lists of map objects returned by search functions.
Definition: CartoTypeGeometry.h:30
IVector< PathIntersectionType > PathIntersectionTypeList
A type for lists of path intersection types returned by Geometry functions.
Definition: CartoTypeGeometry.h:180
IVector< PathIntersectionInfo^> PathIntersectionInfoList
A type for lists of path intersection information objects returned by Geometry functions.
Definition: CartoTypeGeometry.h:209
PathIntersectionType
The ways two paths can intersect.
Definition: CartoTypeGeometry.h:166
@ 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:50
double Y
The Y coordinate.
Definition: CartoTypeGeometry.h:54
double X
The X coordinate.
Definition: CartoTypeGeometry.h:52