PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lwgeom_clone_deep()

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 446 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, LWGEOM::type, and LWCOLLECTION::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_split_wrapx(), lwgeom_subdivide_recursive(), lwgeom_symdifference(), lwgeom_unaryunion(), lwgeom_union(), lwgeom_wrapx(), and rt_raster_surface().

447 {
448  LWDEBUGF(2, "lwgeom_clone called with %p, %s",
449  lwgeom, lwtype_name(lwgeom->type));
450 
451  switch (lwgeom->type)
452  {
453  case POINTTYPE:
454  case LINETYPE:
455  case CIRCSTRINGTYPE:
456  case TRIANGLETYPE:
457  return (LWGEOM *)lwline_clone_deep((LWLINE *)lwgeom);
458  case POLYGONTYPE:
459  return (LWGEOM *)lwpoly_clone_deep((LWPOLY *)lwgeom);
460  case COMPOUNDTYPE:
461  case CURVEPOLYTYPE:
462  case MULTICURVETYPE:
463  case MULTISURFACETYPE:
464  case MULTIPOINTTYPE:
465  case MULTILINETYPE:
466  case MULTIPOLYGONTYPE:
468  case TINTYPE:
469  case COLLECTIONTYPE:
470  return (LWGEOM *)lwcollection_clone_deep((LWCOLLECTION *)lwgeom);
471  default:
472  lwerror("lwgeom_clone_deep: Unknown geometry type: %s", lwtype_name(lwgeom->type));
473  return NULL;
474  }
475 }
#define LINETYPE
Definition: liblwgeom.h:85
LWPOLY * lwpoly_clone_deep(const LWPOLY *lwgeom)
Definition: lwpoly.c:208
#define MULTICURVETYPE
Definition: liblwgeom.h:94
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define CURVEPOLYTYPE
Definition: liblwgeom.h:93
#define COMPOUNDTYPE
Definition: liblwgeom.h:92
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
#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
#define TINTYPE
Definition: liblwgeom.h:98
LWCOLLECTION * lwcollection_clone_deep(const LWCOLLECTION *lwgeom)
Deep clone LWCOLLECTION object.
Definition: lwcollection.c:149
#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
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
#define MULTILINETYPE
Definition: liblwgeom.h:88
LWLINE * lwline_clone_deep(const LWLINE *lwgeom)
Definition: lwline.c:118
#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: