Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

geoobj.h

Go to the documentation of this file.
00001 /* geoobj.h -- A generic spatial object type for FMaps 
00002  *
00003  * Copyright (c) 2000 Eric G. Miller <egm2@jps.net>
00004  *                    Franck Martin <franck@sopac.org>
00005  * 
00006  * This Program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This Program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public
00017  * License along with this Program; if not, write to the
00018  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019  * Boston, MA 02111-1307, USA.
00020  */
00021 
00022 /*
00023  * Modified by the FMaps Team and others 2000.  See the AUTHORS
00024  * file for a list of people on the FMaps Team.  See the ChangeLog
00025  * files for a list of changes.  These files are distributed with
00026  * FMaps at http://FMaps.sourceforge.net/.
00027  */
00028 #define _GNU_SOURCE
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00034   /* Define our datatypes (follows OpenGIS data types)
00035    * FM_POINT               = "POINT (x y z)"
00036    * FM_LINESTRING          = "LINESTRING (x y z,... x y z)"
00037    * FM_POLYGON             = "POLYGON ((x y z, x y z,... x y z),..(x y z, x y z,... x y z)" 
00038    * FM_MULTIPOINT          = "MULTIPOINT (x y z,... x y z)" 
00039    * FM_MULTILINESTRING     = "MULTILINESTRING ((x y z, x y z,... x y z),..(x y z, x y z,... x y z)"
00040    * FM_MULTIPOLYGON        = "MULTIPOLYGON ((x y z, x y z,... x y z),..(x y z, x y z,... x y z)"
00041    * FM_GEOMETRYCOLLECTION  = "GEOMETRYCOLLECTION (POINT (x y z), POINT (x y z), LINESTRING (x y z,... x y z))" 
00042    */
00043   /* Define extended datatypes 
00044    * FM_BOX                 = "BOX (minx miny minz, maxx maxy maxz)"
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 /* FMaps extensions to OpenGIS */
00055 #define FM_BOX                101
00056 
00057   /* Define our data structures */
00058   
00059   typedef struct {
00060     int32     size;         /* the size of the structure      */
00061     int8      byte_order;   /* The order of data LSB or MSB   */
00062     uint      wkbtype;      /* Our datatype flag              */
00063     double    minx;         /* Bounding Box Coordinates       */
00064     double    miny;
00065     double    minz;
00066     double    maxx;
00067     double    maxy;
00068     double    maxz;
00069     char      data[1];      /* The resizable character string */
00070   } GeoObj;
00071 
00072   typedef struct {
00073     double    x,y,z;        /* long/lat/height or northing/easting/height   */
00074   } Point;
00075 
00076   typedef struct {
00077     uint32    numPoints;
00078     Point     points[1];      /* basic structure for points  */
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,         /* Big Endian     */
00094     wkbNDR = 1          /* Little Endina  */
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 /*    WKBGeometryCollection collection; */
00151     WKBMultiPoint         mpoint;
00152     WKBMultiLineString    mlinestring;
00153     WKBMultiPolygon       mpolygon;
00154     WKBBox                box;
00155   } WKBGeometry;
00156   
00157 /*  struct _WKBGeometryCollection {
00158     int8        byte_order;
00159     uint32      wkbType;
00160     uint32      num_wkbGeometries;
00161     WKBGeometry *wkbGeometries;
00162   };
00163 */  
00164   
00165 
00166 
00167 
00168 #ifdef __cplusplus
00169 };
00170 #endif

Generated at Sat Jan 6 20:55:34 2001 for FMaps by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000