PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ CircTreeBuilder()

static int CircTreeBuilder ( const LWGEOM lwgeom,
GeomCache *  cache 
)
static

Builder, freeer and public accessor for cached CIRC_NODE trees.

Definition at line 27 of file geography_measurement_trees.c.

References circ_tree_free(), CircTreeGeomCache::index, LW_FAILURE, LW_SUCCESS, and lwgeom_calculate_circ_tree().

28 {
29  CircTreeGeomCache* circ_cache = (CircTreeGeomCache*)cache;
30  CIRC_NODE* tree = lwgeom_calculate_circ_tree(lwgeom);
31 
32  if ( circ_cache->index )
33  {
34  circ_tree_free(circ_cache->index);
35  circ_cache->index = 0;
36  }
37  if ( ! tree )
38  return LW_FAILURE;
39 
40  circ_cache->index = tree;
41  return LW_SUCCESS;
42 }
Note that p1 and p2 are pointers into an independent POINTARRAY, do not free them.
#define LW_SUCCESS
Definition: liblwgeom.h:65
CIRC_NODE * lwgeom_calculate_circ_tree(const LWGEOM *lwgeom)
#define LW_FAILURE
Definition: liblwgeom.h:64
void circ_tree_free(CIRC_NODE *node)
Recurse from top of node tree and free all children.
Here is the call graph for this function: