1 #ifndef _SHAPEFILE_H_INCLUDED
2 #define _SHAPEFILE_H_INCLUDED
126 #include <dbmalloc.h>
141 #define TRIM_DBF_WHITESPACE
148 #define DISABLE_MULTIPATCH_MEASURE
179 #ifdef SHAPELIB_DLLEXPORT
180 # define SHPAPI_CALL __declspec(dllexport)
181 # define SHPAPI_CALL1(x) __declspec(dllexport) x
189 # define SHPAPI_CALL1(x) x SHPAPI_CALL
209 double adBoundsMin[4];
210 double adBoundsMax[4];
214 unsigned char *pabyRec;
226 #define SHPT_POLYGON 5
227 #define SHPT_MULTIPOINT 8
228 #define SHPT_POINTZ 11
230 #define SHPT_POLYGONZ 15
231 #define SHPT_MULTIPOINTZ 18
232 #define SHPT_POINTM 21
234 #define SHPT_POLYGONM 25
235 #define SHPT_MULTIPOINTM 28
236 #define SHPT_MULTIPATCH 31
244 #define SHPP_TRISTRIP 0
245 #define SHPP_TRIFAN 1
246 #define SHPP_OUTERRING 2
247 #define SHPP_INNERRING 3
248 #define SHPP_FIRSTRING 4
285 SHPHandle SHPAPI_CALL
286 SHPOpen(
const char * pszShapeFile,
const char * pszAccess );
287 SHPHandle SHPAPI_CALL
288 SHPCreate(
const char * pszShapeFile,
int nShapeType );
290 SHPGetInfo( SHPHandle hSHP,
int * pnEntities,
int * pnShapeType,
291 double * padfMinBound,
double * padfMaxBound );
294 SHPReadObject( SHPHandle hSHP,
int iShape );
296 SHPWriteObject( SHPHandle hSHP,
int iShape,
SHPObject * psObject );
299 SHPDestroyObject(
SHPObject * psObject );
301 SHPComputeExtents(
SHPObject * psObject );
303 SHPCreateObject(
int nSHPType,
int nShapeId,
304 int nParts,
int * panPartStart,
int * panPartType,
305 int nVertices,
double * padfX,
double * padfY,
306 double * padfZ,
double * padfM );
308 SHPCreateSimpleObject(
int nSHPType,
int nVertices,
309 double * padfX,
double * padfY,
double * padfZ );
312 SHPRewindObject( SHPHandle hSHP,
SHPObject * psObject );
314 void SHPAPI_CALL SHPClose( SHPHandle hSHP );
315 void SHPAPI_CALL SHPWriteHeader( SHPHandle hSHP );
317 const
char SHPAPI_CALL1(*)
318 SHPTypeName(
int nSHPType );
319 const
char SHPAPI_CALL1(*)
320 SHPPartTypeName(
int nPartType );
327 #define MAX_SUBNODE 4
332 double adfBoundsMin[4];
333 double adfBoundsMax[4];
357 SHPCreateTree( SHPHandle hSHP,
int nDimension,
int nMaxDepth,
358 double *padfBoundsMin,
double *padfBoundsMax );
360 SHPDestroyTree(
SHPTree * hTree );
363 SHPWriteTree(
SHPTree *hTree, const
char * pszFilename );
365 SHPReadTree( const
char * pszFilename );
372 SHPTreeRemoveShapeId(
SHPTree * hTree,
int nShapeId );
375 SHPTreeTrimExtraNodes(
SHPTree * hTree );
378 SHPTreeFindLikelyShapes(
SHPTree * hTree,
379 double * padfBoundsMin,
380 double * padfBoundsMax,
383 SHPCheckBoundsOverlap(
double *,
double *,
double *,
double *,
int );
399 int *panFieldDecimals;
405 int bCurrentRecordModified;
406 char *pszCurrentRecord;
422 #define XBASE_FLDHDR_SZ 32
424 DBFHandle SHPAPI_CALL
425 DBFOpen(
const char * pszDBFFile,
const char * pszAccess );
426 DBFHandle SHPAPI_CALL
427 DBFCreate(
const char * pszDBFFile );
430 DBFGetFieldCount( DBFHandle psDBF );
432 DBFGetRecordCount( DBFHandle psDBF );
434 DBFAddField( DBFHandle hDBF,
const char * pszFieldName,
435 DBFFieldType eType,
int nWidth,
int nDecimals );
437 DBFFieldType SHPAPI_CALL
438 DBFGetFieldInfo( DBFHandle psDBF,
int iField,
439 char * pszFieldName,
int * pnWidth,
int * pnDecimals );
442 DBFGetFieldIndex(DBFHandle psDBF,
const char *pszFieldName);
445 DBFReadIntegerAttribute( DBFHandle hDBF,
int iShape,
int iField );
447 DBFReadDoubleAttribute( DBFHandle hDBF,
int iShape,
int iField );
448 const char SHPAPI_CALL1(*)
449 DBFReadStringAttribute( DBFHandle hDBF,
int iShape,
int iField );
450 const
char SHPAPI_CALL1(*)
451 DBFReadLogicalAttribute( DBFHandle hDBF,
int iShape,
int iField );
453 DBFIsAttributeNULL( DBFHandle hDBF,
int iShape,
int iField );
456 DBFWriteIntegerAttribute( DBFHandle hDBF,
int iShape,
int iField,
459 DBFWriteDoubleAttribute( DBFHandle hDBF,
int iShape,
int iField,
460 double dFieldValue );
462 DBFWriteStringAttribute( DBFHandle hDBF,
int iShape,
int iField,
463 const
char * pszFieldValue );
465 DBFWriteNULLAttribute( DBFHandle hDBF,
int iShape,
int iField );
468 DBFWriteLogicalAttribute( DBFHandle hDBF,
int iShape,
int iField,
469 const
char lFieldValue);
471 DBFWriteAttributeDirectly(DBFHandle psDBF,
int hEntity,
int iField,
473 const
char SHPAPI_CALL1(*)
474 DBFReadTuple(DBFHandle psDBF,
int hEntity );
476 DBFWriteTuple(DBFHandle psDBF,
int hEntity,
void * pRawTuple );
478 DBFHandle SHPAPI_CALL
479 DBFCloneEmpty(DBFHandle psDBF, const
char * pszFilename );
482 DBFClose( DBFHandle hDBF );
484 DBFUpdateHeader( DBFHandle hDBF );
486 DBFGetNativeFieldType( DBFHandle hDBF,
int iField );