1 #ifndef SHAPEFILE_H_INCLUDED
2 #define SHAPEFILE_H_INCLUDED
33 #define SHAPELIB_VERSION_MAJOR 1
34 #define SHAPELIB_VERSION_MINOR 6
35 #define SHAPELIB_VERSION_MICRO 0
37 #define SHAPELIB_MAKE_VERSION_NUMBER(major, minor, micro) \
38 ((major) * 10000 + (minor) * 100 + (micro))
40 #define SHAPELIB_VERSION_NUMBER \
41 SHAPELIB_MAKE_VERSION_NUMBER(SHAPELIB_VERSION_MAJOR, \
42 SHAPELIB_VERSION_MINOR, \
43 SHAPELIB_VERSION_MICRO)
45 #define SHAPELIB_AT_LEAST(major, minor, micro) \
46 (SHAPELIB_VERSION_NUMBER >= \
47 SHAPELIB_MAKE_VERSION_NUMBER(major, minor, micro))
57 #define TRIM_DBF_WHITESPACE
64 #define DISABLE_MULTIPATCH_MEASURE
95 #ifdef SHAPELIB_DLLEXPORT
96 #define SHPAPI_CALL __declspec(dllexport)
97 #define SHPAPI_CALL1(x) __declspec(dllexport) x
101 #if defined(USE_GCC_VISIBILITY_FLAG)
102 #define SHPAPI_CALL __attribute__((visibility("default")))
103 #define SHPAPI_CALL1(x) __attribute__((visibility("default"))) x
110 #define SHPAPI_CALL1(x) x SHPAPI_CALL
118 #define SHPAPI_WINDOWS
119 #define SHPAPI_UTF8_HOOKS
128 #if defined(_MSC_VER) && _MSC_VER >= 1400
136 SAFile (*FOpen)(
const char *filename,
const char *access,
void *pvUserData);
144 int (*Remove)(
const char *filename,
void *pvUserData);
146 void (*Error)(
const char *message);
147 double (*Atof)(
const char *str);
152 #ifdef SHPAPI_UTF8_HOOKS
176 double adBoundsMin[4];
177 double adBoundsMax[4];
204 #define SHPT_POLYGON 5
205 #define SHPT_MULTIPOINT 8
206 #define SHPT_POINTZ 11
208 #define SHPT_POLYGONZ 15
209 #define SHPT_MULTIPOINTZ 18
210 #define SHPT_POINTM 21
212 #define SHPT_POLYGONM 25
213 #define SHPT_MULTIPOINTM 28
214 #define SHPT_MULTIPATCH 31
221 #define SHPP_TRISTRIP 0
222 #define SHPP_TRIFAN 1
223 #define SHPP_OUTERRING 2
224 #define SHPP_INNERRING 3
225 #define SHPP_FIRSTRING 4
271 const char *pszAccess,
const SAHooks *psHooks,
290 int *pnShapeType,
double *padfMinBound,
291 double *padfMaxBound);
301 const
int *panPartStart, const
int *panPartType,
302 int nVertices, const
double *padfX, const
double *padfY,
303 const
double *padfZ, const
double *padfM);
306 const
double *padfY, const
double *padfZ);
321 #define MAX_SUBNODE 4
324 #define MAX_DEFAULT_TREE_DEPTH 12
354 const
double *padfBoundsMin, const
double *padfBoundsMax);
365 double *padfBoundsMax,
int *);
366 int SHPAPI_CALL SHPCheckBoundsOverlap(const
double *, const
double *,
367 const
double *, const
double *,
int);
370 double *padfBoundsMax,
int *pnShapeCount);
372 typedef struct SHPDiskTreeInfo *SHPTreeDiskHandle;
374 SHPTreeDiskHandle
SHPAPI_CALL SHPOpenDiskTree(const
char *pszQIXFilename,
381 double *padfBoundsMin,
double *padfBoundsMax,
400 const
double *padfBoundsMax,
int *pnShapeCount);
403 SBNSearchDiskTreeInteger(const
SBNSearchHandle hSBN,
int bMinX,
int bMinY,
404 int bMaxX,
int bMaxY,
int *pnShapeCount);
469 #define XBASE_FLDHDR_SZ 32
471 #define XBASE_FLDNAME_LEN_READ 11
473 #define XBASE_FLDNAME_LEN_WRITE 10
475 #define XBASE_FLD_MAX_WIDTH 255
482 const char *pszCodePage);
484 const char *pszCodePage,
493 char chType,
int nWidth,
int nDecimals);
500 const char *pszFieldName,
char chType,
501 int nWidth,
int nDecimals);
504 char *pszFieldName,
int *pnWidth,
508 const char *pszFieldName);
527 const
char *pszFieldValue);
531 const
char lFieldValue);
533 const
SHPDate *dateFieldValue);
535 int iField, const
void *pValue);
538 const
void *pRawTuple);
545 const
char *pszFilename);
int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity, const void *pRawTuple)
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 DBFWriteIntegerAttribute(DBFHandle hDBF, int iShape, int iField, int nFieldValue)
SHPHandle SHPAPI_CALL SHPCreate(const char *pszShapeFile, int nShapeType)
SHPTree SHPAPI_CALL1 * SHPCreateTree(SHPHandle hSHP, int nDimension, int nMaxDepth, const double *padfBoundsMin, const double *padfBoundsMax);void SHPAPI_CALL SHPDestroyTree(SHPTree *hTree
void SHPAPI_CALL SHPCloseDiskTree(SHPTreeDiskHandle hDiskTree)
int SHPAPI_CALL DBFGetFieldIndex(const DBFHandle psDBF, const char *pszFieldName)
int SHPAPI_CALL1 * SHPSearchDiskTreeEx(const SHPTreeDiskHandle hDiskTree, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount);int SHPAPI_CALL SHPWriteTreeLL(SHPTree *hTree, const char *pszFilename, const SAHooks *psHooks
int SHPAPI_CALL DBFGetRecordCount(const DBFHandle psDBF)
int SHPAPI_CALL DBFMarkRecordDeleted(DBFHandle psDBF, int iShape, int bIsDeleted)
int SHPAPI_CALL DBFAlterFieldDefn(DBFHandle psDBF, int iField, const char *pszFieldName, char chType, int nWidth, int nDecimals)
SHPHandle SHPAPI_CALL SHPOpenLL(const char *pszShapeFile, const char *pszAccess, const SAHooks *psHooks)
void SHPAPI_CALL DBFUpdateHeader(DBFHandle hDBF)
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)
void SHPAPI_CALL SHPClose(SHPHandle hSHP)
int SHPAPI_CALL DBFWriteDoubleAttribute(DBFHandle hDBF, int iShape, int iField, double dFieldValue)
const char SHPAPI_CALL1 * DBFGetCodePage(const DBFHandle psDBF);void SHPAPI_CALL DBFSetLastModifiedDate(DBFHandle psDBF, int nYYSince1900, int nMM, int nDD
int SHPAPI_CALL DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField, const void *pValue)
void SHPAPI_CALL SHPDestroyObject(SHPObject *psObject)
DBFFieldType SHPAPI_CALL DBFGetFieldInfo(const DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals)
DBFHandle SHPAPI_CALL DBFCreateLL(const char *pszDBFFile, const char *pszCodePage, const SAHooks *psHooks)
void SHPAPI_CALL SHPComputeExtents(SHPObject *psObject)
int SHPAPI_CALL DBFGetFieldCount(const DBFHandle psDBF)
DBFHandle SHPAPI_CALL DBFCloneEmpty(const DBFHandle psDBF, const char *pszFilename)
void SHPAPI_CALL SHPGetInfo(const SHPHandle hSHP, int *pnEntities, int *pnShapeType, double *padfMinBound, double *padfMaxBound)
int SHPAPI_CALL DBFIsRecordDeleted(const DBFHandle psDBF, int iShape)
int SHPAPI_CALL DBFWriteNULLAttribute(DBFHandle hDBF, int iShape, int iField)
void SHPAPI_CALL SHPTreeTrimExtraNodes(SHPTree *hTree)
int SHPAPI_CALL DBFReorderFields(DBFHandle psDBF, const int *panMap)
SHPHandle SHPAPI_CALL SHPOpen(const char *pszShapeFile, const char *pszAccess)
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_CALL1 * SHPTreeFindLikelyShapes(const SHPTree *hTree, double *padfBoundsMin, double *padfBoundsMax, int *);int SHPAPI_CALL SHPCheckBoundsOverlap(const double *, const double *, const double *, const double *, int
int SHPAPI_CALL DBFWriteLogicalAttribute(DBFHandle hDBF, int iShape, int iField, const char lFieldValue)
DBFHandle SHPAPI_CALL DBFCreateEx(const char *pszDBFFile, const char *pszCodePage)
int SHPAPI_CALL SHPRestoreSHX(const char *pszShapeFile, const char *pszAccess, const SAHooks *psHooks)
SHPHandle SHPAPI_CALL SHPOpenLLEx(const char *pszShapeFile, const char *pszAccess, const SAHooks *psHooks, int bRestoreSHX)
int SHPAPI_CALL1 * SHPSearchDiskTree(FILE *fp, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount);typedef struct SHPDiskTreeInfo *SHPTreeDiskHandle;SHPTreeDiskHandle SHPAPI_CALL SHPOpenDiskTree(const char *pszQIXFilename, const SAHooks *psHooks
DBFHandle SHPAPI_CALL DBFCreate(const char *pszDBFFile)
SHPDate SHPAPI_CALL DBFReadDateAttribute(DBFHandle hDBF, int iShape, int iField)
void SHPAPI_CALL DBFClose(DBFHandle hDBF)
int SHPAPI_CALL DBFWriteDateAttribute(DBFHandle hDBF, int iShape, int iField, const SHPDate *dateFieldValue)
int SHPAPI_CALL SHPTreeAddShapeId(SHPTree *hTree, SHPObject *psObject)
struct SBNSearchInfo * SBNSearchHandle
void SHPAPI_CALL SBNSearchFreeIds(int *panShapeId)
DBFHandle SHPAPI_CALL DBFOpenLL(const char *pszDBFFile, const char *pszAccess, const SAHooks *psHooks)
const char SHPAPI_CALL1 * SHPTypeName(int nSHPType);const char SHPAPI_CALL1(*) SHPPartTypeName(int nPartType
void SHPAPI_CALL DBFSetWriteEndOfFileChar(DBFHandle psDBF, int bWriteFlag)
SBNSearchHandle SHPAPI_CALL SBNOpenDiskTree(const char *pszSBNFilename, const SAHooks *psHooks)
SHPHandle SHPAPI_CALL SHPCreateLL(const char *pszShapeFile, int nShapeType, const SAHooks *psHooks)
void SHPAPI_CALL SBNCloseDiskTree(SBNSearchHandle hSBN)
int SHPAPI_CALL SHPRewindObject(const SHPHandle hSHP, SHPObject *psObject)
const char SHPAPI_CALL1 * DBFReadTuple(DBFHandle psDBF, int hEntity);int SHPAPI_CALL DBFWriteTuple(DBFHandle psDBF, int hEntity, const void *pRawTuple
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
void SHPAPI_CALL SHPWriteHeader(SHPHandle hSHP)
char SHPAPI_CALL DBFGetNativeFieldType(const DBFHandle hDBF, int iField)
SHPObject SHPAPI_CALL1 * SHPReadObject(const SHPHandle hSHP, int iShape);int SHPAPI_CALL SHPWriteObject(SHPHandle hSHP, int iShape, const SHPObject *psObject
int SHPAPI_CALL1 * SBNSearchDiskTree(const SBNSearchHandle hSBN, const double *padfBoundsMin, const double *padfBoundsMax, int *pnShapeCount);int SHPAPI_CALL1(*) SBNSearchDiskTreeInteger(const SBNSearchHandle hSBN, int bMinX, int bMinY, int bMaxX, int bMaxY, int *pnShapeCount
int SHPAPI_CALL DBFIsAttributeNULL(const DBFHandle hDBF, int iShape, int iField)
void SHPAPI_CALL SASetupDefaultHooks(SAHooks *psHooks)
double SHPAPI_CALL DBFReadDoubleAttribute(DBFHandle hDBF, int iShape, int iField)
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, const 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]