PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ lwgeom_affine()

void lwgeom_affine ( LWGEOM geom,
const AFFINE affine 
)

Definition at line 1974 of file lwgeom.c.

1975 {
1976  int type = geom->type;
1977  uint32_t i;
1978 
1979  switch(type)
1980  {
1981  /* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
1982  case POINTTYPE:
1983  case LINETYPE:
1984  case CIRCSTRINGTYPE:
1985  case TRIANGLETYPE:
1986  {
1987  LWLINE *l = (LWLINE*)geom;
1988  ptarray_affine(l->points, affine);
1989  break;
1990  }
1991  case POLYGONTYPE:
1992  {
1993  LWPOLY *p = (LWPOLY*)geom;
1994  for( i = 0; i < p->nrings; i++ )
1995  ptarray_affine(p->rings[i], affine);
1996  break;
1997  }
1998  case CURVEPOLYTYPE:
1999  {
2000  LWCURVEPOLY *c = (LWCURVEPOLY*)geom;
2001  for( i = 0; i < c->nrings; i++ )
2002  lwgeom_affine(c->rings[i], affine);
2003  break;
2004  }
2005  default:
2006  {
2007  if( lwgeom_is_collection(geom) )
2008  {
2009  LWCOLLECTION *c = (LWCOLLECTION*)geom;
2010  for( i = 0; i < c->ngeoms; i++ )
2011  {
2012  lwgeom_affine(c->geoms[i], affine);
2013  }
2014  }
2015  else
2016  {
2017  lwerror("lwgeom_affine: unable to handle type '%s'", lwtype_name(type));
2018  }
2019  }
2020  }
2021 
2022  /* Recompute bbox if needed */
2023  if (geom->bbox)
2024  lwgeom_refresh_bbox(geom);
2025 }
#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:1815
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:1974
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: