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