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

Definition at line 91 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.

92 {
93  GSERIALIZED *geom1 = PG_GETARG_GSERIALIZED_P(0);
94  GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
95  GBOX box1;
96  GBOX box2;
97 
98  POSTGIS_DEBUG(2, "lwgeom_le called");
99 
101 
102  gserialized_get_gbox_p(geom1, &box1);
103  gserialized_get_gbox_p(geom2, &box2);
104 
105  PG_FREE_IF_COPY(geom1, 0);
106  PG_FREE_IF_COPY(geom2, 1);
107 
108  if ( ! FPeq(box1.xmin , box2.xmin) )
109  {
110  if (box1.xmin < box2.xmin)
111  {
112  PG_RETURN_BOOL(TRUE);
113  }
114  PG_RETURN_BOOL(FALSE);
115  }
116 
117  if ( ! FPeq(box1.ymin , box2.ymin) )
118  {
119  if (box1.ymin < box2.ymin)
120  {
121  PG_RETURN_BOOL(TRUE);
122  }
123  PG_RETURN_BOOL(FALSE);
124  }
125 
126  if ( ! FPeq(box1.xmax , box2.xmax) )
127  {
128  if (box1.xmax < box2.xmax)
129  {
130  PG_RETURN_BOOL(TRUE);
131  }
132  PG_RETURN_BOOL(FALSE);
133  }
134 
135  if ( ! FPeq(box1.ymax , box2.ymax) )
136  {
137  if (box1.ymax < box2.ymax)
138  {
139  PG_RETURN_BOOL(TRUE);
140  }
141  PG_RETURN_BOOL(FALSE);
142  }
143 
144  PG_RETURN_BOOL(TRUE);
145 }
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: