PostGIS  2.2.7dev-r@@SVN_REVISION@@
Datum lwgeom_lt ( PG_FUNCTION_ARGS  )

Definition at line 42 of file lwgeom_btree.c.

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

43 {
44  GSERIALIZED *geom1 = PG_GETARG_GSERIALIZED_P(0);
45  GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
46  GBOX box1;
47  GBOX box2;
48 
49  POSTGIS_DEBUG(2, "lwgeom_lt called");
50 
52 
53  POSTGIS_DEBUG(3, "lwgeom_lt passed getSRID test");
54 
55  gserialized_get_gbox_p(geom1, &box1);
56  gserialized_get_gbox_p(geom2, &box2);
57 
58  PG_FREE_IF_COPY(geom1, 0);
59  PG_FREE_IF_COPY(geom2, 1);
60 
61  POSTGIS_DEBUG(3, "lwgeom_lt getbox2d_p passed");
62 
63  if ( ! FPeq(box1.xmin , box2.xmin) )
64  {
65  if (box1.xmin < box2.xmin)
66  PG_RETURN_BOOL(TRUE);
67  }
68 
69  if ( ! FPeq(box1.ymin , box2.ymin) )
70  {
71  if (box1.ymin < box2.ymin)
72  PG_RETURN_BOOL(TRUE);
73  }
74 
75  if ( ! FPeq(box1.xmax , box2.xmax) )
76  {
77  if (box1.xmax < box2.xmax)
78  PG_RETURN_BOOL(TRUE);
79  }
80 
81  if ( ! FPeq(box1.ymax , box2.ymax) )
82  {
83  if (box1.ymax < box2.ymax)
84  PG_RETURN_BOOL(TRUE);
85  }
86 
87  PG_RETURN_BOOL(FALSE);
88 }
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: