]> granicus.if.org Git - postgis/commitdiff
Allow passing NULL box to getEdgeWithinBox2D
authorSandro Santilli <strk@kbt.io>
Fri, 18 Nov 2016 11:22:27 +0000 (11:22 +0000)
committerSandro Santilli <strk@kbt.io>
Fri, 18 Nov 2016 11:22:27 +0000 (11:22 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@15236 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/liblwgeom_topo.h
topology/postgis_topology.c

index 8bcc9d1672a40f0bd98d43dcf88fbc5d6757d796..183af5b0f29a91ee32b342ef1f815c55e2b8b1c9 100644 (file)
@@ -457,7 +457,7 @@ typedef struct LWT_BE_CALLBACKS_T {
    * Get edges whose bounding box overlaps a given 2D bounding box
    *
    * @param topo the topology to act upon
-   * @param box the query box
+   * @param box the query box, to be considered infinite if NULL
    * @param numelems output parameter, gets number of elements found
    *                 if the return is not null, otherwise see @return
    *                 section for semantic.
index c7e88943375f2af8692fdefbe2dd25022e479913..8e628c8935881355a7b8fc9c621976eac1e1bc78 100644 (file)
@@ -2736,10 +2736,14 @@ cb_getEdgeWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box,
     appendStringInfoString(sql, "SELECT ");
     addEdgeFields(sql, fields, 0);
   }
-  hexbox = _box2d_to_hexwkb(box, topo->srid);
-  appendStringInfo(sql, " FROM \"%s\".edge WHERE geom && '%s'::geometry",
-                        topo->name, hexbox);
-  lwfree(hexbox);
+  appendStringInfo(sql, " FROM \"%s\".edge", topo->name, hexbox);
+
+  if ( box ) {
+    hexbox = _box2d_to_hexwkb(box, topo->srid);
+    appendStringInfo(sql, " WHERE geom && '%s'::geometry", hexbox);
+    lwfree(hexbox);
+  }
+
   if ( elems_requested == -1 ) {
     appendStringInfoString(sql, ")");
   } else if ( elems_requested > 0 ) {