PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwgeom_affine()

void lwgeom_affine ( LWGEOM geom,
const AFFINE affine 
)

Definition at line 1735 of file lwgeom.c.

References CIRCSTRINGTYPE, CURVEPOLYTYPE, LWCOLLECTION::geoms, LINETYPE, lwerror(), lwgeom_is_collection(), lwtype_name(), LWCOLLECTION::ngeoms, LWPOLY::nrings, LWCURVEPOLY::nrings, LWLINE::points, POINTTYPE, POLYGONTYPE, ptarray_affine(), LWPOLY::rings, LWCURVEPOLY::rings, TRIANGLETYPE, ovdump::type, and LWGEOM::type.

Referenced by LWGEOM_affine(), lwgeom_split_wrapx(), and mvt_geom().

1736 {
1737  int type = geom->type;
1738  int i;
1739 
1740  switch(type)
1741  {
1742  /* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
1743  case POINTTYPE:
1744  case LINETYPE:
1745  case CIRCSTRINGTYPE:
1746  case TRIANGLETYPE:
1747  {
1748  LWLINE *l = (LWLINE*)geom;
1749  ptarray_affine(l->points, affine);
1750  break;
1751  }
1752  case POLYGONTYPE:
1753  {
1754  LWPOLY *p = (LWPOLY*)geom;
1755  for( i = 0; i < p->nrings; i++ )
1756  ptarray_affine(p->rings[i], affine);
1757  break;
1758  }
1759  case CURVEPOLYTYPE:
1760  {
1761  LWCURVEPOLY *c = (LWCURVEPOLY*)geom;
1762  for( i = 0; i < c->nrings; i++ )
1763  lwgeom_affine(c->rings[i], affine);
1764  break;
1765  }
1766  default:
1767  {
1768  if( lwgeom_is_collection(geom) )
1769  {
1770  LWCOLLECTION *c = (LWCOLLECTION*)geom;
1771  for( i = 0; i < c->ngeoms; i++ )
1772  {
1773  lwgeom_affine(c->geoms[i], affine);
1774  }
1775  }
1776  else
1777  {
1778  lwerror("lwgeom_affine: unable to handle type '%s'", lwtype_name(type));
1779  }
1780  }
1781  }
1782 
1783 }
#define LINETYPE
Definition: liblwgeom.h:86
LWGEOM ** rings
Definition: liblwgeom.h:535
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define TRIANGLETYPE
Definition: liblwgeom.h:98
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
LWGEOM ** geoms
Definition: liblwgeom.h:509
void lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
Definition: lwgeom.c:1735
POINTARRAY ** rings
Definition: liblwgeom.h:457
int nrings
Definition: liblwgeom.h:455
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1040
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
uint8_t type
Definition: liblwgeom.h:396
type
Definition: ovdump.py:41
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
void ptarray_affine(POINTARRAY *pa, const AFFINE *affine)
Affine transform a pointarray.
Definition: ptarray.c:1800
POINTARRAY * points
Definition: liblwgeom.h:422
Here is the call graph for this function:
Here is the caller graph for this function: