PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ lwgeom_affine()

void lwgeom_affine ( LWGEOM geom,
const AFFINE affine 
)

Definition at line 1997 of file lwgeom.c.

1998 {
1999  int type = geom->type;
2000  uint32_t i;
2001 
2002  switch(type)
2003  {
2004  /* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
2005  case POINTTYPE:
2006  case LINETYPE:
2007  case CIRCSTRINGTYPE:
2008  case TRIANGLETYPE:
2009  {
2010  LWLINE *l = (LWLINE*)geom;
2011  ptarray_affine(l->points, affine);
2012  break;
2013  }
2014  case POLYGONTYPE:
2015  {
2016  LWPOLY *p = (LWPOLY*)geom;
2017  for( i = 0; i < p->nrings; i++ )
2018  ptarray_affine(p->rings[i], affine);
2019  break;
2020  }
2021  case CURVEPOLYTYPE:
2022  {
2023  LWCURVEPOLY *c = (LWCURVEPOLY*)geom;
2024  for( i = 0; i < c->nrings; i++ )
2025  lwgeom_affine(c->rings[i], affine);
2026  break;
2027  }
2028  default:
2029  {
2030  if( lwgeom_is_collection(geom) )
2031  {
2032  LWCOLLECTION *c = (LWCOLLECTION*)geom;
2033  for( i = 0; i < c->ngeoms; i++ )
2034  {
2035  lwgeom_affine(c->geoms[i], affine);
2036  }
2037  }
2038  else
2039  {
2040  lwerror("lwgeom_affine: unable to handle type '%s'", lwtype_name(type));
2041  }
2042  }
2043  }
2044 
2045  /* Recompute bbox if needed */
2046  if (geom->bbox)
2047  lwgeom_refresh_bbox(geom);
2048 }
#define CURVEPOLYTYPE
Definition: liblwgeom.h:111
#define LINETYPE
Definition: liblwgeom.h:103
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:102
#define POLYGONTYPE
Definition: liblwgeom.h:104
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:109
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:115
void ptarray_affine(POINTARRAY *pa, const AFFINE *affine)
Affine transform a pointarray.
Definition: ptarray.c:1890
void lwgeom_refresh_bbox(LWGEOM *lwgeom)
Drop current bbox and calculate a fresh one.
Definition: lwgeom.c:707
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1097
void lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
Definition: lwgeom.c:1997
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:580
LWGEOM ** geoms
Definition: liblwgeom.h:575
LWGEOM ** rings
Definition: liblwgeom.h:603
uint32_t nrings
Definition: liblwgeom.h:608
uint8_t type
Definition: liblwgeom.h:462
GBOX * bbox
Definition: liblwgeom.h:458
POINTARRAY * points
Definition: liblwgeom.h:483
POINTARRAY ** rings
Definition: liblwgeom.h:519
uint32_t nrings
Definition: liblwgeom.h:524

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: