PostGIS  2.3.7dev-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 408 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_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(), test_clone(), and test_lwgeom_clone().

409 {
410  LWDEBUGF(2, "lwgeom_clone called with %p, %s",
411  lwgeom, lwtype_name(lwgeom->type));
412 
413  switch (lwgeom->type)
414  {
415  case POINTTYPE:
416  return (LWGEOM *)lwpoint_clone((LWPOINT *)lwgeom);
417  case LINETYPE:
418  return (LWGEOM *)lwline_clone((LWLINE *)lwgeom);
419  case CIRCSTRINGTYPE:
420  return (LWGEOM *)lwcircstring_clone((LWCIRCSTRING *)lwgeom);
421  case POLYGONTYPE:
422  return (LWGEOM *)lwpoly_clone((LWPOLY *)lwgeom);
423  case TRIANGLETYPE:
424  return (LWGEOM *)lwtriangle_clone((LWTRIANGLE *)lwgeom);
425  case COMPOUNDTYPE:
426  case CURVEPOLYTYPE:
427  case MULTICURVETYPE:
428  case MULTISURFACETYPE:
429  case MULTIPOINTTYPE:
430  case MULTILINETYPE:
431  case MULTIPOLYGONTYPE:
433  case TINTYPE:
434  case COLLECTIONTYPE:
435  return (LWGEOM *)lwcollection_clone((LWCOLLECTION *)lwgeom);
436  default:
437  lwerror("lwgeom_clone: Unknown geometry type: %s", lwtype_name(lwgeom->type));
438  return NULL;
439  }
440 }
#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
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:216
LWPOINT * lwpoint_clone(const LWPOINT *lwgeom)
Definition: lwpoint.c:221
#define TINTYPE
Definition: liblwgeom.h:98
LWCIRCSTRING * lwcircstring_clone(const LWCIRCSTRING *curve)
Definition: lwcircstring.c:125
#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:191
#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:102
#define COLLECTIONTYPE
Definition: liblwgeom.h:90

Here is the call graph for this function:

Here is the caller graph for this function: