PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwgeom_clone()

LWGEOM* lwgeom_clone ( const LWGEOM lwgeom)

Clone LWGEOM object.

Serialized point lists are not copied.

GBOX are copied

See also
ptarray_clone

Definition at line 444 of file lwgeom.c.

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LINETYPE, lwcircstring_clone(), lwcollection_clone(), LWDEBUGF, lwerror(), lwline_clone(), lwpoint_clone(), lwpoly_clone(), lwtriangle_clone(), lwtype_name(), MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, MULTISURFACETYPE, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, TRIANGLETYPE, LWGEOM::type, and LWCOLLECTION::type.

Referenced by lwcollection_build_buffer(), lwcollection_clone(), lwcollection_extract(), lwcollection_linearize(), lwcompound_construct_from_lwline(), lwcurve_linearize(), lwgeom_as_curve(), lwgeom_as_multi(), lwgeom_homogenize(), lwgeom_segmentize2d(), lwgeom_segmentize_sphere(), lwgeom_set_effective_area(), lwgeom_simplify(), lwgeom_unstroke(), lwmline_unstroke(), lwmpolygon_unstroke(), lwpolygon_unstroke(), RTreeMergeMultiLines(), test_clone(), and test_lwgeom_clone().

445 {
446  LWDEBUGF(2, "lwgeom_clone called with %p, %s",
447  lwgeom, lwtype_name(lwgeom->type));
448 
449  switch (lwgeom->type)
450  {
451  case POINTTYPE:
452  return (LWGEOM *)lwpoint_clone((LWPOINT *)lwgeom);
453  case LINETYPE:
454  return (LWGEOM *)lwline_clone((LWLINE *)lwgeom);
455  case CIRCSTRINGTYPE:
456  return (LWGEOM *)lwcircstring_clone((LWCIRCSTRING *)lwgeom);
457  case POLYGONTYPE:
458  return (LWGEOM *)lwpoly_clone((LWPOLY *)lwgeom);
459  case TRIANGLETYPE:
460  return (LWGEOM *)lwtriangle_clone((LWTRIANGLE *)lwgeom);
461  case COMPOUNDTYPE:
462  case CURVEPOLYTYPE:
463  case MULTICURVETYPE:
464  case MULTISURFACETYPE:
465  case MULTIPOINTTYPE:
466  case MULTILINETYPE:
467  case MULTIPOLYGONTYPE:
469  case TINTYPE:
470  case COLLECTIONTYPE:
471  return (LWGEOM *)lwcollection_clone((LWCOLLECTION *)lwgeom);
472  default:
473  lwerror("lwgeom_clone: Unknown geometry type: %s", lwtype_name(lwgeom->type));
474  return NULL;
475  }
476 }
#define LINETYPE
Definition: liblwgeom.h:86
#define MULTICURVETYPE
Definition: liblwgeom.h:95
LWLINE * lwline_clone(const LWLINE *lwgeom)
Definition: lwline.c:102
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
LWTRIANGLE * lwtriangle_clone(const LWTRIANGLE *lwgeom)
Definition: lwtriangle.c:99
#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
LWPOINT * lwpoint_clone(const LWPOINT *lwgeom)
Definition: lwpoint.c:239
#define TINTYPE
Definition: liblwgeom.h:99
LWCIRCSTRING * lwcircstring_clone(const LWCIRCSTRING *curve)
Definition: lwcircstring.c:125
#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
LWCOLLECTION * lwcollection_clone(const LWCOLLECTION *lwgeom)
Clone LWCOLLECTION object.
Definition: lwcollection.c:123
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
#define MULTILINETYPE
Definition: liblwgeom.h:89
LWPOLY * lwpoly_clone(const LWPOLY *lwgeom)
Definition: lwpoly.c:215
#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: