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

◆ lwgeom_affine()

void lwgeom_affine ( LWGEOM geom,
const AFFINE affine 
)
extern

Definition at line 2083 of file lwgeom.c.

2084{
2085 int type = geom->type;
2086 uint32_t i;
2087
2088 switch(type)
2089 {
2090 /* Take advantage of fact that pt/ln/circ/tri have same memory structure */
2091 case POINTTYPE:
2092 case LINETYPE:
2093 case CIRCSTRINGTYPE:
2094 case TRIANGLETYPE:
2095 {
2096 LWLINE *l = (LWLINE*)geom;
2097 ptarray_affine(l->points, affine);
2098 break;
2099 }
2100 case POLYGONTYPE:
2101 {
2102 LWPOLY *p = (LWPOLY*)geom;
2103 for( i = 0; i < p->nrings; i++ )
2104 ptarray_affine(p->rings[i], affine);
2105 break;
2106 }
2107 case CURVEPOLYTYPE:
2108 {
2109 LWCURVEPOLY *c = (LWCURVEPOLY*)geom;
2110 for( i = 0; i < c->nrings; i++ )
2111 lwgeom_affine(c->rings[i], affine);
2112 break;
2113 }
2114 default:
2115 {
2116 if( lwgeom_is_collection(geom) )
2117 {
2118 LWCOLLECTION *c = (LWCOLLECTION*)geom;
2119 for( i = 0; i < c->ngeoms; i++ )
2120 {
2121 lwgeom_affine(c->geoms[i], affine);
2122 }
2123 }
2124 else
2125 {
2126 lwerror("lwgeom_affine: unable to handle type '%s'", lwtype_name(type));
2127 }
2128 }
2129 }
2130
2131 /* Recompute bbox if needed */
2132 if (geom->bbox)
2133 lwgeom_refresh_bbox(geom);
2134}
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:2021
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 contains sub-geometries or not This basically just checks that the struct ...
Definition lwgeom.c:1097
void lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
Definition lwgeom.c:2083
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: