PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ circ_node_leaf_point_new()

static CIRC_NODE* circ_node_leaf_point_new ( const POINTARRAY pa)
static

Return a point node (zero radius, referencing one point)

Definition at line 123 of file lwgeodetic_tree.c.

References circ_node::center, circ_node::edge_num, geographic_point_init(), circ_node::geom_type, getPoint_internal(), lwalloc(), circ_node::nodes, circ_node::num_nodes, circ_node::p1, circ_node::p2, POINTTYPE, circ_node::pt_outside, circ_node::radius, POINT2D::x, and POINT2D::y.

Referenced by circ_tree_new().

124 {
125  CIRC_NODE* tree = lwalloc(sizeof(CIRC_NODE));
126  tree->p1 = tree->p2 = (POINT2D*)getPoint_internal(pa, 0);
127  geographic_point_init(tree->p1->x, tree->p1->y, &(tree->center));
128  tree->radius = 0.0;
129  tree->nodes = NULL;
130  tree->num_nodes = 0;
131  tree->edge_num = 0;
132  tree->geom_type = POINTTYPE;
133  tree->pt_outside.x = 0.0;
134  tree->pt_outside.y = 0.0;
135  return tree;
136 }
Note that p1 and p2 are pointers into an independent POINTARRAY, do not free them.
GEOGRAPHIC_POINT center
uint32_t num_nodes
uint32_t geom_type
POINT2D * p2
POINT2D * p1
double x
Definition: liblwgeom.h:330
double y
Definition: liblwgeom.h:330
uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: ptarray.c:1750
void geographic_point_init(double lon, double lat, GEOGRAPHIC_POINT *g)
Initialize a geographic point.
Definition: lwgeodetic.c:171
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
POINT2D pt_outside
double radius
void * lwalloc(size_t size)
Definition: lwutil.c:229
struct circ_node ** nodes
Here is the call graph for this function:
Here is the caller graph for this function: