PostGIS  2.4.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 260 of file lwgeom_geos_cluster.c.

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().

261 {
262  cxt->num_items_found = 0;
263 
264  GEOSGeometry* query_envelope;
265  if (geoms[p]->type == POINTTYPE)
266  {
267  const POINT2D* pt = getPoint2d_cp(lwgeom_as_lwpoint(geoms[p])->point, 0);
268  query_envelope = make_geos_segment( pt->x - eps, pt->y - eps, pt->x + eps, pt->y + eps );
269  } else {
270  const GBOX* box = lwgeom_get_bbox(geoms[p]);
271  query_envelope = make_geos_segment( box->xmin - eps, box->ymin - eps, box->xmax + eps, box->ymax + eps );
272  }
273 
274  if (!query_envelope)
275  return LW_FAILURE;
276 
277  GEOSSTRtree_query(tree, query_envelope, &query_accumulate, cxt);
278 
279  GEOSGeom_destroy(query_envelope);
280 
281  return LW_SUCCESS;
282 }
uint32_t num_items_found
GEOSGeometry * make_geos_segment(double x1, double y1, double x2, double y2)
static void query_accumulate(void *item, void *userdata)
double xmax
Definition: liblwgeom.h:293
#define LW_SUCCESS
Definition: liblwgeom.h:80
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition: lwgeom.c:129
#define LW_FAILURE
Definition: liblwgeom.h:79
double x
Definition: liblwgeom.h:328
double ymin
Definition: liblwgeom.h:294
double xmin
Definition: liblwgeom.h:292
const POINT2D * getPoint2d_cp(const POINTARRAY *pa, int n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from...
Definition: lwgeom_api.c:373
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:689
double ymax
Definition: liblwgeom.h:295
double y
Definition: liblwgeom.h:328
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
type
Definition: ovdump.py:41
Here is the call graph for this function:
Here is the caller graph for this function: