PostGIS  2.1.10dev-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 351 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_segmentize(), lwgeom_as_multi(), lwgeom_desegmentize(), lwgeom_homogenize(), lwgeom_segmentize(), lwgeom_segmentize2d(), lwgeom_segmentize_sphere(), lwgeom_simplify(), lwmline_desegmentize(), lwmpolygon_desegmentize(), lwpolygon_desegmentize(), RTreeMergeMultiLines(), and test_lwgeom_clone().

352 {
353  LWDEBUGF(2, "lwgeom_clone called with %p, %s",
354  lwgeom, lwtype_name(lwgeom->type));
355 
356  switch (lwgeom->type)
357  {
358  case POINTTYPE:
359  return (LWGEOM *)lwpoint_clone((LWPOINT *)lwgeom);
360  case LINETYPE:
361  return (LWGEOM *)lwline_clone((LWLINE *)lwgeom);
362  case CIRCSTRINGTYPE:
363  return (LWGEOM *)lwcircstring_clone((LWCIRCSTRING *)lwgeom);
364  case POLYGONTYPE:
365  return (LWGEOM *)lwpoly_clone((LWPOLY *)lwgeom);
366  case TRIANGLETYPE:
367  return (LWGEOM *)lwtriangle_clone((LWTRIANGLE *)lwgeom);
368  case COMPOUNDTYPE:
369  case CURVEPOLYTYPE:
370  case MULTICURVETYPE:
371  case MULTISURFACETYPE:
372  case MULTIPOINTTYPE:
373  case MULTILINETYPE:
374  case MULTIPOLYGONTYPE:
376  case TINTYPE:
377  case COLLECTIONTYPE:
378  return (LWGEOM *)lwcollection_clone((LWCOLLECTION *)lwgeom);
379  default:
380  lwerror("lwgeom_clone: Unknown geometry type: %s", lwtype_name(lwgeom->type));
381  return NULL;
382  }
383 }
#define LINETYPE
Definition: liblwgeom.h:61
#define MULTICURVETYPE
Definition: liblwgeom.h:70
LWLINE * lwline_clone(const LWLINE *lwgeom)
Definition: lwline.c:89
#define POLYGONTYPE
Definition: liblwgeom.h:62
#define CURVEPOLYTYPE
Definition: liblwgeom.h:69
#define COMPOUNDTYPE
Definition: liblwgeom.h:68
#define MULTIPOINTTYPE
Definition: liblwgeom.h:63
LWTRIANGLE * lwtriangle_clone(const LWTRIANGLE *lwgeom)
Definition: lwtriangle.c:86
#define TRIANGLETYPE
Definition: liblwgeom.h:73
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:72
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:164
LWPOINT * lwpoint_clone(const LWPOINT *lwgeom)
Definition: lwpoint.c:206
#define TINTYPE
Definition: liblwgeom.h:74
LWCIRCSTRING * lwcircstring_clone(const LWCIRCSTRING *curve)
Definition: lwcircstring.c:112
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:65
#define MULTISURFACETYPE
Definition: liblwgeom.h:71
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
uint8_t type
Definition: liblwgeom.h:352
LWCOLLECTION * lwcollection_clone(const LWCOLLECTION *lwgeom)
Clone LWCOLLECTION object.
Definition: lwcollection.c:110
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:67
#define MULTILINETYPE
Definition: liblwgeom.h:64
LWPOLY * lwpoly_clone(const LWPOLY *lwgeom)
Definition: lwpoly.c:120
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
#define COLLECTIONTYPE
Definition: liblwgeom.h:66

Here is the call graph for this function:

Here is the caller graph for this function: