PostGIS  2.4.9dev-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 51 of file geography_measurement_trees.c.

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

52 {
53  CircTreeGeomCache* circ_cache = (CircTreeGeomCache*)cache;
54  CIRC_NODE* tree = lwgeom_calculate_circ_tree(lwgeom);
55 
56  if ( circ_cache->index )
57  {
58  circ_tree_free(circ_cache->index);
59  circ_cache->index = 0;
60  }
61  if ( ! tree )
62  return LW_FAILURE;
63 
64  circ_cache->index = tree;
65  return LW_SUCCESS;
66 }
Note that p1 and p2 are pointers into an independent POINTARRAY, do not free them.
#define LW_SUCCESS
Definition: liblwgeom.h:80
CIRC_NODE * lwgeom_calculate_circ_tree(const LWGEOM *lwgeom)
#define LW_FAILURE
Definition: liblwgeom.h:79
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: