GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-bea8435a9e
dig_structs.h
Go to the documentation of this file.
1 /*!
2  \file include/vect/dig_structs.h
3 
4  \brief Data structures for \ref vectorlib
5 
6  \author Written by Dave Gerdes (CERL) 5/1988
7  \author Updated to GRASS 5.7 by Radim Blazek (2001)
8  \author Updated to GRASS 7.0 by Markus Metz (2011)
9  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
10  */
11 #include <grass/config.h>
12 
13 #ifndef DIG___STRUCTS___
14 #define DIG___STRUCTS___
15 
16 #include <stdio.h>
17 
18 #include <sys/types.h>
19 
20 #include <grass/dgl.h>
21 #include <grass/shapefil.h>
22 #include <grass/rbtree.h>
23 #include <grass/rtree.h>
24 #include <grass/dbmi.h>
25 
26 #ifdef HAVE_OGR
27 #include <ogr_api.h>
28 #endif
29 
30 #ifdef HAVE_POSTGRES
31 #include <libpq-fe.h>
32 #endif
33 
34 /*!
35  \brief plus_t size
36 
37  3.10 changes plus_t to int. This assumes that any reasonable machine
38  will use 4 bytes to store an int. The diglib code is not guaranteed
39  to work if plus_t is changed to a type that is larger than an int.
40  */
41 typedef int plus_t;
42 
43 /*!
44  \brief Used by sites lib
45  */
46 struct site_att {
47  /*!
48  \brief Category number
49  */
50  int cat;
51  /*!
52  \brief Array of double attributes
53  */
54  double *dbl;
55  /*!
56  \brief Array of string attributes
57  */
58  char **str;
59 };
60 
61 /*!
62  \brief Bounding box
63  */
64 struct bound_box {
65  /*!
66  \brief North
67  */
68  double N;
69  /*!
70  \brief South
71  */
72  double S;
73  /*!
74  \brief East
75  */
76  double E;
77  /*!
78  \brief West
79  */
80  double W;
81  /*!
82  \brief Top
83  */
84  double T;
85  /*!
86  \brief Bottom
87  */
88  double B;
89 };
90 
91 /*!
92  \brief File definition
93  */
94 struct gvfile {
95  /*!
96  \brief File descriptor
97  */
98  FILE *file;
99  /*!
100  \brief Pointer to beginning of the file in the memory
101  */
102  char *start;
103  /*!
104  \brief Current position set by dig_seek()
105  */
106  char *current;
107  /*!
108  \brief End of file in the memory (pointer to first byte after)
109  */
110  char *end;
111  /*!
112  \brief Size of the file loaded to memory
113  */
114  off_t size;
115  /*!
116  \brief Allocated space
117  */
118  off_t alloc;
119  /*!
120  \brief Is file loaded?
121 
122  - 0 - not loaded
123  - 1 - loaded
124  */
125  int loaded;
126 };
127 
128 /*!
129  \brief Layer (old: field) information
130  */
131 struct field_info {
132  /*!
133  \brief Layer number
134  */
135  int number;
136  /*!
137  \brief Layer name (optional)
138  */
139  char *name;
140  /*!
141  \brief Name of DB driver ('sqlite', 'dbf', ...)
142  */
143  char *driver;
144  /*!
145  brief Name of database
146  */
147  char *database;
148  /*!
149  \brief Name of DB table
150  */
151  char *table;
152  /*!
153  \brief Name of key column (usually 'cat')
154  */
155  char *key;
156 };
157 
158 /*!
159  \brief Database links
160  */
161 struct dblinks {
162  /*!
163  \brief Pointer to the first field_info structure
164  */
165  struct field_info *field;
166  /*!
167  \brief Number of allocated slots
168  */
170  /*!
171  \brief Number of available layers (old: fields)
172  */
173  int n_fields;
174 };
175 
176 /*!
177  \brief Portability info
178 
179  Set by V1_open_new() or V1_open_old()
180  */
181 struct Port_info {
182  /*!
183  \brief File byte order
184  */
186  /*!
187  \brief Size of `off_t` data type
188  */
190 
191  /*!
192  \brief Conversion matrices between file and native byte order (double)
193  */
194  unsigned char dbl_cnvrt[PORT_DOUBLE];
195  /*!
196  \brief Conversion matrices between file and native byte order (float)
197  */
198  unsigned char flt_cnvrt[PORT_FLOAT];
199  /*!
200  \brief Conversion matrices between file and native byte order (long)
201  */
202  unsigned char lng_cnvrt[PORT_LONG];
203  /*!
204  \brief Conversion matrices between file and native byte order (int)
205  */
206  unsigned char int_cnvrt[PORT_INT];
207  /*!
208  \brief Conversion matrices between file and native byte order (short)
209  */
210  unsigned char shrt_cnvrt[PORT_SHORT];
211  /*!
212  \brief Conversion matrices between file and native byte order (off_t)
213  */
214  unsigned char off_t_cnvrt[PORT_OFF_T];
215  /*!
216  \brief Quick reading flag for double
217 
218  Specify if native byte order of that type is the same
219  as byte order of vector file (TRUE) or not (FALSE)
220  */
222  /*!
223  \brief Quick reading flag for float
224 
225  Specify if native byte order of that type is the same
226  as byte order of vector file (TRUE) or not (FALSE)
227  */
229  /*!
230  \brief Quick reading flag for long
231 
232  Specify if native byte order of that type is the same
233  as byte order of vector file (TRUE) or not (FALSE)
234  */
236  /*!
237  \brief Quick reading flag for int
238 
239  Specify if native byte order of that type is the same
240  as byte order of vector file (TRUE) or not (FALSE)
241  */
243  /*!
244  \brief Quick reading flag for short
245 
246  Specify if native byte order of that type is the same
247  as byte order of vector file (TRUE) or not (FALSE)
248  */
250  /*!
251  \brief Quick reading flag for off_t
252 
253  Specify if native byte order of that type is the same
254  as byte order of vector file (TRUE) or not (FALSE)
255  */
257 };
258 
259 /*!
260  \brief List of dead lines in the file
261 
262  \todo Implement it
263 
264  The space can be reused, not yet used
265  */
266 struct recycle {
267  char dummy;
268 };
269 
270 /*! \brief Backward compatibility version info */
271 struct Version_info {
272  /*! \brief Current version (major) */
273  int major;
274  /*! \brief Current version (minor) */
275  int minor;
276  /*! \brief Earliest version that can use this data format (major) */
278  /*! \brief Earliest version that can use this data format (minor) */
280 };
281 
282 /*!
283  \brief Vector map header data
284 
285  Holds header data of vector map (see \ref vlibMap_info)
286  */
287 struct dig_head {
288  /*!
289  \brief Organization name
290  */
292  /*!
293  \brief Map date
294  */
295  char *date;
296  /*!
297  \brief User name
298  */
299  char *user_name;
300  /*!
301  \brief Map name
302  */
303  char *map_name;
304  /*!
305  \brief Source date
306  */
307  char *source_date;
308  /*!
309  \brief Original scale
310  */
312  /*!
313  \brief Comments
314  */
315  char *comment;
316  int proj; /* projection */
317 
318  /*!
319  \brief Zone (UTM only)
320  */
322  /*!
323  \brief Threshold for digitization
324  */
325  double digit_thresh;
326 
327  /* Programmers should NOT touch any thing below here */
328  /* Library takes care of everything for you */
329 
330  /*! \brief Version info for coor file */
331  struct Version_info coor_version;
332 
333  /*!
334  \brief 2D/3D vector data
335 
336  - zero for 2D data
337  - non-zero for 3D data
338  */
339  int with_z;
340 
341  /*!
342  \brief Coor file size
343  */
344  off_t size;
345  /*!
346  \brief Coor header size
347  */
348  long head_size;
349 
350  /*!
351  \brief Portability information
352  */
353  struct Port_info port;
354 
355  /*!
356  \brief Offset of last read line
357  */
358  off_t last_offset;
359 
360  /*!
361  \brief Recycle dead line
362 
363  \todo Not implemented yet
364  */
365  struct recycle *recycle;
366 };
367 
368 /*!
369  \brief Coor file info
370  */
371 struct Coor_info {
372  /*!
373  \brief Total size (in bytes)
374  */
375  off_t size;
376  /*!
377  \brief Time of last modification
378  */
379  long mtime;
380 };
381 
382 /*!
383  \brief Data structure used for building pseudo-topology
384 
385  See Vect__build_sfa() (Format_info_ogr and Format_info_pg) for
386  implementation issues.
387  */
389  /*!
390  \brief Offset list
391 
392  Array where feature/part info is stored for each feature in
393  GRASS. This is not used for GV_CENTROID. Because one feature may
394  contain more elements (geometry collection also recursively),
395  offset for one line may be stored in more records. First record
396  is FID, next records are part indexes if necessary.
397 
398  Example 1:
399 
400  5. ring in 3. polygon in 7. feature (multipolygon) of geometry
401  collection which has FID = 123 123 (feature 123: geometry
402  collection) 6 (7. feature in geometry collection: multiPolygon) 2
403  (3. polygon) 4 (5. ring in the polygon)
404 
405  Example 2: geometry collection FID '1' containing one point, one
406  linestring and one polygon
407 
408  \verbatim
409  Offset:
410 
411  idx offset note
412  ----------------
413  0 1 FID
414  1 0 first part (point)
415 
416  2 1 FID
417  3 1 second part (linestring)
418 
419  4 1 FID
420  5 2 third part (polygon)
421  6 0 first ring of polygon
422 
423  GRASS topology:
424 
425  line idx
426  -----------------
427  1 0 point
428  2 2 line
429  3 4 boundary
430  4 1 centroid read from topo (idx == FID)
431 
432  In PostGIS Topology mode the offset array is used for mapping
433  nodes.
434  \endverbatim
435  */
436  int *array;
437  /*!
438  \brief Number of items in offset list
439  */
441  /*!
442  \brief Space allocated for offset list
443  */
445 };
446 
447 /*!
448  \brief Lines cache for reading feature (non-native formats)
449  */
451  /*!
452  \brief Lines array
453 
454  Some simple features require more allocated lines (eg. polygon
455  with more rings, multipoint, or geometrycollection)
456 
457  Line cache is also used for PostGIS Topology to store single
458  topological element (ctype == CACHE_FEATURE) or all elements
459  from the map (ctype == CACHE_MAP) to avoid random access which
460  is very costly.
461  */
462  struct line_pnts **lines;
463  /*!
464  \brief List of line types (GV_POINT, GV_LINE, ...)
465  */
467  /*!
468  \brief List of line cats (used only for PostGIS Topology access)
469  */
471  /*!
472  \brief Number of allocated lines in cache
473  */
475  /*!
476  \brief Number of lines which forms current feature
477  */
479  /*!
480  \brief Next line to be read from cache
481  */
483  /*!
484  \brief Feature id
485  */
486  long fid;
487  /*!
488  \brief Simple feature type (currently used only by PG format)
489  */
491  /*!
492  \brief Cache type
493 
494  Currently used only by PostGIS Topology which allows caching the
495  whole map (CACHE_MAP) */
496  int ctype;
497 };
498 
499 /*!
500  \brief Non-native format info (OGR)
501 
502  \todo Structure size should not change depending on compilation I
503  think, do it better
504  */
506  /*!
507  \brief OGR driver name
508  */
509  char *driver_name;
510  /*!
511  \brief OGR datasource name
512  */
513  char *dsn;
514  /*!
515  \brief OGR layer name
516  */
517  char *layer_name;
518  /*!
519  \brief SQL where statement (to filter features)
520  */
521  char *where;
522 #ifdef HAVE_OGR
523  /*!
524  \brief Pointer to OGRDriver
525  */
526  OGRSFDriverH driver;
527  /*!
528  \brief Pointer to OGRDataSource
529  */
530  OGRDataSourceH ds;
531  /*!
532  \brief Pointer to OGRLayer
533  */
534  OGRLayerH layer;
535 #else
536  void *driver;
537  void *ds;
538  void *layer;
539 #endif
540 
541  /*!
542  \brief Open DB driver when writing attributes
543 
544  This driver is open by V2_open_new_ogr() and closed by
545  V1_close_ogr().
546  */
548 
549  /*!
550  \brief Array of OGR DSN options
551  */
552  char **dsn_options;
553  /*!
554  \brief Array of OGR layer options
555  */
557 
558  /*!
559  \brief Lines cache for reading feature
560  */
561  struct Format_info_cache cache;
562 
563  /*!
564  \brief Cache to avoid repeated reading (level 2)
565 
566  NULL if no feature is in cache
567  */
568 #ifdef HAVE_OGR
569  OGRFeatureH feature_cache;
570 #else
571  void *feature_cache;
572 #endif
573 
574  /*!
575  \brief Offset list used for building pseudo-topology
576  */
577  struct Format_info_offset offset;
578 
579  /*!
580  \brief Next line to be read
581 
582  Used by V2_read_next_line_ogr()
583  */
585 };
586 
587 /*!
588  \brief Non-native format info (PostGIS)
589  */
591  /*!
592  \brief Connection string
593  */
594  char *conninfo;
595  /*!
596  \brief Database name (derived from conninfo)
597  */
598  char *db_name;
599  /*!
600  \brief Schema name
601  */
602  char *schema_name;
603  /*!
604  \brief Table name
605  */
606  char *table_name;
607  /*!
608  \brief SQL where statement (of filter features)
609  */
610  char *where;
611  /*!
612  \brief FID column
613  */
614  char *fid_column;
615  /*!
616  \brief Geometry column (simple feature access)
617  */
618  char *geom_column;
619  /*!
620  \brief Feature type (simple feature access)
621  */
623  /*!
624  \brief Coordinates dimension (2D or 3D)
625  */
626  int coor_dim;
627  /*!
628  \brief Spatial reference system id (see spatial_ref_sys
629  table)
630  */
631  int srid;
632 
633  /*!
634  \brief Open DB driver when writing attributes
635 
636  This driver is open by V2_open_new_pg() and closed by
637  V1_close_pg().
638  */
640  struct field_info *fi;
641 
642  /*!
643  \brief Start/Finish transaction
644  */
646 #ifdef HAVE_POSTGRES
647  /*!
648  \brief PGconn object (generated by PQconnectdb)
649  */
650  PGconn *conn;
651  PGresult *res;
652 #else
653  void *conn;
654  void *res;
655 #endif
656  /*!
657  \brief Open cursor
658  */
659  char *cursor_name;
661 
662  /*!
663  \brief Next line to be read
664  */
666 
667  /*!
668  \brief Lines cache for reading feature
669  */
670  struct Format_info_cache cache;
671 
672  /*!
673  \brief Offset list used for building pseudo-topology (simple
674  features access)
675  */
676  struct Format_info_offset offset;
677 
678  /* PostGIS topology support */
679  /*!
680  \brief TopoGeometry column (feature table)
681  */
683  /*!
684  \brief Topology schema name and id
685  */
688  /*!
689  \brief Topology format
690 
691  TRUE to store only Topo-Geo data in DB otherwise GRASS-like
692  topology is also maintained in DB
693  */
695 };
696 
697 /*!
698  \brief Non-native format info (currently only OGR is implemented)
699  */
700 struct Format_info {
701  /*!
702  \brief id?
703  */
704  int i;
705  /*!
706  \brief OGR info
707  */
708  struct Format_info_ogr ogr;
709  /*!
710  \brief PostGIS info
711  */
712  struct Format_info_pg pg;
713 };
714 
715 /*!
716  \brief Category index
717  */
718 struct Cat_index {
719  /*!
720  \brief Field (layer) number
721  */
722  int field;
723  /*!
724  \brief Number of items in cat array
725  */
726  int n_cats;
727  /*!
728  \brief Allocated space in cat array
729  */
730  int a_cats;
731  /*!
732  \brief Array of cats (cat, type, lines/area)
733  */
734  int (*cat)[3];
735  /*!
736  \brief Number of unique cats (not updated)
737  */
738  int n_ucats;
739  /*!
740  \brief Number of types in type
741  */
742  int n_types;
743  /*!
744  \brief Number of elements for each type
745 
746  - GV_POINT
747  - GV_LINE
748  - GV_BOUNDARY
749  - GV_CENTROID
750  - GV_FACE
751  - GV_KERNEL
752  - GV_AREA
753  */
754  int type[7][2];
755  /*!
756  \brief Offset of the beginning of this index in cidx file
757  */
758  off_t offset;
759 };
760 
761 /*!
762  \brief Basic topology-related info
763 
764  Holds basic topology-related information about vector map
765 
766  Important note: you should NOT store non-topological information in
767  topological structures.
768  */
769 struct Plus_head {
770  /*! \brief Backward compatibility version info */
771  struct {
772  /*! \brief Version info for topology file */
773  struct Version_info topo;
774  /*! \brief Version info for spatial index file */
775  struct Version_info spidx;
776  /*! \brief Version info for category index file */
777  struct Version_info cidx;
779 
780  /*!
781  \brief 2D/3D vector data
782 
783  - WITH_Z
784  - WITHOUT_Z
785  */
786  int with_z;
787  /*!
788  \brief 2D/3D spatial index
789 
790  - WITH_Z
791  - WITHOUT_Z
792  */
794 
795  /*!
796  \brief Offset size
797 
798  Because Plus_head is available to all relevant
799  functions
800  */
802 
803  /*** file header size ***/
804 
805  /*!
806  \brief Topo header size
807  */
808  long head_size;
809  /*!
810  \brief Spatial index header size
811  */
813  /*!
814  \brief Category index header size
815  */
817 
818  /*!
819  \brief Release memory occupied by support structures
820  (topo, spatial, category)
821  */
823 
824  /*** portability info */
825 
826  /*!
827  \brief Portability information
828  */
829  struct Port_info port;
830  /*!
831  \brief Portability information for spatial index
832  */
833  struct Port_info spidx_port;
834  /*!
835  \brief Portability information for category index
836  */
837  struct Port_info cidx_port;
838  /*!
839  \brief Access mode
840 
841  - GV_MODE_READ
842  - GV_MODE_WRITE
843  - GV_MODE_RW
844  */
845  int mode;
846 
847  /*!
848  \brief Highest level of topology currently available
849 
850  - GV_BUILD_NONE
851  - GV_BUILD_BASE
852  - GV_BUILD_AREAS
853  - GV_BUILD_ATTACH_ISLES
854  - GV_BUILD_CENTROIDS
855  - GV_BUILD_ALL
856  */
857  int built;
858  /*!
859  \brief Bounding box of features
860  */
861  struct bound_box box;
862 
863  /*** topology ***/
864  /*!
865  \brief Array of nodes
866  */
867  struct P_node **Node;
868  /*!
869  \brief Array of vector geometries
870  */
871  struct P_line **Line;
872  /*!
873  \brief Array of areas
874  */
875  struct P_area **Area;
876  /*!
877  \brief Array of isles
878  */
879  struct P_isle **Isle;
880 
881  /* add here P_FACE, P_VOLUME, P_HOLE */
882 
883  /*!
884  \brief Current number of points
885  */
887  /*!
888  \brief Current number of lines
889  */
891  /*!
892  \brief Current number of boundaries
893  */
895  /*!
896  \brief Current number of centroids
897  */
899  /*!
900  \brief Current number of faces
901  */
903  /*!
904  \brief Current number of kernels
905  */
907  /*!
908  \brief Current number of volume faces
909  */
911  /*!
912  \brief Current number of hole faces
913  */
915 
916  /*!
917  \brief Current number of topological features derived from vector
918  geometries
919  */
920  /*!
921  \brief Current number of nodes
922  */
924  /*!
925  \brief Current number of edges
926  */
928  /*!
929  \brief Current number of lines
930  */
932  /*!
933  \brief Current number of areas
934  */
936  /*!
937  \brief Current number of isles
938  */
940  /*!
941  \brief Current number of faces
942  */
944  /*!
945  \brief Current number of volumes
946  */
948  /*!
949  \brief Current number of holes
950  */
952 
953  /*!
954  \brief Number of allocated nodes
955 
956  i.e. array size - 1
957  */
959  /*!
960  \brief Number of allocated edges
961 
962  i.e. array size - 1
963  */
965  /*!
966  \brief Number of allocated lines
967 
968  i.e. array size - 1
969  */
971  /*!
972  \brief Number of allocated areas
973 
974  i.e. array size - 1
975  */
977  /*!
978  \brief Number of allocated isles
979 
980  i.e. array size - 1
981  */
983  /*!
984  \brief Number of allocated faces
985 
986  i.e. array size - 1
987  */
989  /*!
990  \brief Number of allocated volumes
991 
992  i.e. array size - 1
993  */
995  /*!
996  \brief Number of allocated holes
997 
998  i.e. array size - 1
999  */
1001 
1002  /*!
1003  \brief Offset of array of nodes in topo file
1004  */
1006  /*!
1007  \brief Offset of array of edges in topo file
1008  */
1010  /*!
1011  \brief Offset of array of vector geometries in topo file
1012  */
1014  /*!
1015  \brief Offset of array of areas in topo file
1016  */
1018  /*!
1019  \brief Offset of array of isles in topo file
1020  */
1022  /*!
1023  \brief Offset of array of volumes in topo file
1024  */
1026  /*!
1027  \brief Offset of array of holes in topo file
1028  */
1030 
1031  /*** spatial index ***/
1032  /*!
1033  \brief Spatial index built?
1034 
1035  Set to 1 if spatial index is available
1036  */
1038  /*!
1039  \brief Build new spatial index
1040 
1041  Set to 1 if new spatial index will be generated
1042  */
1044  /*!
1045  \brief Build new spatial index in file
1046 
1047  Set to 1 to build new indices in file
1048  */
1050 
1051  /*!
1052  \brief Spatial index file pointer
1053  */
1054  struct gvfile spidx_fp;
1055 
1056  /*!
1057  \brief Offset of nodes in sidx file
1058  */
1060  /*!
1061  \brief Offset of lines in sidx file
1062  */
1064  /*!
1065  \brief Offset of areas in sidx file
1066  */
1068  /*!
1069  \brief Offset of isles in sidx file
1070  */
1072  /*!
1073  \brief Offset of faces in sidx file
1074  */
1076  /*!
1077  \brief Offset of volumes in sidx file
1078  */
1080  /*!
1081  \brief Offset of holes in sidx file
1082  */
1084 
1085  /*!
1086  \brief Node spatial index
1087  */
1089  /*!
1090  \brief Line spatial index
1091  */
1093  /*!
1094  \brief Area spatial index
1095  */
1097  /*!
1098  \brief Isles spatial index
1099  */
1101  /*!
1102  \brief Faces spatial index
1103  */
1105  /*!
1106  \brief Volumes spatial index
1107  */
1109  /*!
1110  \brief Holes spatial index
1111  */
1113 
1114  /*** category index ***/
1115  /*!
1116  \brief Update category index if vector is modified
1117 
1118  By default, category index is not updated
1119  */
1121 
1122  /*!
1123  \brief Number of category indexes (one for each field/layer)
1124  */
1125  int n_cidx;
1126  /*!
1127  \brief Allocated space for category indexes
1128  */
1129  int a_cidx;
1130  /*!
1131  \brief Array of category indexes
1132  */
1133  struct Cat_index *cidx;
1134  /*!
1135  \brief Category index to be updated
1136 
1137  Set to 1 when cidx is created
1138  and reset to 0 whenever any line is changed
1139  */
1141 
1142  /*!
1143  \brief Size of coor file
1144  */
1145  off_t coor_size;
1146  /*!
1147  \brief Time of last coor modification
1148  */
1150 
1151  /*** level 2 ***/
1152  /*!
1153  \brief List of updated lines/nodes
1154 
1155  Note: Vect_set_updated() must be called to maintain this list
1156  */
1157  struct {
1158  /*!
1159  \brief Indicates if the list of updated features is maintained
1160  */
1162 
1163  /*!
1164  \brief Array of updated lines
1165 
1166  List of lines and nodes updated (topo info for the line was
1167  changed) by last write/rewrite/delete operation.
1168  Lines/nodes in the list may be deleted (e.g. delete
1169  boundary: first added for delete area and then delete
1170  */
1171  int *uplines;
1172  /*!
1173  \brief Array of updated lines - offset
1174 
1175  Negative value for dead (deleted) lines - used by Vect_restore_line()
1176  */
1178  /*!
1179  \brief Allocated array of lines
1180  */
1182  /*!
1183  \brief Number of updated lines
1184  */
1186  /*!
1187  \brief Array of updated nodes
1188  */
1189  int *upnodes;
1190  /*!
1191  \brief Allocated array of nodes
1192  */
1194  /*!
1195  \brief number of updated nodes
1196  */
1199 };
1200 
1201 /*!
1202  \brief Graph-related section (see \ref dglib)
1203  */
1204 struct Graph_info {
1205  /*!
1206  \brief Line type used to build the graph
1207  */
1209  /*!
1210  \brief Graph structure
1211  */
1213  /*!
1214  \brief Shortest path cache
1215  */
1217  /*!
1218  \brief Forward costs used for graph
1219 
1220  dglGetEdge() is not supported for _DGL_V1)
1221  */
1222  double *edge_fcosts;
1223  /*!
1224  \brief backward costs used for graph
1225  */
1226  double *edge_bcosts;
1227  /*!
1228  \brief Node costs used for graph
1229  */
1230  double *node_costs;
1231  /*!
1232  \brief Edge and node costs multiplicator
1233  */
1235 };
1236 
1237 /*! \brief
1238  Vector map info
1239 
1240  Maintains all information about an individual open vector map. The
1241  structure must be passed to the most vector library routines.
1242  */
1243 struct Map_info {
1244 
1245  /*** common info for all formats ***/
1246 
1247  /*!
1248  \brief Map format (native, ogr, postgis)
1249 
1250  - GV_FORMAT_NATIVE
1251  - GV_FORMAT_OGR
1252  - GV_FORMAT_OGR_DIRECT
1253  - GV_FORMAT_POSTGIS
1254  */
1255  int format;
1256 
1257  /*!
1258  \brief Temporary map flag
1259  */
1261 
1262  /*!
1263  \brief Array of DB links
1264  */
1265  struct dblinks *dblnk;
1266 
1267  /*!
1268  \brief Plus info (topology, version, ...)
1269  */
1270  struct Plus_head plus;
1271 
1272  /*!
1273  \brief Open indicator
1274 
1275  Should be 0x5522AA22 (VECT_OPEN_CODE) if opened correctly
1276  or 0x22AA2255 (VECT_CLOSED_CODE) if closed
1277 
1278  Anything else implies that structure has never been initialized
1279  */
1280  int open;
1281 
1282  /* Open mode
1283 
1284  - read (GV_MODE_READ),
1285  - write (GV_MODE_WRITE),
1286  - rw (GV_MODE_RW)
1287  */
1288  int mode;
1289 
1290  /*!
1291  \brief Topology level
1292 
1293  - 1 (without topo)
1294  - 2 (with 2D topology)
1295  - 3 (with 3D topology) - not yet implemented
1296  */
1297  int level;
1298 
1299  /*!
1300  \brief Open only header
1301 
1302  Non-zero code to open only header of vector map
1303  */
1305 
1306  /*!
1307  \brief Support files were updated
1308 
1309  Non-zero code to indicate that supoort file were updated
1310  */
1312 
1313  /*!
1314  \brief Map name (for 4.0)
1315  */
1316  char *name;
1317  /*!
1318  \brief Mapset name
1319  */
1320  char *mapset;
1321  /*!
1322  \brief Location name
1323 
1324  Note: location and gisdbase is useful if changed (v.proj or external
1325  apps)
1326  */
1327  char *location;
1328  /*!
1329  \brief GISDBASE path
1330  */
1331  char *gisdbase;
1332 
1333  /*!
1334  \brief Feature id for sequential access
1335 
1336  Note: Line id starts with 1 - see Vect_read_next_line()
1337  */
1339 
1340  /*!
1341  \brief Constraints for sequential feature access
1342  */
1343  struct {
1344  /*!
1345  \brief Non-zero value to enable region constraint
1346  */
1348  /*!
1349  \brief Region (bbox) constraint
1350  */
1351  struct bound_box box;
1352  /*!
1353  \brief Non-zero value to enable feature type constraint
1354  */
1356  /*!
1357  \brief Feature type constraint
1358  */
1359  int type;
1360  /*!
1361  \brief Non-zero value to enable field constraint
1362  */
1364  /*!
1365  \brief Field number constraint (see line_cats structure)
1366  */
1367  int field;
1369 
1370  /*!
1371  \brief ???
1372  */
1373  int proj;
1374 
1375  /*!
1376  \brief History file
1377  */
1378  FILE *hist_fp;
1379 
1380  /*!
1381  \brief Graph info (built for network analysis)
1382  */
1383  struct Graph_info dgraph;
1384 
1385  /*!
1386  \brief Header info
1387  */
1388  struct dig_head head;
1389 
1390  /*** format specific ***/
1391 
1392  /*!
1393  \brief GV file pointer (native format only)
1394  */
1395  struct gvfile dig_fp;
1396 
1397  /*!
1398  \brief Format info for non-native formats
1399  */
1400  struct Format_info fInfo;
1401 
1402  /* temporary solution for sites - to be removed ? */
1403 
1404  /*!
1405  \brief Array of attributes loaded from db
1406 
1407  \todo To be removed?
1408  */
1410  /*!
1411  \brief Number of attributes in site_att array
1412 
1413  \todo To be removed?
1414  */
1416  /*!
1417  \brief Number of double attributes for one site
1418 
1419  \todo To be removed
1420  */
1422  /*!
1423  \brief Number of string attributes for one site
1424 
1425  \todo To be removed?
1426  */
1428 };
1429 
1430 /*!
1431  \brief Topological feature - node
1432  */
1433 struct P_node {
1434  /*!
1435  \brief X coordinate
1436  */
1437  double x;
1438  /*!
1439  \brief Y coordinate
1440  */
1441  double y;
1442  /*!
1443  \brief Z coordinate (used only for 3D data)
1444  */
1445  double z;
1446  /*!
1447  \brief Allocated space for lines
1448  */
1450  /*!
1451  \brief Number of attached lines (size of
1452  lines, angle)
1453 
1454  If 0, then is degenerate node, for snapping ???
1455  */
1457  /*!
1458  \brief List of connected lines
1459 
1460  Line id can be positive (for lines which starts at the node) or
1461  negative (for lines which ends at the node).
1462  */
1464  /*!
1465  \brief List of angles of connected lines
1466 
1467  Angles for lines/boundaries are in radians between -PI and
1468  PI. Value for points or lines with identical points
1469  (degenerated) is set to -9. See dig_calc_begin_angle() and
1470  dig_calc_end_angle() for details.
1471  */
1472  float *angles;
1473 };
1474 
1475 /*!
1476  \brief Line topology
1477  */
1478 struct P_topo_l {
1479  /*!
1480  \brief Start node
1481  */
1483  /*!
1484  \brief End node
1485  */
1487 };
1488 
1489 /*!
1490  \brief Boundary topology
1491  */
1492 struct P_topo_b {
1493  /*!
1494  \brief Start node
1495  */
1497  /*!
1498  \brief End node
1499  */
1501  /*!
1502  \brief Area number to the left, negative for isle
1503  */
1505  /*!
1506  \brief Area number to the right, negative for isle
1507  */
1509 };
1510 
1511 /*!
1512  \brief Centroid topology
1513  */
1514 struct P_topo_c {
1515  /*!
1516  \brief Area number, negative for duplicate centroid
1517  */
1519 };
1520 
1521 /*!
1522  \brief Face topology
1523  */
1524 struct P_topo_f {
1525  /* TODO */
1526  /*!
1527  \brief Array of edges
1528  */
1529  plus_t E[3];
1530  /*!
1531  \brief Volume number to the left, negative for hole
1532  */
1534  /*!
1535  \brief Volume number to the right, negative for hole
1536  */
1538 };
1539 
1540 /*!
1541  \brief Kernel topology
1542  */
1543 struct P_topo_k {
1544  /*!
1545  \brief Volume number, negative for duplicate kernel
1546  */
1548 };
1549 
1550 /*!
1551  \brief Vector geometry
1552  */
1553 struct P_line {
1554  /*!
1555  \brief Line type
1556 
1557  - GV_POINT
1558  - GV_LINE
1559  - GV_BOUNDARY
1560  - GV_CENTROID
1561  - GV_FACE
1562  - GV_KERNEL
1563  */
1564  char type;
1565  /*!
1566  \brief Offset in coor file for line
1567 
1568  OGR-links: offset array index
1569  PG-links: node/edge id
1570  */
1571  off_t offset;
1572  /*!
1573  \brief Topology info
1574 
1575  NULL for points
1576  */
1577  void *topo;
1578 };
1579 
1580 /*!
1581  \brief Area (topology) info
1582  */
1583 struct P_area {
1584  /*!
1585  \brief Number of boundary lines
1586  */
1588  /*!
1589  \brief Allocated space for lines
1590  */
1592  /*!
1593  \brief List of boundary lines
1594 
1595  - negative means direction N2 to N1
1596  - lines are in clockwise order
1597  */
1599 
1600  /********* Above this line is compatible with P_isle **********/
1601 
1602  /*!
1603  \brief Number of first centroid within area
1604  */
1606  /*!
1607  \brief Number of islands inside
1608  */
1610  /*!
1611  \brief Allocated space for isles
1612  */
1614  /*!
1615  \brief 1st generation interior islands
1616  */
1618 };
1619 
1620 /*!
1621  \brief Isle (topology) info
1622  */
1623 struct P_isle {
1624  /*!
1625  \brief Number of boundary lines
1626  */
1628  /*!
1629  \brief Allocated space for lines
1630  */
1632  /*!
1633  \brief List of boundary lines
1634 
1635  - negative means direction N2 to N1
1636  - lines are in counter clockwise order
1637  */
1639 
1640  /********* Above this line is compatible with P_area **********/
1641 
1642  /*!
1643  \brief Area it exists w/in, if any
1644  */
1646 };
1647 
1648 /*!
1649  \brief Feature geometry info - coordinates
1650  */
1651 struct line_pnts {
1652  /*!
1653  \brief Array of X coordinates
1654  */
1655  double *x;
1656  /*!
1657  \brief Array of Y coordinates
1658  */
1659  double *y;
1660  /*!
1661  \brief Array of Z coordinates
1662  */
1663  double *z;
1664  /*!
1665  \brief Number of points
1666  */
1668  /*!
1669  \brief Allocated space for points
1670  */
1672 };
1673 
1674 /*!
1675  \brief Feature category info
1676  */
1677 struct line_cats {
1678  /*!
1679  \brief Array of layers (fields)
1680  */
1681  int *field;
1682  /*!
1683  \brief Array of categories
1684  */
1685  int *cat;
1686  /*!
1687  \brief Number of categories attached to element
1688  */
1689  int n_cats;
1690  /*!
1691  \brief Allocated space for categories
1692  */
1694 };
1695 
1696 /*! \brief Category list */
1697 struct cat_list {
1698  /*!
1699  \brief Category layer (field)
1700  */
1701  int field;
1702  /*!
1703  \brief Array of minimum values
1704  */
1705  int *min;
1706  /*!
1707  \brief Array of maximum values
1708  */
1709  int *max;
1710  /*!
1711  \brief Number of ranges
1712  */
1714  /*!
1715  \brief Allocated space for ranges
1716  */
1718 };
1719 
1720 /*!
1721  \brief List of bounding boxes with id
1722  */
1723 struct boxlist {
1724  /*!
1725  \brief Array of ids
1726  */
1727  int *id;
1728  /*!
1729  \brief Array of bounding boxes
1730  */
1731  struct bound_box *box;
1732  /*!
1733  \brief flag to indicate whether bounding boxes should be added
1734  */
1736  /*!
1737  \brief Number of items in the list
1738  */
1740  /*!
1741  \brief Allocated space for items
1742  */
1744 };
1745 
1746 /*!
1747  \brief Vector array
1748 
1749  Space allocated is size + 1
1750  */
1751 struct varray {
1752  /*!
1753  \brief Array size
1754  */
1755  int size;
1756  /*!
1757  \brief Array
1758 
1759  Where 'class' or new category
1760  or something like that is stored
1761  */
1762  int *c;
1763 };
1764 
1765 /*!
1766  \brief Spatial index info
1767 
1768  For use in modules
1769  */
1771  /*!
1772  \brief Pointer to the search tree (R*-Tree)
1773  */
1774  struct RTree *si_tree;
1775  /*!
1776  \brief Name of file to store the search tree
1777  */
1778  char *name;
1779 };
1780 
1781 #endif /* DIG___STRUCTS___ */
SF_FeatureType
Simple feature types.
Definition: dig_defines.h:239
#define PORT_LONG
Definition: dig_defines.h:47
#define PORT_SHORT
Definition: dig_defines.h:49
#define PORT_DOUBLE
Sizes of types used in portable format (different names used in Vlib/ and diglib/ for the same thing)
Definition: dig_defines.h:45
#define PORT_OFF_T
Definition: dig_defines.h:51
#define PORT_FLOAT
Definition: dig_defines.h:46
#define PORT_INT
Definition: dig_defines.h:48
int plus_t
plus_t size
Definition: dig_structs.h:41
Category index.
Definition: dig_structs.h:718
int n_types
Number of types in type.
Definition: dig_structs.h:742
int(* cat)[3]
Array of cats (cat, type, lines/area)
Definition: dig_structs.h:734
int a_cats
Allocated space in cat array.
Definition: dig_structs.h:730
int n_cats
Number of items in cat array.
Definition: dig_structs.h:726
off_t offset
Offset of the beginning of this index in cidx file.
Definition: dig_structs.h:758
int field
Field (layer) number.
Definition: dig_structs.h:722
int type[7][2]
Number of elements for each type.
Definition: dig_structs.h:754
int n_ucats
Number of unique cats (not updated)
Definition: dig_structs.h:738
Coor file info.
Definition: dig_structs.h:371
off_t size
Total size (in bytes)
Definition: dig_structs.h:375
long mtime
Time of last modification.
Definition: dig_structs.h:379
Lines cache for reading feature (non-native formats)
Definition: dig_structs.h:450
int ctype
Cache type.
Definition: dig_structs.h:496
int lines_next
Next line to be read from cache.
Definition: dig_structs.h:482
int * lines_types
List of line types (GV_POINT, GV_LINE, ...)
Definition: dig_structs.h:466
SF_FeatureType sf_type
Simple feature type (currently used only by PG format)
Definition: dig_structs.h:490
long fid
Feature id.
Definition: dig_structs.h:486
struct line_pnts ** lines
Lines array.
Definition: dig_structs.h:462
int lines_alloc
Number of allocated lines in cache.
Definition: dig_structs.h:474
int * lines_cats
List of line cats (used only for PostGIS Topology access)
Definition: dig_structs.h:470
int lines_num
Number of lines which forms current feature.
Definition: dig_structs.h:478
Data structure used for building pseudo-topology.
Definition: dig_structs.h:388
int * array
Offset list.
Definition: dig_structs.h:436
int array_alloc
Space allocated for offset list.
Definition: dig_structs.h:444
int array_num
Number of items in offset list.
Definition: dig_structs.h:440
Non-native format info (OGR)
Definition: dig_structs.h:505
char * dsn
OGR datasource name.
Definition: dig_structs.h:513
OGRSFDriverH driver
Pointer to OGRDriver.
Definition: dig_structs.h:526
OGRFeatureH feature_cache
Cache to avoid repeated reading (level 2)
Definition: dig_structs.h:569
char * driver_name
OGR driver name.
Definition: dig_structs.h:509
OGRDataSourceH ds
Pointer to OGRDataSource.
Definition: dig_structs.h:530
char * layer_name
OGR layer name.
Definition: dig_structs.h:517
int next_line
Next line to be read.
Definition: dig_structs.h:584
char * where
SQL where statement (to filter features)
Definition: dig_structs.h:521
dbDriver * dbdriver
Open DB driver when writing attributes.
Definition: dig_structs.h:547
OGRLayerH layer
Pointer to OGRLayer.
Definition: dig_structs.h:534
char ** layer_options
Array of OGR layer options.
Definition: dig_structs.h:556
struct Format_info_offset offset
Offset list used for building pseudo-topology.
Definition: dig_structs.h:577
struct Format_info_cache cache
Lines cache for reading feature.
Definition: dig_structs.h:561
char ** dsn_options
Array of OGR DSN options.
Definition: dig_structs.h:552
Non-native format info (PostGIS)
Definition: dig_structs.h:590
char * db_name
Database name (derived from conninfo)
Definition: dig_structs.h:598
char * fid_column
FID column.
Definition: dig_structs.h:614
char * schema_name
Schema name.
Definition: dig_structs.h:602
char * where
SQL where statement (of filter features)
Definition: dig_structs.h:610
dbDriver * dbdriver
Open DB driver when writing attributes.
Definition: dig_structs.h:639
PGconn * conn
PGconn object (generated by PQconnectdb)
Definition: dig_structs.h:650
char * toposchema_name
Topology schema name and id.
Definition: dig_structs.h:686
char * cursor_name
Open cursor.
Definition: dig_structs.h:659
int next_line
Next line to be read.
Definition: dig_structs.h:665
int coor_dim
Coordinates dimension (2D or 3D)
Definition: dig_structs.h:626
char * conninfo
Connection string.
Definition: dig_structs.h:594
PGresult * res
Definition: dig_structs.h:651
struct Format_info_cache cache
Lines cache for reading feature.
Definition: dig_structs.h:670
int inTransaction
Start/Finish transaction.
Definition: dig_structs.h:645
char * topogeom_column
TopoGeometry column (feature table)
Definition: dig_structs.h:682
int srid
Spatial reference system id (see spatial_ref_sys table)
Definition: dig_structs.h:631
struct Format_info_offset offset
Offset list used for building pseudo-topology (simple features access)
Definition: dig_structs.h:676
struct field_info * fi
Definition: dig_structs.h:640
char * geom_column
Geometry column (simple feature access)
Definition: dig_structs.h:618
int topo_geo_only
Topology format.
Definition: dig_structs.h:694
char * table_name
Table name.
Definition: dig_structs.h:606
SF_FeatureType feature_type
Feature type (simple feature access)
Definition: dig_structs.h:622
Non-native format info (currently only OGR is implemented)
Definition: dig_structs.h:700
struct Format_info_pg pg
PostGIS info.
Definition: dig_structs.h:712
struct Format_info_ogr ogr
OGR info.
Definition: dig_structs.h:708
Graph-related section (see GRASS Directed Graph Library)
Definition: dig_structs.h:1204
dglSPCache_s spCache
Shortest path cache.
Definition: dig_structs.h:1216
int line_type
Line type used to build the graph.
Definition: dig_structs.h:1208
int cost_multip
Edge and node costs multiplicator.
Definition: dig_structs.h:1234
double * edge_fcosts
Forward costs used for graph.
Definition: dig_structs.h:1222
double * node_costs
Node costs used for graph.
Definition: dig_structs.h:1230
dglGraph_s graph_s
Graph structure.
Definition: dig_structs.h:1212
double * edge_bcosts
backward costs used for graph
Definition: dig_structs.h:1226
Vector map info.
Definition: dig_structs.h:1243
struct site_att * site_att
Array of attributes loaded from db.
Definition: dig_structs.h:1409
char * mapset
Mapset name.
Definition: dig_structs.h:1320
int temporary
Temporary map flag.
Definition: dig_structs.h:1260
struct gvfile dig_fp
GV file pointer (native format only)
Definition: dig_structs.h:1395
struct dig_head head
Header info.
Definition: dig_structs.h:1388
struct bound_box box
Region (bbox) constraint.
Definition: dig_structs.h:1351
int support_updated
Support files were updated.
Definition: dig_structs.h:1311
int n_site_dbl
Number of double attributes for one site.
Definition: dig_structs.h:1421
char * gisdbase
GISDBASE path.
Definition: dig_structs.h:1331
int level
Topology level.
Definition: dig_structs.h:1297
int proj
???
Definition: dig_structs.h:1373
int n_site_att
Number of attributes in site_att array.
Definition: dig_structs.h:1415
char * name
Map name (for 4.0)
Definition: dig_structs.h:1316
int field
Field number constraint (see line_cats structure)
Definition: dig_structs.h:1367
int field_flag
Non-zero value to enable field constraint.
Definition: dig_structs.h:1363
FILE * hist_fp
History file.
Definition: dig_structs.h:1378
plus_t next_line
Feature id for sequential access.
Definition: dig_structs.h:1338
int type
Feature type constraint.
Definition: dig_structs.h:1359
int n_site_str
Number of string attributes for one site.
Definition: dig_structs.h:1427
int type_flag
Non-zero value to enable feature type constraint.
Definition: dig_structs.h:1355
int open
Open indicator.
Definition: dig_structs.h:1280
char * location
Location name.
Definition: dig_structs.h:1327
int head_only
Open only header.
Definition: dig_structs.h:1304
int format
Map format (native, ogr, postgis)
Definition: dig_structs.h:1255
struct Map_info::@11 constraint
Constraints for sequential feature access.
struct dblinks * dblnk
Array of DB links.
Definition: dig_structs.h:1265
int region_flag
Non-zero value to enable region constraint.
Definition: dig_structs.h:1347
struct Format_info fInfo
Format info for non-native formats.
Definition: dig_structs.h:1400
struct Graph_info dgraph
Graph info (built for network analysis)
Definition: dig_structs.h:1383
struct Plus_head plus
Plus info (topology, version, ...)
Definition: dig_structs.h:1270
Area (topology) info.
Definition: dig_structs.h:1583
plus_t n_isles
Number of islands inside.
Definition: dig_structs.h:1609
plus_t * isles
1st generation interior islands
Definition: dig_structs.h:1617
plus_t n_lines
Number of boundary lines.
Definition: dig_structs.h:1587
plus_t * lines
List of boundary lines.
Definition: dig_structs.h:1598
plus_t alloc_lines
Allocated space for lines.
Definition: dig_structs.h:1591
plus_t centroid
Number of first centroid within area.
Definition: dig_structs.h:1605
plus_t alloc_isles
Allocated space for isles.
Definition: dig_structs.h:1613
Isle (topology) info.
Definition: dig_structs.h:1623
plus_t * lines
List of boundary lines.
Definition: dig_structs.h:1638
plus_t n_lines
Number of boundary lines.
Definition: dig_structs.h:1627
plus_t alloc_lines
Allocated space for lines.
Definition: dig_structs.h:1631
plus_t area
Area it exists w/in, if any.
Definition: dig_structs.h:1645
Vector geometry.
Definition: dig_structs.h:1553
char type
Line type.
Definition: dig_structs.h:1564
off_t offset
Offset in coor file for line.
Definition: dig_structs.h:1571
void * topo
Topology info.
Definition: dig_structs.h:1577
Topological feature - node.
Definition: dig_structs.h:1433
plus_t alloc_lines
Allocated space for lines.
Definition: dig_structs.h:1449
double x
X coordinate.
Definition: dig_structs.h:1437
plus_t n_lines
Number of attached lines (size of lines, angle)
Definition: dig_structs.h:1456
float * angles
List of angles of connected lines.
Definition: dig_structs.h:1472
plus_t * lines
List of connected lines.
Definition: dig_structs.h:1463
double z
Z coordinate (used only for 3D data)
Definition: dig_structs.h:1445
double y
Y coordinate.
Definition: dig_structs.h:1441
Boundary topology.
Definition: dig_structs.h:1492
plus_t left
Area number to the left, negative for isle.
Definition: dig_structs.h:1504
plus_t N1
Start node.
Definition: dig_structs.h:1496
plus_t N2
End node.
Definition: dig_structs.h:1500
plus_t right
Area number to the right, negative for isle.
Definition: dig_structs.h:1508
Centroid topology.
Definition: dig_structs.h:1514
plus_t area
Area number, negative for duplicate centroid.
Definition: dig_structs.h:1518
Face topology.
Definition: dig_structs.h:1524
plus_t left
Volume number to the left, negative for hole.
Definition: dig_structs.h:1533
plus_t E[3]
Array of edges.
Definition: dig_structs.h:1529
plus_t right
Volume number to the right, negative for hole.
Definition: dig_structs.h:1537
Kernel topology.
Definition: dig_structs.h:1543
plus_t volume
Volume number, negative for duplicate kernel.
Definition: dig_structs.h:1547
Line topology.
Definition: dig_structs.h:1478
plus_t N1
Start node.
Definition: dig_structs.h:1482
plus_t N2
End node.
Definition: dig_structs.h:1486
Basic topology-related info.
Definition: dig_structs.h:769
int do_uplist
Indicates if the list of updated features is maintained.
Definition: dig_structs.h:1161
struct gvfile spidx_fp
Spatial index file pointer.
Definition: dig_structs.h:1054
struct Cat_index * cidx
Array of category indexes.
Definition: dig_structs.h:1133
off_t Hole_offset
Offset of array of holes in topo file.
Definition: dig_structs.h:1029
plus_t n_klines
Current number of kernels.
Definition: dig_structs.h:906
int n_cidx
Number of category indexes (one for each field/layer)
Definition: dig_structs.h:1125
int Spidx_built
Spatial index built?
Definition: dig_structs.h:1037
plus_t alloc_lines
Number of allocated lines.
Definition: dig_structs.h:970
off_t Isle_offset
Offset of array of isles in topo file.
Definition: dig_structs.h:1021
off_t Area_spidx_offset
Offset of areas in sidx file.
Definition: dig_structs.h:1067
struct Port_info cidx_port
Portability information for category index.
Definition: dig_structs.h:837
plus_t alloc_faces
Number of allocated faces.
Definition: dig_structs.h:988
off_t Node_offset
Offset of array of nodes in topo file.
Definition: dig_structs.h:1005
int with_z
2D/3D vector data
Definition: dig_structs.h:786
off_t coor_size
Size of coor file.
Definition: dig_structs.h:1145
plus_t n_faces
Current number of faces.
Definition: dig_structs.h:943
off_t Isle_spidx_offset
Offset of isles in sidx file.
Definition: dig_structs.h:1071
struct Plus_head::@9 version
Backward compatibility version info.
struct P_line ** Line
Array of vector geometries.
Definition: dig_structs.h:871
plus_t n_lines
Current number of lines.
Definition: dig_structs.h:931
off_t Hole_spidx_offset
Offset of holes in sidx file.
Definition: dig_structs.h:1083
int Spidx_new
Build new spatial index.
Definition: dig_structs.h:1043
off_t Volume_offset
Offset of array of volumes in topo file.
Definition: dig_structs.h:1025
plus_t n_plines
Current number of points.
Definition: dig_structs.h:886
struct RTree * Isle_spidx
Isles spatial index.
Definition: dig_structs.h:1100
off_t Face_spidx_offset
Offset of faces in sidx file.
Definition: dig_structs.h:1075
int alloc_upnodes
Allocated array of nodes.
Definition: dig_structs.h:1193
off_t Area_offset
Offset of array of areas in topo file.
Definition: dig_structs.h:1017
int off_t_size
Offset size.
Definition: dig_structs.h:801
plus_t alloc_holes
Number of allocated holes.
Definition: dig_structs.h:1000
struct RTree * Area_spidx
Area spatial index.
Definition: dig_structs.h:1096
plus_t n_nodes
Current number of topological features derived from vector geometries.
Definition: dig_structs.h:923
plus_t n_volumes
Current number of volumes.
Definition: dig_structs.h:947
int n_upnodes
number of updated nodes
Definition: dig_structs.h:1197
int Spidx_file
Build new spatial index in file.
Definition: dig_structs.h:1049
plus_t alloc_volumes
Number of allocated volumes.
Definition: dig_structs.h:994
off_t Volume_spidx_offset
Offset of volumes in sidx file.
Definition: dig_structs.h:1079
int * upnodes
Array of updated nodes.
Definition: dig_structs.h:1189
plus_t alloc_areas
Number of allocated areas.
Definition: dig_structs.h:976
int a_cidx
Allocated space for category indexes.
Definition: dig_structs.h:1129
struct RTree * Line_spidx
Line spatial index.
Definition: dig_structs.h:1092
plus_t n_blines
Current number of boundaries.
Definition: dig_structs.h:894
struct P_area ** Area
Array of areas.
Definition: dig_structs.h:875
plus_t alloc_isles
Number of allocated isles.
Definition: dig_structs.h:982
long head_size
Topo header size.
Definition: dig_structs.h:808
struct RTree * Volume_spidx
Volumes spatial index.
Definition: dig_structs.h:1108
int spidx_with_z
2D/3D spatial index
Definition: dig_structs.h:793
int release_support
Release memory occupied by support structures (topo, spatial, category)
Definition: dig_structs.h:822
plus_t n_clines
Current number of centroids.
Definition: dig_structs.h:898
int cidx_up_to_date
Category index to be updated.
Definition: dig_structs.h:1140
struct Version_info cidx
Version info for category index file.
Definition: dig_structs.h:777
long spidx_head_size
Spatial index header size.
Definition: dig_structs.h:812
plus_t alloc_nodes
Number of allocated nodes.
Definition: dig_structs.h:958
struct Version_info topo
Version info for topology file.
Definition: dig_structs.h:773
int update_cidx
Update category index if vector is modified.
Definition: dig_structs.h:1120
plus_t n_vfaces
Current number of volume faces.
Definition: dig_structs.h:910
plus_t n_isles
Current number of isles.
Definition: dig_structs.h:939
int alloc_uplines
Allocated array of lines.
Definition: dig_structs.h:1181
plus_t alloc_edges
Number of allocated edges.
Definition: dig_structs.h:964
struct RTree * Face_spidx
Faces spatial index.
Definition: dig_structs.h:1104
int * uplines
Array of updated lines.
Definition: dig_structs.h:1171
struct Port_info spidx_port
Portability information for spatial index.
Definition: dig_structs.h:833
plus_t n_holes
Current number of holes.
Definition: dig_structs.h:951
plus_t n_hfaces
Current number of hole faces.
Definition: dig_structs.h:914
long cidx_head_size
Category index header size.
Definition: dig_structs.h:816
struct Plus_head::@10 uplist
List of updated lines/nodes.
long coor_mtime
Time of last coor modification.
Definition: dig_structs.h:1149
off_t * uplines_offset
Array of updated lines - offset.
Definition: dig_structs.h:1177
off_t Edge_offset
Offset of array of edges in topo file.
Definition: dig_structs.h:1009
struct bound_box box
Bounding box of features.
Definition: dig_structs.h:861
plus_t n_edges
Current number of edges.
Definition: dig_structs.h:927
off_t Line_spidx_offset
Offset of lines in sidx file.
Definition: dig_structs.h:1063
int n_uplines
Number of updated lines.
Definition: dig_structs.h:1185
struct RTree * Node_spidx
Node spatial index.
Definition: dig_structs.h:1088
struct P_isle ** Isle
Array of isles.
Definition: dig_structs.h:879
struct P_node ** Node
Array of nodes.
Definition: dig_structs.h:867
struct Port_info port
Portability information.
Definition: dig_structs.h:829
off_t Node_spidx_offset
Offset of nodes in sidx file.
Definition: dig_structs.h:1059
int mode
Access mode.
Definition: dig_structs.h:845
struct RTree * Hole_spidx
Holes spatial index.
Definition: dig_structs.h:1112
plus_t n_areas
Current number of areas.
Definition: dig_structs.h:935
int built
Highest level of topology currently available.
Definition: dig_structs.h:857
plus_t n_flines
Current number of faces.
Definition: dig_structs.h:902
off_t Line_offset
Offset of array of vector geometries in topo file.
Definition: dig_structs.h:1013
plus_t n_llines
Current number of lines.
Definition: dig_structs.h:890
struct Version_info spidx
Version info for spatial index file.
Definition: dig_structs.h:775
Portability info.
Definition: dig_structs.h:181
unsigned char flt_cnvrt[PORT_FLOAT]
Conversion matrices between file and native byte order (float)
Definition: dig_structs.h:198
int flt_quick
Quick reading flag for float.
Definition: dig_structs.h:228
unsigned char lng_cnvrt[PORT_LONG]
Conversion matrices between file and native byte order (long)
Definition: dig_structs.h:202
int dbl_quick
Quick reading flag for double.
Definition: dig_structs.h:221
unsigned char off_t_cnvrt[PORT_OFF_T]
Conversion matrices between file and native byte order (off_t)
Definition: dig_structs.h:214
unsigned char int_cnvrt[PORT_INT]
Conversion matrices between file and native byte order (int)
Definition: dig_structs.h:206
int off_t_quick
Quick reading flag for off_t.
Definition: dig_structs.h:256
int lng_quick
Quick reading flag for long.
Definition: dig_structs.h:235
int int_quick
Quick reading flag for int.
Definition: dig_structs.h:242
unsigned char shrt_cnvrt[PORT_SHORT]
Conversion matrices between file and native byte order (short)
Definition: dig_structs.h:210
int off_t_size
Size of off_t data type.
Definition: dig_structs.h:189
unsigned char dbl_cnvrt[PORT_DOUBLE]
Conversion matrices between file and native byte order (double)
Definition: dig_structs.h:194
int shrt_quick
Quick reading flag for short.
Definition: dig_structs.h:249
int byte_order
File byte order.
Definition: dig_structs.h:185
Definition: rtree.h:123
Backward compatibility version info.
Definition: dig_structs.h:271
int minor
Current version (minor)
Definition: dig_structs.h:275
int back_major
Earliest version that can use this data format (major)
Definition: dig_structs.h:277
int back_minor
Earliest version that can use this data format (minor)
Definition: dig_structs.h:279
int major
Current version (major)
Definition: dig_structs.h:273
Bounding box.
Definition: dig_structs.h:64
double W
West.
Definition: dig_structs.h:80
double T
Top.
Definition: dig_structs.h:84
double S
South.
Definition: dig_structs.h:72
double N
North.
Definition: dig_structs.h:68
double E
East.
Definition: dig_structs.h:76
double B
Bottom.
Definition: dig_structs.h:88
List of bounding boxes with id.
Definition: dig_structs.h:1723
int alloc_values
Allocated space for items.
Definition: dig_structs.h:1743
int * id
Array of ids.
Definition: dig_structs.h:1727
struct bound_box * box
Array of bounding boxes.
Definition: dig_structs.h:1731
int n_values
Number of items in the list.
Definition: dig_structs.h:1739
int have_boxes
flag to indicate whether bounding boxes should be added
Definition: dig_structs.h:1735
Category list.
Definition: dig_structs.h:1697
int alloc_ranges
Allocated space for ranges.
Definition: dig_structs.h:1717
int n_ranges
Number of ranges.
Definition: dig_structs.h:1713
int * min
Array of minimum values.
Definition: dig_structs.h:1705
int * max
Array of maximum values.
Definition: dig_structs.h:1709
int field
Category layer (field)
Definition: dig_structs.h:1701
Vector map header data.
Definition: dig_structs.h:287
struct recycle * recycle
Recycle dead line.
Definition: dig_structs.h:365
char * date
Map date.
Definition: dig_structs.h:295
struct Version_info coor_version
Version info for coor file.
Definition: dig_structs.h:331
off_t last_offset
Offset of last read line.
Definition: dig_structs.h:358
long orig_scale
Original scale.
Definition: dig_structs.h:311
int plani_zone
Zone (UTM only)
Definition: dig_structs.h:321
double digit_thresh
Threshold for digitization.
Definition: dig_structs.h:325
char * organization
Organization name.
Definition: dig_structs.h:291
off_t size
Coor file size.
Definition: dig_structs.h:344
int with_z
2D/3D vector data
Definition: dig_structs.h:339
char * comment
Comments.
Definition: dig_structs.h:315
char * user_name
User name.
Definition: dig_structs.h:299
long head_size
Coor header size.
Definition: dig_structs.h:348
char * source_date
Source date.
Definition: dig_structs.h:307
char * map_name
Map name.
Definition: dig_structs.h:303
struct Port_info port
Portability information.
Definition: dig_structs.h:353
Layer (old: field) information.
Definition: dig_structs.h:131
char * table
Name of DB table.
Definition: dig_structs.h:151
char * driver
Name of DB driver ('sqlite', 'dbf', ...)
Definition: dig_structs.h:143
char * name
Layer name (optional)
Definition: dig_structs.h:139
char * database
Definition: dig_structs.h:147
char * key
Name of key column (usually 'cat')
Definition: dig_structs.h:155
int number
Layer number.
Definition: dig_structs.h:135
File definition.
Definition: dig_structs.h:94
int loaded
Is file loaded?
Definition: dig_structs.h:125
char * end
End of file in the memory (pointer to first byte after)
Definition: dig_structs.h:110
char * start
Pointer to beginning of the file in the memory.
Definition: dig_structs.h:102
FILE * file
File descriptor.
Definition: dig_structs.h:98
off_t alloc
Allocated space.
Definition: dig_structs.h:118
off_t size
Size of the file loaded to memory.
Definition: dig_structs.h:114
char * current
Current position set by dig_seek()
Definition: dig_structs.h:106
Feature category info.
Definition: dig_structs.h:1677
int * field
Array of layers (fields)
Definition: dig_structs.h:1681
int alloc_cats
Allocated space for categories.
Definition: dig_structs.h:1693
int * cat
Array of categories.
Definition: dig_structs.h:1685
int n_cats
Number of categories attached to element.
Definition: dig_structs.h:1689
Feature geometry info - coordinates.
Definition: dig_structs.h:1651
double * y
Array of Y coordinates.
Definition: dig_structs.h:1659
int alloc_points
Allocated space for points.
Definition: dig_structs.h:1671
double * x
Array of X coordinates.
Definition: dig_structs.h:1655
int n_points
Number of points.
Definition: dig_structs.h:1667
double * z
Array of Z coordinates.
Definition: dig_structs.h:1663
List of dead lines in the file.
Definition: dig_structs.h:266
char dummy
Definition: dig_structs.h:267
Used by sites lib.
Definition: dig_structs.h:46
int cat
Category number.
Definition: dig_structs.h:50
char ** str
Array of string attributes.
Definition: dig_structs.h:58
double * dbl
Array of double attributes.
Definition: dig_structs.h:54
Spatial index info.
Definition: dig_structs.h:1770
struct RTree * si_tree
Pointer to the search tree (R*-Tree)
Definition: dig_structs.h:1774
char * name
Name of file to store the search tree.
Definition: dig_structs.h:1778
Vector array.
Definition: dig_structs.h:1751
int * c
Array.
Definition: dig_structs.h:1762
int size
Array size.
Definition: dig_structs.h:1755