PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwgeom_scale()

void lwgeom_scale ( LWGEOM geom,
const POINT4D factors 
)

Definition at line 2038 of file lwgeom.c.

2039 {
2040  int type = geom->type;
2041  uint32_t i;
2042 
2043  switch(type)
2044  {
2045  /* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
2046  case POINTTYPE:
2047  case LINETYPE:
2048  case CIRCSTRINGTYPE:
2049  case TRIANGLETYPE:
2050  {
2051  LWLINE *l = (LWLINE*)geom;
2052  ptarray_scale(l->points, factor);
2053  break;
2054  }
2055  case POLYGONTYPE:
2056  {
2057  LWPOLY *p = (LWPOLY*)geom;
2058  for( i = 0; i < p->nrings; i++ )
2059  ptarray_scale(p->rings[i], factor);
2060  break;
2061  }
2062  case CURVEPOLYTYPE:
2063  {
2064  LWCURVEPOLY *c = (LWCURVEPOLY*)geom;
2065  for( i = 0; i < c->nrings; i++ )
2066  lwgeom_scale(c->rings[i], factor);
2067  break;
2068  }
2069  default:
2070  {
2071  if( lwgeom_is_collection(geom) )
2072  {
2073  LWCOLLECTION *c = (LWCOLLECTION*)geom;
2074  for( i = 0; i < c->ngeoms; i++ )
2075  {
2076  lwgeom_scale(c->geoms[i], factor);
2077  }
2078  }
2079  else
2080  {
2081  lwerror("lwgeom_scale: unable to handle type '%s'", lwtype_name(type));
2082  }
2083  }
2084  }
2085 
2086  /* Recompute bbox if needed */
2087  if (geom->bbox)
2088  lwgeom_refresh_bbox(geom);
2089 }
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define LINETYPE
Definition: liblwgeom.h:86
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#define TRIANGLETYPE
Definition: liblwgeom.h:98
void ptarray_scale(POINTARRAY *pa, const POINT4D *factor)
WARNING, make sure you send in only 16-member double arrays or obviously things will go pear-shaped f...
Definition: ptarray.c:1983
void lwgeom_refresh_bbox(LWGEOM *lwgeom)
Drop current bbox and calculate a fresh one.
Definition: lwgeom.c:698
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1085
void lwgeom_scale(LWGEOM *geom, const POINT4D *factor)
Definition: lwgeom.c:2038
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
type
Definition: ovdump.py:41
uint32_t ngeoms
Definition: liblwgeom.h:510
LWGEOM ** geoms
Definition: liblwgeom.h:512
LWGEOM ** rings
Definition: liblwgeom.h:538
uint32_t nrings
Definition: liblwgeom.h:536
uint8_t type
Definition: liblwgeom.h:399
GBOX * bbox
Definition: liblwgeom.h:401
POINTARRAY * points
Definition: liblwgeom.h:425
POINTARRAY ** rings
Definition: liblwgeom.h:460
uint32_t nrings
Definition: liblwgeom.h:458
unsigned int uint32_t
Definition: uthash.h:78

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

Referenced by lwgeom_scale(), ST_Scale(), and test_lwgeom_scale().

Here is the call graph for this function:
Here is the caller graph for this function: