PostGIS  2.5.7dev-r@@SVN_REVISION@@
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  *
13  * This software is available under the following "MIT Style" license,
14  * or at the option of the licensee under the LGPL (see LICENSE.LGPL). This
15  * option is discussed in more detail in shapelib.html.
16  *
17  * --
18  *
19  * Permission is hereby granted, free of charge, to any person obtaining a
20  * copy of this software and associated documentation files (the "Software"),
21  * to deal in the Software without restriction, including without limitation
22  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
23  * and/or sell copies of the Software, and to permit persons to whom the
24  * Software is furnished to do so, subject to the following conditions:
25  *
26  * The above copyright notice and this permission notice shall be included
27  * in all copies or substantial portions of the Software.
28  *
29  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
30  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
32  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
34  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
35  * DEALINGS IN THE SOFTWARE.
36  ******************************************************************************
37  *
38  * $Log: shapefil.h,v $
39  * Revision 1.51 2011-07-24 05:59:25 fwarmerdam
40  * minimize use of CPLError in favor of SAHooks.Error()
41  *
42  * Revision 1.50 2011-05-13 17:35:17 fwarmerdam
43  * added DBFReorderFields() and DBFAlterFields() functions (from Even)
44  *
45  * Revision 1.49 2011-04-16 14:38:21 fwarmerdam
46  * avoid warnings with gcc on SHP_CVSID
47  *
48  * Revision 1.48 2010-08-27 23:42:52 fwarmerdam
49  * add SHPAPI_CALL attribute in code
50  *
51  * Revision 1.47 2010-01-28 11:34:34 fwarmerdam
52  * handle the shape file length limits more gracefully (#3236)
53  *
54  * Revision 1.46 2008-11-12 14:28:15 fwarmerdam
55  * DBFCreateField() now works on files with records
56  *
57  * Revision 1.45 2008/11/11 17:47:10 fwarmerdam
58  * added DBFDeleteField() function
59  *
60  * Revision 1.44 2008/01/16 20:05:19 bram
61  * Add file hooks that accept UTF-8 encoded filenames on some platforms. Use SASetupUtf8Hooks
62  * tosetup the hooks and check SHPAPI_UTF8_HOOKS for its availability. Currently, this
63  * is only available on the Windows platform that decodes the UTF-8 filenames to wide
64  * character strings and feeds them to _wfopen and _wremove.
65  *
66  * Revision 1.43 2008/01/10 16:35:30 fwarmerdam
67  * avoid _ prefix on #defined symbols (bug 1840)
68  *
69  * Revision 1.42 2007/12/18 18:28:14 bram
70  * - create hook for client specific atof (bugzilla ticket 1615)
71  * - check for NULL handle before closing cpCPG file, and close after reading.
72  *
73  * Revision 1.41 2007/12/15 20:25:32 bram
74  * dbfopen.c now reads the Code Page information from the DBF file, and exports
75  * this information as a string through the DBFGetCodePage function. This is
76  * either the number from the LDID header field ("LDID/<number>") or as the
77  * content of an accompanying .CPG file. When creating a DBF file, the code can
78  * be set using DBFCreateEx.
79  *
80  * Revision 1.40 2007/12/06 07:00:25 fwarmerdam
81  * dbfopen now using SAHooks for fileio
82  *
83  * Revision 1.39 2007/12/04 20:37:56 fwarmerdam
84  * preliminary implementation of hooks api for io and errors
85  *
86  * Revision 1.38 2007/11/21 22:39:56 fwarmerdam
87  * close shx file in readonly mode (GDAL #1956)
88  *
89  * Revision 1.37 2007/10/27 03:31:14 fwarmerdam
90  * limit default depth of tree to 12 levels (gdal ticket #1594)
91  *
92  * Revision 1.36 2007/09/10 23:33:15 fwarmerdam
93  * Upstreamed support for visibility flag in SHPAPI_CALL for the needs
94  * of GDAL (gdal ticket #1810).
95  *
96  * Revision 1.35 2007/09/03 19:48:10 fwarmerdam
97  * move DBFReadAttribute() static dDoubleField into dbfinfo
98  *
99  * Revision 1.34 2006/06/17 15:33:32 fwarmerdam
100  * added pszWorkField - bug 1202 (rso)
101  *
102  * Revision 1.33 2006/02/15 01:14:30 fwarmerdam
103  * added DBFAddNativeFieldType
104  *
105  * Revision 1.32 2006/01/26 15:07:32 fwarmerdam
106  * add bMeasureIsUsed flag from Craig Bruce: Bug 1249
107  *
108  * Revision 1.31 2006/01/05 01:27:27 fwarmerdam
109  * added dbf deletion mark/fetch
110  *
111  * Revision 1.30 2005/01/03 22:30:13 fwarmerdam
112  * added support for saved quadtrees
113  *
114  * Revision 1.29 2004/09/26 20:09:35 fwarmerdam
115  * avoid rcsid warnings
116  *
117  * Revision 1.28 2003/12/29 06:02:18 fwarmerdam
118  * added cpl_error.h option
119  *
120  * Revision 1.27 2003/04/21 18:30:37 warmerda
121  * added header write/update public methods
122  *
123  * Revision 1.26 2002/09/29 00:00:08 warmerda
124  * added FTLogical and logical attribute read/write calls
125  *
126  * Revision 1.25 2002/05/07 13:46:30 warmerda
127  * added DBFWriteAttributeDirectly().
128  *
129  * Revision 1.24 2002/04/10 16:59:54 warmerda
130  * added SHPRewindObject
131  *
132  * Revision 1.23 2002/01/15 14:36:07 warmerda
133  * updated email address
134  *
135  * Revision 1.22 2002/01/15 14:32:00 warmerda
136  * try to improve SHPAPI_CALL docs
137  */
138 
139 #define _FILE_OFFSET_BITS 64
140 #include <stdio.h>
141 #include <sys/types.h>
142 
143 #ifdef USE_DBMALLOC
144 #include <dbmalloc.h>
145 #endif
146 
147 #ifdef __cplusplus
148 extern "C" {
149 #endif
150 
151 /************************************************************************/
152 /* Configuration options. */
153 /************************************************************************/
154 
155 /* -------------------------------------------------------------------- */
156 /* Should the DBFReadStringAttribute() strip leading and */
157 /* trailing white space? */
158 /* -------------------------------------------------------------------- */
159 #define TRIM_DBF_WHITESPACE
160 
161 /* -------------------------------------------------------------------- */
162 /* Should we write measure values to the Multipatch object? */
163 /* Reportedly ArcView crashes if we do write it, so for now it */
164 /* is disabled. */
165 /* -------------------------------------------------------------------- */
166 #define DISABLE_MULTIPATCH_MEASURE
167 
168 /* -------------------------------------------------------------------- */
169 /* SHPAPI_CALL */
170 /* */
171 /* The following two macros are present to allow forcing */
172 /* various calling conventions on the Shapelib API. */
173 /* */
174 /* To force __stdcall conventions (needed to call Shapelib */
175 /* from Visual Basic and/or Dephi I believe) the makefile could */
176 /* be modified to define: */
177 /* */
178 /* /DSHPAPI_CALL=__stdcall */
179 /* */
180 /* If it is desired to force export of the Shapelib API without */
181 /* using the shapelib.def file, use the following definition. */
182 /* */
183 /* /DSHAPELIB_DLLEXPORT */
184 /* */
185 /* To get both at once it will be necessary to hack this */
186 /* include file to define: */
187 /* */
188 /* #define SHPAPI_CALL __declspec(dllexport) __stdcall */
189 /* #define SHPAPI_CALL1 __declspec(dllexport) * __stdcall */
190 /* */
191 /* The complexity of the situtation is partly caused by the */
192 /* peculiar requirement of Visual C++ that __stdcall appear */
193 /* after any "*"'s in the return value of a function while the */
194 /* __declspec(dllexport) must appear before them. */
195 /* -------------------------------------------------------------------- */
196 
197 #ifdef SHAPELIB_DLLEXPORT
198 # define SHPAPI_CALL __declspec(dllexport)
199 # define SHPAPI_CALL1(x) __declspec(dllexport) x
200 #endif
201 
202 #ifndef SHPAPI_CALL
203 # if defined(USE_GCC_VISIBILITY_FLAG)
204 # define SHPAPI_CALL __attribute__ ((visibility("default")))
205 # define SHPAPI_CALL1(x) __attribute__ ((visibility("default"))) x
206 # else
207 # define SHPAPI_CALL
208 # endif
209 #endif
210 
211 #ifndef SHPAPI_CALL1
212 # define SHPAPI_CALL1(x) x SHPAPI_CALL
213 #endif
214 
215 /* -------------------------------------------------------------------- */
216 /* Macros for controlling CVSID and ensuring they don't appear */
217 /* as unreferenced variables resulting in lots of warnings. */
218 /* -------------------------------------------------------------------- */
219 #ifndef DISABLE_CVSID
220 # if defined(__GNUC__) && __GNUC__ >= 4
221 # define SHP_CVSID(string) static char cpl_cvsid[] __attribute__((used)) = string;
222 # else
223 # define SHP_CVSID(string) static char cpl_cvsid[] = string; \
224 static char *cvsid_aw() { return( cvsid_aw() ? ((char *) NULL) : cpl_cvsid ); }
225 # endif
226 #else
227 # define SHP_CVSID(string)
228 #endif
229 
230 /* -------------------------------------------------------------------- */
231 /* On some platforms, additional file IO hooks are defined that */
232 /* UTF-8 encoded filenames Unicode filenames */
233 /* -------------------------------------------------------------------- */
234 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
235 # define SHPAPI_WINDOWS
236 # define SHPAPI_UTF8_HOOKS
237 #endif
238 
239 /* -------------------------------------------------------------------- */
240 /* IO/Error hook functions. */
241 /* -------------------------------------------------------------------- */
242 typedef int *SAFile;
243 
244 #ifdef HAVE_SEEKO
245 # ifndef SAOffset
246  typedef off_t SAOffset;
247 # endif
248 #else
249 # ifndef SAOffset
250  typedef unsigned long SAOffset;
251 # endif
252 #endif
253 
254 typedef struct {
255  SAFile (*FOpen) ( const char *filename, const char *access);
256  SAOffset (*FRead) ( void *p, SAOffset size, SAOffset nmemb, SAFile file);
257  SAOffset (*FWrite)( void *p, SAOffset size, SAOffset nmemb, SAFile file);
258  SAOffset (*FSeek) ( SAFile file, SAOffset offset, int whence );
259  SAOffset (*FTell) ( SAFile file );
260  int (*FFlush)( SAFile file );
261  int (*FClose)( SAFile file );
262  int (*Remove) ( const char *filename );
263 
264  void (*Error) ( const char *message );
265  double (*Atof) ( const char *str );
266 } SAHooks;
267 
268 void SHPAPI_CALL SASetupDefaultHooks( SAHooks *psHooks );
269 #ifdef SHPAPI_UTF8_HOOKS
270 void SHPAPI_CALL SASetupUtf8Hooks( SAHooks *psHooks );
271 #endif
272 
273 /************************************************************************/
274 /* SHP Support. */
275 /************************************************************************/
276 typedef struct
277 {
279 
282 
283  int nShapeType; /* SHPT_* */
284 
285  unsigned int nFileSize; /* SHP file */
286 
287  int nRecords;
289  unsigned int *panRecOffset;
290  unsigned int *panRecSize;
291 
292  double adBoundsMin[4];
293  double adBoundsMax[4];
294 
295  int bUpdated;
296 
297  unsigned char *pabyRec;
298  int nBufSize;
299 } SHPInfo;
300 
301 typedef SHPInfo * SHPHandle;
302 
303 /* -------------------------------------------------------------------- */
304 /* Shape types (nSHPType) */
305 /* -------------------------------------------------------------------- */
306 #define SHPT_NULL 0
307 #define SHPT_POINT 1
308 #define SHPT_ARC 3
309 #define SHPT_POLYGON 5
310 #define SHPT_MULTIPOINT 8
311 #define SHPT_POINTZ 11
312 #define SHPT_ARCZ 13
313 #define SHPT_POLYGONZ 15
314 #define SHPT_MULTIPOINTZ 18
315 #define SHPT_POINTM 21
316 #define SHPT_ARCM 23
317 #define SHPT_POLYGONM 25
318 #define SHPT_MULTIPOINTM 28
319 #define SHPT_MULTIPATCH 31
320 
321 
322 /* -------------------------------------------------------------------- */
323 /* Part types - everything but SHPT_MULTIPATCH just uses */
324 /* SHPP_RING. */
325 /* -------------------------------------------------------------------- */
326 
327 #define SHPP_TRISTRIP 0
328 #define SHPP_TRIFAN 1
329 #define SHPP_OUTERRING 2
330 #define SHPP_INNERRING 3
331 #define SHPP_FIRSTRING 4
332 #define SHPP_RING 5
333 
334 /* -------------------------------------------------------------------- */
335 /* SHPObject - represents on shape (without attributes) read */
336 /* from the .shp file. */
337 /* -------------------------------------------------------------------- */
338 typedef struct
339 {
340  int nSHPType;
341 
342  int nShapeId; /* -1 is unknown/unassigned */
343 
344  int nParts;
347 
349  double *padfX;
350  double *padfY;
351  double *padfZ;
352  double *padfM;
353 
354  double dfXMin;
355  double dfYMin;
356  double dfZMin;
357  double dfMMin;
358 
359  double dfXMax;
360  double dfYMax;
361  double dfZMax;
362  double dfMMax;
363 
365 } SHPObject;
366 
367 /* -------------------------------------------------------------------- */
368 /* SHP API Prototypes */
369 /* -------------------------------------------------------------------- */
370 
371 /* If pszAccess is read-only, the fpSHX field of the returned structure */
372 /* will be NULL as it is not necessary to keep the SHX file open */
374  SHPOpen( const char * pszShapeFile, const char * pszAccess );
376  SHPOpenLL( const char *pszShapeFile, const char *pszAccess,
377  SAHooks *psHooks );
379  SHPCreate( const char * pszShapeFile, int nShapeType );
381  SHPCreateLL( const char * pszShapeFile, int nShapeType,
382  SAHooks *psHooks );
383 void SHPAPI_CALL
384  SHPGetInfo( SHPHandle hSHP, int * pnEntities, int * pnShapeType,
385  double * padfMinBound, double * padfMaxBound );
386 
388  SHPReadObject( SHPHandle hSHP, int iShape );
389 int SHPAPI_CALL
390  SHPWriteObject( SHPHandle hSHP, int iShape, SHPObject * psObject );
391 
392 void SHPAPI_CALL
393  SHPDestroyObject( SHPObject * psObject );
394 void SHPAPI_CALL
395  SHPComputeExtents( SHPObject * psObject );
397  SHPCreateObject( int nSHPType, int nShapeId, int nParts,
398  const int * panPartStart, const int * panPartType,
399  int nVertices,
400  const double * padfX, const double * padfY,
401  const double * padfZ, const double * padfM );
404  const double * padfX,
405  const double * padfY,
406  const double * padfZ );
407 
408 int SHPAPI_CALL
409  SHPRewindObject( SHPHandle hSHP, SHPObject * psObject );
410 
411 void SHPAPI_CALL SHPClose( SHPHandle hSHP );
413 
414 const char SHPAPI_CALL1(*)
415  SHPTypeName( int nSHPType );
416 const char SHPAPI_CALL1(*)
417  SHPPartTypeName( int nPartType );
418 
419 /* -------------------------------------------------------------------- */
420 /* Shape quadtree indexing API. */
421 /* -------------------------------------------------------------------- */
422 
423 /* this can be two or four for binary or quad tree */
424 #define MAX_SUBNODE 4
425 
426 /* upper limit of tree levels for automatic estimation */
427 #define MAX_DEFAULT_TREE_DEPTH 12
428 
429 typedef struct shape_tree_node
430 {
431  /* region covered by this node */
432  double adfBoundsMin[4];
433  double adfBoundsMax[4];
434 
435  /* list of shapes stored at this node. The papsShapeObj pointers
436  or the whole list can be NULL */
440 
443 
445 
446 typedef struct
447 {
449 
453 
455 } SHPTree;
456 
458  SHPCreateTree( SHPHandle hSHP, int nDimension, int nMaxDepth,
459  double *padfBoundsMin, double *padfBoundsMax );
460 void SHPAPI_CALL
461  SHPDestroyTree( SHPTree * hTree );
462 
463 int SHPAPI_CALL
464  SHPWriteTree( SHPTree *hTree, const char * pszFilename );
465 
466 int SHPAPI_CALL
467  SHPTreeAddObject( SHPTree * hTree, SHPObject * psObject );
468 int SHPAPI_CALL
469  SHPTreeAddShapeId( SHPTree * hTree, SHPObject * psObject );
470 int SHPAPI_CALL
472 
473 void SHPAPI_CALL
475 
478  double * padfBoundsMin,
479  double * padfBoundsMax,
480  int * );
481 int SHPAPI_CALL
482  SHPCheckBoundsOverlap( double *, double *, double *, double *, int );
483 
485 SHPSearchDiskTree( FILE *fp,
486  double *padfBoundsMin, double *padfBoundsMax,
487  int *pnShapeCount );
488 
489 /************************************************************************/
490 /* DBF Support. */
491 /************************************************************************/
492 typedef struct
493 {
494  SAHooks sHooks;
495 
496  SAFile fp;
497 
498  int nRecords;
499 
500  int nRecordLength;
501  int nHeaderLength;
502  int nFields;
503  int *panFieldOffset;
504  int *panFieldSize;
505  int *panFieldDecimals;
506  char *pachFieldType;
507 
508  char *pszHeader;
509 
510  int nCurrentRecord;
511  int bCurrentRecordModified;
512  char *pszCurrentRecord;
513 
514  int nWorkFieldLength;
515  char *pszWorkField;
516 
517  int bNoHeader;
518  int bUpdated;
519 
520  double dfDoubleField;
521 
522  int iLanguageDriver;
523  char *pszCodePage;
524 } DBFInfo;
525 
526 typedef DBFInfo * DBFHandle;
527 
528 typedef enum {
529  FTString,
530  FTInteger,
531  FTDouble,
532  FTLogical,
533  FTDate,
534  FTInvalid
535 } DBFFieldType;
536 
537 #define XBASE_FLDHDR_SZ 32
538 
539 
540 DBFHandle SHPAPI_CALL
541  DBFOpen( const char * pszDBFFile, const char * pszAccess );
542 DBFHandle SHPAPI_CALL
543  DBFOpenLL( const char * pszDBFFile, const char * pszAccess,
544  SAHooks *psHooks );
545 DBFHandle SHPAPI_CALL
546  DBFCreate( const char * pszDBFFile );
547 DBFHandle SHPAPI_CALL
548  DBFCreateEx( const char * pszDBFFile, const char * pszCodePage );
549 DBFHandle SHPAPI_CALL
550  DBFCreateLL( const char * pszDBFFile, const char * pszCodePage, SAHooks *psHooks );
551 
552 int SHPAPI_CALL
553  DBFGetFieldCount( DBFHandle psDBF );
554 int SHPAPI_CALL
555  DBFGetRecordCount( DBFHandle psDBF );
556 int SHPAPI_CALL
557  DBFAddField( DBFHandle hDBF, const char * pszFieldName,
558  DBFFieldType eType, int nWidth, int nDecimals );
559 
560 int SHPAPI_CALL
561  DBFAddNativeFieldType( DBFHandle hDBF, const char * pszFieldName,
562  char chType, int nWidth, int nDecimals );
563 
564 int SHPAPI_CALL
565  DBFDeleteField( DBFHandle hDBF, int iField );
566 
567 int SHPAPI_CALL
568  DBFReorderFields( DBFHandle psDBF, int* panMap );
569 
570 int SHPAPI_CALL
571  DBFAlterFieldDefn( DBFHandle psDBF, int iField, const char * pszFieldName,
572  char chType, int nWidth, int nDecimals );
573 
574 DBFFieldType SHPAPI_CALL
575  DBFGetFieldInfo( DBFHandle psDBF, int iField,
576  char * pszFieldName, int * pnWidth, int * pnDecimals );
577 
578 int SHPAPI_CALL
579  DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName);
580 
581 int SHPAPI_CALL
582  DBFReadIntegerAttribute( DBFHandle hDBF, int iShape, int iField );
583 double SHPAPI_CALL
584  DBFReadDoubleAttribute( DBFHandle hDBF, int iShape, int iField );
585 const char SHPAPI_CALL1(*)
586  DBFReadStringAttribute( DBFHandle hDBF, int iShape, int iField );
587 const char SHPAPI_CALL1(*)
588  DBFReadLogicalAttribute( DBFHandle hDBF, int iShape, int iField );
589 int SHPAPI_CALL
590  DBFIsAttributeNULL( DBFHandle hDBF, int iShape, int iField );
591 
592 int SHPAPI_CALL
593  DBFWriteIntegerAttribute( DBFHandle hDBF, int iShape, int iField,
594  int nFieldValue );
595 int SHPAPI_CALL
596  DBFWriteDoubleAttribute( DBFHandle hDBF, int iShape, int iField,
597  double dFieldValue );
598 int SHPAPI_CALL
599  DBFWriteStringAttribute( DBFHandle hDBF, int iShape, int iField,
600  const char * pszFieldValue );
601 int SHPAPI_CALL
602  DBFWriteNULLAttribute( DBFHandle hDBF, int iShape, int iField );
603 
604 int SHPAPI_CALL
605  DBFWriteLogicalAttribute( DBFHandle hDBF, int iShape, int iField,
606  const char lFieldValue);
607 int SHPAPI_CALL
608  DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField,
609  void * pValue );
610 const char SHPAPI_CALL1(*)
611  DBFReadTuple(DBFHandle psDBF, int hEntity );
612 int SHPAPI_CALL
613  DBFWriteTuple(DBFHandle psDBF, int hEntity, void * pRawTuple );
614 
615 int SHPAPI_CALL DBFIsRecordDeleted( DBFHandle psDBF, int iShape );
616 int SHPAPI_CALL DBFMarkRecordDeleted( DBFHandle psDBF, int iShape,
617  int bIsDeleted );
618 
619 DBFHandle SHPAPI_CALL
620  DBFCloneEmpty(DBFHandle psDBF, const char * pszFilename );
621 
622 void SHPAPI_CALL
623  DBFClose( DBFHandle hDBF );
624 void SHPAPI_CALL
625  DBFUpdateHeader( DBFHandle hDBF );
626 char SHPAPI_CALL
627  DBFGetNativeFieldType( DBFHandle hDBF, int iField );
628 
629 const char SHPAPI_CALL1(*)
630  DBFGetCodePage(DBFHandle psDBF );
631 
632 #ifdef __cplusplus
633 }
634 #endif
635 
636 #endif /* ndef SHAPEFILE_H_INCLUDED */
const char SHPAPI_CALL1 * DBFGetCodePage(DBFHandle psDBF){ if(psDBF==NULL) return NULL;return psDBF->pszCodePage;}int SHPAPI_CALLDBFDeleteField(DBFHandle psDBF, int iField
Definition: dbfopen.c:1799
DBFHandle SHPAPI_CALL DBFOpen(const char *pszFilename, const char *pszAccess)
Definition: dbfopen.c:365
const char SHPAPI_CALL1 * DBFReadLogicalAttribute(DBFHandle psDBF, int iRecord, int iField){ return((const char *) DBFReadAttribute(psDBF, iRecord, iField, 'L')
int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity, void *pRawTuple)
Definition: dbfopen.c:1549
int SHPAPI_CALL DBFWriteIntegerAttribute(DBFHandle hDBF, int iShape, int iField, int nFieldValue)
Definition: dbfopen.c:1492
SHPHandle SHPAPI_CALL SHPCreate(const char *pszShapeFile, int nShapeType)
Definition: shpopen.c:828
DBFHandle SHPAPI_CALL DBFOpenLL(const char *pszDBFFile, const char *pszAccess, SAHooks *psHooks)
Definition: dbfopen.c:382
SHPObject SHPAPI_CALL1 * SHPReadObject(SHPHandle hSHP, int iShape);int SHPAPI_CALL SHPWriteObject(SHPHandle hSHP, int iShape, SHPObject *psObject
int SHPAPI_CALL DBFMarkRecordDeleted(DBFHandle psDBF, int iShape, int bIsDeleted)
Definition: dbfopen.c:1757
int SHPAPI_CALL DBFGetFieldCount(DBFHandle psDBF)
Definition: dbfopen.c:1195
int SHPAPI_CALL DBFAlterFieldDefn(DBFHandle psDBF, int iField, const char *pszFieldName, char chType, int nWidth, int nDecimals)
Definition: dbfopen.c:2035
void SHPAPI_CALL DBFUpdateHeader(DBFHandle hDBF)
Definition: dbfopen.c:334
int SHPAPI_CALL SHPTreeRemoveShapeId(SHPTree *hTree, int nShapeId)
int SHPAPI_CALL DBFWriteStringAttribute(DBFHandle hDBF, int iShape, int iField, const char *pszFieldValue)
Definition: dbfopen.c:1508
struct shape_tree_node SHPTreeNode
int SHPAPI_CALL DBFDeleteField(DBFHandle hDBF, int iField)
int SHPAPI_CALL SHPTreeAddObject(SHPTree *hTree, SHPObject *psObject)
#define MAX_SUBNODE
Definition: shapefil.h:424
int SHPAPI_CALL SHPWriteTree(SHPTree *hTree, const char *pszFilename)
int SHPAPI_CALL DBFReadIntegerAttribute(DBFHandle hDBF, int iShape, int iField)
Definition: dbfopen.c:1049
int SHPAPI_CALL DBFAddNativeFieldType(DBFHandle hDBF, const char *pszFieldName, char chType, int nWidth, int nDecimals)
Definition: dbfopen.c:820
int SHPAPI_CALL1 * SHPTreeFindLikelyShapes(SHPTree *hTree, double *padfBoundsMin, double *padfBoundsMax, int *);int SHPAPI_CALL SHPCheckBoundsOverlap(double *, double *, double *, double *, int
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:759
int SHPAPI_CALL DBFWriteDoubleAttribute(DBFHandle hDBF, int iShape, int iField, double dFieldValue)
Definition: dbfopen.c:1478
void SHPAPI_CALL SHPDestroyObject(SHPObject *psObject)
Definition: shpopen.c:2182
DBFHandle SHPAPI_CALL DBFCloneEmpty(DBFHandle psDBF, const char *pszFilename)
void SHPAPI_CALL SHPComputeExtents(SHPObject *psObject)
Definition: shpopen.c:999
SHPHandle SHPAPI_CALL SHPCreateLL(const char *pszShapeFile, int nShapeType, SAHooks *psHooks)
Definition: shpopen.c:846
int SHPAPI_CALL DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName)
Definition: dbfopen.c:1703
int SHPAPI_CALL DBFWriteNULLAttribute(DBFHandle hDBF, int iShape, int iField)
Definition: dbfopen.c:1522
void SHPAPI_CALL SHPTreeTrimExtraNodes(SHPTree *hTree)
int SHPAPI_CALL DBFGetRecordCount(DBFHandle psDBF)
Definition: dbfopen.c:1208
SHPHandle SHPAPI_CALL SHPOpen(const char *pszShapeFile, const char *pszAccess)
Definition: shpopen.c:464
SHPInfo * SHPHandle
Definition: shapefil.h:301
int * SAFile
Definition: shapefil.h:242
int SHPAPI_CALL DBFIsAttributeNULL(DBFHandle hDBF, int iShape, int iField)
Definition: dbfopen.c:1175
void SHPAPI_CALL SHPGetInfo(SHPHandle hSHP, int *pnEntities, int *pnShapeType, double *padfMinBound, double *padfMaxBound)
Definition: shpopen.c:796
int SHPAPI_CALL DBFAddField(DBFHandle hDBF, const char *pszFieldName, DBFFieldType eType, int nWidth, int nDecimals)
Definition: dbfopen.c:773
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:1535
DBFHandle SHPAPI_CALL DBFCreateEx(const char *pszDBFFile, const char *pszCodePage)
Definition: dbfopen.c:641
#define SHPAPI_CALL
Definition: shapefil.h:207
DBFHandle SHPAPI_CALL DBFCreate(const char *pszDBFFile)
Definition: dbfopen.c:628
void SHPAPI_CALL DBFClose(DBFHandle hDBF)
Definition: dbfopen.c:578
#define SHPAPI_CALL1(x)
Definition: shapefil.h:212
int SHPAPI_CALL SHPTreeAddShapeId(SHPTree *hTree, SHPObject *psObject)
const char SHPAPI_CALL1 * SHPTypeName(int nSHPType);const char SHPAPI_CALL1(*) SHPPartTypeName(int nPartType
Definition: shpopen.c:2092
SHPHandle SHPAPI_CALL SHPOpenLL(const char *pszShapeFile, const char *pszAccess, SAHooks *psHooks)
Definition: shpopen.c:482
DBFHandle SHPAPI_CALL DBFCreateLL(const char *pszDBFFile, const char *pszCodePage, SAHooks *psHooks)
Definition: dbfopen.c:658
int SHPAPI_CALL1 * SHPSearchDiskTree(FILE *fp, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount);typedef struct{ SAHooks sHooks;SAFile fp;int nRecords;int nRecordLength;int nHeaderLength;int nFields;int *panFieldOffset;int *panFieldSize;int *panFieldDecimals;char *pachFieldType;char *pszHeader;int nCurrentRecord;int bCurrentRecordModified;char *pszCurrentRecord;int nWorkFieldLength;char *pszWorkField;int bNoHeader;int bUpdated;double dfDoubleField;int iLanguageDriver;char *pszCodePage;} DBFInfo;typedef DBFInfo *DBFHandle;typedef enum { FTString, FTInteger, FTDouble, FTLogical, FTDate, FTInvalid} DBFFieldType;#define XBASE_FLDHDR_SZDBFHandle SHPAPI_CALL DBFOpen(const char *pszDBFFile, const char *pszAccess
int SHPAPI_CALL SHPRewindObject(SHPHandle hSHP, SHPObject *psObject)
Definition: shpopen.c:2213
int SHPAPI_CALL DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField, void *pValue)
Definition: dbfopen.c:1410
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:1928
void SHPAPI_CALL SHPWriteHeader(SHPHandle hSHP)
Definition: shpopen.c:339
int SHPAPI_CALL DBFIsRecordDeleted(DBFHandle psDBF, int iShape)
Definition: dbfopen.c:1732
unsigned long SAOffset
Definition: shapefil.h:250
void SHPAPI_CALL SASetupDefaultHooks(SAHooks *psHooks)
Definition: safileio.c:195
const char SHPAPI_CALL1 * DBFReadTuple(DBFHandle psDBF, int hEntity);int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity, void *pRawTuple
char SHPAPI_CALL DBFGetNativeFieldType(DBFHandle hDBF, int iField)
Definition: dbfopen.c:1669
double SHPAPI_CALL DBFReadDoubleAttribute(DBFHandle hDBF, int iShape, int iField)
Definition: dbfopen.c:1069
DBFFieldType SHPAPI_CALL DBFGetFieldInfo(DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals)
Definition: dbfopen.c:1221
psObject nShapeId
Definition: shpopen.c:1048
SHPObject SHPAPI_CALL1 * SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX, const double *padfY, const double *padfZ){ return(SHPCreateObject(nSHPType, -1, 0, NULL, NULL, nVertices, padfX, padfY, padfZ, NULL)
psObject nVertices
Definition: shpopen.c:1139
psObject nSHPType
Definition: shpopen.c:1047
int SHPAPI_CALL SHPWriteObject(SHPHandle psSHP, int nShapeId, SHPObject *psObject)
Definition: shpopen.c:1170
const char SHPAPI_CALL1 * SHPPartTypeName(int nPartType){ switch(nPartType
Definition: shpopen.c:2149
SAFile fpSHX
Definition: shapefil.h:281
int nShapeType
Definition: shapefil.h:283
SAFile fpSHP
Definition: shapefil.h:280
int nMaxRecords
Definition: shapefil.h:288
int nBufSize
Definition: shapefil.h:298
unsigned int * panRecSize
Definition: shapefil.h:290
SAHooks sHooks
Definition: shapefil.h:278
int nRecords
Definition: shapefil.h:287
int bUpdated
Definition: shapefil.h:295
unsigned int nFileSize
Definition: shapefil.h:285
unsigned int * panRecOffset
Definition: shapefil.h:289
unsigned char * pabyRec
Definition: shapefil.h:297
int * panPartType
Definition: shapefil.h:346
double dfZMin
Definition: shapefil.h:356
double dfZMax
Definition: shapefil.h:361
int bMeasureIsUsed
Definition: shapefil.h:364
int nShapeId
Definition: shapefil.h:342
double dfXMax
Definition: shapefil.h:359
double dfYMax
Definition: shapefil.h:360
int * panPartStart
Definition: shapefil.h:345
double dfMMin
Definition: shapefil.h:357
int nSHPType
Definition: shapefil.h:340
int nVertices
Definition: shapefil.h:348
double dfMMax
Definition: shapefil.h:362
double dfYMin
Definition: shapefil.h:355
double * padfZ
Definition: shapefil.h:351
double * padfX
Definition: shapefil.h:349
int nParts
Definition: shapefil.h:344
double * padfM
Definition: shapefil.h:352
double dfXMin
Definition: shapefil.h:354
double * padfY
Definition: shapefil.h:350
SHPTreeNode * psRoot
Definition: shapefil.h:454
SHPHandle hSHP
Definition: shapefil.h:448
int nDimension
Definition: shapefil.h:451
int nMaxDepth
Definition: shapefil.h:450
int nTotalCount
Definition: shapefil.h:452
SHPObject ** papsShapeObj
Definition: shapefil.h:439
int * panShapeIds
Definition: shapefil.h:438
struct shape_tree_node * apsSubNode[MAX_SUBNODE]
Definition: shapefil.h:442
double adfBoundsMax[4]
Definition: shapefil.h:433
double adfBoundsMin[4]
Definition: shapefil.h:432