PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwgeom_clone_deep()

LWGEOM* lwgeom_clone_deep ( const LWGEOM lwgeom)

Deep clone an LWGEOM, everything is copied.

Deep clone an LWGEOM, everything is copied.

POINTARRAY are copied.

Definition at line 482 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(), lwmpoint_remove_repeated_points(), mvt_geom(), and rt_raster_surface().

483 {
484  LWDEBUGF(2, "lwgeom_clone called with %p, %s",
485  lwgeom, lwtype_name(lwgeom->type));
486 
487  switch (lwgeom->type)
488  {
489  case POINTTYPE:
490  case LINETYPE:
491  case CIRCSTRINGTYPE:
492  case TRIANGLETYPE:
493  return (LWGEOM *)lwline_clone_deep((LWLINE *)lwgeom);
494  case POLYGONTYPE:
495  return (LWGEOM *)lwpoly_clone_deep((LWPOLY *)lwgeom);
496  case COMPOUNDTYPE:
497  case CURVEPOLYTYPE:
498  case MULTICURVETYPE:
499  case MULTISURFACETYPE:
500  case MULTIPOINTTYPE:
501  case MULTILINETYPE:
502  case MULTIPOLYGONTYPE:
504  case TINTYPE:
505  case COLLECTIONTYPE:
506  return (LWGEOM *)lwcollection_clone_deep((LWCOLLECTION *)lwgeom);
507  default:
508  lwerror("lwgeom_clone_deep: Unknown geometry type: %s", lwtype_name(lwgeom->type));
509  return NULL;
510  }
511 }
#define LINETYPE
Definition: liblwgeom.h:86
LWPOLY * lwpoly_clone_deep(const LWPOLY *lwgeom)
Definition: lwpoly.c:230
#define MULTICURVETYPE
Definition: liblwgeom.h:95
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
#define TRIANGLETYPE
Definition: liblwgeom.h:98
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:97
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#define TINTYPE
Definition: liblwgeom.h:99
LWCOLLECTION * lwcollection_clone_deep(const LWCOLLECTION *lwgeom)
Deep clone LWCOLLECTION object.
Definition: lwcollection.c:149
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define MULTISURFACETYPE
Definition: liblwgeom.h:96
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
uint8_t type
Definition: liblwgeom.h:396
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
#define MULTILINETYPE
Definition: liblwgeom.h:89
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:190
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
Here is the call graph for this function:
Here is the caller graph for this function: