PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ 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:110
#define LW_SUCCESS
Definition liblwgeom.h:111
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:116
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:725
static void query_accumulate(void *item, void *userdata)
static LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition lwinline.h:121
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:91
double ymax
Definition liblwgeom.h:343
double xmax
Definition liblwgeom.h:341
double ymin
Definition liblwgeom.h:342
double xmin
Definition liblwgeom.h:340
double y
Definition liblwgeom.h:376
double x
Definition liblwgeom.h:376

References getPoint2d_cp(), LW_FAILURE, LW_SUCCESS, lwgeom_as_lwpoint(), lwgeom_get_bbox(), make_geos_segment(), QueryContext::num_items_found, POINTTYPE, query_accumulate(), 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: