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

fmaps.h

Go to the documentation of this file.
00001 /* fmaps.h - fmaps main header file
00002  *
00003  * Copyright (C) 2000  Franck Martin <franck@sopac.org>
00004  *
00005  * This Program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This Program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public
00016  * License along with this Program; if not, write to the
00017  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018  * Boston, MA 02111-1307, USA.
00019  */
00020 
00021 /*
00022  * Modified by the FMaps Team and others 2000.  See the AUTHORS
00023  * file for a list of people on the FMaps Team.  See the ChangeLog
00024  * files for a list of changes.  These files are distributed with
00025  * FMaps at http://FMaps.sourceforge.net/.
00026  */
00027 
00028 #include <gtk/gtk.h>
00029 
00030 #include "gtkfmaps.h"
00031 
00032 #ifndef LIBPQ_H
00033 #  include "libpq-fe.h"
00034 #  define LIBPQ_H
00035 #endif
00036 
00037 #ifndef __FMAPS_H__
00038 #define __FMAPS_H__
00039 
00040 #ifdef __cpluplus
00041 extern "C" {
00042 #endif /* __cpluplus */
00043 
00044 
00045 gchar   *pghost,        /* hostname of the backend server */
00046                         *pgport,        /* port of the backend server */
00047                         *pgoptions,     /* special options to start up the backend server */
00048                         *pgtty;         /* debugging tty for the backend server */
00049 gchar   *dbName,        /* name of database */
00050       *username,            /* name of the user */
00051                         *password;          /* password of the user */
00052 
00053 PGconn          *conn;            /* connection handle to the database */
00054 PGresult        *res;           
00055 PGnotify        *notify;
00056 
00057 
00058 typedef enum
00059 {
00060   EXPORT_ELLIPSOID = 0,
00061   IMPORT_ELLIPSOID = 1,
00062   EXPORT_DATUM = 2,
00063   IMPORT_DATUM = 3,
00064   EXPORT_PROJECTION = 4,
00065   IMPORT_PROJECTION = 5,
00066   EXPORT_MIFMID = 6,  
00067   IMPORT_MIFMID = 7,
00068   EXPORT_SHAPEFILE = 8,
00069   IMPORT_SHAPEFILE = 9
00070 } FM_FileSelection_Action;
00071 
00072 FM_FileSelection_Action fileselection_action;
00073 
00074 /* structure to store the status of each row */
00075 typedef struct _FM_RowStatus FM_RowStatus;
00076 
00077 struct _FM_RowStatus
00078 {
00079   gboolean expandedbefore;
00080   gboolean selectable;
00081   gboolean selected;
00082 };
00083 
00084 /* Widgets */
00085 GtkWidget *dlgPreferences;
00086 GtkWidget *Fmaps;
00087 
00088 /* procedures */
00089 void fmaps_init(void);
00090 void fmaps_quit(void);
00091 
00092 void FM_ConnectDB(void);
00093 void FM_Create_Map_Tables(const gchar *tablename);
00094 int FM_Create_System_Table(PGconn *conn,gchar *tablename,gchar *tablestructure);
00095 void FM_CheckDB(PGconn *conn);
00096 void FM_MessageBox(const char *message);
00097 void FM_Rebuild_Clist(GtkCList *clist, gint type);
00098 void FM_Rebuild_Directory(void);
00099 
00100 /* Import Export Functions*/
00101 void FM_Import_Ellipsoid(PGconn* conn,const char *name);
00102 void FM_Export_Ellipsoid(PGconn* conn,const char *name);
00103 void FM_Import_Datum(PGconn* conn,const char *name);
00104 void FM_Export_Datum(PGconn* conn,const char *name);
00105 void FM_Import_Projection(PGconn* conn,const char *name);
00106 void FM_Export_Projection(PGconn* conn,const char *name);
00107 void FM_Import_MIFMID(PGconn* conn,const char *name);
00108 void FM_Import_ShapeFile(PGconn* conn,const char *name);
00109 
00110 /* Table Window Management functions */
00111 void FM_Display_Table(GtkWidget *tablewindow,gchar *tablename);
00112 
00113 /* MetaData Window Management functions */
00114 void FM_Init_MetaData(GtkWidget *metadatawindow);
00115 void FM_Display_MetaData(GtkWidget *metadatawindow,gchar *tablename);
00116 void FM_Save_MetaData(GtkWidget *metadatawindow);
00117 
00118 
00119 /* Metadata ISO 15046-15 Conformance level 1
00120  *  Cataloguing Information Schema
00121  *  The standard is still in draft
00122  */
00123 
00124 #define F_CATALOGUE_TABLE "CREATE TABLE f_catalogue (meta_file_id varchar(50),meta_parent_id varchar(50),title varchar(50),edition varchar(50),series varchar(50),issue_id varchar(50),refdate DATETIME,data_charset varchar(10),abstract varchar(255),purpose varchar(255),progress INT4,access_constraints varchar(255),use_constraints varchar(50),lineage_statement varchar(255),quality_narrative varchar(255),spatial_reference_code1 BOOLEAN,spatial_reference_code2 BOOLEAN,conform_level_code INT4,lang_meta_code char(2),meta_charset varchar(10),meta_date DATETIME)"
00125 
00126 /* progress:
00127  * 1-completed 2-in work 3-planned 4-required 5-on-going 6-historical archive 7-obsolete
00128  * conform_level_code:
00129  * 1-Level 1 2-Level 2 3-Level 1 with extensions
00130  *
00131  * spatial_reference_code1: geographic identifiers
00132  * spatial_reference_code2: coordinates
00133  */
00134 
00135 #define F_CATALOGUE_INITITATIVE_TABLE "CREATE TABLE f_catalogue_initiative (CID OID,init_type varchar(50),init_name varchar(50),refdate DATETIME)"
00136 
00137 #define F_CATALOGUE_PARTY_TABLE "CREATE TABLE f_catalogue_party (CID OID,party_individual varchar(50),party_org varchar(50), party_role_code INT4,address varchar(255),city varchar(50),admin_area varchar(50),country char(2),resource_url varchar(100),email varchar(100),phone varchar(50))"
00138 
00139 /* party_role_code:
00140  * 1-originator 2-publisher 3-custodian 4-principal investigator 5-content provider
00141  * 6-processor 7-distributor 8-point of contact 9-metadata provider
00142  */
00143 
00144 #define F_CATALOGUE_EXTENTS_TABLE "CREATE TABLE f_catalogue_extents (CID OID,westbc FLOAT8,eastbc FLOAT8,northbc FLOAT8,southbc FLOAT8,geo_name varchar(50),geo_name_ref varchar(50),time_extent DATETIME,min_elev INT4,max_elev INT4)"
00145 
00146 #define F_CATALOGUE_RESOLUTION_CODE_TABLE "CREATE TABLE f_catalogue_resolution_code (CID OID,resolution_code INT4)"
00147 
00148 /* resolution_code:
00149  * 0-1:500k-smaller 3-1:15k-1:39k  6-1:500-larger 9-2-5meters     12-20-29 meters 15-100-999 meters
00150  * 1-1:200k-1:499k  4-1:5k-1:14999 7-<1 meter     10-6-9 meters   13-30-40 meters 16-1-9 meters
00151  * 2-1:40k-1:199k   5-1:25k-1:4999 8-1-2 meters   11-10-19 meters 14-50-99 meters 17->=10km
00152  */
00153 
00154 #define F_CATALOGUE_LANG_DATA_CODE_TABLE "CREATE TABLE f_catalogue_lang_data_code (CID OID,lang_data_code char(2))"
00155 
00156 #define F_CATALOGUE_THEME_CODE_TABLE "CREATE TABLE f_catalogue_theme_code (CID OID,theme_code INT4)"
00157 
00158 /* theme_code:
00159  * 1-cadatral     5-geodetic control   9-soils       13-hydrologic    17-oceanographic 21-industry and energy
00160  * 2-cultural and 6-transportation and 10-political  14-environmental 18-modelling and 22-buildings and
00161  * demographic      communications        boundaries    monitoring       simulation       structures
00162  * 3-topography   7-radiance/imagery   11-vegetation 15-wetlands      19-facilities
00163  * 4-atmosphere   8-biosphere          12-cryosphere 16-land use      20-geologic    
00164  */
00165   
00166 #define F_CATALOGUE_KEYWORD_INFO_TABLE "CREATE TABLE f_catalogue_keyword_info (CID OID,keywords varchar(50),keyword_type_code INT4,keyword_thesaurus varchar(50))"
00167 
00168 /* keyword_type_code:
00169  * 1-temporal 2-theme 3-place 4-stratum 5-discipline
00170  */
00171  
00172 #define F_CATALOGUE_SPATIAL_REP_TYPE_CODE_TABLE "CREATE TABLE f_catalogue_spatial_rep_type_code (CID OID,spatial_rep_type_code INT4)"
00173 
00174 /* spatial_rep_type_code:
00175  * 1-text 2-vector 3-raster 4-image
00176  */
00177  
00178 #define F_CATALOGUE_DISTRIB_ID_TABLE "CREATE TABLE f_catalogue_distrib_id (CID OID,distrib_id varchar(50))"
00179 
00180 #define F_CATALOGUE_FORMAT_CODE_TABLE "CREATE TABLE f_catalogue_format_code (CID OID, format_code varchar(50))"
00181 
00182 #define F_CATALOGUE_MEDIA_TABLE "CREATE TABLE f_catalogue_media (CID OID,media varchar(50))"
00183 
00184 #define F_CATALOGUE_RESOURCE_URL_TABLE "CREATE TABLE f_catalogue_resource_url (CID OID,resource_url varchar(100))"
00185 
00186 
00187 /* old metadata table creation */
00188 #define F_DATA_TABLE "CREATE TABLE f_data (dataid SERIAL, data varchar(25),topic varchar(10),objects varchar(10),projid INT4, datumid INT4, ellipsoidid INT4);"
00189 #define F_DATA_TABLE_FIELD "(data, topic, objects, projid, datumid, ellipsoidid)"
00190 
00191 
00192 /* Projection table creation */
00193 
00194 #define F_PROJ_TABLE "CREATE TABLE f_projection (projid INT4, name varchar(50),type INT4, par1 FLOAT8, par2 FLOAT8, par3 FLOAT8, par4 FLOAT8, par5 FLOAT8, par6 FLOAT8, par7 FLOAT8, par8 FLOAT8, par9 FLOAT8, par10 FLOAT8)"
00195 #define F_DATUM_TABLE "CREATE TABLE f_datum (datumid INT4, name varchar(50), type INT4, ellipsoidid INT4, dx FLOAT8, dy FLOAT8, dz FLOAT8, ox FLOAT8, oy FLOAT8, oz FLOAT8, scale FLOAT8, pm FLOAT8)"
00196 #define F_ELLIPSOID_TABLE "CREATE TABLE f_ellipsoid (ellipsoidid INT4, name varchar(50), a FLOAT8, f FLOAT8)"
00197 #define F_PROJDATUM_TABLE "CREATE TABLE f_projdatum (projdatumid SERIAL, name varchar(100), projid INT4, datumid INT4, ellipsoidid INT4)"
00198 
00199 /* The Real Thing now 
00200  * The geographical object table
00201  *
00202  * tid: relates to the OID in the data table
00203  * size: size of a point or line width
00204  * factor/pattern: for a line
00205  * pattern: for a point, a predefined 3D object
00206  * r,g,b,a: Color/Alpha of the object if no color array
00207  * t1,t2: datetime start, datetime end
00208  * geo: the geographic object
00209  * color: the color array
00210  * edge: the edge array to select which edge is seen or not
00211  */
00212 #define F_GEO_TABLE "(tid OID, size FLOAT8, factor INT2, pattern INT4, r INT2, g INT2, b INT2, a INT2, t1 DATETIME, t2 DATETIME, geo GEOOBJ, color INT2[][], edge BOOL[])"
00213 #define F_GEO_TABLE_FIELD "tid , size , factor , pattern , r , g , b , a , t1, t2, geo , color , edge"
00214 
00215 
00216 #ifdef __cpluplus
00217 }
00218 #endif /* __cpluplus */
00219 
00220 #endif /* __FMAPS_H__ */

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