PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ LWGEOM_inside_circle_point()

Datum LWGEOM_inside_circle_point ( PG_FUNCTION_ARGS  )

Definition at line 1047 of file lwgeom_functions_basic.c.

References dumpnode::geom, lwgeom_as_lwpoint(), LWGEOM_collect(), lwgeom_from_gserialized(), lwgeom_is_empty(), lwpoint_free(), lwpoint_inside_circle(), and PG_FUNCTION_INFO_V1().

Referenced by LWGEOM_longitude_shift().

1048 {
1049  GSERIALIZED *geom;
1050  double cx = PG_GETARG_FLOAT8(1);
1051  double cy = PG_GETARG_FLOAT8(2);
1052  double rr = PG_GETARG_FLOAT8(3);
1053  LWPOINT *lwpoint;
1054  LWGEOM *lwgeom;
1055  int inside;
1056 
1057  geom = PG_GETARG_GSERIALIZED_P(0);
1058  lwgeom = lwgeom_from_gserialized(geom);
1059  lwpoint = lwgeom_as_lwpoint(lwgeom);
1060  if ( lwpoint == NULL || lwgeom_is_empty(lwgeom) )
1061  {
1062  PG_FREE_IF_COPY(geom, 0);
1063  PG_RETURN_NULL(); /* not a point */
1064  }
1065 
1066  inside = lwpoint_inside_circle(lwpoint, cx, cy, rr);
1067  lwpoint_free(lwpoint);
1068 
1069  PG_FREE_IF_COPY(geom, 0);
1070  PG_RETURN_BOOL(inside);
1071 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwpoint_free(LWPOINT *pt)
Definition: lwpoint.c:182
int lwpoint_inside_circle(const LWPOINT *p, double cx, double cy, double rad)
Definition: lwgeom.c:566
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition: lwgeom.c:80
LWGEOM * geom
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
Definition: lwgeom.c:1297
Here is the call graph for this function:
Here is the caller graph for this function: