PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ LWGEOM_SetEffectiveArea()

Datum LWGEOM_SetEffectiveArea ( PG_FUNCTION_ARGS  )

Definition at line 98 of file lwgeom_functions_analytic.c.

99 {
100  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
101  GSERIALIZED *result;
102  int type = gserialized_get_type(geom);
103  LWGEOM *in;
104  LWGEOM *out;
105  double area=0;
106  int set_area=0;
107 
108  if ( type == POINTTYPE || type == MULTIPOINTTYPE )
109  PG_RETURN_POINTER(geom);
110 
111  if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) )
112  area = PG_GETARG_FLOAT8(1);
113 
114  if ( (PG_NARGS()>2) && (!PG_ARGISNULL(2)) )
115  set_area = PG_GETARG_INT32(2);
116 
117  in = lwgeom_from_gserialized(geom);
118 
119  out = lwgeom_set_effective_area(in,set_area, area);
120  if ( ! out ) PG_RETURN_NULL();
121 
122  /* COMPUTE_BBOX TAINTING */
123  if ( in->bbox ) lwgeom_add_bbox(out);
124 
125  result = geometry_serialize(out);
126  lwgeom_free(out);
127  PG_FREE_IF_COPY(geom, 0);
128  PG_RETURN_POINTER(result);
129 }
LWGEOM * lwgeom_set_effective_area(const LWGEOM *igeom, int set_area, double trshld)
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
uint32_t gserialized_get_type(const GSERIALIZED *s)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
Definition: g_serialized.c:86
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:686
Datum area(PG_FUNCTION_ARGS)
type
Definition: ovdump.py:41
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
GBOX * bbox
Definition: liblwgeom.h:401

References area(), LWGEOM::bbox, geometry_serialize(), gserialized_get_type(), lwgeom_add_bbox(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_set_effective_area(), MULTIPOINTTYPE, POINTTYPE, and ovdump::type.

Here is the call graph for this function: