~ubuntu-branches/ubuntu/wily/grass/wily

« back to all changes in this revision

Viewing changes to .pc/allows-to-typo.patch/include/vect/dig_structs.h

Tags: 7.0.0~rc1+ds1-1~exp1
* New upstream release candidate.
* Repack upstream tarball, remove precompiled Python objects.
* Add upstream metadata.
* Update gbp.conf and Vcs-Git URL to use the experimental branch.
* Update watch file for GRASS 7.0.
* Drop build dependencies for Tcl/Tk, add build dependencies:
  python-numpy, libnetcdf-dev, netcdf-bin, libblas-dev, liblapack-dev
* Update Vcs-Browser URL to use cgit instead of gitweb.
* Update paths to use grass70.
* Add configure options: --with-netcdf, --with-blas, --with-lapack,
  remove --with-tcltk-includes.
* Update patches for GRASS 7.
* Update copyright file, changes:
  - Update copyright years
  - Group files by license
  - Remove unused license sections
* Add patches for various typos.
* Fix desktop file with patch instead of d/rules.
* Use minimal dh rules.
* Bump Standards-Version to 3.9.6, no changes.
* Use dpkg-maintscript-helper to replace directories with symlinks.
  (closes: #776349)
* Update my email to use @debian.org address.

Show diffs side-by-side

added added

removed removed

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