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

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

188 {
189  GSERIALIZED *geom1 = PG_GETARG_GSERIALIZED_P(0);
190  GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
191  GBOX box1;
192  GBOX box2;
193 
194  POSTGIS_DEBUG(2, "lwgeom_ge called");
195 
197 
198  gserialized_get_gbox_p(geom1, &box1);
199  gserialized_get_gbox_p(geom2, &box2);
200 
201  PG_FREE_IF_COPY(geom1, 0);
202  PG_FREE_IF_COPY(geom2, 1);
203 
204  if ( ! FPeq(box1.xmin , box2.xmin) )
205  {
206  if (box1.xmin > box2.xmin)
207  {
208  PG_RETURN_BOOL(TRUE);
209  }
210  PG_RETURN_BOOL(FALSE);
211  }
212 
213  if ( ! FPeq(box1.ymin , box2.ymin) )
214  {
215  if (box1.ymin > box2.ymin)
216  {
217  PG_RETURN_BOOL(TRUE);
218  }
219  PG_RETURN_BOOL(FALSE);
220  }
221 
222  if ( ! FPeq(box1.xmax , box2.xmax) )
223  {
224  if (box1.xmax > box2.xmax)
225  {
226  PG_RETURN_BOOL(TRUE);
227  }
228  PG_RETURN_BOOL(FALSE);
229  }
230 
231  if ( ! FPeq(box1.ymax , box2.ymax) )
232  {
233  if (box1.ymax > box2.ymax)
234  {
235  PG_RETURN_BOOL(TRUE);
236  }
237  PG_RETURN_BOOL(FALSE);
238  }
239 
240  PG_RETURN_BOOL(TRUE);
241 }
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: