1 #ifndef SHAPEFILE_H_INCLUDED 2 #define SHAPEFILE_H_INCLUDED 147 #include <dbmalloc.h> 151 #include "cpl_conv.h" 166 #define TRIM_DBF_WHITESPACE 173 #define DISABLE_MULTIPATCH_MEASURE 204 #ifdef SHAPELIB_DLLEXPORT 205 # define SHPAPI_CALL __declspec(dllexport) 206 # define SHPAPI_CALL1(x) __declspec(dllexport) x 210 # if defined(USE_GCC_VISIBILITY_FLAG) 211 # define SHPAPI_CALL __attribute__ ((visibility("default"))) 212 # define SHPAPI_CALL1(x) __attribute__ ((visibility("default"))) x 219 # define SHPAPI_CALL1(x) x SHPAPI_CALL 226 #ifndef DISABLE_CVSID 227 # if defined(__GNUC__) && __GNUC__ >= 4 228 # define SHP_CVSID(string) static const char cpl_cvsid[] __attribute__((used)) = string; 230 # define SHP_CVSID(string) static const char cpl_cvsid[] = string; \ 231 static const char *cvsid_aw() { return( cvsid_aw() ? NULL : cpl_cvsid ); } 234 # define SHP_CVSID(string) 241 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 242 # define SHPAPI_WINDOWS 243 # define SHPAPI_UTF8_HOOKS 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);
263 int (*Remove) (
const char *filename );
265 void (*Error) (
const char *message );
266 double (*Atof) (
const char *str );
270 #ifdef SHPAPI_UTF8_HOOKS 295 double adBoundsMin[4];
296 double adBoundsMax[4];
317 #define SHPT_POLYGON 5 318 #define SHPT_MULTIPOINT 8 319 #define SHPT_POINTZ 11 321 #define SHPT_POLYGONZ 15 322 #define SHPT_MULTIPOINTZ 18 323 #define SHPT_POINTM 21 325 #define SHPT_POLYGONM 25 326 #define SHPT_MULTIPOINTM 28 327 #define SHPT_MULTIPATCH 31 335 #define SHPP_TRISTRIP 0 336 #define SHPP_TRIFAN 1 337 #define SHPP_OUTERRING 2 338 #define SHPP_INNERRING 3 339 #define SHPP_FIRSTRING 4 383 SHPOpen(
const char * pszShapeFile,
const char * pszAccess );
385 SHPOpenLL(
const char *pszShapeFile,
const char *pszAccess,
388 SHPOpenLLEx(
const char *pszShapeFile,
const char *pszAccess,
389 SAHooks *psHooks,
int bRestoreSHX );
392 SHPRestoreSHX(
const char *pszShapeFile,
const char *pszAccess,
402 SHPCreate(
const char * pszShapeFile,
int nShapeType );
404 SHPCreateLL(
const char * pszShapeFile,
int nShapeType,
407 SHPGetInfo( SHPHandle hSHP,
int * pnEntities,
int * pnShapeType,
408 double * padfMinBound,
double * padfMaxBound );
421 const
int * panPartStart, const
int * panPartType,
423 const
double * padfX, const
double * padfY,
424 const
double * padfZ, const
double * padfM );
427 const
double * padfX,
428 const
double * padfY,
429 const
double * padfZ );
447 #define MAX_SUBNODE 4 450 #define MAX_DEFAULT_TREE_DEPTH 12 455 double adfBoundsMin[4];
456 double adfBoundsMax[4];
481 SHPCreateTree( SHPHandle hSHP,
int nDimension,
int nMaxDepth,
482 double *padfBoundsMin,
double *padfBoundsMax );
484 SHPDestroyTree(
SHPTree * hTree );
499 double * padfBoundsMin,
500 double * padfBoundsMax,
503 SHPCheckBoundsOverlap(
double *,
double *,
double *,
double *,
int );
507 double *padfBoundsMin,
double *padfBoundsMax,
511 typedef struct SHPDiskTreeInfo* SHPTreeDiskHandle;
514 SHPOpenDiskTree( const
char* pszQIXFilename,
522 double *padfBoundsMin,
double *padfBoundsMax,
526 SHPWriteTreeLL(
SHPTree *hTree, const
char *pszFilename,
SAHooks *psHooks );
544 double *padfBoundsMin,
double *padfBoundsMax,
548 SBNSearchDiskTreeInteger( SBNSearchHandle hSBN,
549 int bMinX,
int bMinY,
int bMaxX,
int bMaxY,
609 #define XBASE_FLDHDR_SZ 32 613 DBFOpen(
const char * pszDBFFile,
const char * pszAccess );
615 DBFOpenLL(
const char * pszDBFFile,
const char * pszAccess,
620 DBFCreateEx(
const char * pszDBFFile,
const char * pszCodePage );
629 DBFAddField( DBFHandle hDBF,
const char * pszFieldName,
630 DBFFieldType eType,
int nWidth,
int nDecimals );
634 char chType,
int nWidth,
int nDecimals );
644 char chType,
int nWidth,
int nDecimals );
648 char * pszFieldName,
int * pnWidth,
int * pnDecimals );
669 double dFieldValue );
672 const
char * pszFieldValue );
678 const
char lFieldValue);
685 DBFWriteTuple(DBFHandle psDBF,
int hEntity,
void * pRawTuple );
void SHPAPI_CALL SBNCloseDiskTree(SBNSearchHandle hSBN)
DBFFieldType SHPAPI_CALL DBFGetFieldInfo(DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals)
void SHPAPI_CALL DBFSetLastModifiedDate(DBFHandle psDBF, int nYYSince1900, int nMM, int nDD)
int SHPAPI_CALL DBFWriteIntegerAttribute(DBFHandle hDBF, int iShape, int iField, int nFieldValue)
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
int SHPAPI_CALL DBFGetFieldCount(DBFHandle psDBF)
void SHPAPI_CALL SHPComputeExtents(SHPObject *psObject)
struct shape_tree_node SHPTreeNode
void SHPAPI_CALL SHPTreeTrimExtraNodes(SHPTree *hTree)
DBFHandle SHPAPI_CALL DBFCreateLL(const char *pszDBFFile, const char *pszCodePage, SAHooks *psHooks)
const char SHPAPI_CALL1 * DBFGetCodePage(DBFHandle psDBF);void SHPAPI_CALL DBFSetLastModifiedDate(DBFHandle psDBF, int nYYSince1900, int nMM, int nDD
int SHPAPI_CALL DBFIsRecordDeleted(DBFHandle psDBF, int iShape)
int SHPAPI_CALL SHPRewindObject(SHPHandle hSHP, SHPObject *psObject)
char SHPAPI_CALL DBFGetNativeFieldType(DBFHandle hDBF, int iField)
void SHPAPI_CALL DBFClose(DBFHandle hDBF)
DBFHandle SHPAPI_CALL DBFCloneEmpty(DBFHandle psDBF, const char *pszFilename)
void SHPAPI_CALL SHPGetInfo(SHPHandle hSHP, int *pnEntities, int *pnShapeType, double *padfMinBound, double *padfMaxBound)
void SHPAPI_CALL SBNSearchFreeIds(int *panShapeId)
int SHPAPI_CALL DBFWriteNULLAttribute(DBFHandle hDBF, int iShape, int iField)
SHPObject ** papsShapeObj
void SHPAPI_CALL SHPClose(SHPHandle hSHP)
int SHPAPI_CALL SHPTreeAddShapeId(SHPTree *hTree, SHPObject *psObject)
DBFHandle SHPAPI_CALL DBFOpen(const char *pszDBFFile, const char *pszAccess)
int SHPAPI_CALL DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName)
int SHPAPI_CALL SHPRestoreSHX(const char *pszShapeFile, const char *pszAccess, SAHooks *psHooks)
struct SBNSearchInfo * SBNSearchHandle
int SHPAPI_CALL DBFReorderFields(DBFHandle psDBF, int *panMap)
int SHPAPI_CALL DBFWriteStringAttribute(DBFHandle hDBF, int iShape, int iField, const char *pszFieldValue)
unsigned int * panRecOffset
int SHPAPI_CALL1 * SHPTreeFindLikelyShapes(SHPTree *hTree, double *padfBoundsMin, double *padfBoundsMax, int *);int SHPAPI_CALL SHPCheckBoundsOverlap(double *, double *, double *, double *, int
int SHPAPI_CALL SHPWriteObject(SHPHandle psSHP, int nShapeId, SHPObject *psObject)
double SHPAPI_CALL DBFReadDoubleAttribute(DBFHandle hDBF, int iShape, int iField)
SHPTree SHPAPI_CALL1 * SHPCreateTree(SHPHandle hSHP, int nDimension, int nMaxDepth, double *padfBoundsMin, double *padfBoundsMax);void SHPAPI_CALL SHPDestroyTree(SHPTree *hTree
int SHPAPI_CALL DBFReadIntegerAttribute(DBFHandle hDBF, int iShape, int iField)
DBFHandle SHPAPI_CALL DBFCreateEx(const char *pszDBFFile, const char *pszCodePage)
SHPHandle SHPAPI_CALL SHPOpenLL(const char *pszShapeFile, const char *pszAccess, SAHooks *psHooks)
SBNSearchHandle SHPAPI_CALL SBNOpenDiskTree(const char *pszSBNFilename, SAHooks *psHooks)
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)
SHPHandle SHPAPI_CALL SHPCreate(const char *pszShapeFile, int nShapeType)
SHPObject * psCachedObject
int SHPAPI_CALL DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField, void *pValue)
SHPObject SHPAPI_CALL1 * SHPReadObject(SHPHandle hSHP, int iShape);int SHPAPI_CALL SHPWriteObject(SHPHandle hSHP, int iShape, SHPObject *psObject
int SHPAPI_CALL DBFWriteLogicalAttribute(DBFHandle hDBF, int iShape, int iField, const char lFieldValue)
const char SHPAPI_CALL1 * DBFReadTuple(DBFHandle psDBF, int hEntity);int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity, void *pRawTuple
int SHPAPI_CALL DBFDeleteField(DBFHandle hDBF, int iField)
int SHPAPI_CALL SHPTreeRemoveShapeId(SHPTree *hTree, int nShapeId)
int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity, void *pRawTuple)
int SHPAPI_CALL DBFGetRecordCount(DBFHandle psDBF)
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 * DBFReadLogicalAttribute(DBFHandle psDBF, int iRecord, int iField){ return((const char *) DBFReadAttribute(psDBF, iRecord, iField, 'L')
struct shape_tree_node * apsSubNode[MAX_SUBNODE]
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 DBFIsAttributeNULL(DBFHandle hDBF, int iShape, int iField)
void SHPAPI_CALL SHPSetFastModeReadObject(SHPHandle hSHP, int bFastMode)
void SHPAPI_CALL DBFUpdateHeader(DBFHandle hDBF)
int SHPAPI_CALL DBFAddField(DBFHandle hDBF, const char *pszFieldName, DBFFieldType eType, int nWidth, int nDecimals)
DBFHandle SHPAPI_CALL DBFCreate(const char *pszDBFFile)
SHPHandle SHPAPI_CALL SHPCreateLL(const char *pszShapeFile, int nShapeType, SAHooks *psHooks)
SHPHandle SHPAPI_CALL SHPOpenLLEx(const char *pszShapeFile, const char *pszAccess, SAHooks *psHooks, int bRestoreSHX)
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
DBFHandle SHPAPI_CALL DBFOpenLL(const char *pszDBFFile, const char *pszAccess, SAHooks *psHooks)
SHPHandle SHPAPI_CALL SHPOpen(const char *pszShapeFile, const char *pszAccess)
void SHPAPI_CALL SHPWriteHeader(SHPHandle hSHP)
int SHPAPI_CALL DBFWriteDoubleAttribute(DBFHandle hDBF, int iShape, int iField, double dFieldValue)
int SHPAPI_CALL SHPWriteTree(SHPTree *hTree, const char *pszFilename)
void SHPAPI_CALL SHPCloseDiskTree(SHPTreeDiskHandle hDiskTree)
unsigned int * panRecSize
unsigned char * pabyObjectBuf
int SHPAPI_CALL DBFAddNativeFieldType(DBFHandle hDBF, const char *pszFieldName, char chType, int nWidth, int nDecimals)
void SHPAPI_CALL SHPDestroyObject(SHPObject *psObject)
int SHPAPI_CALL DBFAlterFieldDefn(DBFHandle psDBF, int iField, const char *pszFieldName, char chType, int nWidth, int nDecimals)
const char SHPAPI_CALL1 * SHPPartTypeName(int nPartType){ switch(nPartType
void SHPAPI_CALL SASetupDefaultHooks(SAHooks *psHooks)
const char SHPAPI_CALL1 * DBFReadStringAttribute(DBFHandle hDBF, int iShape, int iField);const char SHPAPI_CALL1(*) DBFReadLogicalAttribute(DBFHandle hDBF, int iShape, int iField
int bCurrentRecordModified
int SHPAPI_CALL DBFMarkRecordDeleted(DBFHandle psDBF, int iShape, int bIsDeleted)
const char SHPAPI_CALL1 * SHPTypeName(int nSHPType);const char SHPAPI_CALL1(*) SHPPartTypeName(int nPartType