#796 closed defect (fixed)
GEOSSTRtree_nearest_r implementation missing from CAPI
Reported by: | darkpanda | Owned by: | dbaston |
---|---|---|---|
Priority: | major | Milestone: | 3.6.1 |
Component: | Default | Version: | 3.6.0 |
Severity: | Unassigned | Keywords: | |
Cc: |
Description
It looks like the implementation for GEOSSTRtree_nearest_r is missing from the CAPI. The declaration exists in geos_c.h.in but there's no matching implementation.
Attachments (1)
Change History (11)
comment:1 by , 7 years ago
Owner: | changed from | to
---|
by , 7 years ago
comment:2 by , 7 years ago
Dane, please also implement GEOSSTRtree_nearest as a wrapper, for consistency and testsuite coverage (just realized that all re-entrant functions are already tested as a consequence of all non-reentrant ones being wrappers to the former)
comment:3 by , 7 years ago
It already is a wrapper:
const GEOSGeometry * GEOSSTRtree_nearest (geos::index::strtree::STRtree *tree, const geos::geom::Geometry *g) { return (const GEOSGeometry*) GEOSSTRtree_nearest_generic( tree, g, g, NULL, NULL); }
comment:4 by , 7 years ago
Must be a wrapper to the corresponding re-entrant interface, or it would never be tested. I tried locally and revealed a signature mismatch:
geos_c.cpp:1183:33: error: invalid conversion from ‘const void*’ to ‘const geos::geom::Geometry*’ [-fpermissive] return GEOSSTRtree_nearest_r( handle, tree, g); ^
This is because the re-entrant intarface reads:
extern const void GEOS_DLL *GEOSSTRtree_nearest_r(GEOSContextHandle_t handle, GEOSSTRtree *tree, const GEOSGeometry* geom);
While the non-reentrant:
extern const GEOSGeometry GEOS_DLL *GEOSSTRtree_nearest(GEOSSTRtree *tree, const GEOSGeometry* geom)
See the return type is different (void vs Geometry).
comment:5 by , 7 years ago
Correct return type for GEOSSTRtree_nearest_r is Geometry*. Looks like the header is incorrect.
Feel free to make GEOSSTRtree_nearest wrap GEOSSTRtree_nearest_r instead of wrapping GEOSSTRtree_nearest_generic
The function was added via https://github.com/libgeos/libgeos/pull/61 as per #768 Daniel: can you take a look at this ?
BTW: we really need to put the reentrant API under unit testing !