PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ LWGEOM_SetEffectiveArea()

Datum LWGEOM_SetEffectiveArea ( PG_FUNCTION_ARGS  )

Definition at line 96 of file lwgeom_functions_analytic.c.

97{
98 GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
99 GSERIALIZED *result;
100 int type = gserialized_get_type(geom);
101 LWGEOM *in;
102 LWGEOM *out;
103 double area=0;
104 int set_area=0;
105
106 if ( type == POINTTYPE || type == MULTIPOINTTYPE )
107 PG_RETURN_POINTER(geom);
108
109 if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) )
110 area = PG_GETARG_FLOAT8(1);
111
112 if ( (PG_NARGS()>2) && (!PG_ARGISNULL(2)) )
113 set_area = PG_GETARG_INT32(2);
114
115 in = lwgeom_from_gserialized(geom);
116
117 out = lwgeom_set_effective_area(in,set_area, area);
118 if ( ! out ) PG_RETURN_NULL();
119
120 /* COMPUTE_BBOX TAINTING */
121 if ( in->bbox ) lwgeom_add_bbox(out);
122
123 result = geometry_serialize(out);
124 lwgeom_free(out);
125 PG_FREE_IF_COPY(geom, 0);
126 PG_RETURN_POINTER(result);
127}
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 *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
Definition gserialized.c:89
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1138
#define MULTIPOINTTYPE
Definition liblwgeom.h:119
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:116
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition lwgeom.c:677
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
GBOX * bbox
Definition liblwgeom.h:444

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

Here is the call graph for this function: