37 |
****************************************************************************** |
****************************************************************************** |
38 |
* |
* |
39 |
* $Log$ |
* $Log$ |
40 |
* Revision 1.1 2001/08/28 15:41:52 bh |
* Revision 1.4 2002/08/22 16:00:01 bh |
41 |
* import all the source files |
* * extensions/shapelib/shapefil.h (DBFCommit), |
42 |
|
* extensions/shapelib/dbfopen.c (DBFCommit): New API function to |
43 |
|
* commit any changes made to the DBF file. |
44 |
|
* |
45 |
|
* Revision 1.3 2002/05/07 14:09:45 bh |
46 |
|
* * extensions/shapelib/shpopen.c, extensions/shapelib/shapefil.h, |
47 |
|
* extensions/shapelib/dbfopen.c: Really update to the versions of |
48 |
|
* shapelib 1.2.9. For some reason it wasn't really done on |
49 |
|
* 2002-04-11. |
50 |
|
* |
51 |
|
* Revision 1.20 2001/07/20 13:06:02 warmerda |
52 |
|
* fixed SHPAPI attribute for SHPTreeFindLikelyShapes |
53 |
|
* |
54 |
|
* Revision 1.19 2001/05/31 19:20:13 warmerda |
55 |
|
* added DBFGetFieldIndex() |
56 |
|
* |
57 |
|
* Revision 1.18 2001/05/31 18:15:40 warmerda |
58 |
|
* Added support for NULL fields in DBF files |
59 |
|
* |
60 |
|
* Revision 1.17 2001/05/23 13:36:52 warmerda |
61 |
|
* added use of SHPAPI_CALL |
62 |
|
* |
63 |
|
* Revision 1.16 2000/09/25 14:15:59 warmerda |
64 |
|
* added DBFGetNativeFieldType() |
65 |
* |
* |
66 |
* Revision 1.15 2000/02/16 16:03:51 warmerda |
* Revision 1.15 2000/02/16 16:03:51 warmerda |
67 |
* added null shape support |
* added null shape support |
116 |
#ifdef __cplusplus |
#ifdef __cplusplus |
117 |
extern "C" { |
extern "C" { |
118 |
#endif |
#endif |
119 |
|
|
120 |
|
#ifndef SHPAPI_CALL |
121 |
|
#define SHPAPI_CALL |
122 |
|
#endif |
123 |
|
|
124 |
|
#define SHPAPI_CALL1(x) * SHPAPI_CALL |
125 |
|
|
126 |
/************************************************************************/ |
/************************************************************************/ |
127 |
/* Configuration options. */ |
/* Configuration options. */ |
230 |
/* -------------------------------------------------------------------- */ |
/* -------------------------------------------------------------------- */ |
231 |
/* SHP API Prototypes */ |
/* SHP API Prototypes */ |
232 |
/* -------------------------------------------------------------------- */ |
/* -------------------------------------------------------------------- */ |
233 |
SHPHandle SHPOpen( const char * pszShapeFile, const char * pszAccess ); |
SHPHandle SHPAPI_CALL |
234 |
SHPHandle SHPCreate( const char * pszShapeFile, int nShapeType ); |
SHPOpen( const char * pszShapeFile, const char * pszAccess ); |
235 |
void SHPGetInfo( SHPHandle hSHP, int * pnEntities, int * pnShapeType, |
SHPHandle SHPAPI_CALL |
236 |
double * padfMinBound, double * padfMaxBound ); |
SHPCreate( const char * pszShapeFile, int nShapeType ); |
237 |
|
void SHPAPI_CALL |
238 |
SHPObject *SHPReadObject( SHPHandle hSHP, int iShape ); |
SHPGetInfo( SHPHandle hSHP, int * pnEntities, int * pnShapeType, |
239 |
int SHPWriteObject( SHPHandle hSHP, int iShape, SHPObject * psObject ); |
double * padfMinBound, double * padfMaxBound ); |
240 |
|
|
241 |
void SHPDestroyObject( SHPObject * psObject ); |
SHPObject SHPAPI_CALL1(*) |
242 |
void SHPComputeExtents( SHPObject * psObject ); |
SHPReadObject( SHPHandle hSHP, int iShape ); |
243 |
SHPObject *SHPCreateObject( int nSHPType, int nShapeId, |
int SHPAPI_CALL |
244 |
int nParts, int * panPartStart, int * panPartType, |
SHPWriteObject( SHPHandle hSHP, int iShape, SHPObject * psObject ); |
245 |
int nVertices, double * padfX, double * padfY, |
|
246 |
double * padfZ, double * padfM ); |
void SHPAPI_CALL |
247 |
SHPObject *SHPCreateSimpleObject( int nSHPType, int nVertices, |
SHPDestroyObject( SHPObject * psObject ); |
248 |
double * padfX, double * padfY, double * padfZ ); |
void SHPAPI_CALL |
249 |
|
SHPComputeExtents( SHPObject * psObject ); |
250 |
void SHPClose( SHPHandle hSHP ); |
SHPObject SHPAPI_CALL1(*) |
251 |
|
SHPCreateObject( int nSHPType, int nShapeId, |
252 |
const char *SHPTypeName( int nSHPType ); |
int nParts, int * panPartStart, int * panPartType, |
253 |
const char *SHPPartTypeName( int nPartType ); |
int nVertices, double * padfX, double * padfY, |
254 |
|
double * padfZ, double * padfM ); |
255 |
|
SHPObject SHPAPI_CALL1(*) |
256 |
|
SHPCreateSimpleObject( int nSHPType, int nVertices, |
257 |
|
double * padfX, double * padfY, double * padfZ ); |
258 |
|
|
259 |
|
void SHPAPI_CALL |
260 |
|
SHPClose( SHPHandle hSHP ); |
261 |
|
|
262 |
|
const char SHPAPI_CALL1(*) |
263 |
|
SHPTypeName( int nSHPType ); |
264 |
|
const char SHPAPI_CALL1(*) |
265 |
|
SHPPartTypeName( int nPartType ); |
266 |
|
|
267 |
/* -------------------------------------------------------------------- */ |
/* -------------------------------------------------------------------- */ |
268 |
/* Shape quadtree indexing API. */ |
/* Shape quadtree indexing API. */ |
298 |
SHPTreeNode *psRoot; |
SHPTreeNode *psRoot; |
299 |
} SHPTree; |
} SHPTree; |
300 |
|
|
301 |
SHPTree *SHPCreateTree( SHPHandle hSHP, int nDimension, int nMaxDepth, |
SHPTree SHPAPI_CALL1(*) |
302 |
double *padfBoundsMin, double *padfBoundsMax ); |
SHPCreateTree( SHPHandle hSHP, int nDimension, int nMaxDepth, |
303 |
void SHPDestroyTree( SHPTree * hTree ); |
double *padfBoundsMin, double *padfBoundsMax ); |
304 |
|
void SHPAPI_CALL |
305 |
int SHPWriteTree( SHPTree *hTree, const char * pszFilename ); |
SHPDestroyTree( SHPTree * hTree ); |
306 |
SHPTree SHPReadTree( const char * pszFilename ); |
|
307 |
|
int SHPAPI_CALL |
308 |
int SHPTreeAddObject( SHPTree * hTree, SHPObject * psObject ); |
SHPWriteTree( SHPTree *hTree, const char * pszFilename ); |
309 |
int SHPTreeAddShapeId( SHPTree * hTree, SHPObject * psObject ); |
SHPTree SHPAPI_CALL |
310 |
int SHPTreeRemoveShapeId( SHPTree * hTree, int nShapeId ); |
SHPReadTree( const char * pszFilename ); |
311 |
|
|
312 |
void SHPTreeTrimExtraNodes( SHPTree * hTree ); |
int SHPAPI_CALL |
313 |
|
SHPTreeAddObject( SHPTree * hTree, SHPObject * psObject ); |
314 |
int *SHPTreeFindLikelyShapes( SHPTree * hTree, |
int SHPAPI_CALL |
315 |
double * padfBoundsMin, |
SHPTreeAddShapeId( SHPTree * hTree, SHPObject * psObject ); |
316 |
double * padfBoundsMax, |
int SHPAPI_CALL |
317 |
int * ); |
SHPTreeRemoveShapeId( SHPTree * hTree, int nShapeId ); |
318 |
int SHPCheckBoundsOverlap( double *, double *, double *, double *, int ); |
|
319 |
|
void SHPAPI_CALL |
320 |
|
SHPTreeTrimExtraNodes( SHPTree * hTree ); |
321 |
|
|
322 |
|
int SHPAPI_CALL1(*) |
323 |
|
SHPTreeFindLikelyShapes( SHPTree * hTree, |
324 |
|
double * padfBoundsMin, |
325 |
|
double * padfBoundsMax, |
326 |
|
int * ); |
327 |
|
int SHPAPI_CALL |
328 |
|
SHPCheckBoundsOverlap( double *, double *, double *, double *, int ); |
329 |
|
|
330 |
/************************************************************************/ |
/************************************************************************/ |
331 |
/* DBF Support. */ |
/* DBF Support. */ |
365 |
|
|
366 |
#define XBASE_FLDHDR_SZ 32 |
#define XBASE_FLDHDR_SZ 32 |
367 |
|
|
368 |
DBFHandle DBFOpen( const char * pszDBFFile, const char * pszAccess ); |
DBFHandle SHPAPI_CALL |
369 |
DBFHandle DBFCreate( const char * pszDBFFile ); |
DBFOpen( const char * pszDBFFile, const char * pszAccess ); |
370 |
|
DBFHandle SHPAPI_CALL |
371 |
int DBFGetFieldCount( DBFHandle psDBF ); |
DBFCreate( const char * pszDBFFile ); |
372 |
int DBFGetRecordCount( DBFHandle psDBF ); |
|
373 |
int DBFAddField( DBFHandle hDBF, const char * pszFieldName, |
int SHPAPI_CALL |
374 |
DBFFieldType eType, int nWidth, int nDecimals ); |
DBFGetFieldCount( DBFHandle psDBF ); |
375 |
|
int SHPAPI_CALL |
376 |
DBFFieldType DBFGetFieldInfo( DBFHandle psDBF, int iField, |
DBFGetRecordCount( DBFHandle psDBF ); |
377 |
char * pszFieldName, |
int SHPAPI_CALL |
378 |
int * pnWidth, int * pnDecimals ); |
DBFAddField( DBFHandle hDBF, const char * pszFieldName, |
379 |
|
DBFFieldType eType, int nWidth, int nDecimals ); |
380 |
int DBFReadIntegerAttribute( DBFHandle hDBF, int iShape, int iField ); |
|
381 |
double DBFReadDoubleAttribute( DBFHandle hDBF, int iShape, int iField ); |
DBFFieldType SHPAPI_CALL |
382 |
const char *DBFReadStringAttribute( DBFHandle hDBF, int iShape, int iField ); |
DBFGetFieldInfo( DBFHandle psDBF, int iField, |
383 |
|
char * pszFieldName, int * pnWidth, int * pnDecimals ); |
384 |
int DBFWriteIntegerAttribute( DBFHandle hDBF, int iShape, int iField, |
|
385 |
int nFieldValue ); |
int SHPAPI_CALL |
386 |
int DBFWriteDoubleAttribute( DBFHandle hDBF, int iShape, int iField, |
DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName); |
387 |
double dFieldValue ); |
|
388 |
int DBFWriteStringAttribute( DBFHandle hDBF, int iShape, int iField, |
int SHPAPI_CALL |
389 |
const char * pszFieldValue ); |
DBFReadIntegerAttribute( DBFHandle hDBF, int iShape, int iField ); |
390 |
|
double SHPAPI_CALL |
391 |
|
DBFReadDoubleAttribute( DBFHandle hDBF, int iShape, int iField ); |
392 |
|
const char SHPAPI_CALL1(*) |
393 |
|
DBFReadStringAttribute( DBFHandle hDBF, int iShape, int iField ); |
394 |
|
int SHPAPI_CALL |
395 |
|
DBFIsAttributeNULL( DBFHandle hDBF, int iShape, int iField ); |
396 |
|
|
397 |
|
int SHPAPI_CALL |
398 |
|
DBFWriteIntegerAttribute( DBFHandle hDBF, int iShape, int iField, |
399 |
|
int nFieldValue ); |
400 |
|
int SHPAPI_CALL |
401 |
|
DBFWriteDoubleAttribute( DBFHandle hDBF, int iShape, int iField, |
402 |
|
double dFieldValue ); |
403 |
|
int SHPAPI_CALL |
404 |
|
DBFWriteStringAttribute( DBFHandle hDBF, int iShape, int iField, |
405 |
|
const char * pszFieldValue ); |
406 |
|
int SHPAPI_CALL |
407 |
|
DBFWriteNULLAttribute( DBFHandle hDBF, int iShape, int iField ); |
408 |
|
|
409 |
|
const char SHPAPI_CALL1(*) |
410 |
|
DBFReadTuple(DBFHandle psDBF, int hEntity ); |
411 |
|
int SHPAPI_CALL |
412 |
|
DBFWriteTuple(DBFHandle psDBF, int hEntity, void * pRawTuple ); |
413 |
|
|
414 |
const char *DBFReadTuple(DBFHandle psDBF, int hEntity ); |
DBFHandle SHPAPI_CALL |
415 |
int DBFWriteTuple(DBFHandle psDBF, int hEntity, void * pRawTuple ); |
DBFCloneEmpty(DBFHandle psDBF, const char * pszFilename ); |
|
|
|
|
DBFHandle DBFCloneEmpty(DBFHandle psDBF, const char * pszFilename ); |
|
416 |
|
|
417 |
void DBFClose( DBFHandle hDBF ); |
void SHPAPI_CALL |
418 |
|
DBFClose( DBFHandle hDBF ); |
419 |
|
char SHPAPI_CALL |
420 |
|
DBFGetNativeFieldType( DBFHandle hDBF, int iField ); |
421 |
|
|
422 |
|
int SHPAPI_CALL |
423 |
|
DBFCommit( DBFHandle hDBF ); |
424 |
|
|
425 |
#ifdef __cplusplus |
#ifdef __cplusplus |
426 |
} |
} |