PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ lwgeom_scale()

void lwgeom_scale ( LWGEOM geom,
const POINT4D factors 
)

Definition at line 2028 of file lwgeom.c.

2029 {
2030  int type = geom->type;
2031  uint32_t i;
2032 
2033  switch(type)
2034  {
2035  /* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
2036  case POINTTYPE:
2037  case LINETYPE:
2038  case CIRCSTRINGTYPE:
2039  case TRIANGLETYPE:
2040  {
2041  LWLINE *l = (LWLINE*)geom;
2042  ptarray_scale(l->points, factor);
2043  break;
2044  }
2045  case POLYGONTYPE:
2046  {
2047  LWPOLY *p = (LWPOLY*)geom;
2048  for( i = 0; i < p->nrings; i++ )
2049  ptarray_scale(p->rings[i], factor);
2050  break;
2051  }
2052  case CURVEPOLYTYPE:
2053  {
2054  LWCURVEPOLY *c = (LWCURVEPOLY*)geom;
2055  for( i = 0; i < c->nrings; i++ )
2056  lwgeom_scale(c->rings[i], factor);
2057  break;
2058  }
2059  default:
2060  {
2061  if( lwgeom_is_collection(geom) )
2062  {
2063  LWCOLLECTION *c = (LWCOLLECTION*)geom;
2064  for( i = 0; i < c->ngeoms; i++ )
2065  {
2066  lwgeom_scale(c->geoms[i], factor);
2067  }
2068  }
2069  else
2070  {
2071  lwerror("lwgeom_scale: unable to handle type '%s'", lwtype_name(type));
2072  }
2073  }
2074  }
2075 
2076  /* Recompute bbox if needed */
2077  if (geom->bbox)
2078  lwgeom_refresh_bbox(geom);
2079 }
#define CURVEPOLYTYPE
Definition: liblwgeom.h:125
#define LINETYPE
Definition: liblwgeom.h:117
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:116
#define POLYGONTYPE
Definition: liblwgeom.h:118
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:123
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
#define TRIANGLETYPE
Definition: liblwgeom.h:129
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:690
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1080
void lwgeom_scale(LWGEOM *geom, const POINT4D *factor)
Definition: lwgeom.c:2028
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
type
Definition: ovdump.py:42
uint32_t ngeoms
Definition: liblwgeom.h:594
LWGEOM ** geoms
Definition: liblwgeom.h:589
LWGEOM ** rings
Definition: liblwgeom.h:617
uint32_t nrings
Definition: liblwgeom.h:622
uint8_t type
Definition: liblwgeom.h:476
GBOX * bbox
Definition: liblwgeom.h:472
POINTARRAY * points
Definition: liblwgeom.h:497
POINTARRAY ** rings
Definition: liblwgeom.h:533
uint32_t nrings
Definition: liblwgeom.h:538

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: