/[thuban]/branches/WIP-pyshapelib-bramz/libraries/shapelib/shapefil.h
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/libraries/shapelib/shapefil.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/thuban/libraries/shapelib/shapefil.h revision 1612 by jan, Tue Aug 19 21:29:25 2003 UTC branches/WIP-pyshapelib-bramz/libraries/shapelib/shapefil.h revision 2752 by bramz, Tue Apr 10 23:45:00 2007 UTC
# Line 6  Line 6 
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
# Line 37  Line 37 
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
# Line 117  Line 165 
165  #include <dbmalloc.h>  #include <dbmalloc.h>
166  #endif  #endif
167    
168    #ifdef USE_CPL
169    #include "cpl_error.h"
170    #endif
171    
172  #ifdef __cplusplus  #ifdef __cplusplus
173  extern "C" {  extern "C" {
174  #endif  #endif
175    
176  #ifndef SHPAPI_CALL  #if defined(_WIN32) || defined(_WIN64)
177  #define SHPAPI_CALL  #define SHPAPI_HAS_WIDE
178  #endif  #endif
179    
 #define SHPAPI_CALL1(x)      * SHPAPI_CALL  
       
180  /************************************************************************/  /************************************************************************/
181  /*                        Configuration options.                        */  /*                        Configuration options.                        */
182  /************************************************************************/  /************************************************************************/
# Line 144  extern "C" { Line 194  extern "C" {
194  /* -------------------------------------------------------------------- */  /* -------------------------------------------------------------------- */
195  #define DISABLE_MULTIPATCH_MEASURE  #define DISABLE_MULTIPATCH_MEASURE
196    
197    /* -------------------------------------------------------------------- */
198    /*      SHPAPI_CALL                                                     */
199    /*                                                                      */
200    /*      The following two macros are present to allow forcing           */
201    /*      various calling conventions on the Shapelib API.                */
202    /*                                                                      */
203    /*      To force __stdcall conventions (needed to call Shapelib         */
204    /*      from Visual Basic and/or Dephi I believe) the makefile could    */
205    /*      be modified to define:                                          */
206    /*                                                                      */
207    /*        /DSHPAPI_CALL=__stdcall                                       */
208    /*                                                                      */
209    /*      If it is desired to force export of the Shapelib API without    */
210    /*      using the shapelib.def file, use the following definition.      */
211    /*                                                                      */
212    /*        /DSHAPELIB_DLLEXPORT                                          */
213    /*                                                                      */
214    /*      To get both at once it will be necessary to hack this           */
215    /*      include file to define:                                         */
216    /*                                                                      */
217    /*        #define SHPAPI_CALL __declspec(dllexport) __stdcall           */
218    /*        #define SHPAPI_CALL1 __declspec(dllexport) * __stdcall        */
219    /*                                                                      */
220    /*      The complexity of the situtation is partly caused by the        */
221    /*      peculiar requirement of Visual C++ that __stdcall appear        */
222    /*      after any "*"'s in the return value of a function while the     */
223    /*      __declspec(dllexport) must appear before them.                  */
224    /* -------------------------------------------------------------------- */
225    
226    #ifdef SHAPELIB_DLLEXPORT
227    #  define SHPAPI_CALL __declspec(dllexport)
228    #  define SHPAPI_CALL1(x)  __declspec(dllexport) x
229    #endif
230    
231    #ifndef SHPAPI_CALL
232    #  define SHPAPI_CALL
233    #endif
234    
235    #ifndef SHPAPI_CALL1
236    #  define SHPAPI_CALL1(x)      x SHPAPI_CALL
237    #endif
238        
239  /************************************************************************/  /************************************************************************/
240  /*                             SHP Support.                             */  /*                             SHP Support.                             */
241  /************************************************************************/  /************************************************************************/
# Line 165  typedef        struct Line 257  typedef        struct
257      double      adBoundsMax[4];      double      adBoundsMax[4];
258    
259      int         bUpdated;      int         bUpdated;
260    
261        unsigned char *pabyRec;
262        int         nBufSize;
263  } SHPInfo;  } SHPInfo;
264    
265  typedef SHPInfo * SHPHandle;  typedef SHPInfo * SHPHandle;
# Line 238  SHPHandle SHPAPI_CALL Line 333  SHPHandle SHPAPI_CALL
333        SHPOpen( const char * pszShapeFile, const char * pszAccess );        SHPOpen( const char * pszShapeFile, const char * pszAccess );
334  SHPHandle SHPAPI_CALL  SHPHandle SHPAPI_CALL
335        SHPCreate( const char * pszShapeFile, int nShapeType );        SHPCreate( const char * pszShapeFile, int nShapeType );
336    #ifdef SHPAPI_HAS_WIDE
337    SHPHandle SHPAPI_CALL
338          SHPOpenW( const wchar_t * pszShapeFile, const wchar_t * pszAccess );
339    SHPHandle SHPAPI_CALL
340          SHPCreateW( const wchar_t * pszShapeFile, int nShapeType );
341    #endif
342    SHPHandle SHPAPI_CALL
343          SHPOpenEx( FILE * pfSHP, FILE * pfSHX );
344    void SHPAPI_CALL
345          SHPCreateEx( FILE * pfSHP, FILE * pfSHX, int nShapeType );
346    
347  void SHPAPI_CALL  void SHPAPI_CALL
348        SHPGetInfo( SHPHandle hSHP, int * pnEntities, int * pnShapeType,        SHPGetInfo( SHPHandle hSHP, int * pnEntities, int * pnShapeType,
349                    double * padfMinBound, double * padfMaxBound );                    double * padfMinBound, double * padfMaxBound );
# Line 260  SHPObject SHPAPI_CALL1(*) Line 366  SHPObject SHPAPI_CALL1(*)
366        SHPCreateSimpleObject( int nSHPType, int nVertices,        SHPCreateSimpleObject( int nSHPType, int nVertices,
367                               double * padfX, double * padfY, double * padfZ );                               double * padfX, double * padfY, double * padfZ );
368    
369  void SHPAPI_CALL  int SHPAPI_CALL
370        SHPClose( SHPHandle hSHP );        SHPRewindObject( SHPHandle hSHP, SHPObject * psObject );
371    
372    void SHPAPI_CALL SHPClose( SHPHandle hSHP );
373    void SHPAPI_CALL SHPWriteHeader( SHPHandle hSHP );
374    
375  const char SHPAPI_CALL1(*)  const char SHPAPI_CALL1(*)
376        SHPTypeName( int nSHPType );        SHPTypeName( int nSHPType );
# Line 312  int    SHPAPI_CALL Line 421  int    SHPAPI_CALL
421        SHPWriteTree( SHPTree *hTree, const char * pszFilename );        SHPWriteTree( SHPTree *hTree, const char * pszFilename );
422  SHPTree SHPAPI_CALL  SHPTree SHPAPI_CALL
423        SHPReadTree( const char * pszFilename );        SHPReadTree( const char * pszFilename );
424    #ifdef SHPAPI_HAS_WIDE
425    int     SHPAPI_CALL
426          SHPWriteTreeW( SHPTree *hTree, const wchar_t * pszFilename );
427    SHPTree SHPAPI_CALL
428          SHPReadTreeW( const wchar_t * pszFilename );
429    #endif
430    
431  int     SHPAPI_CALL  int     SHPAPI_CALL
432        SHPTreeAddObject( SHPTree * hTree, SHPObject * psObject );        SHPTreeAddObject( SHPTree * hTree, SHPObject * psObject );
# Line 356  typedef        struct Line 471  typedef        struct
471            
472      int         bNoHeader;      int         bNoHeader;
473      int         bUpdated;      int         bUpdated;
474            int             nLanguageDriver;
475  } DBFInfo;  } DBFInfo;
476    
477  typedef DBFInfo * DBFHandle;  typedef DBFInfo * DBFHandle;
# Line 364  typedef enum { Line 480  typedef enum {
480    FTString,    FTString,
481    FTInteger,    FTInteger,
482    FTDouble,    FTDouble,
483      FTLogical,
484    FTInvalid    FTInvalid
485  } DBFFieldType;  } DBFFieldType;
486    
487  #define XBASE_FLDHDR_SZ       32  #define XBASE_FLDHDR_SZ       32
488    
489    /* to hand over a locale agnostic atof function, if decimal_point != ".\0" */
490    void SHPAPI_CALL
491            DBFSetatof_function(  double (* new_atof_function)(const char *nptr));
492    
493  DBFHandle SHPAPI_CALL  DBFHandle SHPAPI_CALL
494        DBFOpen( const char * pszDBFFile, const char * pszAccess );        DBFOpen( const char * pszDBFFile, const char * pszAccess );
495  DBFHandle SHPAPI_CALL  DBFHandle SHPAPI_CALL
496        DBFCreate( const char * pszDBFFile );        DBFCreate( const char * pszDBFFile );
497    #ifdef SHPAPI_HAS_WIDE
498    DBFHandle SHPAPI_CALL
499          DBFOpenW( const wchar_t * pszDBFFile, const wchar_t * pszAccess );
500    DBFHandle SHPAPI_CALL
501          DBFCreateW( const wchar_t * pszDBFFile );
502    #endif
503    DBFHandle SHPAPI_CALL
504          DBFOpenEx( FILE* pf );
505    DBFHandle SHPAPI_CALL
506          DBFCreateEx( FILE* pf );
507    
508  int     SHPAPI_CALL  int     SHPAPI_CALL
509        DBFGetFieldCount( DBFHandle psDBF );        DBFGetFieldCount( DBFHandle psDBF );
# Line 395  double         SHPAPI_CALL Line 526  double         SHPAPI_CALL
526        DBFReadDoubleAttribute( DBFHandle hDBF, int iShape, int iField );        DBFReadDoubleAttribute( DBFHandle hDBF, int iShape, int iField );
527  const char SHPAPI_CALL1(*)  const char SHPAPI_CALL1(*)
528        DBFReadStringAttribute( DBFHandle hDBF, int iShape, int iField );        DBFReadStringAttribute( DBFHandle hDBF, int iShape, int iField );
529    const char SHPAPI_CALL1(*)
530          DBFReadLogicalAttribute( DBFHandle hDBF, int iShape, int iField );
531  int     SHPAPI_CALL  int     SHPAPI_CALL
532        DBFIsAttributeNULL( DBFHandle hDBF, int iShape, int iField );        DBFIsAttributeNULL( DBFHandle hDBF, int iShape, int iField );
533    
# Line 410  int SHPAPI_CALL Line 543  int SHPAPI_CALL
543  int SHPAPI_CALL  int SHPAPI_CALL
544       DBFWriteNULLAttribute( DBFHandle hDBF, int iShape, int iField );       DBFWriteNULLAttribute( DBFHandle hDBF, int iShape, int iField );
545    
546    int SHPAPI_CALL
547         DBFWriteLogicalAttribute( DBFHandle hDBF, int iShape, int iField,
548                                   const char lFieldValue);
549    int SHPAPI_CALL
550         DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField,
551                                   void * pValue );
552  const char SHPAPI_CALL1(*)  const char SHPAPI_CALL1(*)
553        DBFReadTuple(DBFHandle psDBF, int hEntity );        DBFReadTuple(DBFHandle psDBF, int hEntity );
554  int SHPAPI_CALL  int SHPAPI_CALL
# Line 417  int SHPAPI_CALL Line 556  int SHPAPI_CALL
556    
557  DBFHandle SHPAPI_CALL  DBFHandle SHPAPI_CALL
558        DBFCloneEmpty(DBFHandle psDBF, const char * pszFilename );        DBFCloneEmpty(DBFHandle psDBF, const char * pszFilename );
559    #ifdef DBFAPI_HAS_WIDE
560    DBFHandle SHPAPI_CALL
561          DBFCloneEmptyW(DBFHandle psDBF, const wchar_t * pszFilename );
562    #endif
563    void SHPAPI_CALL
564          DBFCloneEmptyEx(DBFHandle psDBF, DBFHandle newDBF );
565    
566  void    SHPAPI_CALL  void    SHPAPI_CALL
567        DBFClose( DBFHandle hDBF );        DBFClose( DBFHandle hDBF );
568    void    SHPAPI_CALL
569          DBFUpdateHeader( DBFHandle hDBF );
570  char    SHPAPI_CALL  char    SHPAPI_CALL
571        DBFGetNativeFieldType( DBFHandle hDBF, int iField );        DBFGetNativeFieldType( DBFHandle hDBF, int iField );
572    
 int SHPAPI_CALL  
       DBFCommit( DBFHandle hDBF );  
   
573  #ifdef __cplusplus  #ifdef __cplusplus
574  }  }
575  #endif  #endif

Legend:
Removed from v.1612  
changed lines
  Added in v.2752

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26