PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@

◆ test_lwline_clip_big()

static void test_lwline_clip_big ( void  )
static

Definition at line 751 of file cu_algorithm.c.

References lwcollection_free(), lwfree(), lwgeom_to_ewkt(), lwline_clip_to_ordinate_range(), lwline_construct(), lwline_free(), ptarray_construct(), ptarray_set_point4d(), SRID_UNKNOWN, POINT4D::x, POINT4D::y, and POINT4D::z.

Referenced by algorithms_suite_setup().

752 {
753  POINTARRAY *pa = ptarray_construct(1, 0, 3);
754  LWLINE *line = lwline_construct(SRID_UNKNOWN, NULL, pa);
755  LWCOLLECTION *c;
756  char *ewkt;
757  POINT4D p;
758 
759  p.x = 0.0;
760  p.y = 0.0;
761  p.z = 0.0;
762  ptarray_set_point4d(pa, 0, &p);
763 
764  p.x = 1.0;
765  p.y = 1.0;
766  p.z = 1.0;
767  ptarray_set_point4d(pa, 1, &p);
768 
769  p.x = 2.0;
770  p.y = 2.0;
771  p.z = 2.0;
772  ptarray_set_point4d(pa, 2, &p);
773 
774  c = lwline_clip_to_ordinate_range(line, 'Z', 0.5, 1.5);
775  ewkt = lwgeom_to_ewkt((LWGEOM*)c);
776  //printf("c = %s\n", ewkt);
777  CU_ASSERT_STRING_EQUAL(ewkt, "MULTILINESTRING((0.5 0.5 0.5,1 1 1,1.5 1.5 1.5))" );
778 
779  lwfree(ewkt);
781  lwline_free(line);
782 }
double x
Definition: liblwgeom.h:354
POINTARRAY * ptarray_construct(char hasz, char hasm, uint32_t npoints)
Construct an empty pointarray, allocating storage and setting the npoints, but not filling in any inf...
Definition: ptarray.c:62
void lwfree(void *mem)
Definition: lwutil.c:244
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:556
void lwline_free(LWLINE *line)
Definition: lwline.c:76
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
Definition: lwgeom_api.c:425
LWCOLLECTION * lwline_clip_to_ordinate_range(const LWLINE *line, char ordinate, double from, double to)
Clip a line based on the from/to range of one of its ordinates.
LWLINE * lwline_construct(int srid, GBOX *bbox, POINTARRAY *points)
Definition: lwline.c:42
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:187
double z
Definition: liblwgeom.h:354
void lwcollection_free(LWCOLLECTION *col)
Definition: lwcollection.c:356
double y
Definition: liblwgeom.h:354
Here is the call graph for this function:
Here is the caller graph for this function: