44{
48 GEOSGeometry* gdiff;
49 GEOSGeometry* g1;
50 GEOSGeometry* g2;
51 int ret;
52
53
58
59
60
61
62
63
64
65
66
68
70 if ( ! g1 )
71 {
73 return NULL;
74 }
76 if ( ! g2 )
77 {
78 GEOSGeom_destroy(g1);
80 return NULL;
81 }
82
83
85 {
86 gdiff = GEOSBoundary(g2);
87 GEOSGeom_destroy(g2);
88 if ( ! gdiff )
89 {
90 GEOSGeom_destroy(g1);
92 return NULL;
93 }
94 g2 = gdiff; gdiff = NULL;
95 }
96
97
98 ret = GEOSRelatePattern(g1, g2, "1********");
99 if ( 2 == ret )
100 {
102 GEOSGeom_destroy(g1);
103 GEOSGeom_destroy(g2);
104 return NULL;
105 }
106 if ( ret )
107 {
108 GEOSGeom_destroy(g1);
109 GEOSGeom_destroy(g2);
110 lwerror(
"Splitter line has linear intersection with input");
111 return NULL;
112 }
113
114
115 gdiff = GEOSDifference(g1,g2);
116 GEOSGeom_destroy(g1);
117 GEOSGeom_destroy(g2);
118 if (gdiff == NULL)
119 {
121 return NULL;
122 }
123
125 GEOSGeom_destroy(gdiff);
126 if (NULL == diff)
127 {
129 return NULL;
130 }
131
133 if ( ! out )
134 {
136 components[0] = diff;
138 NULL, 1, components);
139 }
140 else
141 {
142
144
146 }
147
148
150}
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, uint8_t autofix)
void lwgeom_geos_error(const char *fmt,...)
void(*) LWGEOM GEOS2LWGEOM)(const GEOSGeometry *geom, uint8_t want3d)
LWCOLLECTION * lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
void lwgeom_set_srid(LWGEOM *geom, int32_t srid)
Set the SRID on an LWGEOM For collections, only the parent gets an SRID, all the children get SRID_UN...
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
#define FLAGS_GET_Z(flags)
void * lwalloc(size_t size)
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.