PostGIS  2.2.7dev-r@@SVN_REVISION@@
static void test_lwline_clip_big ( void  )
static

Definition at line 672 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().

673 {
674  POINTARRAY *pa = ptarray_construct(1, 0, 3);
675  LWLINE *line = lwline_construct(SRID_UNKNOWN, NULL, pa);
676  LWCOLLECTION *c;
677  char *ewkt;
678  POINT4D p;
679 
680  p.x = 0.0;
681  p.y = 0.0;
682  p.z = 0.0;
683  ptarray_set_point4d(pa, 0, &p);
684 
685  p.x = 1.0;
686  p.y = 1.0;
687  p.z = 1.0;
688  ptarray_set_point4d(pa, 1, &p);
689 
690  p.x = 2.0;
691  p.y = 2.0;
692  p.z = 2.0;
693  ptarray_set_point4d(pa, 2, &p);
694 
695  c = lwline_clip_to_ordinate_range(line, 'Z', 0.5, 1.5);
696  ewkt = lwgeom_to_ewkt((LWGEOM*)c);
697  //printf("c = %s\n", ewkt);
698  CU_ASSERT_STRING_EQUAL(ewkt, "MULTILINESTRING((0.5 0.5 0.5,1 1 1,1.5 1.5 1.5))" );
699 
700  lwfree(ewkt);
702  lwline_free(line);
703 }
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
Definition: lwgeom_api.c:536
double x
Definition: liblwgeom.h:336
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:214
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:469
void lwline_free(LWLINE *line)
Definition: lwline.c:63
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:29
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:172
double z
Definition: liblwgeom.h:336
void lwcollection_free(LWCOLLECTION *col)
Definition: lwcollection.c:326
double y
Definition: liblwgeom.h:336

Here is the call graph for this function:

Here is the caller graph for this function: