PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ lwgeom_scale()

void lwgeom_scale ( LWGEOM geom,
const POINT4D factor 
)

Definition at line 2074 of file lwgeom.c.

2075 {
2076  int type = geom->type;
2077  uint32_t i;
2078 
2079  switch(type)
2080  {
2081  /* Take advantage of fact tht pt/ln/circ/tri have same memory structure */
2082  case POINTTYPE:
2083  case LINETYPE:
2084  case CIRCSTRINGTYPE:
2085  case TRIANGLETYPE:
2086  {
2087  LWLINE *l = (LWLINE*)geom;
2088  ptarray_scale(l->points, factor);
2089  break;
2090  }
2091  case POLYGONTYPE:
2092  {
2093  LWPOLY *p = (LWPOLY*)geom;
2094  for( i = 0; i < p->nrings; i++ )
2095  ptarray_scale(p->rings[i], factor);
2096  break;
2097  }
2098  case CURVEPOLYTYPE:
2099  {
2100  LWCURVEPOLY *c = (LWCURVEPOLY*)geom;
2101  for( i = 0; i < c->nrings; i++ )
2102  lwgeom_scale(c->rings[i], factor);
2103  break;
2104  }
2105  default:
2106  {
2107  if( lwgeom_is_collection(geom) )
2108  {
2109  LWCOLLECTION *c = (LWCOLLECTION*)geom;
2110  for( i = 0; i < c->ngeoms; i++ )
2111  {
2112  lwgeom_scale(c->geoms[i], factor);
2113  }
2114  }
2115  else
2116  {
2117  lwerror("lwgeom_scale: unable to handle type '%s'", lwtype_name(type));
2118  }
2119  }
2120  }
2121 
2122  /* Recompute bbox if needed */
2123  if (geom->bbox)
2124  lwgeom_refresh_bbox(geom);
2125 }
#define CURVEPOLYTYPE
Definition: liblwgeom.h:126
#define LINETYPE
Definition: liblwgeom.h:118
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:117
#define POLYGONTYPE
Definition: liblwgeom.h:119
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:124
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:130
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: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:2074
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:595
LWGEOM ** geoms
Definition: liblwgeom.h:590
LWGEOM ** rings
Definition: liblwgeom.h:618
uint32_t nrings
Definition: liblwgeom.h:623
uint8_t type
Definition: liblwgeom.h:477
GBOX * bbox
Definition: liblwgeom.h:473
POINTARRAY * points
Definition: liblwgeom.h:498
POINTARRAY ** rings
Definition: liblwgeom.h:534
uint32_t nrings
Definition: liblwgeom.h:539

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: