PostGIS  3.2.2dev-r@@SVN_REVISION@@

◆ lwgeom_affine()

void lwgeom_affine ( LWGEOM geom,
const AFFINE affine 
)

Definition at line 2003 of file lwgeom.c.

2004 {
2005  int type = geom->type;
2006  uint32_t i;
2007 
2008  switch(type)
2009  {
2010  /* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
2011  case POINTTYPE:
2012  case LINETYPE:
2013  case CIRCSTRINGTYPE:
2014  case TRIANGLETYPE:
2015  {
2016  LWLINE *l = (LWLINE*)geom;
2017  ptarray_affine(l->points, affine);
2018  break;
2019  }
2020  case POLYGONTYPE:
2021  {
2022  LWPOLY *p = (LWPOLY*)geom;
2023  for( i = 0; i < p->nrings; i++ )
2024  ptarray_affine(p->rings[i], affine);
2025  break;
2026  }
2027  case CURVEPOLYTYPE:
2028  {
2029  LWCURVEPOLY *c = (LWCURVEPOLY*)geom;
2030  for( i = 0; i < c->nrings; i++ )
2031  lwgeom_affine(c->rings[i], affine);
2032  break;
2033  }
2034  default:
2035  {
2036  if( lwgeom_is_collection(geom) )
2037  {
2038  LWCOLLECTION *c = (LWCOLLECTION*)geom;
2039  for( i = 0; i < c->ngeoms; i++ )
2040  {
2041  lwgeom_affine(c->geoms[i], affine);
2042  }
2043  }
2044  else
2045  {
2046  lwerror("lwgeom_affine: unable to handle type '%s'", lwtype_name(type));
2047  }
2048  }
2049  }
2050 
2051  /* Recompute bbox if needed */
2052  if (geom->bbox)
2053  lwgeom_refresh_bbox(geom);
2054 }
#define CURVEPOLYTYPE
Definition: liblwgeom.h:125
#define LINETYPE
Definition: liblwgeom.h:117
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:116
#define POLYGONTYPE
Definition: liblwgeom.h:118
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:123
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
#define TRIANGLETYPE
Definition: liblwgeom.h:129
void ptarray_affine(POINTARRAY *pa, const AFFINE *affine)
Affine transform a pointarray.
Definition: ptarray.c:1877
void lwgeom_refresh_bbox(LWGEOM *lwgeom)
Drop current bbox and calculate a fresh one.
Definition: lwgeom.c:690
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1080
void lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
Definition: lwgeom.c:2003
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
type
Definition: ovdump.py:42
uint32_t ngeoms
Definition: liblwgeom.h:594
LWGEOM ** geoms
Definition: liblwgeom.h:589
LWGEOM ** rings
Definition: liblwgeom.h:617
uint32_t nrings
Definition: liblwgeom.h:622
uint8_t type
Definition: liblwgeom.h:476
GBOX * bbox
Definition: liblwgeom.h:472
POINTARRAY * points
Definition: liblwgeom.h:497
POINTARRAY ** rings
Definition: liblwgeom.h:533
uint32_t nrings
Definition: liblwgeom.h:538

References LWGEOM::bbox, CIRCSTRINGTYPE, CURVEPOLYTYPE, LWCOLLECTION::geoms, LINETYPE, lwerror(), lwgeom_affine(), lwgeom_is_collection(), lwgeom_refresh_bbox(), lwtype_name(), LWCOLLECTION::ngeoms, LWPOLY::nrings, LWCURVEPOLY::nrings, LWLINE::points, POINTTYPE, POLYGONTYPE, ptarray_affine(), LWPOLY::rings, LWCURVEPOLY::rings, TRIANGLETYPE, LWGEOM::type, and ovdump::type.

Referenced by lwgeom_affine(), LWGEOM_affine(), lwgeom_solid_contains_lwgeom(), lwgeom_split_wrapx(), mvt_geom(), and ST_Scale().

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