PostGIS  2.1.10dev-r@@SVN_REVISION@@
LWGEOM* lwgeom_clone_deep ( const LWGEOM lwgeom)

Deep-clone an LWGEOM object.

Deep clone an LWGEOM, everything is copied.

POINTARRAY are copied.

Definition at line 389 of file lwgeom.c.

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LINETYPE, lwcollection_clone_deep(), LWDEBUGF, lwerror(), lwline_clone_deep(), lwpoly_clone_deep(), lwtype_name(), MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, MULTISURFACETYPE, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, TRIANGLETYPE, and LWGEOM::type.

Referenced by lwcollection_clone_deep(), LWGEOM_addpoint(), lwgeom_difference(), lwgeom_intersection(), lwgeom_remove_repeated_points(), lwgeom_segmentize_sphere(), lwgeom_symdifference(), lwgeom_union(), and rt_raster_surface().

390 {
391  LWDEBUGF(2, "lwgeom_clone called with %p, %s",
392  lwgeom, lwtype_name(lwgeom->type));
393 
394  switch (lwgeom->type)
395  {
396  case POINTTYPE:
397  case LINETYPE:
398  case CIRCSTRINGTYPE:
399  case TRIANGLETYPE:
400  return (LWGEOM *)lwline_clone_deep((LWLINE *)lwgeom);
401  case POLYGONTYPE:
402  return (LWGEOM *)lwpoly_clone_deep((LWPOLY *)lwgeom);
403  case COMPOUNDTYPE:
404  case CURVEPOLYTYPE:
405  case MULTICURVETYPE:
406  case MULTISURFACETYPE:
407  case MULTIPOINTTYPE:
408  case MULTILINETYPE:
409  case MULTIPOLYGONTYPE:
411  case TINTYPE:
412  case COLLECTIONTYPE:
413  return (LWGEOM *)lwcollection_clone_deep((LWCOLLECTION *)lwgeom);
414  default:
415  lwerror("lwgeom_clone_deep: Unknown geometry type: %s", lwtype_name(lwgeom->type));
416  return NULL;
417  }
418 }
#define LINETYPE
Definition: liblwgeom.h:61
LWPOLY * lwpoly_clone_deep(const LWPOLY *lwgeom)
Definition: lwpoly.c:135
#define MULTICURVETYPE
Definition: liblwgeom.h:70
#define POLYGONTYPE
Definition: liblwgeom.h:62
#define CURVEPOLYTYPE
Definition: liblwgeom.h:69
#define COMPOUNDTYPE
Definition: liblwgeom.h:68
#define MULTIPOINTTYPE
Definition: liblwgeom.h:63
#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
#define TINTYPE
Definition: liblwgeom.h:74
LWCOLLECTION * lwcollection_clone_deep(const LWCOLLECTION *lwgeom)
Deep clone LWCOLLECTION object.
Definition: lwcollection.c:136
#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
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:67
#define MULTILINETYPE
Definition: liblwgeom.h:64
LWLINE * lwline_clone_deep(const LWLINE *lwgeom)
Definition: lwline.c:105
#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: