PostGIS  2.2.7dev-r@@SVN_REVISION@@
void lwgeom_affine ( LWGEOM geom,
const AFFINE affine 
)

Definition at line 1691 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, and LWGEOM::type.

Referenced by LWGEOM_affine().

1692 {
1693  int type = geom->type;
1694  int i;
1695 
1696  switch(type)
1697  {
1698  /* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
1699  case POINTTYPE:
1700  case LINETYPE:
1701  case CIRCSTRINGTYPE:
1702  case TRIANGLETYPE:
1703  {
1704  LWLINE *l = (LWLINE*)geom;
1705  ptarray_affine(l->points, affine);
1706  break;
1707  }
1708  case POLYGONTYPE:
1709  {
1710  LWPOLY *p = (LWPOLY*)geom;
1711  for( i = 0; i < p->nrings; i++ )
1712  ptarray_affine(p->rings[i], affine);
1713  break;
1714  }
1715  case CURVEPOLYTYPE:
1716  {
1717  LWCURVEPOLY *c = (LWCURVEPOLY*)geom;
1718  for( i = 0; i < c->nrings; i++ )
1719  lwgeom_affine(c->rings[i], affine);
1720  break;
1721  }
1722  default:
1723  {
1724  if( lwgeom_is_collection(geom) )
1725  {
1726  LWCOLLECTION *c = (LWCOLLECTION*)geom;
1727  for( i = 0; i < c->ngeoms; i++ )
1728  {
1729  lwgeom_affine(c->geoms[i], affine);
1730  }
1731  }
1732  else
1733  {
1734  lwerror("lwgeom_affine: unable to handle type '%s'", lwtype_name(type));
1735  }
1736  }
1737  }
1738 
1739 }
#define LINETYPE
Definition: liblwgeom.h:71
LWGEOM ** rings
Definition: liblwgeom.h:519
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define CURVEPOLYTYPE
Definition: liblwgeom.h:79
#define TRIANGLETYPE
Definition: liblwgeom.h:83
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
LWGEOM ** geoms
Definition: liblwgeom.h:493
void lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
Definition: lwgeom.c:1691
POINTARRAY ** rings
Definition: liblwgeom.h:441
int nrings
Definition: liblwgeom.h:439
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:991
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
uint8_t type
Definition: liblwgeom.h:380
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
void ptarray_affine(POINTARRAY *pa, const AFFINE *affine)
Affine transform a pointarray.
Definition: ptarray.c:1753
POINTARRAY * points
Definition: liblwgeom.h:406

Here is the call graph for this function:

Here is the caller graph for this function: