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