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

◆ RTreeMergeMultiLines()

static LWMLINE * RTreeMergeMultiLines ( LWMLINE line1,
LWMLINE line2 
)
static

Merges two multilinestrings into a single multilinestring.

Definition at line 282 of file lwgeom_rtree.c.

283{
284 LWGEOM **geoms;
285 LWCOLLECTION *col;
286 uint32_t i, j, ngeoms;
287
288 POSTGIS_DEBUGF(2, "RTreeMergeMultiLines called on %p, %d, %d; %p, %d, %d", line1, line1->ngeoms, line1->type, line2, line2->ngeoms, line2->type);
289
290 ngeoms = line1->ngeoms + line2->ngeoms;
291 geoms = lwalloc(sizeof(LWGEOM *) * ngeoms);
292
293 j = 0;
294 for (i = 0; i < line1->ngeoms; i++, j++)
295 {
296 geoms[j] = lwgeom_clone((LWGEOM *)line1->geoms[i]);
297 }
298 for (i = 0; i < line2->ngeoms; i++, j++)
299 {
300 geoms[j] = lwgeom_clone((LWGEOM *)line2->geoms[i]);
301 }
302 col = lwcollection_construct(MULTILINETYPE, SRID_UNKNOWN, NULL, ngeoms, geoms);
303
304 POSTGIS_DEBUGF(3, "RTreeMergeMultiLines returning %p, %d, %d", col, col->ngeoms, col->type);
305
306 return (LWMLINE *)col;
307}
LWCOLLECTION * lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
#define MULTILINETYPE
Definition liblwgeom.h:120
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition lwgeom.c:473
void * lwalloc(size_t size)
Definition lwutil.c:227
#define SRID_UNKNOWN
Unknown SRID value.
Definition liblwgeom.h:229
uint32_t ngeoms
Definition liblwgeom.h:566
uint8_t type
Definition liblwgeom.h:564
LWLINE ** geoms
Definition liblwgeom.h:533
uint8_t type
Definition liblwgeom.h:536
uint32_t ngeoms
Definition liblwgeom.h:538

References LWMLINE::geoms, lwalloc(), lwcollection_construct(), lwgeom_clone(), MULTILINETYPE, LWMLINE::ngeoms, LWCOLLECTION::ngeoms, SRID_UNKNOWN, LWMLINE::type, and LWCOLLECTION::type.

Referenced by RTreeFindLineSegments().

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