GRASS GIS 8 Programmer's Manual  8.4.0dev(2024)-535c39c9fc
shapefil.h
Go to the documentation of this file.
1 #ifndef SHAPEFILE_H_INCLUDED
2 #define SHAPEFILE_H_INCLUDED
3 
4 /******************************************************************************
5  * $Id$
6  *
7  * Project: Shapelib
8  * Purpose: Primary include file for Shapelib.
9  * Author: Frank Warmerdam, warmerdam@pobox.com
10  *
11  ******************************************************************************
12  * Copyright (c) 1999, Frank Warmerdam
13  * Copyright (c) 2012-2016, Even Rouault <even dot rouault at spatialys.com>
14  *
15  * This software is available under the following "MIT Style" license,
16  * or at the option of the licensee under the LGPL (see COPYING). This
17  * option is discussed in more detail in shapelib.html.
18  *
19  * --
20  *
21  * Permission is hereby granted, free of charge, to any person obtaining a
22  * copy of this software and associated documentation files (the "Software"),
23  * to deal in the Software without restriction, including without limitation
24  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
25  * and/or sell copies of the Software, and to permit persons to whom the
26  * Software is furnished to do so, subject to the following conditions:
27  *
28  * The above copyright notice and this permission notice shall be included
29  * in all copies or substantial portions of the Software.
30  *
31  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
34  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
36  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
37  * DEALINGS IN THE SOFTWARE.
38  ******************************************************************************
39  *
40  */
41 
42 #include <stdio.h>
43 
44 #ifdef USE_CPL
45 #include "cpl_conv.h"
46 #endif
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 /************************************************************************/
53 /* Configuration options. */
54 /************************************************************************/
55 
56 /* -------------------------------------------------------------------- */
57 /* Should the DBFReadStringAttribute() strip leading and */
58 /* trailing white space? */
59 /* -------------------------------------------------------------------- */
60 #define TRIM_DBF_WHITESPACE
61 
62 /* -------------------------------------------------------------------- */
63 /* Should we write measure values to the Multipatch object? */
64 /* Reportedly ArcView crashes if we do write it, so for now it */
65 /* is disabled. */
66 /* -------------------------------------------------------------------- */
67 #define DISABLE_MULTIPATCH_MEASURE
68 
69 /* -------------------------------------------------------------------- */
70 /* SHPAPI_CALL */
71 /* */
72 /* The following two macros are present to allow forcing */
73 /* various calling conventions on the Shapelib API. */
74 /* */
75 /* To force __stdcall conventions (needed to call Shapelib */
76 /* from Visual Basic and/or Dephi I believe) the makefile could */
77 /* be modified to define: */
78 /* */
79 /* /DSHPAPI_CALL=__stdcall */
80 /* */
81 /* If it is desired to force export of the Shapelib API without */
82 /* using the shapelib.def file, use the following definition. */
83 /* */
84 /* /DSHAPELIB_DLLEXPORT */
85 /* */
86 /* To get both at once it will be necessary to hack this */
87 /* include file to define: */
88 /* */
89 /* #define SHPAPI_CALL __declspec(dllexport) __stdcall */
90 /* #define SHPAPI_CALL1 __declspec(dllexport) * __stdcall */
91 /* */
92 /* The complexity of the situation is partly caused by the */
93 /* peculiar requirement of Visual C++ that __stdcall appear */
94 /* after any "*"'s in the return value of a function while the */
95 /* __declspec(dllexport) must appear before them. */
96 /* -------------------------------------------------------------------- */
97 
98 #ifdef SHAPELIB_DLLEXPORT
99 #define SHPAPI_CALL __declspec(dllexport)
100 #define SHPAPI_CALL1(x) __declspec(dllexport) x
101 #endif
102 
103 #ifndef SHPAPI_CALL
104 #if defined(USE_GCC_VISIBILITY_FLAG)
105 #define SHPAPI_CALL __attribute__((visibility("default")))
106 #define SHPAPI_CALL1(x) __attribute__((visibility("default"))) x
107 #else
108 #define SHPAPI_CALL
109 #endif
110 #endif
111 
112 #ifndef SHPAPI_CALL1
113 #define SHPAPI_CALL1(x) x SHPAPI_CALL
114 #endif
115 
116 /* -------------------------------------------------------------------- */
117 /* Macros for controlling CVSID and ensuring they don't appear */
118 /* as unreferenced variables resulting in lots of warnings. */
119 /* -------------------------------------------------------------------- */
120 #ifndef DISABLE_CVSID
121 #if defined(__GNUC__) && __GNUC__ >= 4
122 #define SHP_CVSID(string) \
123  static const char cpl_cvsid[] __attribute__((used)) = string;
124 #else
125 #define SHP_CVSID(string) \
126  static const char cpl_cvsid[] = string; \
127  static const char *cvsid_aw() \
128  { \
129  return (cvsid_aw() ? NULL : cpl_cvsid); \
130  }
131 #endif
132 #else
133 #define SHP_CVSID(string)
134 #endif
135 
136 /* -------------------------------------------------------------------- */
137 /* On some platforms, additional file IO hooks are defined that */
138 /* UTF-8 encoded filenames Unicode filenames */
139 /* -------------------------------------------------------------------- */
140 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
141 #define SHPAPI_WINDOWS
142 #define SHPAPI_UTF8_HOOKS
143 #endif
144 
145 /* -------------------------------------------------------------------- */
146 /* IO/Error hook functions. */
147 /* -------------------------------------------------------------------- */
148 typedef int *SAFile;
149 
150 #ifndef SAOffset
151 typedef unsigned long SAOffset;
152 #endif
153 
154 typedef struct {
155  SAFile (*FOpen)(const char *filename, const char *access);
156  SAOffset (*FRead)(void *p, SAOffset size, SAOffset nmemb, SAFile file);
157  SAOffset (*FWrite)(void *p, SAOffset size, SAOffset nmemb, SAFile file);
158  SAOffset (*FSeek)(SAFile file, SAOffset offset, int whence);
159  SAOffset (*FTell)(SAFile file);
160  int (*FFlush)(SAFile file);
161  int (*FClose)(SAFile file);
162  int (*Remove)(const char *filename);
163 
164  void (*Error)(const char *message);
165  double (*Atof)(const char *str);
166 } SAHooks;
167 
169 #ifdef SHPAPI_UTF8_HOOKS
170 void SHPAPI_CALL SASetupUtf8Hooks(SAHooks *psHooks);
171 #endif
172 
173 /************************************************************************/
174 /* SHP Support. */
175 /************************************************************************/
176 typedef struct tagSHPObject SHPObject;
177 
178 typedef struct {
180 
183 
184  int nShapeType; /* SHPT_* */
185 
186  unsigned int nFileSize; /* SHP file */
187 
188  int nRecords;
190  unsigned int *panRecOffset;
191  unsigned int *panRecSize;
192 
193  double adBoundsMin[4];
194  double adBoundsMax[4];
195 
196  int bUpdated;
197 
198  unsigned char *pabyRec;
199  int nBufSize;
200 
202  unsigned char *pabyObjectBuf;
205 } SHPInfo;
206 
208 
209 /* -------------------------------------------------------------------- */
210 /* Shape types (nSHPType) */
211 /* -------------------------------------------------------------------- */
212 #define SHPT_NULL 0
213 #define SHPT_POINT 1
214 #define SHPT_ARC 3
215 #define SHPT_POLYGON 5
216 #define SHPT_MULTIPOINT 8
217 #define SHPT_POINTZ 11
218 #define SHPT_ARCZ 13
219 #define SHPT_POLYGONZ 15
220 #define SHPT_MULTIPOINTZ 18
221 #define SHPT_POINTM 21
222 #define SHPT_ARCM 23
223 #define SHPT_POLYGONM 25
224 #define SHPT_MULTIPOINTM 28
225 #define SHPT_MULTIPATCH 31
226 
227 /* -------------------------------------------------------------------- */
228 /* Part types - everything but SHPT_MULTIPATCH just uses */
229 /* SHPP_RING. */
230 /* -------------------------------------------------------------------- */
231 
232 #define SHPP_TRISTRIP 0
233 #define SHPP_TRIFAN 1
234 #define SHPP_OUTERRING 2
235 #define SHPP_INNERRING 3
236 #define SHPP_FIRSTRING 4
237 #define SHPP_RING 5
238 
239 /* -------------------------------------------------------------------- */
240 /* SHPObject - represents on shape (without attributes) read */
241 /* from the .shp file. */
242 /* -------------------------------------------------------------------- */
243 struct tagSHPObject {
244  int nSHPType;
245 
246  int nShapeId; /* -1 is unknown/unassigned */
247 
248  int nParts;
251 
253  double *padfX;
254  double *padfY;
255  double *padfZ;
256  double *padfM;
257 
258  double dfXMin;
259  double dfYMin;
260  double dfZMin;
261  double dfMMin;
262 
263  double dfXMax;
264  double dfYMax;
265  double dfZMax;
266  double dfMMax;
267 
270 };
271 
272 /* -------------------------------------------------------------------- */
273 /* SHP API Prototypes */
274 /* -------------------------------------------------------------------- */
275 
276 /* If pszAccess is read-only, the fpSHX field of the returned structure */
277 /* will be NULL as it is not necessary to keep the SHX file open */
278 SHPHandle SHPAPI_CALL SHPOpen(const char *pszShapeFile, const char *pszAccess);
279 SHPHandle SHPAPI_CALL SHPOpenLL(const char *pszShapeFile, const char *pszAccess,
280  SAHooks *psHooks);
281 SHPHandle SHPAPI_CALL SHPOpenLLEx(const char *pszShapeFile,
282  const char *pszAccess, SAHooks *psHooks,
283  int bRestoreSHX);
284 
285 int SHPAPI_CALL SHPRestoreSHX(const char *pszShapeFile, const char *pszAccess,
286  SAHooks *psHooks);
287 
288 /* If setting bFastMode = TRUE, the content of SHPReadObject() is owned by the
289  * SHPHandle. */
290 /* So you cannot have 2 valid instances of SHPReadObject() simultaneously. */
291 /* The SHPObject padfZ and padfM members may be NULL depending on the geometry
292  */
293 /* type. It is illegal to free at hand any of the pointer members of the
294  * SHPObject structure */
295 void SHPAPI_CALL SHPSetFastModeReadObject(SHPHandle hSHP, int bFastMode);
296 
297 SHPHandle SHPAPI_CALL SHPCreate(const char *pszShapeFile, int nShapeType);
298 SHPHandle SHPAPI_CALL SHPCreateLL(const char *pszShapeFile, int nShapeType,
299  SAHooks *psHooks);
300 void SHPAPI_CALL SHPGetInfo(SHPHandle hSHP, int *pnEntities, int *pnShapeType,
301  double *padfMinBound, double *padfMaxBound);
302 
303 SHPObject SHPAPI_CALL1(*) SHPReadObject(SHPHandle hSHP, int iShape);
304 int SHPAPI_CALL SHPWriteObject(SHPHandle hSHP, int iShape, SHPObject *psObject);
305 
306 void SHPAPI_CALL SHPDestroyObject(SHPObject *psObject);
307 void SHPAPI_CALL SHPComputeExtents(SHPObject *psObject);
309  SHPCreateObject(int nSHPType, int nShapeId, int nParts,
310  const int *panPartStart, const int *panPartType,
311  int nVertices, const double *padfX, const double *padfY,
312  const double *padfZ, const double *padfM);
314  SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX,
315  const double *padfY, const double *padfZ);
316 
318 
319 void SHPAPI_CALL SHPClose(SHPHandle hSHP);
321 
322 const char SHPAPI_CALL1(*) SHPTypeName(int nSHPType);
323 const char SHPAPI_CALL1(*) SHPPartTypeName(int nPartType);
324 
325 /* -------------------------------------------------------------------- */
326 /* Shape quadtree indexing API. */
327 /* -------------------------------------------------------------------- */
328 
329 /* this can be two or four for binary or quad tree */
330 #define MAX_SUBNODE 4
331 
332 /* upper limit of tree levels for automatic estimation */
333 #define MAX_DEFAULT_TREE_DEPTH 12
334 
335 typedef struct shape_tree_node {
336  /* region covered by this node */
337  double adfBoundsMin[4];
338  double adfBoundsMax[4];
339 
340  /* list of shapes stored at this node. The papsShapeObj pointers
341  or the whole list can be NULL */
345 
348 
350 
351 typedef struct {
353 
357 
359 } SHPTree;
360 
362  SHPCreateTree(SHPHandle hSHP, int nDimension, int nMaxDepth,
363  double *padfBoundsMin, double *padfBoundsMax);
364 void SHPAPI_CALL SHPDestroyTree(SHPTree *hTree);
365 
366 int SHPAPI_CALL SHPWriteTree(SHPTree *hTree, const char *pszFilename);
367 
370 
372 
374  SHPTreeFindLikelyShapes(SHPTree *hTree, double *padfBoundsMin,
375  double *padfBoundsMax, int *);
376 int SHPAPI_CALL SHPCheckBoundsOverlap(double *, double *, double *, double *,
377  int);
378 
379 int SHPAPI_CALL1(*) SHPSearchDiskTree(FILE *fp, double *padfBoundsMin,
380  double *padfBoundsMax, int *pnShapeCount);
381 
382 typedef struct SHPDiskTreeInfo *SHPTreeDiskHandle;
383 
384 SHPTreeDiskHandle SHPAPI_CALL SHPOpenDiskTree(const char *pszQIXFilename,
385  SAHooks *psHooks);
386 
387 void SHPAPI_CALL SHPCloseDiskTree(SHPTreeDiskHandle hDiskTree);
388 
390  SHPSearchDiskTreeEx(SHPTreeDiskHandle hDiskTree, double *padfBoundsMin,
391  double *padfBoundsMax, int *pnShapeCount);
392 
393 int SHPAPI_CALL SHPWriteTreeLL(SHPTree *hTree, const char *pszFilename,
394  SAHooks *psHooks);
395 
396 /* -------------------------------------------------------------------- */
397 /* SBN Search API */
398 /* -------------------------------------------------------------------- */
399 
400 typedef struct SBNSearchInfo *SBNSearchHandle;
401 
402 SBNSearchHandle SHPAPI_CALL SBNOpenDiskTree(const char *pszSBNFilename,
403  SAHooks *psHooks);
404 
406 
408  SBNSearchDiskTree(SBNSearchHandle hSBN, double *padfBoundsMin,
409  double *padfBoundsMax, int *pnShapeCount);
410 
411 int SHPAPI_CALL1(*)
412  SBNSearchDiskTreeInteger(SBNSearchHandle hSBN, int bMinX, int bMinY,
413  int bMaxX, int bMaxY, int *pnShapeCount);
414 
415 void SHPAPI_CALL SBNSearchFreeIds(int *panShapeId);
416 
417 /************************************************************************/
418 /* DBF Support. */
419 /************************************************************************/
420 typedef struct {
422 
424 
425  int nRecords;
426 
427  int nRecordLength; /* Must fit on uint16 */
428  int nHeaderLength; /* File header length (32) + field
429  descriptor length + spare space.
430  Must fit on uint16 */
431  int nFields;
436 
437  char *pszHeader; /* Field descriptors */
438 
442 
445 
447  int bUpdated;
448 
449  union {
452  } fieldValue;
453 
455  char *pszCodePage;
456 
457  int nUpdateYearSince1900; /* 0-255 */
458  int nUpdateMonth; /* 1-12 */
459  int nUpdateDay; /* 1-31 */
460 
461  int bWriteEndOfFileChar; /* defaults to TRUE */
462 
464 } DBFInfo;
465 
467 
468 typedef enum {
474  FTInvalid
476 
477 /* Field descriptor/header size */
478 #define XBASE_FLDHDR_SZ 32
479 /* Shapelib read up to 11 characters, even if only 10 should normally be used */
480 #define XBASE_FLDNAME_LEN_READ 11
481 /* On writing, we limit to 10 characters */
482 #define XBASE_FLDNAME_LEN_WRITE 10
483 /* Normally only 254 characters should be used. We tolerate 255 historically */
484 #define XBASE_FLD_MAX_WIDTH 255
485 
486 DBFHandle SHPAPI_CALL DBFOpen(const char *pszDBFFile, const char *pszAccess);
487 DBFHandle SHPAPI_CALL DBFOpenLL(const char *pszDBFFile, const char *pszAccess,
488  SAHooks *psHooks);
489 DBFHandle SHPAPI_CALL DBFCreate(const char *pszDBFFile);
490 DBFHandle SHPAPI_CALL DBFCreateEx(const char *pszDBFFile,
491  const char *pszCodePage);
492 DBFHandle SHPAPI_CALL DBFCreateLL(const char *pszDBFFile,
493  const char *pszCodePage, SAHooks *psHooks);
494 
497 int SHPAPI_CALL DBFAddField(DBFHandle hDBF, const char *pszFieldName,
498  DBFFieldType eType, int nWidth, int nDecimals);
499 
500 int SHPAPI_CALL DBFAddNativeFieldType(DBFHandle hDBF, const char *pszFieldName,
501  char chType, int nWidth, int nDecimals);
502 
503 int SHPAPI_CALL DBFDeleteField(DBFHandle hDBF, int iField);
504 
505 int SHPAPI_CALL DBFReorderFields(DBFHandle psDBF, int *panMap);
506 
507 int SHPAPI_CALL DBFAlterFieldDefn(DBFHandle psDBF, int iField,
508  const char *pszFieldName, char chType,
509  int nWidth, int nDecimals);
510 
512  char *pszFieldName, int *pnWidth,
513  int *pnDecimals);
514 
515 int SHPAPI_CALL DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName);
516 
517 int SHPAPI_CALL DBFReadIntegerAttribute(DBFHandle hDBF, int iShape, int iField);
518 double SHPAPI_CALL DBFReadDoubleAttribute(DBFHandle hDBF, int iShape,
519  int iField);
520 const char SHPAPI_CALL1(*)
521  DBFReadStringAttribute(DBFHandle hDBF, int iShape, int iField);
522 const char SHPAPI_CALL1(*)
523  DBFReadLogicalAttribute(DBFHandle hDBF, int iShape, int iField);
524 int SHPAPI_CALL DBFIsAttributeNULL(DBFHandle hDBF, int iShape, int iField);
525 
526 int SHPAPI_CALL DBFWriteIntegerAttribute(DBFHandle hDBF, int iShape, int iField,
527  int nFieldValue);
528 int SHPAPI_CALL DBFWriteDoubleAttribute(DBFHandle hDBF, int iShape, int iField,
529  double dFieldValue);
530 int SHPAPI_CALL DBFWriteStringAttribute(DBFHandle hDBF, int iShape, int iField,
531  const char *pszFieldValue);
532 int SHPAPI_CALL DBFWriteNULLAttribute(DBFHandle hDBF, int iShape, int iField);
533 
534 int SHPAPI_CALL DBFWriteLogicalAttribute(DBFHandle hDBF, int iShape, int iField,
535  const char lFieldValue);
536 int SHPAPI_CALL DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity,
537  int iField, void *pValue);
538 const char SHPAPI_CALL1(*) DBFReadTuple(DBFHandle psDBF, int hEntity);
539 int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity, void *pRawTuple);
540 
541 int SHPAPI_CALL DBFIsRecordDeleted(DBFHandle psDBF, int iShape);
542 int SHPAPI_CALL DBFMarkRecordDeleted(DBFHandle psDBF, int iShape,
543  int bIsDeleted);
544 
545 DBFHandle SHPAPI_CALL DBFCloneEmpty(DBFHandle psDBF, const char *pszFilename);
546 
547 void SHPAPI_CALL DBFClose(DBFHandle hDBF);
549 char SHPAPI_CALL DBFGetNativeFieldType(DBFHandle hDBF, int iField);
550 
551 const char SHPAPI_CALL1(*) DBFGetCodePage(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 */
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:332
int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity, void *pRawTuple)
Definition: dbfopen.c:1506
#define file
int SHPAPI_CALL DBFWriteIntegerAttribute(DBFHandle hDBF, int iShape, int iField, int nFieldValue)
Definition: dbfopen.c:1449
SHPHandle SHPAPI_CALL SHPCreate(const char *pszShapeFile, int nShapeType)
Definition: shpopen.c:944
DBFFieldType
Definition: shapefil.h:468
@ FTDouble
Definition: shapefil.h:471
@ FTString
Definition: shapefil.h:469
@ FTInvalid
Definition: shapefil.h:474
@ FTLogical
Definition: shapefil.h:472
@ FTDate
Definition: shapefil.h:473
@ FTInteger
Definition: shapefil.h:470
void SHPAPI_CALL SHPCloseDiskTree(SHPTreeDiskHandle hDiskTree)
DBFHandle SHPAPI_CALL DBFOpenLL(const char *pszDBFFile, const char *pszAccess, SAHooks *psHooks)
Definition: dbfopen.c:378
SHPObject SHPAPI_CALL1 * SHPReadObject(SHPHandle hSHP, int iShape);int SHPAPI_CALL SHPWriteObject(SHPHandle hSHP, int iShape, SHPObject *psObject
Definition: shpopen.c:1761
int SHPAPI_CALL DBFMarkRecordDeleted(DBFHandle psDBF, int iShape, int bIsDeleted)
Definition: dbfopen.c:1692
int SHPAPI_CALL DBFGetFieldCount(DBFHandle psDBF)
Definition: dbfopen.c:1174
int SHPAPI_CALL DBFAlterFieldDefn(DBFHandle psDBF, int iField, const char *pszFieldName, char chType, int nWidth, int nDecimals)
Definition: dbfopen.c:1989
void SHPAPI_CALL DBFUpdateHeader(DBFHandle hDBF)
Definition: dbfopen.c:298
int SHPAPI_CALL SHPTreeRemoveShapeId(SHPTree *hTree, int nShapeId)
int SHPAPI_CALL DBFWriteStringAttribute(DBFHandle hDBF, int iShape, int iField, const char *pszFieldValue)
Definition: dbfopen.c:1464
struct shape_tree_node SHPTreeNode
int SHPAPI_CALL DBFDeleteField(DBFHandle hDBF, int iField)
#define MAX_SUBNODE
Definition: shapefil.h:330
DBFHandle SHPAPI_CALL DBFOpen(const char *pszDBFFile, const char *pszAccess)
Definition: dbfopen.c:346
int SHPAPI_CALL SHPWriteTree(SHPTree *hTree, const char *pszFilename)
int SHPAPI_CALL DBFReadIntegerAttribute(DBFHandle hDBF, int iShape, int iField)
Definition: dbfopen.c:1050
int SHPAPI_CALL DBFAddNativeFieldType(DBFHandle hDBF, const char *pszFieldName, char chType, int nWidth, int nDecimals)
Definition: dbfopen.c:792
void SHPAPI_CALL SHPSetFastModeReadObject(SHPHandle hSHP, int bFastMode)
Definition: shpopen.c:898
int SHPAPI_CALL1 * SHPTreeFindLikelyShapes(SHPTree *hTree, double *padfBoundsMin, double *padfBoundsMax, int *);int SHPAPI_CALL SHPCheckBoundsOverlap(double *, double *, double *, double *, int
int SHPAPI_CALL1 * SHPSearchDiskTree(FILE *fp, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount);typedef struct SHPDiskTreeInfo *SHPTreeDiskHandle;SHPTreeDiskHandle SHPAPI_CALL SHPOpenDiskTree(const char *pszQIXFilename, SAHooks *psHooks
const char SHPAPI_CALL1 * DBFGetCodePage(DBFHandle psDBF);void SHPAPI_CALL DBFSetLastModifiedDate(DBFHandle psDBF, int nYYSince1900, int nMM, int nDD
Definition: dbfopen.c:1730
SHPTree SHPAPI_CALL1 * SHPCreateTree(SHPHandle hSHP, int nDimension, int nMaxDepth, double *padfBoundsMin, double *padfBoundsMax);void SHPAPI_CALL SHPDestroyTree(SHPTree *hTree
void SHPAPI_CALL SHPClose(SHPHandle hSHP)
Definition: shpopen.c:852
int SHPAPI_CALL DBFWriteDoubleAttribute(DBFHandle hDBF, int iShape, int iField, double dFieldValue)
Definition: dbfopen.c:1436
void SHPAPI_CALL SHPDestroyObject(SHPObject *psObject)
Definition: shpopen.c:2611
DBFHandle SHPAPI_CALL DBFCloneEmpty(DBFHandle psDBF, const char *pszFilename)
Definition: dbfopen.c:1574
void SHPAPI_CALL SHPComputeExtents(SHPObject *psObject)
Definition: shpopen.c:1117
DBFInfo * DBFHandle
Definition: shapefil.h:466
SHPHandle SHPAPI_CALL SHPCreateLL(const char *pszShapeFile, int nShapeType, SAHooks *psHooks)
Definition: shpopen.c:960
int SHPAPI_CALL1 * SHPSearchDiskTreeEx(SHPTreeDiskHandle hDiskTree, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount);int SHPAPI_CALL SHPWriteTreeLL(SHPTree *hTree, const char *pszFilename, SAHooks *psHooks
int SHPAPI_CALL DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName)
Definition: dbfopen.c:1649
int SHPAPI_CALL DBFWriteNULLAttribute(DBFHandle hDBF, int iShape, int iField)
Definition: dbfopen.c:1479
void SHPAPI_CALL SHPTreeTrimExtraNodes(SHPTree *hTree)
int SHPAPI_CALL DBFGetRecordCount(DBFHandle psDBF)
Definition: dbfopen.c:1186
SHPHandle SHPAPI_CALL SHPOpen(const char *pszShapeFile, const char *pszAccess)
Definition: shpopen.c:289
SHPInfo * SHPHandle
Definition: shapefil.h:207
int * SAFile
Definition: shapefil.h:148
int SHPAPI_CALL DBFIsAttributeNULL(DBFHandle hDBF, int iShape, int iField)
Definition: dbfopen.c:1158
void SHPAPI_CALL SHPGetInfo(SHPHandle hSHP, int *pnEntities, int *pnShapeType, double *padfMinBound, double *padfMaxBound)
Definition: shpopen.c:917
SBNSearchHandle SHPAPI_CALL SBNOpenDiskTree(const char *pszSBNFilename, SAHooks *psHooks)
int SHPAPI_CALL DBFAddField(DBFHandle hDBF, const char *pszFieldName, DBFFieldType eType, int nWidth, int nDecimals)
Definition: dbfopen.c:748
const char SHPAPI_CALL1 * DBFReadStringAttribute(DBFHandle hDBF, int iShape, int iField);const char SHPAPI_CALL1(*) DBFReadLogicalAttribute(DBFHandle hDBF, int iShape, int iField
int SHPAPI_CALL DBFWriteLogicalAttribute(DBFHandle hDBF, int iShape, int iField, const char lFieldValue)
Definition: dbfopen.c:1491
DBFHandle SHPAPI_CALL DBFCreateEx(const char *pszDBFFile, const char *pszCodePage)
Definition: dbfopen.c:631
#define SHPAPI_CALL
Definition: shapefil.h:108
DBFHandle SHPAPI_CALL DBFCreate(const char *pszDBFFile)
Definition: dbfopen.c:620
void SHPAPI_CALL DBFClose(DBFHandle hDBF)
Definition: dbfopen.c:572
#define SHPAPI_CALL1(x)
Definition: shapefil.h:113
int SHPAPI_CALL SHPTreeAddShapeId(SHPTree *hTree, SHPObject *psObject)
struct SBNSearchInfo * SBNSearchHandle
Definition: shapefil.h:400
void SHPAPI_CALL SBNSearchFreeIds(int *panShapeId)
const char SHPAPI_CALL1 * SHPTypeName(int nSHPType);const char SHPAPI_CALL1(*) SHPPartTypeName(int nPartType
Definition: shpopen.c:2527
int SHPAPI_CALL1 * SBNSearchDiskTree(SBNSearchHandle hSBN, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount);int SHPAPI_CALL1(*) SBNSearchDiskTreeInteger(SBNSearchHandle hSBN, int bMinX, int bMinY, int bMaxX, int bMaxY, int *pnShapeCount
SHPHandle SHPAPI_CALL SHPOpenLLEx(const char *pszShapeFile, const char *pszAccess, SAHooks *psHooks, int bRestoreSHX)
Definition: shpopen.c:659
void SHPAPI_CALL DBFSetWriteEndOfFileChar(DBFHandle psDBF, int bWriteFlag)
Definition: dbfopen.c:2228
SHPHandle SHPAPI_CALL SHPOpenLL(const char *pszShapeFile, const char *pszAccess, SAHooks *psHooks)
Definition: shpopen.c:321
void SHPAPI_CALL SBNCloseDiskTree(SBNSearchHandle hSBN)
DBFHandle SHPAPI_CALL DBFCreateLL(const char *pszDBFFile, const char *pszCodePage, SAHooks *psHooks)
Definition: dbfopen.c:647
int SHPAPI_CALL SHPRewindObject(SHPHandle hSHP, SHPObject *psObject)
int SHPAPI_CALL DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField, void *pValue)
Definition: dbfopen.c:1372
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
int SHPAPI_CALL DBFReorderFields(DBFHandle psDBF, int *panMap)
Definition: dbfopen.c:1869
void SHPAPI_CALL SHPWriteHeader(SHPHandle hSHP)
Definition: shpopen.c:142
int SHPAPI_CALL DBFIsRecordDeleted(DBFHandle psDBF, int iShape)
Definition: dbfopen.c:1668
unsigned long SAOffset
Definition: shapefil.h:151
void SHPAPI_CALL SASetupDefaultHooks(SAHooks *psHooks)
Definition: safileio.c:183
const char SHPAPI_CALL1 * DBFReadTuple(DBFHandle psDBF, int hEntity);int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity, void *pRawTuple
int SHPAPI_CALL SHPRestoreSHX(const char *pszShapeFile, const char *pszAccess, SAHooks *psHooks)
Definition: shpopen.c:680
char SHPAPI_CALL DBFGetNativeFieldType(DBFHandle hDBF, int iField)
Definition: dbfopen.c:1632
double SHPAPI_CALL DBFReadDoubleAttribute(DBFHandle hDBF, int iShape, int iField)
Definition: dbfopen.c:1068
DBFFieldType SHPAPI_CALL DBFGetFieldInfo(DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals)
Definition: dbfopen.c:1200
psObject nShapeId
Definition: shpopen.c:1158
psObject nVertices
Definition: shpopen.c:1247
psObject nSHPType
Definition: shpopen.c:1157
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, SHPObject *psObject)
Definition: shpopen.c:1275
const char SHPAPI_CALL1 * SHPPartTypeName(int nPartType){ switch(nPartType
Definition: shpopen.c:2581
int nUpdateDay
Definition: shapefil.h:459
int bWriteEndOfFileChar
Definition: shapefil.h:461
int nRecordLength
Definition: shapefil.h:427
int * panFieldOffset
Definition: shapefil.h:432
int * panFieldDecimals
Definition: shapefil.h:434
char * pszCodePage
Definition: shapefil.h:455
int nUpdateMonth
Definition: shapefil.h:458
int nFields
Definition: shapefil.h:431
int bUpdated
Definition: shapefil.h:447
int nHeaderLength
Definition: shapefil.h:428
int * panFieldSize
Definition: shapefil.h:433
char * pszCurrentRecord
Definition: shapefil.h:441
int bCurrentRecordModified
Definition: shapefil.h:440
char * pszHeader
Definition: shapefil.h:437
int nUpdateYearSince1900
Definition: shapefil.h:457
SAFile fp
Definition: shapefil.h:423
char * pachFieldType
Definition: shapefil.h:435
int bRequireNextWriteSeek
Definition: shapefil.h:463
int nWorkFieldLength
Definition: shapefil.h:443
SAHooks sHooks
Definition: shapefil.h:421
int bNoHeader
Definition: shapefil.h:446
int iLanguageDriver
Definition: shapefil.h:454
int nRecords
Definition: shapefil.h:425
char * pszWorkField
Definition: shapefil.h:444
double dfDoubleField
Definition: shapefil.h:450
int nIntField
Definition: shapefil.h:451
int nCurrentRecord
Definition: shapefil.h:439
SAFile fpSHX
Definition: shapefil.h:182
int nShapeType
Definition: shapefil.h:184
SAFile fpSHP
Definition: shapefil.h:181
int nMaxRecords
Definition: shapefil.h:189
SHPObject * psCachedObject
Definition: shapefil.h:204
int nBufSize
Definition: shapefil.h:199
unsigned int * panRecSize
Definition: shapefil.h:191
SAHooks sHooks
Definition: shapefil.h:179
int nRecords
Definition: shapefil.h:188
unsigned char * pabyObjectBuf
Definition: shapefil.h:202
int bUpdated
Definition: shapefil.h:196
int nObjectBufSize
Definition: shapefil.h:203
unsigned int nFileSize
Definition: shapefil.h:186
unsigned int * panRecOffset
Definition: shapefil.h:190
int bFastModeReadObject
Definition: shapefil.h:201
unsigned char * pabyRec
Definition: shapefil.h:198
SHPTreeNode * psRoot
Definition: shapefil.h:358
SHPHandle hSHP
Definition: shapefil.h:352
int nDimension
Definition: shapefil.h:355
int nMaxDepth
Definition: shapefil.h:354
int nTotalCount
Definition: shapefil.h:356
SHPObject ** papsShapeObj
Definition: shapefil.h:344
int * panShapeIds
Definition: shapefil.h:343
struct shape_tree_node * apsSubNode[MAX_SUBNODE]
Definition: shapefil.h:347
double adfBoundsMax[4]
Definition: shapefil.h:338
double adfBoundsMin[4]
Definition: shapefil.h:337
int bFastModeReadObject
Definition: shapefil.h:269
double dfYMax
Definition: shapefil.h:264
double * padfX
Definition: shapefil.h:253
double dfXMin
Definition: shapefil.h:258
int * panPartType
Definition: shapefil.h:250
int nVertices
Definition: shapefil.h:252
int nShapeId
Definition: shapefil.h:246
double dfYMin
Definition: shapefil.h:259
double * padfY
Definition: shapefil.h:254
int nSHPType
Definition: shapefil.h:244
double dfMMax
Definition: shapefil.h:266
double * padfZ
Definition: shapefil.h:255
double dfZMax
Definition: shapefil.h:265
double dfXMax
Definition: shapefil.h:263
int * panPartStart
Definition: shapefil.h:249
double * padfM
Definition: shapefil.h:256
double dfMMin
Definition: shapefil.h:261
double dfZMin
Definition: shapefil.h:260
int bMeasureIsUsed
Definition: shapefil.h:268