PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ lwgeom_scale()

void lwgeom_scale ( LWGEOM geom,
const POINT4D factors 
)

Definition at line 2137 of file lwgeom.c.

2138 {
2139  int type = geom->type;
2140  uint32_t i;
2141 
2142  switch(type)
2143  {
2144  /* Take advantage of fact that pt/ln/circ/tri have same memory structure */
2145  case POINTTYPE:
2146  case LINETYPE:
2147  case CIRCSTRINGTYPE:
2148  case TRIANGLETYPE:
2149  {
2150  LWLINE *l = (LWLINE*)geom;
2151  ptarray_scale(l->points, factor);
2152  break;
2153  }
2154  case POLYGONTYPE:
2155  {
2156  LWPOLY *p = (LWPOLY*)geom;
2157  for( i = 0; i < p->nrings; i++ )
2158  ptarray_scale(p->rings[i], factor);
2159  break;
2160  }
2161  case CURVEPOLYTYPE:
2162  {
2163  LWCURVEPOLY *c = (LWCURVEPOLY*)geom;
2164  for( i = 0; i < c->nrings; i++ )
2165  lwgeom_scale(c->rings[i], factor);
2166  break;
2167  }
2168  default:
2169  {
2170  if( lwgeom_is_collection(geom) )
2171  {
2172  LWCOLLECTION *c = (LWCOLLECTION*)geom;
2173  for( i = 0; i < c->ngeoms; i++ )
2174  {
2175  lwgeom_scale(c->geoms[i], factor);
2176  }
2177  }
2178  else
2179  {
2180  lwerror("lwgeom_scale: unable to handle type '%s'", lwtype_name(type));
2181  }
2182  }
2183  }
2184 
2185  /* Recompute bbox if needed */
2186  if (geom->bbox)
2187  lwgeom_refresh_bbox(geom);
2188 }
#define CURVEPOLYTYPE
Definition: liblwgeom.h:111
#define LINETYPE
Definition: liblwgeom.h:103
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:102
#define POLYGONTYPE
Definition: liblwgeom.h:104
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:109
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:115
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:2066
void lwgeom_refresh_bbox(LWGEOM *lwgeom)
Drop current bbox and calculate a fresh one.
Definition: lwgeom.c:707
int lwgeom_is_collection(const LWGEOM *geom)
Determine whether a LWGEOM contains sub-geometries or not This basically just checks that the struct ...
Definition: lwgeom.c:1097
void lwgeom_scale(LWGEOM *geom, const POINT4D *factor)
Definition: lwgeom.c:2137
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
type
Definition: ovdump.py:42
uint32_t ngeoms
Definition: liblwgeom.h:580
LWGEOM ** geoms
Definition: liblwgeom.h:575
LWGEOM ** rings
Definition: liblwgeom.h:603
uint32_t nrings
Definition: liblwgeom.h:608
uint8_t type
Definition: liblwgeom.h:462
GBOX * bbox
Definition: liblwgeom.h:458
POINTARRAY * points
Definition: liblwgeom.h:483
POINTARRAY ** rings
Definition: liblwgeom.h:519
uint32_t nrings
Definition: liblwgeom.h:524

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: