PostGIS  2.2.7dev-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 433 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 _lwt_AddLineEdge(), _lwt_split_by_nodes(), lwcollection_clone_deep(), LWGEOM_addpoint(), lwgeom_clip_by_rect(), lwgeom_difference(), lwgeom_intersection(), lwgeom_remove_repeated_points(), lwgeom_segmentize_sphere(), lwgeom_subdivide_recursive(), lwgeom_symdifference(), lwgeom_unaryunion(), lwgeom_union(), and rt_raster_surface().

434 {
435  LWDEBUGF(2, "lwgeom_clone called with %p, %s",
436  lwgeom, lwtype_name(lwgeom->type));
437 
438  switch (lwgeom->type)
439  {
440  case POINTTYPE:
441  case LINETYPE:
442  case CIRCSTRINGTYPE:
443  case TRIANGLETYPE:
444  return (LWGEOM *)lwline_clone_deep((LWLINE *)lwgeom);
445  case POLYGONTYPE:
446  return (LWGEOM *)lwpoly_clone_deep((LWPOLY *)lwgeom);
447  case COMPOUNDTYPE:
448  case CURVEPOLYTYPE:
449  case MULTICURVETYPE:
450  case MULTISURFACETYPE:
451  case MULTIPOINTTYPE:
452  case MULTILINETYPE:
453  case MULTIPOLYGONTYPE:
455  case TINTYPE:
456  case COLLECTIONTYPE:
457  return (LWGEOM *)lwcollection_clone_deep((LWCOLLECTION *)lwgeom);
458  default:
459  lwerror("lwgeom_clone_deep: Unknown geometry type: %s", lwtype_name(lwgeom->type));
460  return NULL;
461  }
462 }
#define LINETYPE
Definition: liblwgeom.h:71
LWPOLY * lwpoly_clone_deep(const LWPOLY *lwgeom)
Definition: lwpoly.c:135
#define MULTICURVETYPE
Definition: liblwgeom.h:80
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define CURVEPOLYTYPE
Definition: liblwgeom.h:79
#define COMPOUNDTYPE
Definition: liblwgeom.h:78
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
#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
#define TINTYPE
Definition: liblwgeom.h:84
LWCOLLECTION * lwcollection_clone_deep(const LWCOLLECTION *lwgeom)
Deep clone LWCOLLECTION object.
Definition: lwcollection.c:136
#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
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
#define MULTILINETYPE
Definition: liblwgeom.h:74
LWLINE * lwline_clone_deep(const LWLINE *lwgeom)
Definition: lwline.c:105
#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: