PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ test_tree_circ_create()

static void test_tree_circ_create ( void  )
static

Definition at line 25 of file cu_tree.c.

26{
27 LWLINE *g;
28 CIRC_NODE *c;
29 /* Line with 4 edges */
30 g = lwgeom_as_lwline(lwgeom_from_wkt("LINESTRING(0 88,0 89,0 90,180 89,180 88)", LW_PARSER_CHECK_NONE));
31 c = circ_tree_new(g->points);
32 //circ_tree_print(c, 0);
33
34 if ( CIRC_NODE_SIZE > 4 )
35 {
36 CU_ASSERT(c->num_nodes == 4);
37 }
38 else
39 {
40 CU_ASSERT(c->num_nodes == ( 4 % CIRC_NODE_SIZE ? 1 : 0 ) + 4 / CIRC_NODE_SIZE);
41 }
42
44 lwline_free(g);
45}
#define LW_PARSER_CHECK_NONE
Definition liblwgeom.h:2149
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
Definition lwgeom.c:207
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition lwin_wkt.c:940
void lwline_free(LWLINE *line)
Definition lwline.c:67
void circ_tree_free(CIRC_NODE *node)
Recurse from top of node tree and free all children.
CIRC_NODE * circ_tree_new(const POINTARRAY *pa)
Build a tree of nodes from a point array, one node per edge.
#define CIRC_NODE_SIZE
POINTARRAY * points
Definition liblwgeom.h:483
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: