PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ rect_tree_contains_point()

int rect_tree_contains_point ( RECT_NODE node,
const POINT2D pt 
)

Definition at line 398 of file lwtree.c.

399 {
400  int i, c;
401 
402  /* Object cannot contain point if bounds don't */
403  if (!rect_node_bounds_point(node, pt))
404  return 0;
405 
406  switch (node->geom_type)
407  {
408  case POLYGONTYPE:
409  case CURVEPOLYTYPE:
410  return rect_tree_area_contains_point(node, pt) > 0;
411 
412  case MULTIPOLYGONTYPE:
413  case MULTISURFACETYPE:
414  case COLLECTIONTYPE:
415  {
416  for (i = 0; i < node->i.num_nodes; i++)
417  {
418  c = rect_tree_contains_point(node->i.nodes[i], pt);
419  if (c) return LW_TRUE;
420  }
421  return LW_FALSE;
422  }
423 
424  default:
425  return LW_FALSE;
426  }
427 }
#define LW_FALSE
Definition: liblwgeom.h:77
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define MULTISURFACETYPE
Definition: liblwgeom.h:96
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
int rect_tree_contains_point(RECT_NODE *node, const POINT2D *pt)
Definition: lwtree.c:398
static int rect_tree_area_contains_point(RECT_NODE *node, const POINT2D *pt)
Definition: lwtree.c:344
static int rect_node_bounds_point(RECT_NODE *node, const POINT2D *pt)
Definition: lwtree.c:384
struct rect_node * nodes[RECT_NODE_SIZE]
Definition: lwtree.h:61
RECT_NODE_INTERNAL i
Definition: lwtree.h:75
unsigned char geom_type
Definition: lwtree.h:68

References COLLECTIONTYPE, CURVEPOLYTYPE, rect_node::geom_type, rect_node::i, LW_FALSE, LW_TRUE, MULTIPOLYGONTYPE, MULTISURFACETYPE, RECT_NODE_INTERNAL::nodes, RECT_NODE_INTERNAL::num_nodes, POLYGONTYPE, rect_node_bounds_point(), and rect_tree_area_contains_point().

Referenced by rect_tree_distance_tree(), rect_tree_intersects_tree(), and tree_pt().

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