PostGIS  2.5.0dev-r@@SVN_REVISION@@
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 475 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, and LWGEOM::type.

Referenced by lwcollection_build_buffer(), lwcollection_clone(), lwcollection_extract(), lwcollection_linearize(), lwcompound_construct_from_lwline(), lwcurve_linearize(), lwgeom_as_curve(), lwgeom_as_multi(), lwgeom_homogenize(), lwgeom_segmentize2d(), lwgeom_segmentize_sphere(), lwgeom_set_effective_area(), lwgeom_unstroke(), lwmline_unstroke(), lwmpolygon_unstroke(), lwpoint_locate_between_m(), lwpolygon_unstroke(), RTreeMergeMultiLines(), test_clone(), and test_lwgeom_clone().

476 {
477  LWDEBUGF(2, "lwgeom_clone called with %p, %s",
478  lwgeom, lwtype_name(lwgeom->type));
479 
480  switch (lwgeom->type)
481  {
482  case POINTTYPE:
483  return (LWGEOM *)lwpoint_clone((LWPOINT *)lwgeom);
484  case LINETYPE:
485  return (LWGEOM *)lwline_clone((LWLINE *)lwgeom);
486  case CIRCSTRINGTYPE:
487  return (LWGEOM *)lwcircstring_clone((LWCIRCSTRING *)lwgeom);
488  case POLYGONTYPE:
489  return (LWGEOM *)lwpoly_clone((LWPOLY *)lwgeom);
490  case TRIANGLETYPE:
491  return (LWGEOM *)lwtriangle_clone((LWTRIANGLE *)lwgeom);
492  case COMPOUNDTYPE:
493  case CURVEPOLYTYPE:
494  case MULTICURVETYPE:
495  case MULTISURFACETYPE:
496  case MULTIPOINTTYPE:
497  case MULTILINETYPE:
498  case MULTIPOLYGONTYPE:
500  case TINTYPE:
501  case COLLECTIONTYPE:
502  return (LWGEOM *)lwcollection_clone((LWCOLLECTION *)lwgeom);
503  default:
504  lwerror("lwgeom_clone: Unknown geometry type: %s", lwtype_name(lwgeom->type));
505  return NULL;
506  }
507 }
#define LINETYPE
Definition: liblwgeom.h:85
#define MULTICURVETYPE
Definition: liblwgeom.h:94
LWLINE * lwline_clone(const LWLINE *lwgeom)
Definition: lwline.c:102
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define CURVEPOLYTYPE
Definition: liblwgeom.h:93
#define COMPOUNDTYPE
Definition: liblwgeom.h:92
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
LWPOINT * lwpoint_clone(const LWPOINT *lwgeom)
Definition: lwpoint.c:239
LWTRIANGLE * lwtriangle_clone(const LWTRIANGLE *lwgeom)
Definition: lwtriangle.c:99
#define TRIANGLETYPE
Definition: liblwgeom.h:97
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:96
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#define TINTYPE
Definition: liblwgeom.h:98
LWCIRCSTRING * lwcircstring_clone(const LWCIRCSTRING *curve)
Definition: lwcircstring.c:124
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:89
#define MULTISURFACETYPE
Definition: liblwgeom.h:95
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
uint8_t type
Definition: liblwgeom.h:395
LWCOLLECTION * lwcollection_clone(const LWCOLLECTION *lwgeom)
Clone LWCOLLECTION object.
Definition: lwcollection.c:123
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
#define MULTILINETYPE
Definition: liblwgeom.h:88
LWPOLY * lwpoly_clone(const LWPOLY *lwgeom)
Definition: lwpoly.c:211
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
#define COLLECTIONTYPE
Definition: liblwgeom.h:90

Here is the call graph for this function:

Here is the caller graph for this function: