PostGIS  2.5.0dev-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 520 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(), lwcollection_linearize(), lwcurve_linearize(), LWGEOM_addpoint(), lwgeom_difference(), lwgeom_grid(), lwgeom_intersection(), lwgeom_linemerge(), lwgeom_remove_repeated_points(), lwgeom_reverse(), lwgeom_segmentize_sphere(), lwgeom_simplify(), lwgeom_split_wrapx(), lwgeom_subdivide_recursive(), lwgeom_symdifference(), lwgeom_unaryunion(), lwgeom_union(), lwgeom_unstroke(), lwgeom_wrapx(), lwmline_unstroke(), lwmpolygon_unstroke(), lwpolygon_unstroke(), rt_raster_surface(), and test_trim_bits().

521 {
522  LWDEBUGF(2, "lwgeom_clone called with %p, %s",
523  lwgeom, lwtype_name(lwgeom->type));
524 
525  switch (lwgeom->type)
526  {
527  case POINTTYPE:
528  case LINETYPE:
529  case CIRCSTRINGTYPE:
530  case TRIANGLETYPE:
531  return (LWGEOM *)lwline_clone_deep((LWLINE *)lwgeom);
532  case POLYGONTYPE:
533  return (LWGEOM *)lwpoly_clone_deep((LWPOLY *)lwgeom);
534  case COMPOUNDTYPE:
535  case CURVEPOLYTYPE:
536  case MULTICURVETYPE:
537  case MULTISURFACETYPE:
538  case MULTIPOINTTYPE:
539  case MULTILINETYPE:
540  case MULTIPOLYGONTYPE:
542  case TINTYPE:
543  case COLLECTIONTYPE:
544  return (LWGEOM *)lwcollection_clone_deep((LWCOLLECTION *)lwgeom);
545  default:
546  lwerror("lwgeom_clone_deep: Unknown geometry type: %s", lwtype_name(lwgeom->type));
547  return NULL;
548  }
549 }
#define LINETYPE
Definition: liblwgeom.h:85
LWPOLY * lwpoly_clone_deep(const LWPOLY *lwgeom)
Definition: lwpoly.c:228
#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:218
#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:398
#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:190
#define COLLECTIONTYPE
Definition: liblwgeom.h:90
Here is the call graph for this function:
Here is the caller graph for this function: