MobilityDB 1.3
Loading...
Searching...
No Matches
Macros | Functions
stbox.c File Reference

Functions for spatiotemporal bounding boxes. More...

#include "geo/stbox.h"
#include <assert.h>
#include <float.h>
#include <limits.h>
#include "utils/timestamp.h"
#include <lwgeodetic.h>
#include <meos.h>
#include <meos_internal_geo.h>
#include "temporal/postgres_types.h"
#include "temporal/set.h"
#include "temporal/span.h"
#include "temporal/spanset.h"
#include "temporal/type_inout.h"
#include "temporal/type_util.h"
#include "geo/meos_transform.h"
#include "geo/postgis_funcs.h"
#include "geo/tgeo.h"
#include "geo/tgeo_spatialfuncs.h"
#include "geo/tspatial_parser.h"

Macros

#define MAXGBOXLEN   256
 
#define MAXSTBOXLEN   256
 

Functions

bool above_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box is above the second one. More...
 
bool adjacent_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the spatiotemporal boxes are adjacent. More...
 
bool after_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box is after the second one. More...
 
bool back_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box is at the back of the second one. More...
 
bool before_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box is before the second one. More...
 
bool below_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box is below the second one. More...
 
STBoxbox3d_to_stbox (const BOX3D *box)
 Convert a BOX3D into a spatiotemporal box. More...
 
bool contained_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box is contained in the second one. More...
 
bool contains_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box contains the second one. More...
 
static bool ensure_valid_pos_stbox_stbox (const STBox *box1, const STBox *box2)
 Verify the conditions for a position operator. More...
 
bool front_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box is in front of the the second one. More...
 
void gbox_set_stbox (const GBOX *box, int32_t srid, STBox *result)
 Set the a spatiotemporal box in the last argument from the GBOX and the SRID. More...
 
STBoxgbox_to_stbox (const GBOX *box)
 Convert a GBOX into a spatiotemporal box. More...
 
bool geo_set_stbox (const GSERIALIZED *gs, STBox *box)
 Return in the last argument the spatiotemporal box of a geometry/geography. More...
 
STBoxgeo_stbox (const GSERIALIZED *gs)
 Convert a geometry/geography into a spatiotemporal box. More...
 
STBoxgeo_timestamptz_to_stbox (const GSERIALIZED *gs, TimestampTz t)
 Return a spatiotemporal box from a geometry/geography and a timestamptz. More...
 
STBoxgeo_to_stbox (const GSERIALIZED *gs)
 Convert a geometry/geography into a spatiotemporal box. More...
 
STBoxgeo_tstzspan_to_stbox (const GSERIALIZED *gs, const Span *s)
 Return a spatiotemporal box from a geometry/geography and a timestamptz span. More...
 
void geoarr_set_stbox (const Datum *values, int count, STBox *box)
 Return in the last argument a spatiotemporal box constructed from an array of geometries/geographies. More...
 
bool inter_stbox_stbox (const STBox *box1, const STBox *box2, STBox *result)
 Return in the last argument the intersection of two spatiotemporal boxes. More...
 
STBoxintersection_stbox_stbox (const STBox *box1, const STBox *box2)
 Return the intersection of the spatiotemporal boxes. More...
 
bool left_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box is to the left of the second one. More...
 
void ll2cart (const POINT2D *g, POINT3D *p)
 
bool overabove_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box does not extend below the second one. More...
 
bool overafter_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box is not before the second one. More...
 
bool overback_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box does not extend to the front of the second one. More...
 
bool overbefore_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box is not after the second one. More...
 
bool overbelow_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box does not extend above the second one. More...
 
bool overfront_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box does not extend to the back of the second one. More...
 
bool overlaps_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the spatiotemporal boxes overlap @csqlfn Overlaps_stbox_stbox() More...
 
bool overleft_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box does not extend to the right of the second one. More...
 
bool overright_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box does not extend to the left of the second one. More...
 
void point_get_coords (const GSERIALIZED *point, bool hasz, double *x, double *y, double *z)
 Get the coordinates from a geometry/geography point. More...
 
bool right_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box is to the right of the second one. More...
 
bool same_stbox_stbox (const STBox *box1, const STBox *box2)
 Return true if the spatiotemporal boxes are equal in the common dimensions. More...
 
bool spatial_set_stbox (Datum d, meosType basetype, STBox *box)
 Return in the last argument a spatiotemporal box constructed from a spatial base value. More...
 
double stbox_area (const STBox *box, bool spheroid)
 Return the area of a spatiotemporal box. More...
 
char * stbox_as_hexwkb (const STBox *box, uint8_t variant, size_t *size_out)
 Return the ASCII hex-encoded Well-Known Binary (HexWKB) representation of a spatiotemporal box. More...
 
uint8_t * stbox_as_wkb (const STBox *box, uint8_t variant, size_t *size_out)
 Return the Well-Known Binary (WKB) representation of a spatiotemporal box. More...
 
int stbox_cmp (const STBox *box1, const STBox *box2)
 Return -1, 0, or 1 depending on whether the first spatiotemporal box is less than, equal to, or greater than the second one. More...
 
STBoxstbox_copy (const STBox *box)
 Return a copy of a spatiotemporal box. More...
 
bool stbox_eq (const STBox *box1, const STBox *box2)
 Return true if the spatiotemporal boxes are equal. More...
 
void stbox_expand (const STBox *box1, STBox *box2)
 Return the second spatiotemporal box expanded with the first one. More...
 
STBoxstbox_expand_space (const STBox *box, double d)
 Return a spatiotemporal box with the space bounds expanded/decreased by a double. More...
 
STBoxstbox_expand_time (const STBox *box, const Interval *interv)
 Return a spatiotemporal box with the time span expanded/decreased by an interval. More...
 
STBoxstbox_from_hexwkb (const char *hexwkb)
 Return a spatiotemporal box from its ASCII hex-encoded Well-Known Binary (WKB) representation. More...
 
STBoxstbox_from_wkb (const uint8_t *wkb, size_t size)
 Return a spatiotemporal box from its Well-Known Binary (WKB) representation. More...
 
bool stbox_ge (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box is greater than or equal to the second one. More...
 
GSERIALIZEDstbox_geo (const STBox *box)
 Return a spatiotemporal box converted as a geometry/geography. More...
 
STBoxstbox_get_space (const STBox *box)
 Return a spatiotemporal box with only the space dimension @csqlfn Stbox_get_space() More...
 
bool stbox_gt (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box is greater than the second one. More...
 
bool stbox_hast (const STBox *box)
 Return true if a spatiotemporal box has time dimension. More...
 
bool stbox_hasx (const STBox *box)
 Return true if a spatiotemporal box has value dimension. More...
 
bool stbox_hasz (const STBox *box)
 Return true if a spatiotemporal box has Z dimension. More...
 
STBoxstbox_in (const char *str)
 Return a spatiotemporal box from its Well-Known Text (WKT) representation. More...
 
bool stbox_isgeodetic (const STBox *box)
 Return true if a spatiotemporal box is geodetic. More...
 
bool stbox_le (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box is less than or equal to the second one. More...
 
bool stbox_lt (const STBox *box1, const STBox *box2)
 Return true if the first spatiotemporal box is less than the second one. More...
 
STBoxstbox_make (bool hasx, bool hasz, bool geodetic, int32 srid, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, const Span *s)
 Return a spatiotemporal box from the arguments. More...
 
bool stbox_ne (const STBox *box1, const STBox *box2)
 Return true if the spatiotemporal boxes are different. More...
 
char * stbox_out (const STBox *box, int maxdd)
 Return the Well-Known Text (WKT) representation of a spatiotemporal box. More...
 
double stbox_perimeter (const STBox *box, bool spheroid)
 Return the permieter of the spatiotemporal box. More...
 
STBoxstbox_quad_split (const STBox *box, int *count)
 Return a spatiotemporal box split with respect to its space bounds in four quadrants (2D) or eight octants (3D) More...
 
STBoxstbox_round (const STBox *box, int maxdd)
 Return a spatiotemporal box with the precision of the coordinates set to a number of decimal places. More...
 
void stbox_round_set (const STBox *box, int maxdd, STBox *result)
 Return in the last argument a spatiotemporal box with the precision set to a number of decimal places. More...
 
void stbox_set (bool hasx, bool hasz, bool geodetic, int32 srid, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, const Span *s, STBox *box)
 Return in the last argument a spatiotemporal box constructed from the given arguments. More...
 
void stbox_set_box3d (const STBox *box, BOX3D *box3d)
 Return in the last argument a BOX3D constructed from a spatiotemporal box. More...
 
void stbox_set_gbox (const STBox *box, GBOX *gbox)
 Return in the last argument a GBOX constructed from a spatiotemporal box. More...
 
STBoxstbox_set_srid (const STBox *box, int32_t srid)
 Return a spatiotemporal box with the coordinates set to an SRID. More...
 
STBoxstbox_shift_scale_time (const STBox *box, const Interval *shift, const Interval *duration)
 Return a spatiotemporal box with the time span expanded and/or scaled by two intervals. More...
 
int32_t stbox_srid (const STBox *box)
 Return the SRID of a spatiotemporal box. More...
 
static void stbox_stbox_flags (const STBox *box1, const STBox *box2, bool *hasx, bool *hasz, bool *hast, bool *geodetic)
 Return the ouput variables initialized with the flag values of two boxes. More...
 
bool stbox_tmax (const STBox *box, TimestampTz *result)
 Return in the last argument the maximum T value of a spatiotemporal box. More...
 
bool stbox_tmax_inc (const STBox *box, bool *result)
 Return in the last argument whether the maximum T value of a spatiotemporal box is inclusive. More...
 
bool stbox_tmin (const STBox *box, TimestampTz *result)
 Return in the last argument the minimum T value of a spatiotemporal box. More...
 
bool stbox_tmin_inc (const STBox *box, bool *result)
 Return in the last argument whether the maximum T value of a spatiotemporal box is inclusive. More...
 
BOX3Dstbox_to_box3d (const STBox *box)
 Convert a spatiotemporal box into a BOX3D More...
 
GBOXstbox_to_gbox (const STBox *box)
 Convert a spatiotemporal box into a GBOX More...
 
GSERIALIZEDstbox_to_geo (const STBox *box)
 Return a spatiotemporal box converted as a geometry/geography. More...
 
Spanstbox_to_tstzspan (const STBox *box)
 Convert a spatiotemporal box into a timestamptz span. More...
 
static STBoxstbox_transf_pj (const STBox *box, int32_t srid_to, const LWPROJ *pj)
 Return a spatiotemporal box transformed to another SRID using a pipeline. More...
 
STBoxstbox_transform (const STBox *box, int32_t srid_to)
 Return a spatiotemporal box transformed to another SRID. More...
 
STBoxstbox_transform_pipeline (const STBox *box, const char *pipeline, int32_t srid_to, bool is_forward)
 Return a spatiotemporal box transformed to another SRID using a pipeline. More...
 
double stbox_volume (const STBox *box)
 Return the volume of a 3D spatiotemporal box. More...
 
bool stbox_xmax (const STBox *box, double *result)
 Return in the last argument the maximum X value of a spatiotemporal box. More...
 
bool stbox_xmin (const STBox *box, double *result)
 Return in the last argument the minimum X value of a spatiotemporal box. More...
 
bool stbox_ymax (const STBox *box, double *result)
 Return in the last argument the maximum Y value of a spatiotemporal box. More...
 
bool stbox_ymin (const STBox *box, double *result)
 Return in the last argument the minimum Y value of a spatiotemporal box. More...
 
bool stbox_zmax (const STBox *box, double *result)
 Return in the last argument the maximum Z value of a spatiotemporal box. More...
 
bool stbox_zmin (const STBox *box, double *result)
 Return in the last argument the minimum Z value of a spatiotemporal box. More...
 
STBoxstboxarr_round (const STBox *boxarr, int count, int maxdd)
 Return an array of spatiotemporal boxes with the precision of the coordinates set to a number of decimal places. More...
 
void timestamptz_set_stbox (TimestampTz t, STBox *box)
 Return in the last argument a spatiotemporal box constructed from a timestamptz. More...
 
STBoxtimestamptz_to_stbox (TimestampTz t)
 Convert a timestamptz into a spatiotemporal box. More...
 
static bool topo_stbox_stbox_init (const STBox *box1, const STBox *box2, bool *hasx, bool *hasz, bool *hast, bool *geodetic)
 Verify the conditions and set the ouput variables with the values of the flags of the boxes. More...
 
void tstzset_set_stbox (const Set *s, STBox *box)
 Return in the last argument a spatiotemporal box constructed from a timestamptz set. More...
 
STBoxtstzset_to_stbox (const Set *s)
 Convert a timestamptz set into a spatiotemporal box. More...
 
void tstzspan_set_stbox (const Span *s, STBox *box)
 Return in the last argument a spatiotemporal box constructed from a timestamptz span. More...
 
STBoxtstzspan_to_stbox (const Span *s)
 Convert a timestamptz span into a spatiotemporal box. More...
 
void tstzspanset_set_stbox (const SpanSet *ss, STBox *box)
 Return in the last argument a spatiotemporal box constructed from a timestamptz span set. More...
 
STBoxtstzspanset_to_stbox (const SpanSet *ss)
 Convert a timestamptz span set into a spatiotemporal box. More...
 
STBoxunion_stbox_stbox (const STBox *box1, const STBox *box2, bool strict)
 Return the union of the spatiotemporal boxes. More...
 

Detailed Description

Functions for spatiotemporal bounding boxes.