PostGIS  2.5.7dev-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 482 of file lwgeom.c.

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  return (LWGEOM *)lwpoint_clone((LWPOINT *)lwgeom);
491  case LINETYPE:
492  return (LWGEOM *)lwline_clone((LWLINE *)lwgeom);
493  case CIRCSTRINGTYPE:
494  return (LWGEOM *)lwcircstring_clone((LWCIRCSTRING *)lwgeom);
495  case POLYGONTYPE:
496  return (LWGEOM *)lwpoly_clone((LWPOLY *)lwgeom);
497  case TRIANGLETYPE:
498  return (LWGEOM *)lwtriangle_clone((LWTRIANGLE *)lwgeom);
499  case COMPOUNDTYPE:
500  case CURVEPOLYTYPE:
501  case MULTICURVETYPE:
502  case MULTISURFACETYPE:
503  case MULTIPOINTTYPE:
504  case MULTILINETYPE:
505  case MULTIPOLYGONTYPE:
507  case TINTYPE:
508  case COLLECTIONTYPE:
509  return (LWGEOM *)lwcollection_clone((LWCOLLECTION *)lwgeom);
510  default:
511  lwerror("lwgeom_clone: Unknown geometry type: %s", lwtype_name(lwgeom->type));
512  return NULL;
513  }
514 }
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define MULTILINETYPE
Definition: liblwgeom.h:89
#define MULTISURFACETYPE
Definition: liblwgeom.h:96
#define LINETYPE
Definition: liblwgeom.h:86
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
#define TINTYPE
Definition: liblwgeom.h:99
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:97
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#define MULTICURVETYPE
Definition: liblwgeom.h:95
#define TRIANGLETYPE
Definition: liblwgeom.h:98
LWPOINT * lwpoint_clone(const LWPOINT *lwgeom)
Definition: lwpoint.c:239
LWLINE * lwline_clone(const LWLINE *lwgeom)
Definition: lwline.c:102
LWCOLLECTION * lwcollection_clone(const LWCOLLECTION *lwgeom)
Clone LWCOLLECTION object.
Definition: lwcollection.c:123
LWPOLY * lwpoly_clone(const LWPOLY *lwgeom)
Definition: lwpoly.c:213
LWTRIANGLE * lwtriangle_clone(const LWTRIANGLE *lwgeom)
Definition: lwtriangle.c:99
LWCIRCSTRING * lwcircstring_clone(const LWCIRCSTRING *curve)
Definition: lwcircstring.c:124
#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
uint8_t type
Definition: liblwgeom.h:399

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 LWPOINT::type.

Referenced by lwcollection_build_buffer(), lwcollection_clone(), lwcollection_extract(), lwcompound_construct_from_lwline(), lwgeom_as_curve(), lwgeom_as_multi(), lwgeom_chaikin(), lwgeom_homogenize(), lwgeom_segmentize2d(), lwgeom_segmentize_sphere(), lwgeom_set_effective_area(), lwpoint_locate_between_m(), RTreeMergeMultiLines(), test_clone(), and test_lwgeom_clone().

Here is the call graph for this function:
Here is the caller graph for this function: