PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ lwgeom_affine()

void lwgeom_affine ( LWGEOM geom,
const AFFINE affine 
)

Definition at line 1975 of file lwgeom.c.

1976{
1977 int type = geom->type;
1978 uint32_t i;
1979
1980 switch(type)
1981 {
1982 /* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
1983 case POINTTYPE:
1984 case LINETYPE:
1985 case CIRCSTRINGTYPE:
1986 case TRIANGLETYPE:
1987 {
1988 LWLINE *l = (LWLINE*)geom;
1989 ptarray_affine(l->points, affine);
1990 break;
1991 }
1992 case POLYGONTYPE:
1993 {
1994 LWPOLY *p = (LWPOLY*)geom;
1995 for( i = 0; i < p->nrings; i++ )
1996 ptarray_affine(p->rings[i], affine);
1997 break;
1998 }
1999 case CURVEPOLYTYPE:
2000 {
2001 LWCURVEPOLY *c = (LWCURVEPOLY*)geom;
2002 for( i = 0; i < c->nrings; i++ )
2003 lwgeom_affine(c->rings[i], affine);
2004 break;
2005 }
2006 default:
2007 {
2008 if( lwgeom_is_collection(geom) )
2009 {
2010 LWCOLLECTION *c = (LWCOLLECTION*)geom;
2011 for( i = 0; i < c->ngeoms; i++ )
2012 {
2013 lwgeom_affine(c->geoms[i], affine);
2014 }
2015 }
2016 else
2017 {
2018 lwerror("lwgeom_affine: unable to handle type '%s'", lwtype_name(type));
2019 }
2020 }
2021 }
2022
2023 /* Recompute bbox if needed */
2024 if (geom->bbox)
2025 lwgeom_refresh_bbox(geom);
2026}
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition lwutil.c:216
#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
#define TRIANGLETYPE
Definition liblwgeom.h:129
void ptarray_affine(POINTARRAY *pa, const AFFINE *affine)
Affine transform a pointarray.
Definition ptarray.c:1766
void lwgeom_refresh_bbox(LWGEOM *lwgeom)
Drop current bbox and calculate a fresh one.
Definition lwgeom.c:689
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition lwgeom.c:1079
void lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
Definition lwgeom.c:1975
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition lwutil.c:190
uint32_t ngeoms
Definition liblwgeom.h:566
LWGEOM ** geoms
Definition liblwgeom.h:561
LWGEOM ** rings
Definition liblwgeom.h:589
uint32_t nrings
Definition liblwgeom.h:594
uint8_t type
Definition liblwgeom.h:448
GBOX * bbox
Definition liblwgeom.h:444
POINTARRAY * points
Definition liblwgeom.h:469
POINTARRAY ** rings
Definition liblwgeom.h:505
uint32_t nrings
Definition liblwgeom.h:510

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, and LWGEOM::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: