PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ test_lwline_split_by_point_to()

static void test_lwline_split_by_point_to ( void  )
static

Definition at line 19 of file cu_split.c.

References cu_error_msg_reset(), LW_PARSER_CHECK_NONE, lwcollection_free(), lwgeom_as_lwline(), lwgeom_as_lwpoint(), lwgeom_from_wkt(), lwline_free(), lwline_split_by_point_to(), lwmline_construct_empty(), lwpoint_free(), LWMLINE::ngeoms, and SRID_UNKNOWN.

Referenced by split_suite_setup().

20 {
21 #if POSTGIS_GEOS_VERSION >= 33
22  LWLINE *line;
23  LWPOINT *point;
24  LWMLINE *coll;
25  int ret;
26 
27  /* Because i don't trust that much prior tests... ;) */
29 
31  CU_ASSERT_EQUAL(coll->ngeoms, 0);
32 
33  line = lwgeom_as_lwline(lwgeom_from_wkt("LINESTRING(0 0,5 5, 10 0)",
35  CU_ASSERT(line != NULL);
36 
38  "POINT(0 0)",
40  ret = lwline_split_by_point_to(line, point, coll);
41  CU_ASSERT_EQUAL(ret, 1);
42  CU_ASSERT_EQUAL(coll->ngeoms, 0);
43  lwpoint_free(point);
44 
46  "POINT(10 0)",
48  ret = lwline_split_by_point_to(line, point, coll);
49  CU_ASSERT_EQUAL(ret, 1);
50  CU_ASSERT_EQUAL(coll->ngeoms, 0);
51  lwpoint_free(point);
52 
54  "POINT(5 0)",
56  ret = lwline_split_by_point_to(line, point, coll);
57  CU_ASSERT_EQUAL(ret, 0);
58  CU_ASSERT_EQUAL(coll->ngeoms, 0);
59  lwpoint_free(point);
60 
62  "POINT(5 5)",
64  ret = lwline_split_by_point_to(line, point, coll);
65  CU_ASSERT_EQUAL(ret, 2);
66  CU_ASSERT_EQUAL(coll->ngeoms, 2);
67  lwpoint_free(point);
68 
70  "POINT(2 2)",
72  ret = lwline_split_by_point_to(line, point, coll);
73  CU_ASSERT_EQUAL(ret, 2);
74  CU_ASSERT_EQUAL(coll->ngeoms, 4);
75  lwpoint_free(point);
76 
78  lwline_free(line);
79 
80 #endif /* POSTGIS_GEOS_VERSION >= 33 */
81 }
void lwpoint_free(LWPOINT *pt)
Definition: lwpoint.c:182
void lwline_free(LWLINE *line)
Definition: lwline.c:63
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:890
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition: lwgeom.c:80
LWMLINE * lwmline_construct_empty(int srid, char hasz, char hasm)
Definition: lwmline.c:24
int ngeoms
Definition: liblwgeom.h:465
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1869
void cu_error_msg_reset()
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:172
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
Definition: lwgeom.c:89
void lwcollection_free(LWCOLLECTION *col)
Definition: lwcollection.c:326
int lwline_split_by_point_to(const LWLINE *ln, const LWPOINT *pt, LWMLINE *to)
Split a line by a point and push components to the provided multiline.
Here is the call graph for this function:
Here is the caller graph for this function: