PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwgeom_gt()

Datum lwgeom_gt ( PG_FUNCTION_ARGS  )

Definition at line 244 of file lwgeom_btree.c.

References error_if_srid_mismatch(), FALSE, FPeq, gserialized_get_gbox_p(), gserialized_get_srid(), lwgeom_cmp(), PG_FUNCTION_INFO_V1(), TRUE, GBOX::xmax, GBOX::xmin, GBOX::ymax, and GBOX::ymin.

Referenced by lwgeom_ge().

245 {
246  GSERIALIZED *geom1 = PG_GETARG_GSERIALIZED_P(0);
247  GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
248  GBOX box1;
249  GBOX box2;
250 
251  POSTGIS_DEBUG(2, "lwgeom_gt called");
252 
254 
255  gserialized_get_gbox_p(geom1, &box1);
256  gserialized_get_gbox_p(geom2, &box2);
257 
258  PG_FREE_IF_COPY(geom1, 0);
259  PG_FREE_IF_COPY(geom2, 1);
260 
261  if ( ! FPeq(box1.xmin , box2.xmin) )
262  {
263  if (box1.xmin > box2.xmin)
264  {
265  PG_RETURN_BOOL(TRUE);
266  }
267  }
268 
269  if ( ! FPeq(box1.ymin , box2.ymin) )
270  {
271  if (box1.ymin > box2.ymin)
272  {
273  PG_RETURN_BOOL(TRUE);
274  }
275  }
276 
277  if ( ! FPeq(box1.xmax , box2.xmax) )
278  {
279  if (box1.xmax > box2.xmax)
280  {
281  PG_RETURN_BOOL(TRUE);
282  }
283  }
284 
285  if ( ! FPeq(box1.ymax , box2.ymax) )
286  {
287  if (box1.ymax > box2.ymax)
288  {
289  PG_RETURN_BOOL(TRUE);
290  }
291  }
292 
293  PG_RETURN_BOOL(FALSE);
294 }
int gserialized_get_gbox_p(const GSERIALIZED *g, GBOX *box)
Read the bounding box off a serialization and calculate one if it is not already there.
Definition: g_serialized.c:371
double xmax
Definition: liblwgeom.h:277
void error_if_srid_mismatch(int srid1, int srid2)
Definition: lwutil.c:341
double ymin
Definition: liblwgeom.h:278
double xmin
Definition: liblwgeom.h:276
double ymax
Definition: liblwgeom.h:279
#define FALSE
Definition: dbfopen.c:168
#define FPeq(A, B)
Definition: box2d.c:11
#define TRUE
Definition: dbfopen.c:169
int32_t gserialized_get_srid(const GSERIALIZED *s)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
Definition: g_serialized.c:69
Here is the call graph for this function:
Here is the caller graph for this function: