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

Contents of /branches/WIP-pyshapelib-bramz/libraries/pyshapelib/pyshapelib_api.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2735 - (show annotations)
Mon Mar 12 23:24:35 2007 UTC (17 years, 11 months ago) by bramz
File MIME type: text/plain
File size: 1317 byte(s)
rewritten shapelib to use hand-crafted Python bindings instead of SWIG generated ones.
1 /* Header file for the PyShapelib API for other Python modules */
2 /* $Revision$ */
3
4 #ifndef PYSHAPELIB_API_H
5 #define PYSHAPELIB_API_H
6
7 typedef struct {
8 /* Shapefile functions */
9 SHPObject * (*SHPReadObject)(SHPHandle hSHP, int iShape);
10 void (*SHPDestroyObject)(SHPObject * psObject);
11
12 /* SHPTree functions */
13 SHPTree * (*SHPCreateTree)(SHPHandle hSHP, int nDimension, int nMaxDepth,
14 double *padfBoundsMin, double *padfBoundsMax);
15 void (*SHPDestroyTree)(SHPTree * hTree);
16 int * (*SHPTreeFindLikelyShapes)(SHPTree * hTree, double * padfBoundsMin,
17 double * padfBoundsMax, int *);
18 } PyShapeLibAPI;
19
20
21 /* Macro to import the shapelib module, extract the API pointer and
22 * assign it to the variable given as argument */
23 #define PYSHAPELIB_IMPORT_API(apivariable) \
24 { \
25 PyObject * shapelib = PyImport_ImportModule("shapelib"); \
26 if (shapelib) \
27 { \
28 PyObject * c_api_func = PyObject_GetAttrString(shapelib, "c_api"); \
29 if (c_api_func) \
30 { \
31 PyObject * cobj = PyObject_CallObject(c_api_func, NULL); \
32 if (cobj) \
33 { \
34 (apivariable) = (PyShapeLibAPI*)PyCObject_AsVoidPtr(cobj); \
35 } \
36 } \
37 } \
38 }
39
40
41 #endif /* PYSHAPELIB_API_H */

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26