Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#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)

796.patch (720 bytes ) - added by dbaston 7 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 by strk, 7 years ago

Owner: changed from geos-devel@… to dbaston

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 !

by dbaston, 7 years ago

Attachment: 796.patch added

comment:2 by strk, 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 dbaston, 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 strk, 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 dbaston, 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

comment:6 by strk, 7 years ago

In 4303:

Fix GEOSSTRtree_nearest_r signature and add missing implementation

See #796

comment:7 by strk, 7 years ago

Resolution: fixed
Status: newclosed

In 4304:

Fix GEOSSTRtree_nearest_r signature and add missing implementation

Closes #796

comment:8 by Sandro Santilli <strk@…>, 7 years ago

In 3049fb8/git:

Fix GEOSSTRtree_nearest_r signature and add missing implementation

See #796

git-svn-id: http://svn.osgeo.org/geos/trunk@4303 5242fede-7e19-0410-aef8-94bd7d2200fb

comment:9 by Sandro Santilli <strk@…>, 7 years ago

In 3049fb8/git:

Fix GEOSSTRtree_nearest_r signature and add missing implementation

See #796

git-svn-id: http://svn.osgeo.org/geos/trunk@4303 5242fede-7e19-0410-aef8-94bd7d2200fb

comment:10 by Sandro Santilli <strk@…>, 7 years ago

In 3049fb8/git:

Fix GEOSSTRtree_nearest_r signature and add missing implementation

See #796

git-svn-id: http://svn.osgeo.org/geos/trunk@4303 5242fede-7e19-0410-aef8-94bd7d2200fb

Note: See TracTickets for help on using tickets.