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

◆ lwgeom_affine()

void lwgeom_affine ( LWGEOM geom,
const AFFINE affine 
)

Definition at line 2111 of file lwgeom.c.

2112{
2113 int type = geom->type;
2114 uint32_t i;
2115
2116 switch(type)
2117 {
2118 /* Take advantage of fact that pt/ln/circ/tri have same memory structure */
2119 case POINTTYPE:
2120 case LINETYPE:
2121 case CIRCSTRINGTYPE:
2122 case TRIANGLETYPE:
2123 {
2124 LWLINE *l = (LWLINE*)geom;
2125 ptarray_affine(l->points, affine);
2126 break;
2127 }
2128 case POLYGONTYPE:
2129 {
2130 LWPOLY *p = (LWPOLY*)geom;
2131 for( i = 0; i < p->nrings; i++ )
2132 ptarray_affine(p->rings[i], affine);
2133 break;
2134 }
2135 case CURVEPOLYTYPE:
2136 {
2137 LWCURVEPOLY *c = (LWCURVEPOLY*)geom;
2138 for( i = 0; i < c->nrings; i++ )
2139 lwgeom_affine(c->rings[i], affine);
2140 break;
2141 }
2142 default:
2143 {
2144 if( lwgeom_is_collection(geom) )
2145 {
2146 LWCOLLECTION *c = (LWCOLLECTION*)geom;
2147 for( i = 0; i < c->ngeoms; i++ )
2148 {
2149 lwgeom_affine(c->geoms[i], affine);
2150 }
2151 }
2152 else
2153 {
2154 lwerror("lwgeom_affine: unable to handle type '%s'", lwtype_name(type));
2155 }
2156 }
2157 }
2158
2159 /* Recompute bbox if needed */
2160 if (geom->bbox)
2161 lwgeom_refresh_bbox(geom);
2162}
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: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
#define TRIANGLETYPE
Definition liblwgeom.h:115
void ptarray_affine(POINTARRAY *pa, const AFFINE *affine)
Affine transform a pointarray.
Definition ptarray.c:2033
void lwgeom_refresh_bbox(LWGEOM *lwgeom)
Drop current bbox and calculate a fresh one.
Definition lwgeom.c:735
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM contains sub-geometries or not This basically just checks that the struct ...
Definition lwgeom.c:1125
void lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
Definition lwgeom.c:2111
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
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, 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: