PostGIS  3.3.9dev-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 
270  LW_ON_INTERRUPT(return LW_FAILURE);
271 
272  if (geoms[p]->type == POINTTYPE)
273  {
274  const POINT2D* pt = getPoint2d_cp(lwgeom_as_lwpoint(geoms[p])->point, 0);
275  query_envelope = make_geos_segment( pt->x - eps, pt->y - eps, pt->x + eps, pt->y + eps );
276  } else {
277  const GBOX* box = lwgeom_get_bbox(geoms[p]);
278  query_envelope = make_geos_segment( box->xmin - eps, box->ymin - eps, box->xmax + eps, box->ymax + eps );
279  }
280 
281  if (!query_envelope)
282  return LW_FAILURE;
283 
284  GEOSSTRtree_query(tree, query_envelope, &query_accumulate, cxt);
285 
286  GEOSGeom_destroy(query_envelope);
287 
288  return LW_SUCCESS;
289 }
GEOSGeometry * make_geos_segment(double x1, double y1, double x2, double y2)
#define LW_FAILURE
Definition: liblwgeom.h:111
#define LW_SUCCESS
Definition: liblwgeom.h:112
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:117
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:372
double xmax
Definition: liblwgeom.h:370
double ymin
Definition: liblwgeom.h:371
double xmin
Definition: liblwgeom.h:369
double y
Definition: liblwgeom.h:405
double x
Definition: liblwgeom.h:405
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: