Menu

[r5472]: / trunk / toolkits / basemap / pyshapelib / pyshapelib_api.h  Maximize  Restore  History

Download this file

42 lines (34 with data), 1.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* Header file for the PyShapelib API for other Python modules */
/* $Revision$ */
#ifndef PYSHAPELIB_API_H
#define PYSHAPELIB_API_H
typedef struct {
/* Shapefile functions */
SHPObject * (*SHPReadObject)(SHPHandle hSHP, int iShape);
void (*SHPDestroyObject)(SHPObject * psObject);
/* SHPTree functions */
SHPTree * (*SHPCreateTree)(SHPHandle hSHP, int nDimension, int nMaxDepth,
double *padfBoundsMin, double *padfBoundsMax);
void (*SHPDestroyTree)(SHPTree * hTree);
int * (*SHPTreeFindLikelyShapes)(SHPTree * hTree, double * padfBoundsMin,
double * padfBoundsMax, int *);
} PyShapeLibAPI;
/* Macro to import the shapelib module, extract the API pointer and
* assign it to the variable given as argument */
#define PYSHAPELIB_IMPORT_API(apivariable) \
{ \
PyObject * shapelib = PyImport_ImportModule("shapelibc"); \
if (shapelib) \
{ \
PyObject * c_api_func = PyObject_GetAttrString(shapelib, "c_api"); \
if (c_api_func) \
{ \
PyObject * cobj = PyObject_CallObject(c_api_func, NULL); \
if (cobj) \
{ \
(apivariable) = (PyShapeLibAPI*)PyCObject_AsVoidPtr(cobj); \
} \
} \
} \
}
#endif /* PYSHAPELIB_API_H */
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.