PostGIS  3.2.2dev-r@@SVN_REVISION@@

◆ lwgeom_scale()

void lwgeom_scale ( LWGEOM geom,
const POINT4D factors 
)

Definition at line 2057 of file lwgeom.c.

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