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

gtkfmaps.h

Go to the documentation of this file.
00001 /* gtkfmaps.h
00002 *
00003 * Widget for map display
00004 *
00005 */
00006 #ifndef __GTK_FMAPS_H__
00007 #define __GTK_FMAPS_H__
00008 
00009 #include <gdk/gdk.h>
00010 #include <gtk/gtkadjustment.h>
00011 #include <gtk/gtkwidget.h>
00012 #include <gtkgl/gtkglarea.h>
00013 #include <GL/gl.h>
00014 
00015 #ifndef LIBPQ_H
00016 #  include "libpq-fe.h"
00017 #  define LIBPQ_H
00018 #endif
00019 
00020 #ifdef __cpluplus
00021 extern "C" {
00022 #endif /* __cpluplus */
00023 
00024 #define GTK_TYPE_FMAPS                  (gtk_fmaps_get_type())
00025 #define GTK_FMAPS(obj)                  GTK_CHECK_CAST (obj, GTK_TYPE_FMAPS, GtkFMaps)
00026 #define GTK_FMAPS_CLASS(klass)          GTK_CHECK_CLASS_CAST (klass, GTK_TYPE_FMAPS, GtkFMapsClass)
00027 #define GTK_IS_FMAPS(obj)               GTK_CHECK_TYPE (obj, GTK_TYPE_FMAPS)
00028 #define GTK_IS_FMAPS_CLASS(klass)       GTK_CHECK_CLASS_TYPE ((klass),GTK_TYPE_FMAPS)
00029 
00030 /* Action Status */
00031 #define ACTION_NONE     0
00032 #define ACTION_ZOOM     1
00033 
00034 #define FM_POINT        0
00035 #define FM_PLINE        1
00036 
00037 /* enumeration of the various types of datum transformation */
00038 
00039 typedef enum
00040 {
00041   DAT_NONE = 0,                 /* no datum transformation: unknown datum or WGS84 */
00042   DAT_MOLENDENSKY = 1,          /* 3 parameters */
00043   DAT_BURSA_WOLFE = 2             /* 8 parameters */
00044 } GtkFMapsDatumType;
00045 
00046 /* enumeration of the various units, SI is default */
00047 
00048 typedef enum
00049 {
00050   UNIT_DEGREE = 0,
00051   UNIT_M = 1,
00052   UNIT_CM =2,
00053   UNIT_CHAINS = 3,
00054   UNIT_FEET = 4,
00055   UNIT_INCHES = 5,
00056   UNIT_KM = 6,
00057   UNIT_LINKS = 7,
00058   UNIT_MILES = 8,
00059   UNIT_MM = 9,
00060   UNIT_NAUTICALMILES = 10,
00061   UNIT_RODS = 11,
00062   UNIT_USSURVEYFEET = 12,
00063   UNIT_YARDS = 13,
00064   UNIT_FATHOM = 14
00065 } GtkFMapsUnitType;
00066 
00067 /* enumeration of the various projections supported */
00068 
00069 typedef enum
00070 {
00071   PROJ_NONE = 0,        /* to be used for unprojected objects: beware of results */
00072   PROJ_LONLAT = 1,
00073   PROJ_MERCATOR = 2
00074 /* to be devellopped
00075   PROJ_TRANSVERSE_MERCATOR
00076   PROJ_ALBERTS_EQUAL_AREA_CONIC
00077   PROJ_AZIMUTHAL_EQUIDISTANT
00078   PROJ_CYLINDRICAL_EQUAL_AREA
00079   PROJ_ECKERT_IV
00080   PROJ_ECKET_VI
00081   PROJ_EQUIDISTANT_CONIC
00082   PROJ_GALL
00083   PROJ_HOTLINE_OBLIQUE_MERCATOR
00084   PROJ_LAMBERT_AZIMUTHAL_EQUAL_AREA
00085   PROJ_LAMBERT_CONFORMAL_CONIC
00086   PROJ_MERCATOR
00087   PROJ_MILLER
00088   PROJ_MOLLWEIDE
00089   PROJ_NEW_ZEALND_MAP_GRID
00090   PROJ_REGIONAL_MERCATOR
00091   PROJ_ROBINSON
00092   PROJ_SINUSOIDAL
00093   PROJ_STEREOGRAPHIC
00094   PROJ_SWISS_OBLIQUE_MERCATOR
00095   end of planned projections */
00096 
00097 } GtkFMapsProjectionType;
00098 
00099 
00100 typedef struct _GtkFMaps GtkFMaps;
00101 typedef struct _GtkFMapsClass GtkFMapsClass;
00102 typedef struct _GtkFMapsTable GtkFMapsTable;
00103 typedef struct _GtkFMapsTableList GtkFMapsTableList;
00104 typedef struct _GtkFMapsProjDatum GtkFMapsProjDatum;
00105 
00106 struct _GtkFMaps
00107 {
00108   GtkGLArea glarea;     /* parent is GtkGLArea */
00109 
00110   /* local parameters*/
00111 
00112   /*Old values from adjustement stored so we know when something changes */
00113   /* I took these parameters from the gtk sample dial but don't know why? */
00114   gfloat old_value;
00115   gfloat old_lower;
00116   gfloat old_upper;
00117 
00118   GtkAdjustment *adjustment;
00119 
00120   /* parameters for GtkFMaps */
00121 
00122   gdouble zoom;                 /* level of zoom of the map */
00123   gdouble centerx;              /* center x of the map in projection units */
00124   gdouble centery;              /* center y of the map in projection units */
00125   gdouble width;                /* width of the map in projection units */
00126   gdouble height;               /* height of the map in projection units */
00127 
00128   gint actionstatus;            /* type of action to perform ZOOM,...*/
00129 
00130   gint  nbtables;
00131   GtkFMapsTable **table;        /* an array of pointers on each table (should be a GLIST or something)*/
00132 
00133   PGconn *conn;                 /* connection to the PostgreSQL DB */
00134 
00135   GtkFMapsProjDatum *projdatum;
00136 
00137 };
00138 
00139 struct _GtkFMapsClass
00140 {
00141   GtkGLAreaClass parent_class;
00142 
00143   /* list of signals */
00144 
00145 };
00146 
00147 /* structure containing the data used to draw a map */
00148 
00149 struct _GtkFMapsTable
00150 {
00151   /* table structure information */
00152   gchar *name;        /* table name */
00153   gint oid;                                             /* oid in PG */
00154   gboolean visible;             /* the table must be drawn */
00155   gboolean text;                        /* contains geoobj textual */
00156   gboolean vector;              /* contains geeobj vector */
00157   gboolean raster;              /* contains geoobj raster */
00158   gboolean image;               /* contains geoobj image */
00159 
00160   GtkFMapsProjDatum *projdatum;
00161 };
00162 
00163 /* projection datum structure */
00164 
00165 struct _GtkFMapsProjDatum
00166 {
00167   /*datum conversion parameters: loaded from the table and computed to fit the map datum */
00168   GtkFMapsDatumType datumtransform;
00169 
00170 
00171   gdouble dx,dy,dz;     /* datum shift */
00172   gdouble ex,ey,ez;     /* datum rotation */
00173   gdouble m;            /* scale */
00174   gdouble pm;           /* prime meridian */
00175 
00176   gdouble e,a,f;        /* eccentricity, semi major axis, flattening */
00177 
00178   /* Internal Parameters for the datum transformation calculation */
00179   gdouble r11,r12,r13;
00180   gdouble r21,r22,r23;
00181   gdouble r31,r32,r33;
00182 
00183   /* projection type */
00184   GtkFMapsProjectionType projection;
00185 
00186   /* projection parameters */
00187   gdouble par1,par2,par3,par4,par5,par6,par7,par8,par9,par10;
00188 };
00189 
00190 struct _GtkFMapsTableList       
00191 {
00192   gint  nbtables;
00193   GtkFMapsTable **table;                /* an array of pointers on each table (should be a GLIST or something)*/
00194 };
00195 
00196 /* Well Known Binary Format for geographic objects */
00197 
00198 typedef struct _Point Point;
00199 typedef struct _LinearRing LinearRing;
00200 typedef struct _WKBPoint WKBPoint;
00201 typedef struct _WKBLineString WKBLineString;
00202 typedef struct _WKBPolygon WKBPolygon;
00203 typedef struct _WKBMultiPoint WKBMultiPoint;
00204 typedef struct _WKBMultiLineString WKBMultiLineString;
00205 typedef struct _WKBMultiPolygon WKBMultiPolygon;
00206 typedef struct _WKBGeometry WKBGeometry;
00207 typedef struct _WKBGeometryCollection WKBGeometryCollection;
00208 
00209 
00210 struct _Point
00211 {
00212   gdouble x;
00213   gdouble y;
00214   gdouble z;
00215 };
00216 
00217 struct _LinearRing
00218 {
00219   guint32 numPoints;
00220   Point *points;
00221 };
00222 
00223 typedef enum
00224 {
00225   POINT = 1,
00226   LINESTRING = 2,
00227   POLYGON = 3,
00228   MULTIPOINT = 4,
00229   MULTILINESTRING = 5,
00230   MULTIPOLYGON = 6,
00231   GEOMETRYCOLLECTION = 7
00232 } wkbGeometryType;
00233 
00234 typedef enum
00235 {
00236   XDR = 0, // Big Endian
00237   NDR = 1 // Little Endian
00238 } wkbByteOrder;
00239 
00240 struct _WKBPoint {
00241   wkbByteOrder byteOrder;
00242   wkbGeometryType wkbType; // 1
00243   Point point;
00244 };
00245 
00246 struct _WKBLineString {
00247   wkbByteOrder byteOrder;
00248   wkbGeometryType wkbType; // 2
00249   guint32 numPoints;
00250   Point *points;
00251 };
00252 
00253 struct _WKBPolygon {
00254   wkbByteOrder byteOrder;
00255   wkbGeometryType wkbType; // 3
00256   guint32 numRings;
00257   LinearRing *rings;
00258 };
00259 
00260 struct _WKBMultiPoint {
00261   wkbByteOrder byteOrder;
00262   wkbGeometryType wkbType; // 4
00263   guint32 num_wkbPoints;
00264   WKBPoint *WKBPoints;
00265 };
00266 
00267 struct _WKBMultiLineString {
00268   wkbByteOrder byteOrder;
00269   wkbGeometryType wkbType; // 5
00270   guint32 num_wkbLineStrings;
00271   WKBLineString *WKBLineStrings;
00272 };
00273 
00274 struct _WKBMultiPolygon {
00275   wkbByteOrder byteOrder;
00276   wkbGeometryType wkbType; // 6
00277   guint32 num_wkbPolygons;
00278   WKBPolygon *wkbPolygons;
00279 };
00280 
00281 struct _WKBGeometryCollection {
00282   wkbByteOrder byte_order;
00283   wkbGeometryType wkbType; // 7
00284   guint32 num_wkbGeometries;
00285   WKBGeometry *wkbGeometries;
00286 };
00287 
00288 struct _WKBGeometry {
00289   union {
00290     WKBPoint point;
00291     WKBLineString linestring;
00292     WKBPolygon polygon;
00293     WKBGeometryCollection collection;
00294     WKBMultiPoint mpoint;
00295     WKBMultiLineString mlinestring;
00296     WKBMultiPolygon mpolygon;
00297   } object;
00298 };
00299 
00300 
00301 
00302 /* end of Well Known Binary Format of geometric objects */
00303 
00304 /* public procedures */
00305 
00306 GtkWidget*      gtk_fmaps_new                   (GtkAdjustment *adjustment, PGconn *conn);
00307 guint           gtk_fmaps_get_type              (void);
00308 GtkAdjustment*  gtk_fmaps_get_adjustment        (GtkFMaps *fmaps);
00309 void            gtk_fmaps_set_adjustment        (GtkFMaps *fmaps,
00310                                                  GtkAdjustment *adjustment);                                            
00311 void            gtk_fmaps_add_table             (GtkFMaps *fmaps, gchar *name, gboolean visible);
00312                                                 
00313 #ifdef __cpluplus
00314 }
00315 #endif /* __cpluplus */
00316 
00317 #endif /* __GTK_FMAPS_H__ */

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