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

◆ test_modification()

static void test_modification ( void  )
static

Definition at line 108 of file cu_iterator.c.

109{
110 uint32_t i;
111 uint32_t j = 0;
112
113 for (i = 0; i < sizeof(inputs)/sizeof(char*); i++)
114 {
118
119 while (lwpointiterator_has_next(it1))
120 {
121 /* Make up a coordinate, assign it to the next spot in it1,
122 * read it from it2 to verify that it was assigned correctly. */
123 POINT4D p1, p2;
124 p1.x = sqrt(j++);
125 p1.y = sqrt(j++);
126 p1.z = sqrt(j++);
127 p1.m = sqrt(j++);
128
129 CU_ASSERT_TRUE(lwpointiterator_modify_next(it1, &p1));
130 CU_ASSERT_TRUE(lwpointiterator_next(it2, &p2));
131
132 CU_ASSERT_EQUAL(p1.x, p2.x);
133 CU_ASSERT_EQUAL(p1.y, p2.y);
134
135 if (lwgeom_has_z(input))
136 CU_ASSERT_EQUAL(p1.z, p2.z);
137
138 if (lwgeom_has_m(input))
139 CU_ASSERT_EQUAL(p1.m, p2.m);
140 }
141
142 lwgeom_free(input);
143
146 }
147}
char * inputs[]
Definition cu_iterator.c:17
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
#define LW_PARSER_CHECK_NONE
Definition liblwgeom.h:2149
LWPOINTITERATOR * lwpointiterator_create(const LWGEOM *g)
Create a new LWPOINTITERATOR over supplied LWGEOM*.
Definition lwiterator.c:243
int lwpointiterator_next(LWPOINTITERATOR *s, POINT4D *p)
Attempts to assign the next point in the iterator to p, and advances the iterator to the next point.
Definition lwiterator.c:210
LWPOINTITERATOR * lwpointiterator_create_rw(LWGEOM *g)
Create a new LWPOINTITERATOR over supplied LWGEOM* Supports modification of coordinates during iterat...
Definition lwiterator.c:252
void lwpointiterator_destroy(LWPOINTITERATOR *s)
Free all memory associated with the iterator.
Definition lwiterator.c:268
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
Definition lwgeom.c:962
int lwpointiterator_modify_next(LWPOINTITERATOR *s, const POINT4D *p)
Attempts to replace the next point int the iterator with p, and advances the iterator to the next poi...
Definition lwiterator.c:224
int lwpointiterator_has_next(LWPOINTITERATOR *s)
Returns LW_TRUE if there is another point available in the iterator.
Definition lwiterator.c:202
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
Definition lwgeom.c:969
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition lwin_wkt.c:940
double m
Definition liblwgeom.h:414
double x
Definition liblwgeom.h:414
double z
Definition liblwgeom.h:414
double y
Definition liblwgeom.h:414

References inputs, LW_PARSER_CHECK_NONE, lwgeom_free(), lwgeom_from_wkt(), lwgeom_has_m(), lwgeom_has_z(), lwpointiterator_create(), lwpointiterator_create_rw(), lwpointiterator_destroy(), lwpointiterator_has_next(), lwpointiterator_modify_next(), lwpointiterator_next(), POINT4D::m, POINT4D::x, POINT4D::y, and POINT4D::z.

Referenced by iterator_suite_setup().

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