PostGIS  3.4.0dev-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 263 of file lwgeom_geos_cluster.c.

264 {
265  cxt->num_items_found = 0;
266 
267  GEOSGeometry* query_envelope;
268 
269  LW_ON_INTERRUPT(return LW_FAILURE);
270 
271  if (geoms[p]->type == POINTTYPE)
272  {
273  const POINT2D* pt = getPoint2d_cp(lwgeom_as_lwpoint(geoms[p])->point, 0);
274  query_envelope = make_geos_segment( pt->x - eps, pt->y - eps, pt->x + eps, pt->y + eps );
275  } else {
276  const GBOX* box = lwgeom_get_bbox(geoms[p]);
277  query_envelope = make_geos_segment( box->xmin - eps, box->ymin - eps, box->xmax + eps, box->ymax + eps );
278  }
279 
280  if (!query_envelope)
281  return LW_FAILURE;
282 
283  GEOSSTRtree_query(tree, query_envelope, &query_accumulate, cxt);
284 
285  GEOSGeom_destroy(query_envelope);
286 
287  return LW_SUCCESS;
288 }
GEOSGeometry * make_geos_segment(double x1, double y1, double x2, double y2)
#define LW_FAILURE
Definition: liblwgeom.h:96
#define LW_SUCCESS
Definition: liblwgeom.h:97
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:102
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:743
#define LW_ON_INTERRUPT(x)
static void query_accumulate(void *item, void *userdata)
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
Definition: lwinline.h:101
static LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition: lwinline.h:131
type
Definition: ovdump.py:42
double ymax
Definition: liblwgeom.h:357
double xmax
Definition: liblwgeom.h:355
double ymin
Definition: liblwgeom.h:356
double xmin
Definition: liblwgeom.h:354
double y
Definition: liblwgeom.h:390
double x
Definition: liblwgeom.h:390
uint32_t num_items_found

References getPoint2d_cp(), LW_FAILURE, LW_ON_INTERRUPT, 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: