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

◆ LWGEOM_SetEffectiveArea()

Datum LWGEOM_SetEffectiveArea ( PG_FUNCTION_ARGS  )

Definition at line 90 of file lwgeom_functions_analytic.c.

91{
92 GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
94 int type = gserialized_get_type(geom);
95 LWGEOM *in;
96 LWGEOM *out;
97 double area=0;
98 int set_area=0;
99
100 if ( type == POINTTYPE || type == MULTIPOINTTYPE )
101 PG_RETURN_POINTER(geom);
102
103 if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) )
104 area = PG_GETARG_FLOAT8(1);
105
106 if ( (PG_NARGS()>2) && (!PG_ARGISNULL(2)) )
107 set_area = PG_GETARG_INT32(2);
108
109 in = lwgeom_from_gserialized(geom);
110
111 out = lwgeom_set_effective_area(in,set_area, area);
112 if ( ! out ) PG_RETURN_NULL();
113
114 /* COMPUTE_BBOX TAINTING */
115 if ( in->bbox ) lwgeom_add_bbox(out);
116
117 result = geometry_serialize(out);
118 lwgeom_free(out);
119 PG_FREE_IF_COPY(geom, 0);
120 PG_RETURN_POINTER(result);
121}
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition cu_print.c:267
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,...
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
#define MULTIPOINTTYPE
Definition liblwgeom.h:105
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:102
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition lwgeom.c:723
GBOX * bbox
Definition liblwgeom.h:458

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

Here is the call graph for this function: