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

Definition at line 1611 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().

1612 {
1613  int type = geom->type;
1614  int i;
1615 
1616  switch(type)
1617  {
1618  /* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
1619  case POINTTYPE:
1620  case LINETYPE:
1621  case CIRCSTRINGTYPE:
1622  case TRIANGLETYPE:
1623  {
1624  LWLINE *l = (LWLINE*)geom;
1625  ptarray_affine(l->points, affine);
1626  break;
1627  }
1628  case POLYGONTYPE:
1629  {
1630  LWPOLY *p = (LWPOLY*)geom;
1631  for( i = 0; i < p->nrings; i++ )
1632  ptarray_affine(p->rings[i], affine);
1633  break;
1634  }
1635  case CURVEPOLYTYPE:
1636  {
1637  LWCURVEPOLY *c = (LWCURVEPOLY*)geom;
1638  for( i = 0; i < c->nrings; i++ )
1639  lwgeom_affine(c->rings[i], affine);
1640  break;
1641  }
1642  default:
1643  {
1644  if( lwgeom_is_collection(geom) )
1645  {
1646  LWCOLLECTION *c = (LWCOLLECTION*)geom;
1647  for( i = 0; i < c->ngeoms; i++ )
1648  {
1649  lwgeom_affine(c->geoms[i], affine);
1650  }
1651  }
1652  else
1653  {
1654  lwerror("lwgeom_affine: unable to handle type '%s'", lwtype_name(type));
1655  }
1656  }
1657  }
1658 
1659 }
#define LINETYPE
Definition: liblwgeom.h:61
LWGEOM ** rings
Definition: liblwgeom.h:491
#define POLYGONTYPE
Definition: liblwgeom.h:62
#define CURVEPOLYTYPE
Definition: liblwgeom.h:69
#define TRIANGLETYPE
Definition: liblwgeom.h:73
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:164
LWGEOM ** geoms
Definition: liblwgeom.h:465
void lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
Definition: lwgeom.c:1611
POINTARRAY ** rings
Definition: liblwgeom.h:413
int nrings
Definition: liblwgeom.h:411
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:947
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
uint8_t type
Definition: liblwgeom.h:352
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:67
void ptarray_affine(POINTARRAY *pa, const AFFINE *affine)
Affine transform a pointarray.
Definition: ptarray.c:1692
POINTARRAY * points
Definition: liblwgeom.h:378

Here is the call graph for this function:

Here is the caller graph for this function: