PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ dbscan_update_context()

static int dbscan_update_context ( GEOSSTRtree *  tree,
struct QueryContext cxt,
LWGEOM **  geoms,
uint32_t  p,
double  eps 
)
static

Definition at line 264 of file lwgeom_geos_cluster.c.

265 {
266  cxt->num_items_found = 0;
267 
268  GEOSGeometry* query_envelope;
269  if (geoms[p]->type == POINTTYPE)
270  {
271  const POINT2D* pt = getPoint2d_cp(lwgeom_as_lwpoint(geoms[p])->point, 0);
272  query_envelope = make_geos_segment( pt->x - eps, pt->y - eps, pt->x + eps, pt->y + eps );
273  } else {
274  const GBOX* box = lwgeom_get_bbox(geoms[p]);
275  query_envelope = make_geos_segment( box->xmin - eps, box->ymin - eps, box->xmax + eps, box->ymax + eps );
276  }
277 
278  if (!query_envelope)
279  return LW_FAILURE;
280 
281  GEOSSTRtree_query(tree, query_envelope, &query_accumulate, cxt);
282 
283  GEOSGeom_destroy(query_envelope);
284 
285  return LW_SUCCESS;
286 }
GEOSGeometry * make_geos_segment(double x1, double y1, double x2, double y2)
#define LW_FAILURE
Definition: liblwgeom.h:79
#define LW_SUCCESS
Definition: liblwgeom.h:80
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition: lwgeom.c:161
const GBOX * lwgeom_get_bbox(const LWGEOM *lwgeom)
Get a non-empty geometry bounding box, computing and caching it if not already there.
Definition: lwgeom.c:734
const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
Definition: lwgeom_api.c:374
static void query_accumulate(void *item, void *userdata)
type
Definition: ovdump.py:41
double ymax
Definition: liblwgeom.h:298
double xmax
Definition: liblwgeom.h:296
double ymin
Definition: liblwgeom.h:297
double xmin
Definition: liblwgeom.h:295
double y
Definition: liblwgeom.h:331
double x
Definition: liblwgeom.h:331
uint32_t num_items_found

References getPoint2d_cp(), LW_FAILURE, LW_SUCCESS, lwgeom_as_lwpoint(), lwgeom_get_bbox(), make_geos_segment(), QueryContext::num_items_found, POINTTYPE, query_accumulate(), ovdump::type, POINT2D::x, GBOX::xmax, GBOX::xmin, POINT2D::y, GBOX::ymax, and GBOX::ymin.

Referenced by union_dbscan_general(), and union_dbscan_minpoints_1().

Here is the call graph for this function:
Here is the caller graph for this function: