00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020
00021
00022 00023 00024 00025 00026 00027
00028 #define _GNU_SOURCE
00029
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033
00034 00035 00036 00037 00038 00039 00040 00041 00042
00043 00044 00045
00046
00047 #define FM_POINT 1
00048 #define FM_LINESTRING 2
00049 #define FM_POLYGON 3
00050 #define FM_MULTIPOINT 4
00051 #define FM_MULTILINESTRING 5
00052 #define FM_MULTIPOLYGON 6
00053 #define FM_GEOMETRYCOLLECTION 7
00054
00055 #define FM_BOX 101
00056
00057
00058
00059 typedef struct {
00060 int32 size;
00061 int8 byte_order;
00062 uint wkbtype;
00063 double minx;
00064 double miny;
00065 double minz;
00066 double maxx;
00067 double maxy;
00068 double maxz;
00069 char data[1];
00070 } GeoObj;
00071
00072 typedef struct {
00073 double x,y,z;
00074 } Point;
00075
00076 typedef struct {
00077 uint32 numPoints;
00078 Point points[1];
00079 } LinearRing;
00080
00081 enum wkbGeometryType {
00082 wkbPoint = FM_POINT,
00083 wkbLineString = FM_LINESTRING,
00084 wkbPolygon = FM_POLYGON,
00085 wkbMultiPoint = FM_MULTIPOINT,
00086 wkbMultiLineString = FM_MULTILINESTRING,
00087 wkbMultiPolygon = FM_MULTIPOLYGON,
00088 wkbGeometryCollection = FM_GEOMETRYCOLLECTION,
00089 wkbBox = FM_BOX
00090 };
00091
00092 enum wkbByteOrder {
00093 wkbXDR = 0,
00094 wkbNDR = 1
00095 };
00096
00097 typedef struct {
00098 int8 byteOrder;
00099 uint32 wkbType;
00100 Point point;
00101 } WKBPoint;
00102
00103 typedef struct {
00104 int8 byteOrder;
00105 uint32 wkbType;
00106 uint32 numPoints;
00107 Point points[1];
00108 } WKBLineString;
00109
00110 typedef struct {
00111 int8 byteOrder;
00112 uint32 wkbType;
00113 uint32 numRings;
00114 LinearRing rings[1];
00115 } WKBPolygon;
00116
00117 typedef struct {
00118 int8 byteOrder;
00119 uint32 wkbType;
00120 uint32 num_wkbPoints;
00121 WKBPoint *wkbPoints;
00122 } WKBMultiPoint;
00123
00124 typedef struct {
00125 int8 byteOrder;
00126 uint32 wkbType;
00127 uint32 num_wkbLineStrings;
00128 WKBLineString *wkbLineStrings;
00129 } WKBMultiLineString;
00130
00131 typedef struct {
00132 int8 byteOrder;
00133 uint32 wkbType;
00134 uint32 num_wkbPolygons;
00135 WKBPolygon *wkbPolygons;
00136 } WKBMultiPolygon;
00137
00138 typedef struct {
00139 int8 byteOrder;
00140 uint32 wkbType;
00141 double x[6];
00142 } WKBBox;
00143
00144 typedef struct _WKBGeometryCollection WKBGeometryCollection;
00145
00146 typedef union {
00147 WKBPoint point;
00148 WKBLineString linestring;
00149 WKBPolygon polygon;
00150
00151 WKBMultiPoint mpoint;
00152 WKBMultiLineString mlinestring;
00153 WKBMultiPolygon mpolygon;
00154 WKBBox box;
00155 } WKBGeometry;
00156
00157 00158 00159 00160 00161 00162 00163
00164
00165
00166
00167
00168 #ifdef __cplusplus
00169 };
00170 #endif