PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwgeom_clone()

LWGEOM* lwgeom_clone ( const LWGEOM lwgeom)

Clone LWGEOM object.

Serialized point lists are not copied.

GBOX are copied

See also
ptarray_clone

Definition at line 395 of file lwgeom.c.

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LINETYPE, lwcircstring_clone(), lwcollection_clone(), LWDEBUGF, lwerror(), lwline_clone(), lwpoint_clone(), lwpoly_clone(), lwtriangle_clone(), lwtype_name(), MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, MULTISURFACETYPE, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, TRIANGLETYPE, LWGEOM::type, and LWCOLLECTION::type.

Referenced by lwcollection_build_buffer(), lwcollection_clone(), lwcollection_extract(), lwcollection_stroke(), lwcompound_construct_from_lwline(), lwgeom_as_curve(), lwgeom_as_multi(), lwgeom_homogenize(), lwgeom_segmentize2d(), lwgeom_segmentize_sphere(), lwgeom_set_effective_area(), lwgeom_simplify(), lwgeom_stroke(), lwgeom_unstroke(), lwmline_unstroke(), lwmpolygon_unstroke(), lwpolygon_unstroke(), RTreeMergeMultiLines(), and test_lwgeom_clone().

396 {
397  LWDEBUGF(2, "lwgeom_clone called with %p, %s",
398  lwgeom, lwtype_name(lwgeom->type));
399 
400  switch (lwgeom->type)
401  {
402  case POINTTYPE:
403  return (LWGEOM *)lwpoint_clone((LWPOINT *)lwgeom);
404  case LINETYPE:
405  return (LWGEOM *)lwline_clone((LWLINE *)lwgeom);
406  case CIRCSTRINGTYPE:
407  return (LWGEOM *)lwcircstring_clone((LWCIRCSTRING *)lwgeom);
408  case POLYGONTYPE:
409  return (LWGEOM *)lwpoly_clone((LWPOLY *)lwgeom);
410  case TRIANGLETYPE:
411  return (LWGEOM *)lwtriangle_clone((LWTRIANGLE *)lwgeom);
412  case COMPOUNDTYPE:
413  case CURVEPOLYTYPE:
414  case MULTICURVETYPE:
415  case MULTISURFACETYPE:
416  case MULTIPOINTTYPE:
417  case MULTILINETYPE:
418  case MULTIPOLYGONTYPE:
420  case TINTYPE:
421  case COLLECTIONTYPE:
422  return (LWGEOM *)lwcollection_clone((LWCOLLECTION *)lwgeom);
423  default:
424  lwerror("lwgeom_clone: Unknown geometry type: %s", lwtype_name(lwgeom->type));
425  return NULL;
426  }
427 }
#define LINETYPE
Definition: liblwgeom.h:71
#define MULTICURVETYPE
Definition: liblwgeom.h:80
LWLINE * lwline_clone(const LWLINE *lwgeom)
Definition: lwline.c:89
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define CURVEPOLYTYPE
Definition: liblwgeom.h:79
#define COMPOUNDTYPE
Definition: liblwgeom.h:78
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
LWTRIANGLE * lwtriangle_clone(const LWTRIANGLE *lwgeom)
Definition: lwtriangle.c:86
#define TRIANGLETYPE
Definition: liblwgeom.h:83
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:82
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
LWPOINT * lwpoint_clone(const LWPOINT *lwgeom)
Definition: lwpoint.c:208
#define TINTYPE
Definition: liblwgeom.h:84
LWCIRCSTRING * lwcircstring_clone(const LWCIRCSTRING *curve)
Definition: lwcircstring.c:112
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:75
#define MULTISURFACETYPE
Definition: liblwgeom.h:81
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
uint8_t type
Definition: liblwgeom.h:380
LWCOLLECTION * lwcollection_clone(const LWCOLLECTION *lwgeom)
Clone LWCOLLECTION object.
Definition: lwcollection.c:110
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
#define MULTILINETYPE
Definition: liblwgeom.h:74
LWPOLY * lwpoly_clone(const LWPOLY *lwgeom)
Definition: lwpoly.c:120
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
#define COLLECTIONTYPE
Definition: liblwgeom.h:76
Here is the call graph for this function:
Here is the caller graph for this function: