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

◆ lwcompound_is_closed()

int lwcompound_is_closed ( const LWCOMPOUND curve)

Definition at line 35 of file lwcompound.c.

36{
37 size_t size;
38 int npoints=0;
39
40 if ( lwgeom_has_z((LWGEOM*)compound) )
41 {
42 size = sizeof(POINT3D);
43 }
44 else
45 {
46 size = sizeof(POINT2D);
47 }
48
49 if ( compound->geoms[compound->ngeoms - 1]->type == CIRCSTRINGTYPE )
50 {
51 npoints = ((LWCIRCSTRING *)compound->geoms[compound->ngeoms - 1])->points->npoints;
52 }
53 else if (compound->geoms[compound->ngeoms - 1]->type == LINETYPE)
54 {
55 npoints = ((LWLINE *)compound->geoms[compound->ngeoms - 1])->points->npoints;
56 }
57
58 if ( memcmp(getPoint_internal( (POINTARRAY *)compound->geoms[0]->data, 0),
59 getPoint_internal( (POINTARRAY *)compound->geoms[compound->ngeoms - 1]->data,
60 npoints - 1),
61 size) )
62 {
63 return LW_FALSE;
64 }
65
66 return LW_TRUE;
67}
#define LW_FALSE
Definition liblwgeom.h:108
#define LINETYPE
Definition liblwgeom.h:117
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
Definition lwgeom.c:916
#define CIRCSTRINGTYPE
Definition liblwgeom.h:123
#define LW_TRUE
Return types for functions with status returns.
Definition liblwgeom.h:107
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition lwinline.h:67
void * data
Definition liblwgeom.h:445
uint8_t type
Definition liblwgeom.h:448

References CIRCSTRINGTYPE, LWGEOM::data, LWCOMPOUND::geoms, getPoint_internal(), LINETYPE, LW_FALSE, LW_TRUE, lwgeom_has_z(), LWCOMPOUND::ngeoms, and LWGEOM::type.

Referenced by lwgeom_is_closed(), test_isclosed(), and wkt_parser_curvepolygon_add_ring().

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