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

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

670 {
671  POINTARRAY *pa = ptarray_construct(1, 0, 3);
672  LWLINE *line = lwline_construct(SRID_UNKNOWN, NULL, pa);
673  LWCOLLECTION *c;
674  char *ewkt;
675  POINT4D p;
676 
677  p.x = 0.0;
678  p.y = 0.0;
679  p.z = 0.0;
680  ptarray_set_point4d(pa, 0, &p);
681 
682  p.x = 1.0;
683  p.y = 1.0;
684  p.z = 1.0;
685  ptarray_set_point4d(pa, 1, &p);
686 
687  p.x = 2.0;
688  p.y = 2.0;
689  p.z = 2.0;
690  ptarray_set_point4d(pa, 2, &p);
691 
692  c = lwline_clip_to_ordinate_range(line, 'Z', 0.5, 1.5);
693  ewkt = lwgeom_to_ewkt((LWGEOM*)c);
694  //printf("c = %s\n", ewkt);
695  CU_ASSERT_STRING_EQUAL(ewkt, "MULTILINESTRING((0.5 0.5 0.5,1 1 1,1.5 1.5 1.5))" );
696 
697  lwfree(ewkt);
699  lwline_free(line);
700 }
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
Definition: lwgeom_api.c:501
double x
Definition: liblwgeom.h:308
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:49
void lwfree(void *mem)
Definition: lwutil.c:190
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:425
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:154
double z
Definition: liblwgeom.h:308
void lwcollection_free(LWCOLLECTION *col)
Definition: lwcollection.c:316
double y
Definition: liblwgeom.h:308

Here is the call graph for this function:

Here is the caller graph for this function: