PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ test_tree_circ_create()

static void test_tree_circ_create ( void  )
static

Definition at line 24 of file cu_tree.c.

25 {
26  LWLINE *g;
27  CIRC_NODE *c;
28  /* Line with 4 edges */
29  g = lwgeom_as_lwline(lwgeom_from_wkt("LINESTRING(0 88,0 89,0 90,180 89,180 88)", LW_PARSER_CHECK_NONE));
30  c = circ_tree_new(g->points);
31  //circ_tree_print(c, 0);
32 
33  if ( CIRC_NODE_SIZE > 4 )
34  {
35  CU_ASSERT(c->num_nodes == 4);
36  }
37  else
38  {
39  CU_ASSERT(c->num_nodes == ( 4 % CIRC_NODE_SIZE ? 1 : 0 ) + 4 / CIRC_NODE_SIZE);
40  }
41 
42  circ_tree_free(c);
43  lwline_free(g);
44 }
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
Definition: lwgeom.c:170
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2005
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
void lwline_free(LWLINE *line)
Definition: lwline.c:76
CIRC_NODE * circ_tree_new(const POINTARRAY *pa)
Build a tree of nodes from a point array, one node per edge.
void circ_tree_free(CIRC_NODE *node)
Recurse from top of node tree and free all children.
#define CIRC_NODE_SIZE
POINTARRAY * points
Definition: liblwgeom.h:425
uint32_t num_nodes
Note that p1 and p2 are pointers into an independent POINTARRAY, do not free them.

References CIRC_NODE_SIZE, circ_tree_free(), circ_tree_new(), LW_PARSER_CHECK_NONE, lwgeom_as_lwline(), lwgeom_from_wkt(), lwline_free(), circ_node::num_nodes, and LWLINE::points.

Referenced by tree_suite_setup().

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