forked from JulesStringer/GerberParser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wkb.h
161 lines (129 loc) · 3.08 KB
/
wkb.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#ifndef _WKB_INCLUDED
#define _WKB_INCLUDED 0
enum wkbGeometryType{
wkbUnknown = 0,
wkbPoint = 1,
wkbLineString = 2,
wkbPolygon = 3,
wkbMultiPoint = 4,
wkbMultiLineString = 5,
wkbMultiPolygon = 6,
wkbGeometryCollection = 7,
wkbCircle = 8 //this does not form part of the Open GIS spec and is for internal use only
};
enum wkbByteOrder{
wkbXDR = 0,
wkbNDR = 1 // Use this one for Intel Platforms
};
#define WKBPOINT wkbPoint
#define WKBLINESTRING wkbLineString
#define WKBPOLYGON wkbPolygon
#pragma pack(1)
#ifndef GM_POINT_DEFINED
#define GM_POINT_DEFINED
typedef struct tagGM_POINT
{
double x;
double y;
} GM_POINT;
#endif
typedef struct tagGM_LinearRing
{
ULONG numPoints;
GM_POINT Points[1];
} GM_LinearRing;
typedef struct tagWKB
{
BYTE byteOrder;
ULONG wkbType;
} WKB;
typedef struct tagWKBPoint
{
BYTE byteOrder;
ULONG wkbType;
GM_POINT Point;
} WKBPoint;
typedef struct tagWKBLineString
{
BYTE byteOrder;
ULONG wkbType;
ULONG numpoint;
GM_POINT Points[1];
} WKBLineString;
typedef struct tagWKBPolygon
{
BYTE byteOrder;
ULONG wkbType;
ULONG numRings;
GM_LinearRing rings[1];
} WKBPolygon;
typedef struct tagWKBMultiPoint
{
BYTE byteOrder;
ULONG wkbType;
ULONG num_wkbPoints;
WKBPoint WKBPoints[1];
} WKBMultiPoint;
typedef struct tagWKBMultiLineString
{
BYTE byteOrder;
ULONG wkbType;
ULONG num_wkbLineStrings;
WKBLineString WKBLineStrings[1];
} WKBMultiLineString;
typedef struct tagWKBMultiPolygon
{
BYTE byteOrder;
ULONG wkbType;
ULONG num_wkbPolygons;
WKBPolygon WKBPolygons[1];
} WKBMultiPolygon;
/*
typedef struct tagWKBGeometryCollection WKBGeometryCollection;
typedef struct tagWKBGeometry{
union{
WKBPoint point;
WKBLineString linestring;
WKBPolygon polygon;
WKBGeometryCollection collection;
WKBMultiPoint mpoint;
WKBMultiLineString mlinestring;
WKBMultiPolygon mpolygon;
}
}WKBGeometry;
*/
typedef struct tagWKBGeometryCollection
{
BYTE byteOrder;
ULONG wkbType;
ULONG num_wkbGeometries;
WKB wkb[1];
} WKBGeometryCollection;
//
// our own extremely useful specialization of polygon - the rectangle
//
#ifndef WKBRectangle_defined
#define WKBRectangle_defined
typedef struct tagGM_Rectangle
{
ULONG numPoints;
GM_POINT Points[5];
} GM_Rectangle;
typedef struct tagWKBRectangle
{
BYTE byteOrder;
ULONG wkbType;
ULONG numRings;
GM_Rectangle rings[1];
} WKBRectangle;
#endif
//the following is for internal use only and is NOT part of the open GIS spec
typedef struct tagWKBCircle
{
BYTE byteOrder;
ULONG wkbType;
GM_POINT Centre;
double Radius;
} WKBCircle;
#pragma pack()
#endif _WKB_INCLUDED