PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ lwgeom_scale()

void lwgeom_scale ( LWGEOM geom,
const POINT4D factors 
)

Definition at line 2051 of file lwgeom.c.

2052 {
2053  int type = geom->type;
2054  uint32_t i;
2055 
2056  switch(type)
2057  {
2058  /* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
2059  case POINTTYPE:
2060  case LINETYPE:
2061  case CIRCSTRINGTYPE:
2062  case TRIANGLETYPE:
2063  {
2064  LWLINE *l = (LWLINE*)geom;
2065  ptarray_scale(l->points, factor);
2066  break;
2067  }
2068  case POLYGONTYPE:
2069  {
2070  LWPOLY *p = (LWPOLY*)geom;
2071  for( i = 0; i < p->nrings; i++ )
2072  ptarray_scale(p->rings[i], factor);
2073  break;
2074  }
2075  case CURVEPOLYTYPE:
2076  {
2077  LWCURVEPOLY *c = (LWCURVEPOLY*)geom;
2078  for( i = 0; i < c->nrings; i++ )
2079  lwgeom_scale(c->rings[i], factor);
2080  break;
2081  }
2082  default:
2083  {
2084  if( lwgeom_is_collection(geom) )
2085  {
2086  LWCOLLECTION *c = (LWCOLLECTION*)geom;
2087  for( i = 0; i < c->ngeoms; i++ )
2088  {
2089  lwgeom_scale(c->geoms[i], factor);
2090  }
2091  }
2092  else
2093  {
2094  lwerror("lwgeom_scale: unable to handle type '%s'", lwtype_name(type));
2095  }
2096  }
2097  }
2098 
2099  /* Recompute bbox if needed */
2100  if (geom->bbox)
2101  lwgeom_refresh_bbox(geom);
2102 }
#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:2058
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 can contain sub-geometries or not.
Definition: lwgeom.c:1097
void lwgeom_scale(LWGEOM *geom, const POINT4D *factor)
Definition: lwgeom.c:2051
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: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: