GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
shapefil.h
Go to the documentation of this file.
1 #ifndef SHAPEFILE_H_INCLUDED
2 #define SHAPEFILE_H_INCLUDED
3 
4 /******************************************************************************
5  *
6  * Project: Shapelib
7  * Purpose: Primary include file for Shapelib.
8  * Author: Frank Warmerdam, warmerdam@pobox.com
9  *
10  ******************************************************************************
11  * Copyright (c) 1999, Frank Warmerdam
12  * Copyright (c) 2012-2016, Even Rouault <even dot rouault at spatialys.com>
13  *
14  * SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
15  ******************************************************************************
16  *
17  */
18 
19 #include <stdio.h>
20 
21 #ifdef USE_CPL
22 #include "cpl_conv.h"
23 #endif
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 /************************************************************************/
30 /* Version related macros (added in 1.6.0) */
31 /************************************************************************/
32 
33 #define SHAPELIB_VERSION_MAJOR 1
34 #define SHAPELIB_VERSION_MINOR 6
35 #define SHAPELIB_VERSION_MICRO 0
36 
37 #define SHAPELIB_MAKE_VERSION_NUMBER(major, minor, micro) \
38  ((major) * 10000 + (minor) * 100 + (micro))
39 
40 #define SHAPELIB_VERSION_NUMBER \
41  SHAPELIB_MAKE_VERSION_NUMBER(SHAPELIB_VERSION_MAJOR, \
42  SHAPELIB_VERSION_MINOR, \
43  SHAPELIB_VERSION_MICRO)
44 
45 #define SHAPELIB_AT_LEAST(major, minor, micro) \
46  (SHAPELIB_VERSION_NUMBER >= \
47  SHAPELIB_MAKE_VERSION_NUMBER(major, minor, micro))
48 
49 /************************************************************************/
50 /* Configuration options. */
51 /************************************************************************/
52 
53 /* -------------------------------------------------------------------- */
54 /* Should the DBFReadStringAttribute() strip leading and */
55 /* trailing white space? */
56 /* -------------------------------------------------------------------- */
57 #define TRIM_DBF_WHITESPACE
58 
59 /* -------------------------------------------------------------------- */
60 /* Should we write measure values to the Multipatch object? */
61 /* Reportedly ArcView crashes if we do write it, so for now it */
62 /* is disabled. */
63 /* -------------------------------------------------------------------- */
64 #define DISABLE_MULTIPATCH_MEASURE
65 
66 /* -------------------------------------------------------------------- */
67 /* SHPAPI_CALL */
68 /* */
69 /* The following two macros are present to allow forcing */
70 /* various calling conventions on the Shapelib API. */
71 /* */
72 /* To force __stdcall conventions (needed to call Shapelib */
73 /* from Visual Basic and/or Delphi I believe) the makefile could */
74 /* be modified to define: */
75 /* */
76 /* /DSHPAPI_CALL=__stdcall */
77 /* */
78 /* If it is desired to force export of the Shapelib API without */
79 /* using the shapelib.def file, use the following definition. */
80 /* */
81 /* /DSHAPELIB_DLLEXPORT */
82 /* */
83 /* To get both at once it will be necessary to hack this */
84 /* include file to define: */
85 /* */
86 /* #define SHPAPI_CALL __declspec(dllexport) __stdcall */
87 /* #define SHPAPI_CALL1 __declspec(dllexport) * __stdcall */
88 /* */
89 /* The complexity of the situation is partly caused by the */
90 /* peculiar requirement of Visual C++ that __stdcall appear */
91 /* after any "*"'s in the return value of a function while the */
92 /* __declspec(dllexport) must appear before them. */
93 /* -------------------------------------------------------------------- */
94 
95 #ifdef SHAPELIB_DLLEXPORT
96 #define SHPAPI_CALL __declspec(dllexport)
97 #define SHPAPI_CALL1(x) __declspec(dllexport) x
98 #endif
99 
100 #ifndef SHPAPI_CALL
101 #if defined(USE_GCC_VISIBILITY_FLAG)
102 #define SHPAPI_CALL __attribute__((visibility("default")))
103 #define SHPAPI_CALL1(x) __attribute__((visibility("default"))) x
104 #else
105 #define SHPAPI_CALL
106 #endif
107 #endif
108 
109 #ifndef SHPAPI_CALL1
110 #define SHPAPI_CALL1(x) x SHPAPI_CALL
111 #endif
112 
113 /* -------------------------------------------------------------------- */
114 /* On some platforms, additional file IO hooks are defined that */
115 /* UTF-8 encoded filenames Unicode filenames */
116 /* -------------------------------------------------------------------- */
117 #if defined(_WIN32)
118 #define SHPAPI_WINDOWS
119 #define SHPAPI_UTF8_HOOKS
120 #endif
121 
122 /* -------------------------------------------------------------------- */
123 /* IO/Error hook functions. */
124 /* -------------------------------------------------------------------- */
125 typedef int *SAFile;
126 
127 #ifndef SAOffset
128 #if defined(_MSC_VER) && _MSC_VER >= 1400
129 typedef unsigned __int64 SAOffset;
130 #else
131 typedef unsigned long SAOffset;
132 #endif
133 #endif
134 
135 typedef struct {
136  SAFile (*FOpen)(const char *filename, const char *access, void *pvUserData);
137  SAOffset (*FRead)(void *p, SAOffset size, SAOffset nmemb, SAFile file);
138  SAOffset (*FWrite)(const void *p, SAOffset size, SAOffset nmemb,
139  SAFile file);
140  SAOffset (*FSeek)(SAFile file, SAOffset offset, int whence);
141  SAOffset (*FTell)(SAFile file);
142  int (*FFlush)(SAFile file);
143  int (*FClose)(SAFile file);
144  int (*Remove)(const char *filename, void *pvUserData);
145 
146  void (*Error)(const char *message);
147  double (*Atof)(const char *str);
148  void *pvUserData;
149 } SAHooks;
150 
152 #ifdef SHPAPI_UTF8_HOOKS
153 void SHPAPI_CALL SASetupUtf8Hooks(SAHooks *psHooks);
154 #endif
155 
156 /************************************************************************/
157 /* SHP Support. */
158 /************************************************************************/
159 typedef struct tagSHPObject SHPObject;
160 
161 typedef struct {
163 
166 
167  int nShapeType; /* SHPT_* */
168 
169  unsigned int nFileSize; /* SHP file */
170 
171  int nRecords;
173  unsigned int *panRecOffset;
174  unsigned int *panRecSize;
175 
176  double adBoundsMin[4];
177  double adBoundsMax[4];
178 
179  int bUpdated;
180 
181  unsigned char *pabyRec;
182  int nBufSize;
183 
185  unsigned char *pabyObjectBuf;
188 } SHPInfo;
189 
191 
192 typedef struct {
193  int year;
194  int month;
195  int day;
196 } SHPDate;
197 
198 /* -------------------------------------------------------------------- */
199 /* Shape types (nSHPType) */
200 /* -------------------------------------------------------------------- */
201 #define SHPT_NULL 0
202 #define SHPT_POINT 1
203 #define SHPT_ARC 3
204 #define SHPT_POLYGON 5
205 #define SHPT_MULTIPOINT 8
206 #define SHPT_POINTZ 11
207 #define SHPT_ARCZ 13
208 #define SHPT_POLYGONZ 15
209 #define SHPT_MULTIPOINTZ 18
210 #define SHPT_POINTM 21
211 #define SHPT_ARCM 23
212 #define SHPT_POLYGONM 25
213 #define SHPT_MULTIPOINTM 28
214 #define SHPT_MULTIPATCH 31
215 
216 /* -------------------------------------------------------------------- */
217 /* Part types - everything but SHPT_MULTIPATCH just uses */
218 /* SHPP_RING. */
219 /* -------------------------------------------------------------------- */
220 
221 #define SHPP_TRISTRIP 0
222 #define SHPP_TRIFAN 1
223 #define SHPP_OUTERRING 2
224 #define SHPP_INNERRING 3
225 #define SHPP_FIRSTRING 4
226 #define SHPP_RING 5
227 
228 /* -------------------------------------------------------------------- */
229 /* SHPObject - represents on shape (without attributes) read */
230 /* from the .shp file. */
231 /* -------------------------------------------------------------------- */
232 struct tagSHPObject {
233  int nSHPType;
234 
235  int nShapeId; /* -1 is unknown/unassigned */
236 
237  int nParts;
240 
242  double *padfX;
243  double *padfY;
244  double *padfZ;
245  double *padfM;
246 
247  double dfXMin;
248  double dfYMin;
249  double dfZMin;
250  double dfMMin;
251 
252  double dfXMax;
253  double dfYMax;
254  double dfZMax;
255  double dfMMax;
256 
259 };
260 
261 /* -------------------------------------------------------------------- */
262 /* SHP API Prototypes */
263 /* -------------------------------------------------------------------- */
264 
265 /* If pszAccess is read-only, the fpSHX field of the returned structure */
266 /* will be NULL as it is not necessary to keep the SHX file open */
267 SHPHandle SHPAPI_CALL SHPOpen(const char *pszShapeFile, const char *pszAccess);
268 SHPHandle SHPAPI_CALL SHPOpenLL(const char *pszShapeFile, const char *pszAccess,
269  const SAHooks *psHooks);
270 SHPHandle SHPAPI_CALL SHPOpenLLEx(const char *pszShapeFile,
271  const char *pszAccess, const SAHooks *psHooks,
272  int bRestoreSHX);
273 
274 int SHPAPI_CALL SHPRestoreSHX(const char *pszShapeFile, const char *pszAccess,
275  const SAHooks *psHooks);
276 
277 /* If setting bFastMode = TRUE, the content of SHPReadObject() is owned by the
278  * SHPHandle. */
279 /* So you cannot have 2 valid instances of SHPReadObject() simultaneously. */
280 /* The SHPObject padfZ and padfM members may be NULL depending on the geometry
281  */
282 /* type. It is illegal to free at hand any of the pointer members of the
283  * SHPObject structure */
284 void SHPAPI_CALL SHPSetFastModeReadObject(SHPHandle hSHP, int bFastMode);
285 
286 SHPHandle SHPAPI_CALL SHPCreate(const char *pszShapeFile, int nShapeType);
287 SHPHandle SHPAPI_CALL SHPCreateLL(const char *pszShapeFile, int nShapeType,
288  const SAHooks *psHooks);
289 void SHPAPI_CALL SHPGetInfo(const SHPHandle hSHP, int *pnEntities,
290  int *pnShapeType, double *padfMinBound,
291  double *padfMaxBound);
292 
293 SHPObject SHPAPI_CALL1(*) SHPReadObject(const SHPHandle hSHP, int iShape);
294 int SHPAPI_CALL SHPWriteObject(SHPHandle hSHP, int iShape,
295  const SHPObject *psObject);
296 
297 void SHPAPI_CALL SHPDestroyObject(SHPObject *psObject);
298 void SHPAPI_CALL SHPComputeExtents(SHPObject *psObject);
300  SHPCreateObject(int nSHPType, int nShapeId, int nParts,
301  const int *panPartStart, const int *panPartType,
302  int nVertices, const double *padfX, const double *padfY,
303  const double *padfZ, const double *padfM);
305  SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX,
306  const double *padfY, const double *padfZ);
307 
308 int SHPAPI_CALL SHPRewindObject(const SHPHandle hSHP, SHPObject *psObject);
309 
310 void SHPAPI_CALL SHPClose(SHPHandle hSHP);
312 
313 const char SHPAPI_CALL1(*) SHPTypeName(int nSHPType);
314 const char SHPAPI_CALL1(*) SHPPartTypeName(int nPartType);
315 
316 /* -------------------------------------------------------------------- */
317 /* Shape quadtree indexing API. */
318 /* -------------------------------------------------------------------- */
319 
320 /* this can be two or four for binary or quad tree */
321 #define MAX_SUBNODE 4
322 
323 /* upper limit of tree levels for automatic estimation */
324 #define MAX_DEFAULT_TREE_DEPTH 12
325 
326 typedef struct shape_tree_node {
327  /* region covered by this node */
328  double adfBoundsMin[4];
329  double adfBoundsMax[4];
330 
331  /* list of shapes stored at this node. The papsShapeObj pointers
332  or the whole list can be NULL */
336 
339 
341 
342 typedef struct {
344 
348 
350 } SHPTree;
351 
353  SHPCreateTree(SHPHandle hSHP, int nDimension, int nMaxDepth,
354  const double *padfBoundsMin, const double *padfBoundsMax);
355 void SHPAPI_CALL SHPDestroyTree(SHPTree *hTree);
356 
357 int SHPAPI_CALL SHPWriteTree(SHPTree *hTree, const char *pszFilename);
358 
360 
362 
364  SHPTreeFindLikelyShapes(const SHPTree *hTree, double *padfBoundsMin,
365  double *padfBoundsMax, int *);
366 int SHPAPI_CALL SHPCheckBoundsOverlap(const double *, const double *,
367  const double *, const double *, int);
368 
369 int SHPAPI_CALL1(*) SHPSearchDiskTree(FILE *fp, double *padfBoundsMin,
370  double *padfBoundsMax, int *pnShapeCount);
371 
372 typedef struct SHPDiskTreeInfo *SHPTreeDiskHandle;
373 
374 SHPTreeDiskHandle SHPAPI_CALL SHPOpenDiskTree(const char *pszQIXFilename,
375  const SAHooks *psHooks);
376 
377 void SHPAPI_CALL SHPCloseDiskTree(SHPTreeDiskHandle hDiskTree);
378 
380  SHPSearchDiskTreeEx(const SHPTreeDiskHandle hDiskTree,
381  double *padfBoundsMin, double *padfBoundsMax,
382  int *pnShapeCount);
383 
384 int SHPAPI_CALL SHPWriteTreeLL(SHPTree *hTree, const char *pszFilename,
385  const SAHooks *psHooks);
386 
387 /* -------------------------------------------------------------------- */
388 /* SBN Search API */
389 /* -------------------------------------------------------------------- */
390 
391 typedef struct SBNSearchInfo *SBNSearchHandle;
392 
393 SBNSearchHandle SHPAPI_CALL SBNOpenDiskTree(const char *pszSBNFilename,
394  const SAHooks *psHooks);
395 
397 
399  SBNSearchDiskTree(const SBNSearchHandle hSBN, const double *padfBoundsMin,
400  const double *padfBoundsMax, int *pnShapeCount);
401 
402 int SHPAPI_CALL1(*)
403  SBNSearchDiskTreeInteger(const SBNSearchHandle hSBN, int bMinX, int bMinY,
404  int bMaxX, int bMaxY, int *pnShapeCount);
405 
406 void SHPAPI_CALL SBNSearchFreeIds(int *panShapeId);
407 
408 /************************************************************************/
409 /* DBF Support. */
410 /************************************************************************/
411 typedef struct {
413 
415 
416  int nRecords;
417 
418  int nRecordLength; /* Must fit on uint16 */
419  int nHeaderLength; /* File header length (32) + field
420  descriptor length + spare space.
421  Must fit on uint16 */
422  int nFields;
427 
428  char *pszHeader; /* Field descriptors */
429 
433 
436 
438  int bUpdated;
439 
440  union {
443  } fieldValue;
444 
446  char *pszCodePage;
447 
448  int nUpdateYearSince1900; /* 0-255 */
449  int nUpdateMonth; /* 1-12 */
450  int nUpdateDay; /* 1-31 */
451 
452  int bWriteEndOfFileChar; /* defaults to TRUE */
453 
455 } DBFInfo;
456 
458 
459 typedef enum {
465  FTInvalid
467 
468 /* Field descriptor/header size */
469 #define XBASE_FLDHDR_SZ 32
470 /* Shapelib read up to 11 characters, even if only 10 should normally be used */
471 #define XBASE_FLDNAME_LEN_READ 11
472 /* On writing, we limit to 10 characters */
473 #define XBASE_FLDNAME_LEN_WRITE 10
474 /* Normally only 254 characters should be used. We tolerate 255 historically */
475 #define XBASE_FLD_MAX_WIDTH 255
476 
477 DBFHandle SHPAPI_CALL DBFOpen(const char *pszDBFFile, const char *pszAccess);
478 DBFHandle SHPAPI_CALL DBFOpenLL(const char *pszDBFFile, const char *pszAccess,
479  const SAHooks *psHooks);
480 DBFHandle SHPAPI_CALL DBFCreate(const char *pszDBFFile);
481 DBFHandle SHPAPI_CALL DBFCreateEx(const char *pszDBFFile,
482  const char *pszCodePage);
483 DBFHandle SHPAPI_CALL DBFCreateLL(const char *pszDBFFile,
484  const char *pszCodePage,
485  const SAHooks *psHooks);
486 
487 int SHPAPI_CALL DBFGetFieldCount(const DBFHandle psDBF);
488 int SHPAPI_CALL DBFGetRecordCount(const DBFHandle psDBF);
489 int SHPAPI_CALL DBFAddField(DBFHandle hDBF, const char *pszFieldName,
490  DBFFieldType eType, int nWidth, int nDecimals);
491 
492 int SHPAPI_CALL DBFAddNativeFieldType(DBFHandle hDBF, const char *pszFieldName,
493  char chType, int nWidth, int nDecimals);
494 
495 int SHPAPI_CALL DBFDeleteField(DBFHandle hDBF, int iField);
496 
497 int SHPAPI_CALL DBFReorderFields(DBFHandle psDBF, const int *panMap);
498 
499 int SHPAPI_CALL DBFAlterFieldDefn(DBFHandle psDBF, int iField,
500  const char *pszFieldName, char chType,
501  int nWidth, int nDecimals);
502 
503 DBFFieldType SHPAPI_CALL DBFGetFieldInfo(const DBFHandle psDBF, int iField,
504  char *pszFieldName, int *pnWidth,
505  int *pnDecimals);
506 
507 int SHPAPI_CALL DBFGetFieldIndex(const DBFHandle psDBF,
508  const char *pszFieldName);
509 
510 int SHPAPI_CALL DBFReadIntegerAttribute(DBFHandle hDBF, int iShape, int iField);
511 double SHPAPI_CALL DBFReadDoubleAttribute(DBFHandle hDBF, int iShape,
512  int iField);
513 const char SHPAPI_CALL1(*)
514  DBFReadStringAttribute(DBFHandle hDBF, int iShape, int iField);
515 const char SHPAPI_CALL1(*)
516  DBFReadLogicalAttribute(DBFHandle hDBF, int iShape, int iField);
518  int iField);
519 int SHPAPI_CALL DBFIsAttributeNULL(const DBFHandle hDBF, int iShape,
520  int iField);
521 
522 int SHPAPI_CALL DBFWriteIntegerAttribute(DBFHandle hDBF, int iShape, int iField,
523  int nFieldValue);
524 int SHPAPI_CALL DBFWriteDoubleAttribute(DBFHandle hDBF, int iShape, int iField,
525  double dFieldValue);
526 int SHPAPI_CALL DBFWriteStringAttribute(DBFHandle hDBF, int iShape, int iField,
527  const char *pszFieldValue);
528 int SHPAPI_CALL DBFWriteNULLAttribute(DBFHandle hDBF, int iShape, int iField);
529 
530 int SHPAPI_CALL DBFWriteLogicalAttribute(DBFHandle hDBF, int iShape, int iField,
531  const char lFieldValue);
532 int SHPAPI_CALL DBFWriteDateAttribute(DBFHandle hDBF, int iShape, int iField,
533  const SHPDate *dateFieldValue);
534 int SHPAPI_CALL DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity,
535  int iField, const void *pValue);
536 const char SHPAPI_CALL1(*) DBFReadTuple(DBFHandle psDBF, int hEntity);
537 int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity,
538  const void *pRawTuple);
539 
540 int SHPAPI_CALL DBFIsRecordDeleted(const DBFHandle psDBF, int iShape);
541 int SHPAPI_CALL DBFMarkRecordDeleted(DBFHandle psDBF, int iShape,
542  int bIsDeleted);
543 
545  const char *pszFilename);
546 
547 void SHPAPI_CALL DBFClose(DBFHandle hDBF);
549 char SHPAPI_CALL DBFGetNativeFieldType(const DBFHandle hDBF, int iField);
550 
551 const char SHPAPI_CALL1(*) DBFGetCodePage(const DBFHandle psDBF);
552 
553 void SHPAPI_CALL DBFSetLastModifiedDate(DBFHandle psDBF, int nYYSince1900,
554  int nMM, int nDD);
555 
556 void SHPAPI_CALL DBFSetWriteEndOfFileChar(DBFHandle psDBF, int bWriteFlag);
557 
558 #ifdef __cplusplus
559 }
560 #endif
561 
562 #endif /* ndef SHAPEFILE_H_INCLUDED */
int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity, const void *pRawTuple)
Definition: dbfopen.c:1510
const char SHPAPI_CALL1 * DBFReadLogicalAttribute(DBFHandle psDBF, int iRecord, int iField){ return STATIC_CAST(const char *, DBFReadAttribute(psDBF, iRecord, iField, 'L')
void SHPAPI_CALL DBFSetLastModifiedDate(DBFHandle psDBF, int nYYSince1900, int nMM, int nDD)
Definition: dbfopen.c:282
#define file
int SHPAPI_CALL DBFWriteIntegerAttribute(DBFHandle hDBF, int iShape, int iField, int nFieldValue)
Definition: dbfopen.c:1432
SHPHandle SHPAPI_CALL SHPCreate(const char *pszShapeFile, int nShapeType)
Definition: shpopen.c:914
DBFFieldType
Definition: shapefil.h:459
@ FTDouble
Definition: shapefil.h:462
@ FTString
Definition: shapefil.h:460
@ FTInvalid
Definition: shapefil.h:465
@ FTLogical
Definition: shapefil.h:463
@ FTDate
Definition: shapefil.h:464
@ FTInteger
Definition: shapefil.h:461
SHPTree SHPAPI_CALL1 * SHPCreateTree(SHPHandle hSHP, int nDimension, int nMaxDepth, const double *padfBoundsMin, const double *padfBoundsMax);void SHPAPI_CALL SHPDestroyTree(SHPTree *hTree
void SHPAPI_CALL SHPCloseDiskTree(SHPTreeDiskHandle hDiskTree)
int SHPAPI_CALL DBFGetFieldIndex(const DBFHandle psDBF, const char *pszFieldName)
Definition: dbfopen.c:1655
int SHPAPI_CALL1 * SHPSearchDiskTreeEx(const SHPTreeDiskHandle hDiskTree, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount);int SHPAPI_CALL SHPWriteTreeLL(SHPTree *hTree, const char *pszFilename, const SAHooks *psHooks
int SHPAPI_CALL DBFGetRecordCount(const DBFHandle psDBF)
Definition: dbfopen.c:1163
int SHPAPI_CALL DBFMarkRecordDeleted(DBFHandle psDBF, int iShape, int bIsDeleted)
Definition: dbfopen.c:1699
int SHPAPI_CALL DBFAlterFieldDefn(DBFHandle psDBF, int iField, const char *pszFieldName, char chType, int nWidth, int nDecimals)
Definition: dbfopen.c:1995
SHPHandle SHPAPI_CALL SHPOpenLL(const char *pszShapeFile, const char *pszAccess, const SAHooks *psHooks)
Definition: shpopen.c:245
void SHPAPI_CALL DBFUpdateHeader(DBFHandle hDBF)
Definition: dbfopen.c:248
int SHPAPI_CALL DBFWriteStringAttribute(DBFHandle hDBF, int iShape, int iField, const char *pszFieldValue)
Definition: dbfopen.c:1447
struct shape_tree_node SHPTreeNode
int SHPAPI_CALL DBFDeleteField(DBFHandle hDBF, int iField)
#define MAX_SUBNODE
Definition: shapefil.h:321
DBFHandle SHPAPI_CALL DBFOpen(const char *pszDBFFile, const char *pszAccess)
Definition: dbfopen.c:296
int SHPAPI_CALL SHPWriteTree(SHPTree *hTree, const char *pszFilename)
int SHPAPI_CALL DBFReadIntegerAttribute(DBFHandle hDBF, int iShape, int iField)
Definition: dbfopen.c:991
int SHPAPI_CALL DBFAddNativeFieldType(DBFHandle hDBF, const char *pszFieldName, char chType, int nWidth, int nDecimals)
Definition: dbfopen.c:734
void SHPAPI_CALL SHPSetFastModeReadObject(SHPHandle hSHP, int bFastMode)
Definition: shpopen.c:867
void SHPAPI_CALL SHPClose(SHPHandle hSHP)
Definition: shpopen.c:821
int SHPAPI_CALL DBFWriteDoubleAttribute(DBFHandle hDBF, int iShape, int iField, double dFieldValue)
Definition: dbfopen.c:1419
const char SHPAPI_CALL1 * DBFGetCodePage(const DBFHandle psDBF);void SHPAPI_CALL DBFSetLastModifiedDate(DBFHandle psDBF, int nYYSince1900, int nMM, int nDD
Definition: dbfopen.c:1737
int SHPAPI_CALL DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField, const void *pValue)
Definition: dbfopen.c:1350
void SHPAPI_CALL SHPDestroyObject(SHPObject *psObject)
Definition: shpopen.c:2654
DBFFieldType SHPAPI_CALL DBFGetFieldInfo(const DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals)
Definition: dbfopen.c:1176
DBFHandle SHPAPI_CALL DBFCreateLL(const char *pszDBFFile, const char *pszCodePage, const SAHooks *psHooks)
Definition: dbfopen.c:597
void SHPAPI_CALL SHPComputeExtents(SHPObject *psObject)
Definition: shpopen.c:1099
int SHPAPI_CALL DBFGetFieldCount(const DBFHandle psDBF)
Definition: dbfopen.c:1152
DBFHandle SHPAPI_CALL DBFCloneEmpty(const DBFHandle psDBF, const char *pszFilename)
Definition: dbfopen.c:1579
DBFInfo * DBFHandle
Definition: shapefil.h:457
void SHPAPI_CALL SHPGetInfo(const SHPHandle hSHP, int *pnEntities, int *pnShapeType, double *padfMinBound, double *padfMaxBound)
Definition: shpopen.c:886
int SHPAPI_CALL DBFIsRecordDeleted(const DBFHandle psDBF, int iShape)
Definition: dbfopen.c:1675
int SHPAPI_CALL DBFWriteNULLAttribute(DBFHandle hDBF, int iShape, int iField)
Definition: dbfopen.c:1461
void SHPAPI_CALL SHPTreeTrimExtraNodes(SHPTree *hTree)
int SHPAPI_CALL DBFReorderFields(DBFHandle psDBF, const int *panMap)
Definition: dbfopen.c:1875
SHPHandle SHPAPI_CALL SHPOpen(const char *pszShapeFile, const char *pszAccess)
Definition: shpopen.c:213
SHPInfo * SHPHandle
Definition: shapefil.h:190
int * SAFile
Definition: shapefil.h:125
int SHPAPI_CALL DBFAddField(DBFHandle hDBF, const char *pszFieldName, DBFFieldType eType, int nWidth, int nDecimals)
Definition: dbfopen.c:690
const char SHPAPI_CALL1 * DBFReadStringAttribute(DBFHandle hDBF, int iShape, int iField);const char SHPAPI_CALL1(*) DBFReadLogicalAttribute(DBFHandle hDBF, int iShape, int iField
int SHPAPI_CALL1 * SHPTreeFindLikelyShapes(const SHPTree *hTree, double *padfBoundsMin, double *padfBoundsMax, int *);int SHPAPI_CALL SHPCheckBoundsOverlap(const double *, const double *, const double *, const double *, int
int SHPAPI_CALL DBFWriteLogicalAttribute(DBFHandle hDBF, int iShape, int iField, const char lFieldValue)
Definition: dbfopen.c:1472
DBFHandle SHPAPI_CALL DBFCreateEx(const char *pszDBFFile, const char *pszCodePage)
Definition: dbfopen.c:581
int SHPAPI_CALL SHPRestoreSHX(const char *pszShapeFile, const char *pszAccess, const SAHooks *psHooks)
Definition: shpopen.c:607
#define SHPAPI_CALL
Definition: shapefil.h:105
SHPHandle SHPAPI_CALL SHPOpenLLEx(const char *pszShapeFile, const char *pszAccess, const SAHooks *psHooks, int bRestoreSHX)
Definition: shpopen.c:586
int SHPAPI_CALL1 * SHPSearchDiskTree(FILE *fp, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount);typedef struct SHPDiskTreeInfo *SHPTreeDiskHandle;SHPTreeDiskHandle SHPAPI_CALL SHPOpenDiskTree(const char *pszQIXFilename, const SAHooks *psHooks
DBFHandle SHPAPI_CALL DBFCreate(const char *pszDBFFile)
Definition: dbfopen.c:570
SHPDate SHPAPI_CALL DBFReadDateAttribute(DBFHandle hDBF, int iShape, int iField)
Definition: dbfopen.c:1053
void SHPAPI_CALL DBFClose(DBFHandle hDBF)
Definition: dbfopen.c:522
int SHPAPI_CALL DBFWriteDateAttribute(DBFHandle hDBF, int iShape, int iField, const SHPDate *dateFieldValue)
Definition: dbfopen.c:1486
#define SHPAPI_CALL1(x)
Definition: shapefil.h:110
int SHPAPI_CALL SHPTreeAddShapeId(SHPTree *hTree, SHPObject *psObject)
struct SBNSearchInfo * SBNSearchHandle
Definition: shapefil.h:391
void SHPAPI_CALL SBNSearchFreeIds(int *panShapeId)
DBFHandle SHPAPI_CALL DBFOpenLL(const char *pszDBFFile, const char *pszAccess, const SAHooks *psHooks)
Definition: dbfopen.c:327
const char SHPAPI_CALL1 * SHPTypeName(int nSHPType);const char SHPAPI_CALL1(*) SHPPartTypeName(int nPartType
Definition: shpopen.c:2570
void SHPAPI_CALL DBFSetWriteEndOfFileChar(DBFHandle psDBF, int bWriteFlag)
Definition: dbfopen.c:2232
SBNSearchHandle SHPAPI_CALL SBNOpenDiskTree(const char *pszSBNFilename, const SAHooks *psHooks)
SHPHandle SHPAPI_CALL SHPCreateLL(const char *pszShapeFile, int nShapeType, const SAHooks *psHooks)
Definition: shpopen.c:930
void SHPAPI_CALL SBNCloseDiskTree(SBNSearchHandle hSBN)
int SHPAPI_CALL SHPRewindObject(const SHPHandle hSHP, SHPObject *psObject)
Definition: shpopen.c:2785
const char SHPAPI_CALL1 * DBFReadTuple(DBFHandle psDBF, int hEntity);int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity, const void *pRawTuple
SHPObject SHPAPI_CALL1 * SHPCreateObject(int nSHPType, int nShapeId, int nParts, const int *panPartStart, const int *panPartType, int nVertices, const double *padfX, const double *padfY, const double *padfZ, const double *padfM);SHPObject SHPAPI_CALL1(*) SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX, const double *padfY, const double *padfZ
void SHPAPI_CALL SHPWriteHeader(SHPHandle hSHP)
Definition: shpopen.c:56
char SHPAPI_CALL DBFGetNativeFieldType(const DBFHandle hDBF, int iField)
Definition: dbfopen.c:1639
SHPObject SHPAPI_CALL1 * SHPReadObject(const SHPHandle hSHP, int iShape);int SHPAPI_CALL SHPWriteObject(SHPHandle hSHP, int iShape, const SHPObject *psObject
Definition: shpopen.c:1785
int SHPAPI_CALL1 * SBNSearchDiskTree(const SBNSearchHandle hSBN, const double *padfBoundsMin, const double *padfBoundsMax, int *pnShapeCount);int SHPAPI_CALL1(*) SBNSearchDiskTreeInteger(const SBNSearchHandle hSBN, int bMinX, int bMinY, int bMaxX, int bMaxY, int *pnShapeCount
int SHPAPI_CALL DBFIsAttributeNULL(const DBFHandle hDBF, int iShape, int iField)
Definition: dbfopen.c:1135
unsigned long SAOffset
Definition: shapefil.h:131
void SHPAPI_CALL SASetupDefaultHooks(SAHooks *psHooks)
Definition: safileio.c:90
double SHPAPI_CALL DBFReadDoubleAttribute(DBFHandle hDBF, int iShape, int iField)
Definition: dbfopen.c:1009
psObject nShapeId
Definition: shpopen.c:1140
psObject nVertices
Definition: shpopen.c:1228
psObject nSHPType
Definition: shpopen.c:1139
SHPObject SHPAPI_CALL1 * SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX, const double *padfY, const double *padfZ){ return(SHPCreateObject(nSHPType, -1, 0, SHPLIB_NULLPTR, SHPLIB_NULLPTR, nVertices, padfX, padfY, padfZ, SHPLIB_NULLPTR)
int SHPAPI_CALL SHPWriteObject(SHPHandle psSHP, int nShapeId, const SHPObject *psObject)
Definition: shpopen.c:1256
const char SHPAPI_CALL1 * SHPPartTypeName(int nPartType){ switch(nPartType
Definition: shpopen.c:2624
int nUpdateDay
Definition: shapefil.h:450
int bWriteEndOfFileChar
Definition: shapefil.h:452
int nRecordLength
Definition: shapefil.h:418
int * panFieldOffset
Definition: shapefil.h:423
int * panFieldDecimals
Definition: shapefil.h:425
char * pszCodePage
Definition: shapefil.h:446
int nUpdateMonth
Definition: shapefil.h:449
int nFields
Definition: shapefil.h:422
int bUpdated
Definition: shapefil.h:438
int nHeaderLength
Definition: shapefil.h:419
int * panFieldSize
Definition: shapefil.h:424
char * pszCurrentRecord
Definition: shapefil.h:432
int bCurrentRecordModified
Definition: shapefil.h:431
char * pszHeader
Definition: shapefil.h:428
int nUpdateYearSince1900
Definition: shapefil.h:448
SAFile fp
Definition: shapefil.h:414
char * pachFieldType
Definition: shapefil.h:426
int bRequireNextWriteSeek
Definition: shapefil.h:454
int nWorkFieldLength
Definition: shapefil.h:434
SAHooks sHooks
Definition: shapefil.h:412
int bNoHeader
Definition: shapefil.h:437
int iLanguageDriver
Definition: shapefil.h:445
int nRecords
Definition: shapefil.h:416
char * pszWorkField
Definition: shapefil.h:435
double dfDoubleField
Definition: shapefil.h:441
int nIntField
Definition: shapefil.h:442
int nCurrentRecord
Definition: shapefil.h:430
void * pvUserData
Definition: shapefil.h:148
int day
Definition: shapefil.h:195
int month
Definition: shapefil.h:194
int year
Definition: shapefil.h:193
SAFile fpSHX
Definition: shapefil.h:165
int nShapeType
Definition: shapefil.h:167
SAFile fpSHP
Definition: shapefil.h:164
int nMaxRecords
Definition: shapefil.h:172
SHPObject * psCachedObject
Definition: shapefil.h:187
int nBufSize
Definition: shapefil.h:182
unsigned int * panRecSize
Definition: shapefil.h:174
SAHooks sHooks
Definition: shapefil.h:162
int nRecords
Definition: shapefil.h:171
unsigned char * pabyObjectBuf
Definition: shapefil.h:185
int bUpdated
Definition: shapefil.h:179
int nObjectBufSize
Definition: shapefil.h:186
unsigned int nFileSize
Definition: shapefil.h:169
unsigned int * panRecOffset
Definition: shapefil.h:173
int bFastModeReadObject
Definition: shapefil.h:184
unsigned char * pabyRec
Definition: shapefil.h:181
SHPTreeNode * psRoot
Definition: shapefil.h:349
SHPHandle hSHP
Definition: shapefil.h:343
int nDimension
Definition: shapefil.h:346
int nMaxDepth
Definition: shapefil.h:345
int nTotalCount
Definition: shapefil.h:347
SHPObject ** papsShapeObj
Definition: shapefil.h:335
int * panShapeIds
Definition: shapefil.h:334
struct shape_tree_node * apsSubNode[MAX_SUBNODE]
Definition: shapefil.h:338
double adfBoundsMax[4]
Definition: shapefil.h:329
double adfBoundsMin[4]
Definition: shapefil.h:328
int bFastModeReadObject
Definition: shapefil.h:258
double dfYMax
Definition: shapefil.h:253
double * padfX
Definition: shapefil.h:242
double dfXMin
Definition: shapefil.h:247
int * panPartType
Definition: shapefil.h:239
int nVertices
Definition: shapefil.h:241
int nShapeId
Definition: shapefil.h:235
double dfYMin
Definition: shapefil.h:248
double * padfY
Definition: shapefil.h:243
int nSHPType
Definition: shapefil.h:233
double dfMMax
Definition: shapefil.h:255
double * padfZ
Definition: shapefil.h:244
double dfZMax
Definition: shapefil.h:254
double dfXMax
Definition: shapefil.h:252
int * panPartStart
Definition: shapefil.h:238
double * padfM
Definition: shapefil.h:245
double dfMMin
Definition: shapefil.h:250
double dfZMin
Definition: shapefil.h:249
int bMeasureIsUsed
Definition: shapefil.h:257