1 #ifndef SHAPEFILE_H_INCLUDED
2 #define SHAPEFILE_H_INCLUDED
60 #define TRIM_DBF_WHITESPACE
67 #define DISABLE_MULTIPATCH_MEASURE
98 #ifdef SHAPELIB_DLLEXPORT
99 #define SHPAPI_CALL __declspec(dllexport)
100 #define SHPAPI_CALL1(x) __declspec(dllexport) x
104 #if defined(USE_GCC_VISIBILITY_FLAG)
105 #define SHPAPI_CALL __attribute__((visibility("default")))
106 #define SHPAPI_CALL1(x) __attribute__((visibility("default"))) x
113 #define SHPAPI_CALL1(x) x SHPAPI_CALL
120 #ifndef DISABLE_CVSID
121 #if defined(__GNUC__) && __GNUC__ >= 4
122 #define SHP_CVSID(string) \
123 static const char cpl_cvsid[] __attribute__((used)) = string;
125 #define SHP_CVSID(string) \
126 static const char cpl_cvsid[] = string; \
127 static const char *cvsid_aw() \
129 return (cvsid_aw() ? NULL : cpl_cvsid); \
133 #define SHP_CVSID(string)
140 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
141 #define SHPAPI_WINDOWS
142 #define SHPAPI_UTF8_HOOKS
155 SAFile (*FOpen)(
const char *filename,
const char *access);
162 int (*Remove)(
const char *filename);
164 void (*Error)(
const char *message);
165 double (*Atof)(
const char *str);
169 #ifdef SHPAPI_UTF8_HOOKS
193 double adBoundsMin[4];
194 double adBoundsMax[4];
215 #define SHPT_POLYGON 5
216 #define SHPT_MULTIPOINT 8
217 #define SHPT_POINTZ 11
219 #define SHPT_POLYGONZ 15
220 #define SHPT_MULTIPOINTZ 18
221 #define SHPT_POINTM 21
223 #define SHPT_POLYGONM 25
224 #define SHPT_MULTIPOINTM 28
225 #define SHPT_MULTIPATCH 31
232 #define SHPP_TRISTRIP 0
233 #define SHPP_TRIFAN 1
234 #define SHPP_OUTERRING 2
235 #define SHPP_INNERRING 3
236 #define SHPP_FIRSTRING 4
282 const char *pszAccess,
SAHooks *psHooks,
301 double *padfMinBound,
double *padfMaxBound);
310 const
int *panPartStart, const
int *panPartType,
311 int nVertices, const
double *padfX, const
double *padfY,
312 const
double *padfZ, const
double *padfM);
315 const
double *padfY, const
double *padfZ);
330 #define MAX_SUBNODE 4
333 #define MAX_DEFAULT_TREE_DEPTH 12
363 double *padfBoundsMin,
double *padfBoundsMax);
375 double *padfBoundsMax,
int *);
376 int SHPAPI_CALL SHPCheckBoundsOverlap(
double *,
double *,
double *,
double *,
380 double *padfBoundsMax,
int *pnShapeCount);
382 typedef struct SHPDiskTreeInfo *SHPTreeDiskHandle;
384 SHPTreeDiskHandle
SHPAPI_CALL SHPOpenDiskTree(const
char *pszQIXFilename,
391 double *padfBoundsMax,
int *pnShapeCount);
409 double *padfBoundsMax,
int *pnShapeCount);
413 int bMaxX,
int bMaxY,
int *pnShapeCount);
478 #define XBASE_FLDHDR_SZ 32
480 #define XBASE_FLDNAME_LEN_READ 11
482 #define XBASE_FLDNAME_LEN_WRITE 10
484 #define XBASE_FLD_MAX_WIDTH 255
491 const char *pszCodePage);
493 const char *pszCodePage,
SAHooks *psHooks);
501 char chType,
int nWidth,
int nDecimals);
508 const char *pszFieldName,
char chType,
509 int nWidth,
int nDecimals);
512 char *pszFieldName,
int *pnWidth,
531 const
char *pszFieldValue);
535 const
char lFieldValue);
537 int iField,
void *pValue);
const char SHPAPI_CALL1 * DBFReadLogicalAttribute(DBFHandle psDBF, int iRecord, int iField){ return STATIC_CAST(const char *, DBFReadAttribute(psDBF, iRecord, iField, 'L')
void SHPAPI_CALL DBFSetLastModifiedDate(DBFHandle psDBF, int nYYSince1900, int nMM, int nDD)
int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity, void *pRawTuple)
int SHPAPI_CALL DBFWriteIntegerAttribute(DBFHandle hDBF, int iShape, int iField, int nFieldValue)
SHPHandle SHPAPI_CALL SHPCreate(const char *pszShapeFile, int nShapeType)
void SHPAPI_CALL SHPCloseDiskTree(SHPTreeDiskHandle hDiskTree)
DBFHandle SHPAPI_CALL DBFOpenLL(const char *pszDBFFile, const char *pszAccess, SAHooks *psHooks)
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)
int SHPAPI_CALL DBFGetFieldCount(DBFHandle psDBF)
int SHPAPI_CALL DBFAlterFieldDefn(DBFHandle psDBF, int iField, const char *pszFieldName, char chType, int nWidth, int nDecimals)
void SHPAPI_CALL DBFUpdateHeader(DBFHandle hDBF)
int SHPAPI_CALL SHPTreeRemoveShapeId(SHPTree *hTree, int nShapeId)
int SHPAPI_CALL DBFWriteStringAttribute(DBFHandle hDBF, int iShape, int iField, const char *pszFieldValue)
struct shape_tree_node SHPTreeNode
int SHPAPI_CALL DBFDeleteField(DBFHandle hDBF, int iField)
DBFHandle SHPAPI_CALL DBFOpen(const char *pszDBFFile, const char *pszAccess)
int SHPAPI_CALL SHPWriteTree(SHPTree *hTree, const char *pszFilename)
int SHPAPI_CALL DBFReadIntegerAttribute(DBFHandle hDBF, int iShape, int iField)
int SHPAPI_CALL DBFAddNativeFieldType(DBFHandle hDBF, const char *pszFieldName, char chType, int nWidth, int nDecimals)
void SHPAPI_CALL SHPSetFastModeReadObject(SHPHandle hSHP, int bFastMode)
int SHPAPI_CALL1 * SHPTreeFindLikelyShapes(SHPTree *hTree, double *padfBoundsMin, double *padfBoundsMax, int *);int SHPAPI_CALL SHPCheckBoundsOverlap(double *, double *, double *, double *, int
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 * DBFGetCodePage(DBFHandle psDBF);void SHPAPI_CALL DBFSetLastModifiedDate(DBFHandle psDBF, int nYYSince1900, int nMM, int nDD
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)
int SHPAPI_CALL DBFWriteDoubleAttribute(DBFHandle hDBF, int iShape, int iField, double dFieldValue)
void SHPAPI_CALL SHPDestroyObject(SHPObject *psObject)
DBFHandle SHPAPI_CALL DBFCloneEmpty(DBFHandle psDBF, const char *pszFilename)
void SHPAPI_CALL SHPComputeExtents(SHPObject *psObject)
SHPHandle SHPAPI_CALL SHPCreateLL(const char *pszShapeFile, int nShapeType, SAHooks *psHooks)
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 DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName)
int SHPAPI_CALL DBFWriteNULLAttribute(DBFHandle hDBF, int iShape, int iField)
void SHPAPI_CALL SHPTreeTrimExtraNodes(SHPTree *hTree)
int SHPAPI_CALL DBFGetRecordCount(DBFHandle psDBF)
SHPHandle SHPAPI_CALL SHPOpen(const char *pszShapeFile, const char *pszAccess)
int SHPAPI_CALL DBFIsAttributeNULL(DBFHandle hDBF, int iShape, int iField)
void SHPAPI_CALL SHPGetInfo(SHPHandle hSHP, int *pnEntities, int *pnShapeType, double *padfMinBound, double *padfMaxBound)
SBNSearchHandle SHPAPI_CALL SBNOpenDiskTree(const char *pszSBNFilename, SAHooks *psHooks)
int SHPAPI_CALL DBFAddField(DBFHandle hDBF, const char *pszFieldName, DBFFieldType eType, int nWidth, int nDecimals)
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)
DBFHandle SHPAPI_CALL DBFCreateEx(const char *pszDBFFile, const char *pszCodePage)
DBFHandle SHPAPI_CALL DBFCreate(const char *pszDBFFile)
void SHPAPI_CALL DBFClose(DBFHandle hDBF)
int SHPAPI_CALL SHPTreeAddShapeId(SHPTree *hTree, SHPObject *psObject)
struct SBNSearchInfo * SBNSearchHandle
void SHPAPI_CALL SBNSearchFreeIds(int *panShapeId)
const char SHPAPI_CALL1 * SHPTypeName(int nSHPType);const char SHPAPI_CALL1(*) SHPPartTypeName(int nPartType
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
SHPHandle SHPAPI_CALL SHPOpenLLEx(const char *pszShapeFile, const char *pszAccess, SAHooks *psHooks, int bRestoreSHX)
void SHPAPI_CALL DBFSetWriteEndOfFileChar(DBFHandle psDBF, int bWriteFlag)
SHPHandle SHPAPI_CALL SHPOpenLL(const char *pszShapeFile, const char *pszAccess, SAHooks *psHooks)
void SHPAPI_CALL SBNCloseDiskTree(SBNSearchHandle hSBN)
DBFHandle SHPAPI_CALL DBFCreateLL(const char *pszDBFFile, const char *pszCodePage, SAHooks *psHooks)
int SHPAPI_CALL SHPRewindObject(SHPHandle hSHP, SHPObject *psObject)
int SHPAPI_CALL DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField, void *pValue)
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)
void SHPAPI_CALL SHPWriteHeader(SHPHandle hSHP)
int SHPAPI_CALL DBFIsRecordDeleted(DBFHandle psDBF, int iShape)
void SHPAPI_CALL SASetupDefaultHooks(SAHooks *psHooks)
const char SHPAPI_CALL1 * DBFReadTuple(DBFHandle psDBF, int hEntity);int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity, void *pRawTuple
int SHPAPI_CALL SHPRestoreSHX(const char *pszShapeFile, const char *pszAccess, SAHooks *psHooks)
char SHPAPI_CALL DBFGetNativeFieldType(DBFHandle hDBF, int iField)
double SHPAPI_CALL DBFReadDoubleAttribute(DBFHandle hDBF, int iShape, int iField)
DBFFieldType SHPAPI_CALL DBFGetFieldInfo(DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals)
SHPObject SHPAPI_CALL1 * SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX, const double *padfY, const double *padfZ){ return(SHPCreateObject(nSHPType, -1, 0, SHPLIB_NULLPTR, SHPLIB_NULLPTR, nVertices, padfX, padfY, padfZ, SHPLIB_NULLPTR)
int SHPAPI_CALL SHPWriteObject(SHPHandle psSHP, int nShapeId, SHPObject *psObject)
const char SHPAPI_CALL1 * SHPPartTypeName(int nPartType){ switch(nPartType
int bCurrentRecordModified
int bRequireNextWriteSeek
SHPObject * psCachedObject
unsigned int * panRecSize
unsigned char * pabyObjectBuf
unsigned int * panRecOffset
SHPObject ** papsShapeObj
struct shape_tree_node * apsSubNode[MAX_SUBNODE]