PostGIS  2.2.7dev-r@@SVN_REVISION@@
static LWGEOM * lwline_split_by_mpoint ( const LWLINE lwgeom_in,
const LWMPOINT blade_in 
)
static

Definition at line 185 of file lwgeom_geos_split.c.

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().

186 {
187  LWMLINE* out;
188  int i, j;
189 
190  out = lwmline_construct_empty(lwline_in->srid,
191  FLAGS_GET_Z(lwline_in->flags),
192  FLAGS_GET_M(lwline_in->flags));
193  lwmline_add_lwline(out, lwline_clone_deep(lwline_in));
194 
195  for (i=0; i<mp->ngeoms; ++i)
196  {
197  for (j=0; j<out->ngeoms; ++j)
198  {
199  lwline_in = out->geoms[j];
200  LWPOINT *blade_in = mp->geoms[i];
201  int ret = lwline_split_by_point_to(lwline_in, blade_in, out);
202  if ( 2 == ret )
203  {
204  /* the point splits this line,
205  * 2 splits were added to collection.
206  * We'll move the latest added into
207  * the slot of the current one.
208  */
209  lwline_free(out->geoms[j]);
210  out->geoms[j] = out->geoms[--out->ngeoms];
211  }
212  }
213  }
214 
215  /* Turn multiline into collection */
216  out->type = COLLECTIONTYPE;
217 
218  return (LWGEOM*)out;
219 }
uint8_t type
Definition: liblwgeom.h:461
void lwline_free(LWLINE *line)
Definition: lwline.c:63
LWMLINE * lwmline_add_lwline(LWMLINE *mobj, const LWLINE *obj)
Definition: lwmline.c:32
LWMLINE * lwmline_construct_empty(int srid, char hasz, char hasm)
Definition: lwmline.c:24
int ngeoms
Definition: liblwgeom.h:465
LWPOINT ** geoms
Definition: liblwgeom.h:454
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:124
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:467
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:125
LWLINE * lwline_clone_deep(const LWLINE *lwgeom)
Definition: lwline.c:105
#define COLLECTIONTYPE
Definition: liblwgeom.h:76

Here is the call graph for this function:

Here is the caller graph for this function: