PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwgeom_affine()

void lwgeom_affine ( LWGEOM geom,
const AFFINE affine 
)

Definition at line 1984 of file lwgeom.c.

1985 {
1986  int type = geom->type;
1987  uint32_t i;
1988 
1989  switch(type)
1990  {
1991  /* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
1992  case POINTTYPE:
1993  case LINETYPE:
1994  case CIRCSTRINGTYPE:
1995  case TRIANGLETYPE:
1996  {
1997  LWLINE *l = (LWLINE*)geom;
1998  ptarray_affine(l->points, affine);
1999  break;
2000  }
2001  case POLYGONTYPE:
2002  {
2003  LWPOLY *p = (LWPOLY*)geom;
2004  for( i = 0; i < p->nrings; i++ )
2005  ptarray_affine(p->rings[i], affine);
2006  break;
2007  }
2008  case CURVEPOLYTYPE:
2009  {
2010  LWCURVEPOLY *c = (LWCURVEPOLY*)geom;
2011  for( i = 0; i < c->nrings; i++ )
2012  lwgeom_affine(c->rings[i], affine);
2013  break;
2014  }
2015  default:
2016  {
2017  if( lwgeom_is_collection(geom) )
2018  {
2019  LWCOLLECTION *c = (LWCOLLECTION*)geom;
2020  for( i = 0; i < c->ngeoms; i++ )
2021  {
2022  lwgeom_affine(c->geoms[i], affine);
2023  }
2024  }
2025  else
2026  {
2027  lwerror("lwgeom_affine: unable to handle type '%s'", lwtype_name(type));
2028  }
2029  }
2030  }
2031 
2032  /* Recompute bbox if needed */
2033  if (geom->bbox)
2034  lwgeom_refresh_bbox(geom);
2035 }
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define LINETYPE
Definition: liblwgeom.h:86
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
#define POLYGONTYPE
Definition: liblwgeom.h:87
#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 TRIANGLETYPE
Definition: liblwgeom.h:98
void ptarray_affine(POINTARRAY *pa, const AFFINE *affine)
Affine transform a pointarray.
Definition: ptarray.c:1796
void lwgeom_refresh_bbox(LWGEOM *lwgeom)
Drop current bbox and calculate a fresh one.
Definition: lwgeom.c:698
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1085
void lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
Definition: lwgeom.c:1984
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
type
Definition: ovdump.py:41
uint32_t ngeoms
Definition: liblwgeom.h:510
LWGEOM ** geoms
Definition: liblwgeom.h:512
LWGEOM ** rings
Definition: liblwgeom.h:538
uint32_t nrings
Definition: liblwgeom.h:536
uint8_t type
Definition: liblwgeom.h:399
GBOX * bbox
Definition: liblwgeom.h:401
POINTARRAY * points
Definition: liblwgeom.h:425
POINTARRAY ** rings
Definition: liblwgeom.h:460
uint32_t nrings
Definition: liblwgeom.h:458
unsigned int uint32_t
Definition: uthash.h:78

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_split_wrapx(), mvt_geom(), and ST_Scale().

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