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

◆ lwline_split_by_mpoint()

static LWGEOM * lwline_split_by_mpoint ( const LWLINE lwgeom_in,
const LWMPOINT blade_in 
)
static

Definition at line 172 of file lwgeom_geos_split.c.

173{
174 LWMLINE* out;
175 uint32_t i, j;
176
177 out = lwmline_construct_empty(lwline_in->srid,
178 FLAGS_GET_Z(lwline_in->flags),
179 FLAGS_GET_M(lwline_in->flags));
180 lwmline_add_lwline(out, lwline_clone_deep(lwline_in));
181
182 for (i=0; i<mp->ngeoms; ++i)
183 {
184 for (j=0; j<out->ngeoms; ++j)
185 {
186 lwline_in = out->geoms[j];
187 LWPOINT *blade_in = mp->geoms[i];
188 int ret = lwline_split_by_point_to(lwline_in, blade_in, out);
189 if ( 2 == ret )
190 {
191 /* the point splits this line,
192 * 2 splits were added to collection.
193 * We'll move the latest added into
194 * the slot of the current one.
195 */
196 lwline_free(out->geoms[j]);
197 out->geoms[j] = out->geoms[--out->ngeoms];
198 }
199 }
200 }
201
202 /* Turn multiline into collection */
203 out->type = COLLECTIONTYPE;
204
205 return (LWGEOM*)out;
206}
#define COLLECTIONTYPE
Definition liblwgeom.h:108
LWMLINE * lwmline_construct_empty(int32_t srid, char hasz, char hasm)
Definition lwmline.c:38
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:165
LWMLINE * lwmline_add_lwline(LWMLINE *mobj, const LWLINE *obj)
Definition lwmline.c:46
#define FLAGS_GET_M(flags)
Definition liblwgeom.h:166
void lwline_free(LWLINE *line)
Definition lwline.c:67
LWLINE * lwline_clone_deep(const LWLINE *lwgeom)
Definition lwline.c:109
int lwline_split_by_point_to(const LWLINE *lwline_in, const LWPOINT *blade_in, LWMLINE *v)
Split a line by a point and push components to the provided multiline.
LWLINE ** geoms
Definition liblwgeom.h:547
uint8_t type
Definition liblwgeom.h:550
uint32_t ngeoms
Definition liblwgeom.h:552
LWPOINT ** geoms
Definition liblwgeom.h:533

References COLLECTIONTYPE, LWLINE::flags, FLAGS_GET_M, FLAGS_GET_Z, LWMPOINT::geoms, LWMLINE::geoms, lwline_clone_deep(), lwline_free(), lwline_split_by_point_to(), lwmline_add_lwline(), lwmline_construct_empty(), LWMPOINT::ngeoms, LWMLINE::ngeoms, LWLINE::srid, and LWMLINE::type.

Referenced by lwline_split().

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