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 *);
367 const
double *, const
double *,
int);
370 double *padfBoundsMax,
int *pnShapeCount);
381 double *padfBoundsMin,
double *padfBoundsMax,
400 const
double *padfBoundsMax,
int *pnShapeCount);
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 SHPTreeAddShapeId(SHPTree *hTree, SHPObject *psObject)
DBFHandle DBFCloneEmpty(const DBFHandle psDBF, const char *pszFilename)
void SHPDestroyObject(SHPObject *psObject)
const char * DBFGetCodePage(const DBFHandle psDBF)
int DBFAddNativeFieldType(DBFHandle hDBF, const char *pszFieldName, char chType, int nWidth, int nDecimals)
SHPDate DBFReadDateAttribute(DBFHandle hDBF, int iShape, int iField)
SHPObject * SHPCreateSimpleObject(int nSHPType, int nVertices, const double *padfX, const double *padfY, const double *padfZ)
DBFHandle DBFOpenLL(const char *pszDBFFile, const char *pszAccess, const SAHooks *psHooks)
int DBFAddField(DBFHandle hDBF, const char *pszFieldName, DBFFieldType eType, int nWidth, int nDecimals)
int * SBNSearchDiskTree(const SBNSearchHandle hSBN, const double *padfBoundsMin, const double *padfBoundsMax, int *pnShapeCount)
void SHPClose(SHPHandle hSHP)
int SHPCheckBoundsOverlap(const double *, const double *, const double *, const double *, int)
SHPHandle SHPOpenLLEx(const char *pszShapeFile, const char *pszAccess, const SAHooks *psHooks, int bRestoreSHX)
int DBFWriteDoubleAttribute(DBFHandle hDBF, int iShape, int iField, double dFieldValue)
struct shape_tree_node SHPTreeNode
int DBFGetFieldCount(const DBFHandle psDBF)
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)
char DBFGetNativeFieldType(const DBFHandle hDBF, int iField)
const char * DBFReadLogicalAttribute(DBFHandle hDBF, int iShape, int iField)
void SHPCloseDiskTree(SHPTreeDiskHandle hDiskTree)
int SHPWriteObject(SHPHandle hSHP, int iShape, const SHPObject *psObject)
int DBFMarkRecordDeleted(DBFHandle psDBF, int iShape, int bIsDeleted)
int * SHPTreeFindLikelyShapes(const SHPTree *hTree, double *padfBoundsMin, double *padfBoundsMax, int *)
void SBNCloseDiskTree(SBNSearchHandle hSBN)
void SHPDestroyTree(SHPTree *hTree)
int DBFAlterFieldDefn(DBFHandle psDBF, int iField, const char *pszFieldName, char chType, int nWidth, int nDecimals)
struct SHPDiskTreeInfo * SHPTreeDiskHandle
SHPTreeDiskHandle SHPOpenDiskTree(const char *pszQIXFilename, const SAHooks *psHooks)
int DBFIsRecordDeleted(const DBFHandle psDBF, int iShape)
void DBFSetWriteEndOfFileChar(DBFHandle psDBF, int bWriteFlag)
int DBFWriteIntegerAttribute(DBFHandle hDBF, int iShape, int iField, int nFieldValue)
SHPHandle SHPOpenLL(const char *pszShapeFile, const char *pszAccess, const SAHooks *psHooks)
void SHPWriteHeader(SHPHandle hSHP)
int DBFWriteDateAttribute(DBFHandle hDBF, int iShape, int iField, const SHPDate *dateFieldValue)
int DBFDeleteField(DBFHandle hDBF, int iField)
SBNSearchHandle SBNOpenDiskTree(const char *pszSBNFilename, const SAHooks *psHooks)
void SBNSearchFreeIds(int *panShapeId)
DBFFieldType DBFGetFieldInfo(const DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals)
int DBFReorderFields(DBFHandle psDBF, const int *panMap)
const char * DBFReadTuple(DBFHandle psDBF, int hEntity)
void DBFUpdateHeader(DBFHandle hDBF)
SHPTree * SHPCreateTree(SHPHandle hSHP, int nDimension, int nMaxDepth, const double *padfBoundsMin, const double *padfBoundsMax)
int DBFReadIntegerAttribute(DBFHandle hDBF, int iShape, int iField)
DBFHandle DBFCreate(const char *pszDBFFile)
SHPHandle SHPOpen(const char *pszShapeFile, const char *pszAccess)
DBFHandle DBFCreateLL(const char *pszDBFFile, const char *pszCodePage, const SAHooks *psHooks)
int SHPWriteTreeLL(SHPTree *hTree, const char *pszFilename, const SAHooks *psHooks)
const char * DBFReadStringAttribute(DBFHandle hDBF, int iShape, int iField)
int DBFIsAttributeNULL(const DBFHandle hDBF, int iShape, int iField)
void DBFSetLastModifiedDate(DBFHandle psDBF, int nYYSince1900, int nMM, int nDD)
void SHPTreeTrimExtraNodes(SHPTree *hTree)
int DBFWriteNULLAttribute(DBFHandle hDBF, int iShape, int iField)
const char * SHPPartTypeName(int nPartType)
double DBFReadDoubleAttribute(DBFHandle hDBF, int iShape, int iField)
SHPObject * SHPReadObject(const SHPHandle hSHP, int iShape)
void SHPGetInfo(const SHPHandle hSHP, int *pnEntities, int *pnShapeType, double *padfMinBound, double *padfMaxBound)
DBFHandle DBFCreateEx(const char *pszDBFFile, const char *pszCodePage)
void SASetupDefaultHooks(SAHooks *psHooks)
int * SHPSearchDiskTree(FILE *fp, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount)
struct SBNSearchInfo * SBNSearchHandle
int SHPWriteTree(SHPTree *hTree, const char *pszFilename)
int SHPRewindObject(const SHPHandle hSHP, SHPObject *psObject)
DBFHandle DBFOpen(const char *pszDBFFile, const char *pszAccess)
int SHPRestoreSHX(const char *pszShapeFile, const char *pszAccess, const SAHooks *psHooks)
int DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField, const void *pValue)
void SHPSetFastModeReadObject(SHPHandle hSHP, int bFastMode)
void SHPComputeExtents(SHPObject *psObject)
int DBFGetRecordCount(const DBFHandle psDBF)
void DBFClose(DBFHandle hDBF)
int * SHPSearchDiskTreeEx(const SHPTreeDiskHandle hDiskTree, double *padfBoundsMin, double *padfBoundsMax, int *pnShapeCount)
int DBFWriteTuple(DBFHandle psDBF, int hEntity, const void *pRawTuple)
int DBFGetFieldIndex(const DBFHandle psDBF, const char *pszFieldName)
int * SBNSearchDiskTreeInteger(const SBNSearchHandle hSBN, int bMinX, int bMinY, int bMaxX, int bMaxY, int *pnShapeCount)
SHPHandle SHPCreateLL(const char *pszShapeFile, int nShapeType, const SAHooks *psHooks)
SHPHandle SHPCreate(const char *pszShapeFile, int nShapeType)
const char * SHPTypeName(int nSHPType)
int DBFWriteStringAttribute(DBFHandle hDBF, int iShape, int iField, const char *pszFieldValue)
int DBFWriteLogicalAttribute(DBFHandle hDBF, int iShape, int iField, const char lFieldValue)
int bCurrentRecordModified
int bRequireNextWriteSeek
SHPObject * psCachedObject
unsigned int * panRecSize
unsigned char * pabyObjectBuf
unsigned int * panRecOffset
SHPObject ** papsShapeObj
struct shape_tree_node * apsSubNode[4]