PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ 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 }
#define MULTILINETYPE
Definition: liblwgeom.h:89
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:43
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:482
void * lwalloc(size_t size)
Definition: lwutil.c:229
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:188
uint32_t ngeoms
Definition: liblwgeom.h:510
uint8_t type
Definition: liblwgeom.h:506
LWLINE ** geoms
Definition: liblwgeom.h:486
uint8_t type
Definition: liblwgeom.h:480
uint32_t ngeoms
Definition: liblwgeom.h:484
unsigned int uint32_t
Definition: uthash.h:78

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: