PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lwgeom_affine()

void lwgeom_affine ( LWGEOM geom,
const AFFINE affine 
)

Definition at line 1704 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(), and lwgeom_split_wrapx().

1705 {
1706  int type = geom->type;
1707  int i;
1708 
1709  switch(type)
1710  {
1711  /* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
1712  case POINTTYPE:
1713  case LINETYPE:
1714  case CIRCSTRINGTYPE:
1715  case TRIANGLETYPE:
1716  {
1717  LWLINE *l = (LWLINE*)geom;
1718  ptarray_affine(l->points, affine);
1719  break;
1720  }
1721  case POLYGONTYPE:
1722  {
1723  LWPOLY *p = (LWPOLY*)geom;
1724  for( i = 0; i < p->nrings; i++ )
1725  ptarray_affine(p->rings[i], affine);
1726  break;
1727  }
1728  case CURVEPOLYTYPE:
1729  {
1730  LWCURVEPOLY *c = (LWCURVEPOLY*)geom;
1731  for( i = 0; i < c->nrings; i++ )
1732  lwgeom_affine(c->rings[i], affine);
1733  break;
1734  }
1735  default:
1736  {
1737  if( lwgeom_is_collection(geom) )
1738  {
1739  LWCOLLECTION *c = (LWCOLLECTION*)geom;
1740  for( i = 0; i < c->ngeoms; i++ )
1741  {
1742  lwgeom_affine(c->geoms[i], affine);
1743  }
1744  }
1745  else
1746  {
1747  lwerror("lwgeom_affine: unable to handle type '%s'", lwtype_name(type));
1748  }
1749  }
1750  }
1751 
1752 }
#define LINETYPE
Definition: liblwgeom.h:85
LWGEOM ** rings
Definition: liblwgeom.h:534
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define CURVEPOLYTYPE
Definition: liblwgeom.h:93
#define TRIANGLETYPE
Definition: liblwgeom.h:97
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
LWGEOM ** geoms
Definition: liblwgeom.h:508
void lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
Definition: lwgeom.c:1704
POINTARRAY ** rings
Definition: liblwgeom.h:456
int nrings
Definition: liblwgeom.h:454
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1004
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
uint8_t type
Definition: liblwgeom.h:395
type
Definition: ovdump.py:41
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:102
void ptarray_affine(POINTARRAY *pa, const AFFINE *affine)
Affine transform a pointarray.
Definition: ptarray.c:1753
POINTARRAY * points
Definition: liblwgeom.h:421
Here is the call graph for this function:
Here is the caller graph for this function: