1 #ifndef SHAPEFILE_H_INCLUDED
2 #define SHAPEFILE_H_INCLUDED
183 #include <dbmalloc.h>
187 #include "cpl_conv.h"
202 #define TRIM_DBF_WHITESPACE
209 #define DISABLE_MULTIPATCH_MEASURE
240 #ifdef SHAPELIB_DLLEXPORT
241 #define SHPAPI_CALL __declspec(dllexport)
242 #define SHPAPI_CALL1(x) __declspec(dllexport) x
246 #if defined(USE_GCC_VISIBILITY_FLAG)
247 #define SHPAPI_CALL __attribute__((visibility("default")))
248 #define SHPAPI_CALL1(x) __attribute__((visibility("default"))) x
255 #define SHPAPI_CALL1(x) x SHPAPI_CALL
262 #ifndef DISABLE_CVSID
263 #if defined(__GNUC__) && __GNUC__ >= 4
264 #define SHP_CVSID(string) \
265 static const char cpl_cvsid[] __attribute__((used)) = string;
267 #define SHP_CVSID(string) \
268 static const char cpl_cvsid[] = string; \
269 static const char *cvsid_aw() { return (cvsid_aw() ? NULL : cpl_cvsid); }
272 #define SHP_CVSID(string)
279 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
280 #define SHPAPI_WINDOWS
281 #define SHPAPI_UTF8_HOOKS
303 void (*Error)(
const char *message);
304 double (*Atof)(
const char *str);
308 #ifdef SHPAPI_UTF8_HOOKS
332 double adBoundsMin[4];
333 double adBoundsMax[4];
354 #define SHPT_POLYGON 5
355 #define SHPT_MULTIPOINT 8
356 #define SHPT_POINTZ 11
358 #define SHPT_POLYGONZ 15
359 #define SHPT_MULTIPOINTZ 18
360 #define SHPT_POINTM 21
362 #define SHPT_POLYGONM 25
363 #define SHPT_MULTIPOINTM 28
364 #define SHPT_MULTIPATCH 31
371 #define SHPP_TRISTRIP 0
372 #define SHPP_TRIFAN 1
373 #define SHPP_OUTERRING 2
374 #define SHPP_INNERRING 3
375 #define SHPP_FIRSTRING 4
419 const char *pszAccess,
422 const char *pszAccess,
427 const char *pszAccess,
446 double *padfMinBound,
447 double *padfMaxBound);
457 const
int *panPartStart,
458 const
int *panPartType,
463 const
double *padfM);
468 const
double *padfZ);
483 #define MAX_SUBNODE 4
486 #define MAX_DEFAULT_TREE_DEPTH 12
517 double *padfBoundsMin,
518 double *padfBoundsMax);
529 double *padfBoundsMin,
530 double *padfBoundsMax,
536 double *padfBoundsMin,
537 double *padfBoundsMax,
548 double *padfBoundsMin,
549 double *padfBoundsMax,
553 const
char *pszFilename,
568 double *padfBoundsMin,
569 double *padfBoundsMax,
640 #define XBASE_FLDHDR_SZ 32
642 #define XBASE_FLDNAME_LEN_READ 11
644 #define XBASE_FLDNAME_LEN_WRITE 10
646 #define XBASE_FLD_MAX_WIDTH 255
650 const char *pszAccess,
654 const char *pszCodePage);
656 const char *pszCodePage,
662 const char *pszFieldName,
668 const char *pszFieldName,
679 const char *pszFieldName,
713 const
char *pszFieldValue);
719 const
char lFieldValue);
FILE * FOpen(const std::string &filename, const std::string &mode)
int SHPTreeAddShapeId(SHPTree *hTree, SHPObject *psObject)
void SHPDestroyObject(SHPObject *psObject)
SBNSearchHandle SBNOpenDiskTree(const char *pszSBNFilename, SAHooks *psHooks)
int DBFAddNativeFieldType(DBFHandle hDBF, const char *pszFieldName, char chType, int nWidth, int nDecimals)
int SHPRestoreSHX(const char *pszShapeFile, const char *pszAccess, SAHooks *psHooks)
SHPObject * SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX, const double *padfY, const double *padfZ)
int DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName)
const char * DBFGetCodePage(DBFHandle psDBF)
int DBFAddField(DBFHandle hDBF, const char *pszFieldName, DBFFieldType eType, int nWidth, int nDecimals)
int DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField, void *pValue)
void SHPClose(SHPHandle hSHP)
SHPHandle SHPOpenLLEx(const char *pszShapeFile, const char *pszAccess, SAHooks *psHooks, int bRestoreSHX)
int DBFWriteDoubleAttribute(DBFHandle hDBF, int iShape, int iField, double dFieldValue)
struct shape_tree_node SHPTreeNode
SHPObject * 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)
const char * DBFReadLogicalAttribute(DBFHandle hDBF, int iShape, int iField)
void SHPCloseDiskTree(SHPTreeDiskHandle hDiskTree)
int DBFMarkRecordDeleted(DBFHandle psDBF, int iShape, int bIsDeleted)
SHPHandle SHPCreateLL(const char *pszShapeFile, int nShapeType, SAHooks *psHooks)
void SBNCloseDiskTree(SBNSearchHandle hSBN)
void SHPDestroyTree(SHPTree *hTree)
int DBFWriteTuple(DBFHandle psDBF, int hEntity, void *pRawTuple)
int DBFAlterFieldDefn(DBFHandle psDBF, int iField, const char *pszFieldName, char chType, int nWidth, int nDecimals)
int SHPCheckBoundsOverlap(double *, double *, double *, double *, int)
void DBFSetWriteEndOfFileChar(DBFHandle psDBF, int bWriteFlag)
SHPHandle SHPOpenLL(const char *pszShapeFile, const char *pszAccess, SAHooks *psHooks)
int SHPWriteTreeLL(SHPTree *hTree, const char *pszFilename, SAHooks *psHooks)
int DBFWriteIntegerAttribute(DBFHandle hDBF, int iShape, int iField, int nFieldValue)
void SHPWriteHeader(SHPHandle hSHP)
int DBFDeleteField(DBFHandle hDBF, int iField)
DBFHandle DBFCloneEmpty(DBFHandle psDBF, const char *pszFilename)
int DBFIsAttributeNULL(DBFHandle hDBF, int iShape, int iField)
void SBNSearchFreeIds(int *panShapeId)
const char * DBFReadTuple(DBFHandle psDBF, int hEntity)
void DBFUpdateHeader(DBFHandle hDBF)
int SHPWriteObject(SHPHandle hSHP, int iShape, SHPObject *psObject)
int DBFReadIntegerAttribute(DBFHandle hDBF, int iShape, int iField)
DBFHandle DBFCreate(const char *pszDBFFile)
SHPHandle SHPOpen(const char *pszShapeFile, const char *pszAccess)
const char * DBFReadStringAttribute(DBFHandle hDBF, int iShape, int iField)
SHPTree * SHPCreateTree(SHPHandle hSHP, int nDimension, int nMaxDepth, double *padfBoundsMin, double *padfBoundsMax)
void DBFSetLastModifiedDate(DBFHandle psDBF, int nYYSince1900, int nMM, int nDD)
void SHPTreeTrimExtraNodes(SHPTree *hTree)
int DBFWriteNULLAttribute(DBFHandle hDBF, int iShape, int iField)
SHPTreeDiskHandle SHPOpenDiskTree(const char *pszQIXFilename, SAHooks *psHooks)
int DBFGetRecordCount(DBFHandle psDBF)
const char * SHPPartTypeName(int nPartType)
int * SBNSearchDiskTreeInteger(SBNSearchHandle hSBN, int bMinX, int bMinY, int bMaxX, int bMaxY, int *pnShapeCount)
double DBFReadDoubleAttribute(DBFHandle hDBF, int iShape, int iField)
void SHPGetInfo(SHPHandle hSHP, int *pnEntities, int *pnShapeType, double *padfMinBound, double *padfMaxBound)
char DBFGetNativeFieldType(DBFHandle hDBF, int iField)
int DBFReorderFields(DBFHandle psDBF, int *panMap)
DBFHandle DBFCreateEx(const char *pszDBFFile, const char *pszCodePage)
void SASetupDefaultHooks(SAHooks *psHooks)
int * SBNSearchDiskTree(SBNSearchHandle hSBN, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount)
int * SHPSearchDiskTree(FILE *fp, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount)
int DBFGetFieldCount(DBFHandle psDBF)
struct SBNSearchInfo * SBNSearchHandle
int DBFIsRecordDeleted(DBFHandle psDBF, int iShape)
int SHPWriteTree(SHPTree *hTree, const char *pszFilename)
SHPObject * SHPReadObject(SHPHandle hSHP, int iShape)
DBFFieldType DBFGetFieldInfo(DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals)
DBFHandle DBFOpen(const char *pszDBFFile, const char *pszAccess)
int SHPTreeRemoveShapeId(SHPTree *hTree, int nShapeId)
int * SHPSearchDiskTreeEx(SHPTreeDiskHandle hDiskTree, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount)
void SHPSetFastModeReadObject(SHPHandle hSHP, int bFastMode)
void SHPComputeExtents(SHPObject *psObject)
DBFHandle DBFCreateLL(const char *pszDBFFile, const char *pszCodePage, SAHooks *psHooks)
DBFHandle DBFOpenLL(const char *pszDBFFile, const char *pszAccess, SAHooks *psHooks)
void DBFClose(DBFHandle hDBF)
int * SHPTreeFindLikelyShapes(SHPTree *hTree, double *padfBoundsMin, double *padfBoundsMax, int *)
SHPHandle SHPCreate(const char *pszShapeFile, int nShapeType)
const char * SHPTypeName(int nSHPType)
int SHPRewindObject(SHPHandle hSHP, SHPObject *psObject)
int DBFWriteStringAttribute(DBFHandle hDBF, int iShape, int iField, const char *pszFieldValue)
int DBFWriteLogicalAttribute(DBFHandle hDBF, int iShape, int iField, const char lFieldValue)
int bCurrentRecordModified
SHPObject * psCachedObject
unsigned int * panRecSize
unsigned char * pabyObjectBuf
unsigned int * panRecOffset
SHPObject ** papsShapeObj
struct shape_tree_node * apsSubNode[4]