6 |
* |
* |
7 |
* Project: Shapelib |
* Project: Shapelib |
8 |
* Purpose: Primary include file for Shapelib. |
* Purpose: Primary include file for Shapelib. |
9 |
* Author: Frank Warmerdam, [email protected] |
* Author: Frank Warmerdam, [email protected] |
10 |
* |
* |
11 |
****************************************************************************** |
****************************************************************************** |
12 |
* Copyright (c) 1999, Frank Warmerdam |
* Copyright (c) 1999, Frank Warmerdam |
37 |
****************************************************************************** |
****************************************************************************** |
38 |
* |
* |
39 |
* $Log$ |
* $Log$ |
40 |
* Revision 1.1 2003/08/19 21:29:25 jan |
* Revision 1.3 2004/05/17 15:47:57 bh |
41 |
* These files have been moved here from thuban/extensions/shapelib/ |
* Update to newest shapelib and get rid of Thuban specific extensions, |
42 |
* See there in the Attic for the older history. |
* i.e. use the new DBFUpdateHeader instead of our DBFCommit kludge |
43 |
* |
* |
44 |
* Revision 1.4 2002/08/22 16:00:01 bh |
* * libraries/shapelib/shpopen.c: Update to version from current |
45 |
* * extensions/shapelib/shapefil.h (DBFCommit), |
* shapelib CVS. |
46 |
* extensions/shapelib/dbfopen.c (DBFCommit): New API function to |
* |
47 |
* commit any changes made to the DBF file. |
* * libraries/shapelib/shapefil.h: Update to version from current |
48 |
* |
* shapelib CVS. |
49 |
* Revision 1.3 2002/05/07 14:09:45 bh |
* |
50 |
* * extensions/shapelib/shpopen.c, extensions/shapelib/shapefil.h, |
* * libraries/shapelib/dbfopen.c: Update to version from current |
51 |
* extensions/shapelib/dbfopen.c: Really update to the versions of |
* shapelib CVS. |
52 |
* shapelib 1.2.9. For some reason it wasn't really done on |
* (DBFCommit): Effectively removed since shapelib itself has |
53 |
* 2002-04-11. |
* DBFUpdateHeader now which is better for what DBFCommit wanted to |
54 |
|
* achieve. |
55 |
|
* We're now using an unmodified version of dbfopen. |
56 |
|
* |
57 |
|
* * libraries/pyshapelib/dbflib_wrap.c, libraries/pyshapelib/dbflib.py: |
58 |
|
* Update from dbflib.i |
59 |
|
* |
60 |
|
* * libraries/pyshapelib/dbflib.i (DBFInfo_commit): New. Implementation of |
61 |
|
* the commit method. This new indirection is necessary because we use the |
62 |
|
* DBFUpdateHeader function now which is not available in shapelib <= |
63 |
|
* 1.2.10 |
64 |
|
* (DBFFile::commit): Use DBFInfo_commit as implementation |
65 |
|
* (pragma __class__): New. Kludge to remove the commit method when |
66 |
|
* the DBFUpdateHeader function isn't available |
67 |
|
* (_have_commit): New. Helper for the pragma kludge. |
68 |
|
* |
69 |
|
* * libraries/pyshapelib/setup.py (dbf_macros): New. Return the |
70 |
|
* preprocessor macros needed to compile the dbflib wrapper. Determine |
71 |
|
* whether DBFUpdateHeader is available and define the right value of |
72 |
|
* HAVE_UPDATE_HEADER |
73 |
|
* (extensions): Use dbf_macros for the dbflibc extension |
74 |
|
* |
75 |
|
* * setup.py (extensions): Add the HAVE_UPDATE_HEADER macro with |
76 |
|
* value '1' to the Lib.dbflibc extension. This simply reflects the |
77 |
|
* shapelib and pyshapelib updates |
78 |
|
* |
79 |
|
* Revision 1.28 2003/12/29 06:02:18 fwarmerdam |
80 |
|
* added cpl_error.h option |
81 |
|
* |
82 |
|
* Revision 1.27 2003/04/21 18:30:37 warmerda |
83 |
|
* added header write/update public methods |
84 |
|
* |
85 |
|
* Revision 1.26 2002/09/29 00:00:08 warmerda |
86 |
|
* added FTLogical and logical attribute read/write calls |
87 |
|
* |
88 |
|
* Revision 1.25 2002/05/07 13:46:30 warmerda |
89 |
|
* added DBFWriteAttributeDirectly(). |
90 |
|
* |
91 |
|
* Revision 1.24 2002/04/10 16:59:54 warmerda |
92 |
|
* added SHPRewindObject |
93 |
|
* |
94 |
|
* Revision 1.23 2002/01/15 14:36:07 warmerda |
95 |
|
* updated email address |
96 |
|
* |
97 |
|
* Revision 1.22 2002/01/15 14:32:00 warmerda |
98 |
|
* try to improve SHPAPI_CALL docs |
99 |
|
* |
100 |
|
* Revision 1.21 2001/11/01 16:29:55 warmerda |
101 |
|
* move pabyRec into SHPInfo for thread safety |
102 |
* |
* |
103 |
* Revision 1.20 2001/07/20 13:06:02 warmerda |
* Revision 1.20 2001/07/20 13:06:02 warmerda |
104 |
* fixed SHPAPI attribute for SHPTreeFindLikelyShapes |
* fixed SHPAPI attribute for SHPTreeFindLikelyShapes |
165 |
#include <dbmalloc.h> |
#include <dbmalloc.h> |
166 |
#endif |
#endif |
167 |
|
|
168 |
#ifdef __cplusplus |
#ifdef USE_CPL |
169 |
extern "C" { |
#include "cpl_error.h" |
170 |
#endif |
#endif |
171 |
|
|
172 |
#ifndef SHPAPI_CALL |
#ifdef __cplusplus |
173 |
#define SHPAPI_CALL |
extern "C" { |
174 |
#endif |
#endif |
175 |
|
|
|
#define SHPAPI_CALL1(x) * SHPAPI_CALL |
|
|
|
|
176 |
/************************************************************************/ |
/************************************************************************/ |
177 |
/* Configuration options. */ |
/* Configuration options. */ |
178 |
/************************************************************************/ |
/************************************************************************/ |
190 |
/* -------------------------------------------------------------------- */ |
/* -------------------------------------------------------------------- */ |
191 |
#define DISABLE_MULTIPATCH_MEASURE |
#define DISABLE_MULTIPATCH_MEASURE |
192 |
|
|
193 |
|
/* -------------------------------------------------------------------- */ |
194 |
|
/* SHPAPI_CALL */ |
195 |
|
/* */ |
196 |
|
/* The following two macros are present to allow forcing */ |
197 |
|
/* various calling conventions on the Shapelib API. */ |
198 |
|
/* */ |
199 |
|
/* To force __stdcall conventions (needed to call Shapelib */ |
200 |
|
/* from Visual Basic and/or Dephi I believe) the makefile could */ |
201 |
|
/* be modified to define: */ |
202 |
|
/* */ |
203 |
|
/* /DSHPAPI_CALL=__stdcall */ |
204 |
|
/* */ |
205 |
|
/* If it is desired to force export of the Shapelib API without */ |
206 |
|
/* using the shapelib.def file, use the following definition. */ |
207 |
|
/* */ |
208 |
|
/* /DSHAPELIB_DLLEXPORT */ |
209 |
|
/* */ |
210 |
|
/* To get both at once it will be necessary to hack this */ |
211 |
|
/* include file to define: */ |
212 |
|
/* */ |
213 |
|
/* #define SHPAPI_CALL __declspec(dllexport) __stdcall */ |
214 |
|
/* #define SHPAPI_CALL1 __declspec(dllexport) * __stdcall */ |
215 |
|
/* */ |
216 |
|
/* The complexity of the situtation is partly caused by the */ |
217 |
|
/* peculiar requirement of Visual C++ that __stdcall appear */ |
218 |
|
/* after any "*"'s in the return value of a function while the */ |
219 |
|
/* __declspec(dllexport) must appear before them. */ |
220 |
|
/* -------------------------------------------------------------------- */ |
221 |
|
|
222 |
|
#ifdef SHAPELIB_DLLEXPORT |
223 |
|
# define SHPAPI_CALL __declspec(dllexport) |
224 |
|
# define SHPAPI_CALL1(x) __declspec(dllexport) x |
225 |
|
#endif |
226 |
|
|
227 |
|
#ifndef SHPAPI_CALL |
228 |
|
# define SHPAPI_CALL |
229 |
|
#endif |
230 |
|
|
231 |
|
#ifndef SHPAPI_CALL1 |
232 |
|
# define SHPAPI_CALL1(x) x SHPAPI_CALL |
233 |
|
#endif |
234 |
|
|
235 |
/************************************************************************/ |
/************************************************************************/ |
236 |
/* SHP Support. */ |
/* SHP Support. */ |
237 |
/************************************************************************/ |
/************************************************************************/ |
253 |
double adBoundsMax[4]; |
double adBoundsMax[4]; |
254 |
|
|
255 |
int bUpdated; |
int bUpdated; |
256 |
|
|
257 |
|
unsigned char *pabyRec; |
258 |
|
int nBufSize; |
259 |
} SHPInfo; |
} SHPInfo; |
260 |
|
|
261 |
typedef SHPInfo * SHPHandle; |
typedef SHPInfo * SHPHandle; |
351 |
SHPCreateSimpleObject( int nSHPType, int nVertices, |
SHPCreateSimpleObject( int nSHPType, int nVertices, |
352 |
double * padfX, double * padfY, double * padfZ ); |
double * padfX, double * padfY, double * padfZ ); |
353 |
|
|
354 |
void SHPAPI_CALL |
int SHPAPI_CALL |
355 |
SHPClose( SHPHandle hSHP ); |
SHPRewindObject( SHPHandle hSHP, SHPObject * psObject ); |
356 |
|
|
357 |
|
void SHPAPI_CALL SHPClose( SHPHandle hSHP ); |
358 |
|
void SHPAPI_CALL SHPWriteHeader( SHPHandle hSHP ); |
359 |
|
|
360 |
const char SHPAPI_CALL1(*) |
const char SHPAPI_CALL1(*) |
361 |
SHPTypeName( int nSHPType ); |
SHPTypeName( int nSHPType ); |
458 |
FTString, |
FTString, |
459 |
FTInteger, |
FTInteger, |
460 |
FTDouble, |
FTDouble, |
461 |
|
FTLogical, |
462 |
FTInvalid |
FTInvalid |
463 |
} DBFFieldType; |
} DBFFieldType; |
464 |
|
|
465 |
#define XBASE_FLDHDR_SZ 32 |
#define XBASE_FLDHDR_SZ 32 |
466 |
|
|
467 |
|
/* to hand over a locale agnostic atof function, if decimal_point != ".\0" */ |
468 |
|
void SHPAPI_CALL |
469 |
|
DBFSetatof_function( double (* new_atof_function)(const char *nptr)); |
470 |
|
|
471 |
DBFHandle SHPAPI_CALL |
DBFHandle SHPAPI_CALL |
472 |
DBFOpen( const char * pszDBFFile, const char * pszAccess ); |
DBFOpen( const char * pszDBFFile, const char * pszAccess ); |
473 |
DBFHandle SHPAPI_CALL |
DBFHandle SHPAPI_CALL |
494 |
DBFReadDoubleAttribute( DBFHandle hDBF, int iShape, int iField ); |
DBFReadDoubleAttribute( DBFHandle hDBF, int iShape, int iField ); |
495 |
const char SHPAPI_CALL1(*) |
const char SHPAPI_CALL1(*) |
496 |
DBFReadStringAttribute( DBFHandle hDBF, int iShape, int iField ); |
DBFReadStringAttribute( DBFHandle hDBF, int iShape, int iField ); |
497 |
|
const char SHPAPI_CALL1(*) |
498 |
|
DBFReadLogicalAttribute( DBFHandle hDBF, int iShape, int iField ); |
499 |
int SHPAPI_CALL |
int SHPAPI_CALL |
500 |
DBFIsAttributeNULL( DBFHandle hDBF, int iShape, int iField ); |
DBFIsAttributeNULL( DBFHandle hDBF, int iShape, int iField ); |
501 |
|
|
511 |
int SHPAPI_CALL |
int SHPAPI_CALL |
512 |
DBFWriteNULLAttribute( DBFHandle hDBF, int iShape, int iField ); |
DBFWriteNULLAttribute( DBFHandle hDBF, int iShape, int iField ); |
513 |
|
|
514 |
|
int SHPAPI_CALL |
515 |
|
DBFWriteLogicalAttribute( DBFHandle hDBF, int iShape, int iField, |
516 |
|
const char lFieldValue); |
517 |
|
int SHPAPI_CALL |
518 |
|
DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField, |
519 |
|
void * pValue ); |
520 |
const char SHPAPI_CALL1(*) |
const char SHPAPI_CALL1(*) |
521 |
DBFReadTuple(DBFHandle psDBF, int hEntity ); |
DBFReadTuple(DBFHandle psDBF, int hEntity ); |
522 |
int SHPAPI_CALL |
int SHPAPI_CALL |
527 |
|
|
528 |
void SHPAPI_CALL |
void SHPAPI_CALL |
529 |
DBFClose( DBFHandle hDBF ); |
DBFClose( DBFHandle hDBF ); |
530 |
|
void SHPAPI_CALL |
531 |
|
DBFUpdateHeader( DBFHandle hDBF ); |
532 |
char SHPAPI_CALL |
char SHPAPI_CALL |
533 |
DBFGetNativeFieldType( DBFHandle hDBF, int iField ); |
DBFGetNativeFieldType( DBFHandle hDBF, int iField ); |
534 |
|
|
|
int SHPAPI_CALL |
|
|
DBFCommit( DBFHandle hDBF ); |
|
|
|
|
535 |
#ifdef __cplusplus |
#ifdef __cplusplus |
536 |
} |
} |
537 |
#endif |
#endif |