1 /* 2 ** 2010 August 30 3 ** 4 ** The author disclaims copyright to this source code. In place of 5 ** a legal notice, here is a blessing: 6 ** 7 ** May you do good and not evil. 8 ** May you find forgiveness for yourself and forgive others. 9 ** May you share freely, never taking more than you give. 10 ** 11 ************************************************************************* 12 */ 13 14 #ifndef _SQLITE3RTREE_H_ 15 #define _SQLITE3RTREE_H_ 16 17 #include <sqlite3.h> 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry; 24 25 /* 26 ** Register a geometry callback named zGeom that can be used as part of an 27 ** R-Tree geometry query as follows: 28 ** 29 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...) 30 */ 31 int sqlite3_rtree_geometry_callback( 32 sqlite3 *db, 33 const char *zGeom, 34 int (*xGeom)(sqlite3_rtree_geometry *, int nCoord, double *aCoord, int *pRes), 35 void *pContext 36 ); 37 38 39 /* 40 ** A pointer to a structure of the following type is passed as the first 41 ** argument to callbacks registered using rtree_geometry_callback(). 42 */ 43 struct sqlite3_rtree_geometry { 44 void *pContext; /* Copy of pContext passed to s_r_g_c() */ 45 int nParam; /* Size of array aParam[] */ 46 double *aParam; /* Parameters passed to SQL geom function */ 47 void *pUser; /* Callback implementation user data */ 48 void (*xDelUser)(void *); /* Called by SQLite to clean up pUser */ 49 }; 50 51 52 #ifdef __cplusplus 53 } /* end of the 'extern "C"' block */ 54 #endif 55 56 #endif /* ifndef _SQLITE3RTREE_H_ */ 57