1 /* VPFVIEW.H */
2 
3 #ifndef __VPFVIEW_H__
4 #define __VPFVIEW_H__
5 
6 #include <stdlib.h> /* to pick up min/max... */
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include <ossim/vpfutil/set.h>
13 #ifdef __MSDOS__
14 #  include "gui.h"
15 #endif
16 #include <ossim/vpfutil/vpftable.h>
17 #include <ossim/vpfutil/linklist.h>
18 
19 #ifdef __MSDOS__
20 typedef unsigned char VPF_BOOLEAN;
21 #else
22 typedef unsigned VPF_BOOLEAN;
23 #if (!defined(_MSC_VER))
24 #  ifndef stricmp
25 #    define stricmp(a,b) ossim_strcasecmp(a,b)
26 #  endif
27 #  ifndef strcmpi
28 #    define strcmpi(a,b) ossim_strcasecmp(a, b)
29 #  endif
30 #  ifndef strncmpi
31 #    define strncmpi(a,b,c) ossim_strncasecmp(a,b,c)
32 #  endif
33 #  ifndef ltoa
34 #    define ltoa(l,s,len) sprintf(s,"%d",l)
35 #  endif
36 #  ifndef itoa
37 #    define itoa(i,s,len) sprintf(s,"%d",i)
38 #  endif
39 #endif
40 
41 #endif
42 
43 typedef char color_type;
44 
45 
46 /* Degree-minutes-seconds type */
47 typedef struct {
48    int   degrees;
49    int   minutes;
50    float seconds;
51 } dms_type;
52 
53 
54 /* Geographic extent */
55 typedef struct {
56    float x1, y1, x2, y2;
57 } extent_type;
58 
59 /* Currently supported VPF versions */
60 typedef enum { VPF_0_7, VPF_0_8 } vpf_version_type;
61 
62 
63 /* VPF database internal structure */
64 typedef struct {
65    char name[9];      /* Name of the VPF database */
66    char *path;        /* DOS path name to the database */
67    char **library;    /* Array of library names within the database */
68    int  nlibraries;   /* Number of libraries in the database */
69    char *producer;    /* Producer of the database - from header table */
70    vpf_version_type version; /* VPF Version of the database */
71    int byte_order;    /* Byte order of the database */
72 } database_type;
73 
74 
75 /* VPF coverage internal structure */
76 typedef struct {
77    char name[9];        /* Name of the coverage */
78    char *description;   /* Description of the coverage */
79    char *path;          /* DOS path name to the coverage */
80    int  topolevel;      /* Topology level of the coverage */
81 } coverage_type;
82 
83 
84 /* VPF feature types */
85 typedef enum { VPF_LINE=1, VPF_AREA, VPF_ANNO, VPF_POINT, VPF_COMPLEX_FEATURE=6 } vpf_feature_type;
86 
87 /* VPF primitive types */
88 typedef enum { VPF_EDGE=1, VPF_FACE, VPF_TEXT, VPF_ENTITY_NODE, VPF_CONNECTED_NODE }
89    vpf_primitive_type;
90 
91 
92 /* Units of measure */
93 typedef enum { VPF_UNKNOWN_UNITS, VPF_METERS, VPF_SECONDS, VPF_FEET, VPF_INCHES,
94 	       VPF_KILOMETERS, VPF_OTHER_UNITS, VPF_DEC_DEGREES } units_type;
95 
96 
97 /* VPF feature class internal structure */
98 typedef struct {
99    char name[40];       /* Name of the feature class */
100    char *description;   /* Description of the feature class */
101    int  coverage;       /* Containing coverage number */
102    char *table;         /* Feature table name */
103    vpf_primitive_type primclass; /* Primitive class */
104    char cprim[6];       /* Array of primclasses if primclass=COMPLEX */
105    set_type view_set;   /* Themes of the view in this feature class */
106 } feature_class_type;
107 
108 
109 /* VPF library internal structure */
110 typedef struct {
111    char name[9];            /* Name of the library */
112    char database[9];        /* Name of the containing database */
113    char *path;              /* DOS path name to the library */
114    char *description;       /* Library description */
115    extent_type extent;      /* Map extent of the library */
116    char security[15];       /* Security classification of the library */
117    coverage_type *cover;    /* Coverages within the library */
118    int ncover;              /* Number of coverages in the library */
119    feature_class_type *fc;  /* Feature classes within the library */
120    int nfc;                 /* Number of feature classes in the library */
121    long int ntiles;         /* Number of tiles in the library */
122    set_type tile_set;       /* Set of 'active' tiles in the library */
123    double tileheight;       /* 'Height' of tile 1 in the library */
124    VPF_BOOLEAN dec_degrees;     /* Coordinates in decimal degrees? */
125    char *prjname;           /* Projection name (if not dec_degrees) */
126    units_type units;        /* Units of measure (if not dec_degrees) */
127    vpf_version_type version; /* VPF Version of the database */
128 } library_type;
129 
130 
131 /* A theme is a single entry for a view of the database.  It can be */
132 /* thought of as a stored query with a description and symbology.   */
133 /* Each theme is associated with a feature class.                   */
134 typedef struct {
135    char *description;              /* Description of the theme */
136    char *fc;                       /* Feature class name for the theme */
137    int  fcnum;                     /* Theme's feature class number */
138    int  primclass;                 /* Primitive class of the theme */
139    char *text_col;                 /* Column to be displayed as text */
140    char *expression;               /* Query expression */
141    int  point_color, point_symbol; /* Point color and symbol */
142    int  line_color, line_symbol;   /* Line color and symbol */
143    int  area_color, area_symbol;   /* Area color and symbol */
144    int  text_color, text_symbol;   /* Text color and symbol */
145 } theme_type;
146 
147 
148 /* View structure.  Each view is associated with a particular database */
149 /* and a particular library within that datbase.                       */
150 typedef struct {
151    char database[9];         /* Database name */
152    char library[9];          /* Library name */
153    char name[9];             /* View name */
154    int  nthemes;             /* Number of themes in the view */
155    theme_type *theme;        /* Array of themes */
156    set_type selected;        /* Set of themes selected for display */
157    set_type displayed;       /* Set of displayed themes */
158    linked_list_type sellist; /* List of selected themes (ordered) */
159 } view_type;
160 
161 
162 /* Map environment information */
163 typedef struct {
164    extent_type mapextent;           /* Current map extent */
165    VPF_BOOLEAN     mapchanged;          /* Flag - has anything changed? */
166    VPF_BOOLEAN     mapdisplayed;        /* Flag - has the map been displayed? */
167    VPF_BOOLEAN     user_escape;         /* Flag - has the user hit escape? */
168    VPF_BOOLEAN     study_area_selected; /* Flag - study area selected? */
169    VPF_BOOLEAN     latlongrid;          /* Flag - lat-lon grid to be displayed?*/
170    VPF_BOOLEAN     scale_bar;           /* Flag - scale bar to be displayed? */
171 #ifdef __MSDOS__
172    window_type scale_bar_window;    /* Window containing the scale bar */
173 #endif
174    int         maptop;              /* Top y location of the map */
175    int         mapbottom;           /* Bottom y location of the map */
176    int         projection;          /* Current projection number */
177 #ifdef __MSDOS__
178    void far    (*forward_proj)();   /* Forward projection function pointer*/
179    void far    (*inverse_proj)();   /* Inverse projection function pointer*/
180 #endif
181 } map_environment_type;
182 
183 
184 /* Output devices */
185 #define SCREEN     1
186 #define POSTSCRIPT 2  /* Black and white */
187 #define COLORPS    3
188 #define PRINTER    4
189 
190 
191 /* Functions: */
192 
193 #include <ossim/vpfutil/vpfmisc.h>
194 
195 set_type query_table( char *query, vpf_table_type table );
196 #ifdef __cplusplus
197 }
198 #endif
199 
200 #endif
201