MobilityDB  1.0
Data Structures | Macros | Functions
stbox.h File Reference

Functions for spatiotemporal bounding boxes. More...

#include <postgres.h>
#include <catalog/pg_type.h>
#include <utils/timestamp.h>
#include <liblwgeom.h>
#include "general/timetypes.h"
Include dependency graph for stbox.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  STBOX
 Structure to represent spatiotemporal boxes. More...
 

Macros

#define DatumGetSTboxP(X)   ((STBOX *) DatumGetPointer(X))
 
#define STboxPGetDatum(X)   PointerGetDatum(X)
 
#define PG_GETARG_STBOX_P(n)   DatumGetSTboxP(PG_GETARG_DATUM(n))
 
#define PG_RETURN_STBOX_P(x)   return STboxPGetDatum(x)
 

Functions

STBOXstbox_make (bool hasx, bool hasz, bool hast, bool geodetic, int32 srid, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, TimestampTz tmin, TimestampTz tmax)
 Constructs a newly allocated spatiotemporal box. More...
 
void stbox_set (STBOX *box, bool hasx, bool hasz, bool hast, bool geodetic, int32 srid, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, TimestampTz tmin, TimestampTz tmax)
 Set the spatiotemporal box from the argument values. More...
 
STBOXstbox_copy (const STBOX *box)
 Returns a copy of the spatiotemporal box. More...
 
void stbox_expand (STBOX *box1, const STBOX *box2)
 Expand the first spatiotemporal box with the second one. More...
 
void stbox_shift_tscale (STBOX *box, const Interval *start, const Interval *duration)
 Shift and/or scale the time span of the spatiotemporal box by the interval. More...
 
void ensure_has_X_stbox (const STBOX *box)
 Ensure that the temporal value has XY dimension. More...
 
void ensure_has_T_stbox (const STBOX *box)
 Ensure that the temporal value has T dimension. More...
 
Datum stbox_in (PG_FUNCTION_ARGS)
 Input function for spatiotemporal boxes. More...
 
Datum stbox_out (PG_FUNCTION_ARGS)
 Output function for spatiotemporal boxes. More...
 
Datum stbox_constructor_t (PG_FUNCTION_ARGS)
 Construct a spatiotemporal box from the arguments. More...
 
Datum stbox_constructor (PG_FUNCTION_ARGS)
 Construct a spatiotemporal box from the arguments. More...
 
Datum stbox_constructor_z (PG_FUNCTION_ARGS)
 Construct a spatiotemporal box from the arguments. More...
 
Datum stbox_constructor_zt (PG_FUNCTION_ARGS)
 Construct a spatiotemporal box from the arguments. More...
 
Datum geodstbox_constructor_t (PG_FUNCTION_ARGS)
 Construct a spatiotemporal box from the arguments. More...
 
Datum geodstbox_constructor (PG_FUNCTION_ARGS)
 Construct a spatiotemporal box from the arguments. More...
 
Datum geodstbox_constructor_z (PG_FUNCTION_ARGS)
 Construct a spatiotemporal box from the arguments. More...
 
Datum geodstbox_constructor_zt (PG_FUNCTION_ARGS)
 Construct a spatiotemporal box from the arguments. More...
 
Datum stbox_to_period (PG_FUNCTION_ARGS)
 Cast the spatiotemporal box as a period. More...
 
Datum stbox_to_box2d (PG_FUNCTION_ARGS)
 Cast the spatiotemporal box as a GBOX value for PostGIS. More...
 
Datum stbox_to_box3d (PG_FUNCTION_ARGS)
 Cast the spatiotemporal box as a BOX3D value for PostGIS. More...
 
BOX3D * stbox_to_box3d_internal (const STBOX *box)
 
GBOX * stbox_to_gbox (const STBOX *box)
 Cast the spatiotemporal box as a GBOX value for PostGIS. More...
 
Datum box2d_to_stbox (PG_FUNCTION_ARGS)
 Transform a box2d to a spatiotemporal box. More...
 
Datum box3d_to_stbox (PG_FUNCTION_ARGS)
 Transform a box3d to a spatiotemporal box. More...
 
Datum geo_to_stbox (PG_FUNCTION_ARGS)
 Transform a geometry/geography to a spatiotemporal box. More...
 
Datum timestamp_to_stbox (PG_FUNCTION_ARGS)
 Transform a timestampt to a spatiotemporal box. More...
 
Datum timestampset_to_stbox (PG_FUNCTION_ARGS)
 Transform a timestamp set to a spatiotemporal box. More...
 
Datum period_to_stbox (PG_FUNCTION_ARGS)
 Transform a period to a spatiotemporal box. More...
 
Datum periodset_to_stbox (PG_FUNCTION_ARGS)
 Transform a period set to a spatiotemporal box. More...
 
Datum geo_timestamp_to_stbox (PG_FUNCTION_ARGS)
 Transform a geometry/geography and a timestamp to a spatiotemporal box. More...
 
Datum geo_period_to_stbox (PG_FUNCTION_ARGS)
 Transform a geometry/geography and a period to a spatiotemporal box. More...
 
bool geo_to_stbox_internal (STBOX *box, const GSERIALIZED *gs)
 Transform a geometry/geography to a spatiotemporal box (internal function) More...
 
void timestamp_to_stbox_internal (STBOX *box, TimestampTz t)
 Transform a timestampt to a spatiotemporal box (internal function) More...
 
void timestampset_to_stbox_internal (STBOX *box, const TimestampSet *ps)
 Transform a timestamp set to a spatiotemporal box (internal function) More...
 
void period_to_stbox_internal (STBOX *box, const Period *p)
 Transform a period to a spatiotemporal box (internal function) More...
 
void periodset_to_stbox_internal (STBOX *box, const PeriodSet *ps)
 Transform a period set to a spatiotemporal box (internal function) More...
 
Datum stbox_hasx (PG_FUNCTION_ARGS)
 Returns true if the spatiotemporal box has X dimension. More...
 
Datum stbox_hasz (PG_FUNCTION_ARGS)
 Returns true if the spatiotemporal box has Z dimension. More...
 
Datum stbox_hast (PG_FUNCTION_ARGS)
 Returns true if the spatiotemporal box has T dimension. More...
 
Datum stbox_geodetic (PG_FUNCTION_ARGS)
 
Datum stbox_xmin (PG_FUNCTION_ARGS)
 Returns the minimum X value of the spatiotemporal box. More...
 
Datum stbox_xmax (PG_FUNCTION_ARGS)
 Returns the maximum X value of the spatiotemporal box. More...
 
Datum stbox_ymin (PG_FUNCTION_ARGS)
 Returns the minimum Y value of the spatiotemporal box. More...
 
Datum stbox_ymax (PG_FUNCTION_ARGS)
 Returns the maximum Y value of the spatiotemporal box. More...
 
Datum stbox_zmin (PG_FUNCTION_ARGS)
 Returns the minimum Z value of the spatiotemporal box. More...
 
Datum stbox_zmax (PG_FUNCTION_ARGS)
 Returns the maximum Z value of the spatiotemporal box. More...
 
Datum stbox_tmin (PG_FUNCTION_ARGS)
 Returns the minimum timestamp value of the spatiotemporal box. More...
 
Datum stbox_tmax (PG_FUNCTION_ARGS)
 Returns the maximum timestamp value of the spatiotemporal box. More...
 
Datum stbox_srid (PG_FUNCTION_ARGS)
 Returns the SRID of the spatiotemporal box. More...
 
Datum stbox_set_srid (PG_FUNCTION_ARGS)
 Sets the SRID of the spatiotemporal box. More...
 
Datum stbox_transform (PG_FUNCTION_ARGS)
 Transform a spatiotemporal box into another spatial reference system. More...
 
Datum stbox_expand_spatial (PG_FUNCTION_ARGS)
 Expand the spatial dimension of the spatiotemporal box with the double value. More...
 
Datum stbox_expand_temporal (PG_FUNCTION_ARGS)
 Expand the temporal dimension of the spatiotemporal box with the interval value. More...
 
Datum stbox_set_precision (PG_FUNCTION_ARGS)
 Sets the precision of the coordinates of the spatiotemporal box. More...
 
STBOXstbox_expand_spatial_internal (STBOX *box, double d)
 Expand the spatial dimension of the spatiotemporal box with the double value (internal function) More...
 
STBOXstbox_expand_temporal_internal (STBOX *box, Datum interval)
 Expand the temporal dimension of the spatiotemporal box with the interval value (internal function) More...
 
Datum contains_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box contains the second one. More...
 
Datum contained_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box is contained by the second one. More...
 
Datum overlaps_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the spatiotemporal boxes overlap. More...
 
Datum same_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the spatiotemporal boxes are equal on the common dimensions. More...
 
Datum adjacent_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the spatiotemporal boxes are adjacent. More...
 
bool contains_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first spatiotemporal box contains the second one (internal function) More...
 
bool contained_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first spatiotemporal box is contained by the second one (internal function) More...
 
bool overlaps_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the spatiotemporal boxes overlap (internal function) More...
 
bool same_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the spatiotemporal boxes are equal on the common dimensions (internal function) More...
 
bool adjacent_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the spatiotemporal boxes are adjacent (internal function) More...
 
Datum left_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box is strictly to the left of the second one. More...
 
Datum overleft_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box does not extend to the right of the second one. More...
 
Datum right_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box is strictly to the right of the second one. More...
 
Datum overright_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first spatio temporal box does not extend to the left of the second one. More...
 
Datum below_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box is strictly below of the second one. More...
 
Datum overbelow_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box does not extend above of the second one. More...
 
Datum above_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box is strictly above of the second one. More...
 
Datum overabove_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box does not extend below of the second one. More...
 
Datum front_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box is strictly in front of the second one. More...
 
Datum overfront_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box does not extend to the back of the second one. More...
 
Datum back_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box is strictly back of the second one. More...
 
Datum overback_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box does not extend to the front of the second one. More...
 
Datum before_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box is strictly before the second one. More...
 
Datum overbefore_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first temporal box does not extend after the second one. More...
 
Datum after_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box is strictly after the second one. More...
 
Datum overafter_stbox_stbox (PG_FUNCTION_ARGS)
 Returns true if the first temporal box does not extend before the second one. More...
 
bool left_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first spatiotemporal box is strictly to the left of the second one (internal function) More...
 
bool overleft_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first spatiotemporal box does not extend to the right of the second one (internal function) More...
 
bool right_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first spatiotemporal box is strictly to the right of the second one (internal function) More...
 
bool overright_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first spatio temporal box does not extend to the left of the second one (internal function) More...
 
bool below_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first spatiotemporal box is strictly below of the second one (internal function) More...
 
bool overbelow_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first spatiotemporal box does not extend above of the second one (internal function) More...
 
bool above_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first spatiotemporal box is strictly above of the second one (internal function) More...
 
bool overabove_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first spatiotemporal box does not extend below of the second one (internal function) More...
 
bool front_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first spatiotemporal box is strictly in front of the second one (internal function) More...
 
bool overfront_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first spatiotemporal box does not extend to the back of the second one (internal function) More...
 
bool back_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first spatiotemporal box is strictly back of the second one (internal function) More...
 
bool overback_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first spatiotemporal box does not extend to the front of the second one (internal function) More...
 
bool before_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first spatiotemporal box is strictly before the second one (internal function) More...
 
bool overbefore_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first temporal box does not extend after the second one (internal function) More...
 
bool after_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first spatiotemporal box is strictly after the second one (internal function) More...
 
bool overafter_stbox_stbox_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the first temporal box does not extend before the second one (internal function) More...
 
Datum stbox_union (PG_FUNCTION_ARGS)
 Returns the union of the spatiotemporal boxes. More...
 
Datum stbox_intersection (PG_FUNCTION_ARGS)
 Returns the intersection of the spatiotemporal boxes. More...
 
STBOXstbox_union_internal (const STBOX *box1, const STBOX *box2, bool strict)
 Returns the union of the spatiotemporal boxes (internal function) More...
 
STBOXstbox_intersection_internal (const STBOX *box1, const STBOX *box2)
 Returns the intersection of the spatiotemporal boxes (internal function) More...
 
Datum stbox_cmp (PG_FUNCTION_ARGS)
 Returns -1, 0, or 1 depending on whether the first spatiotemporal box is less than, equal, or greater than the second one. More...
 
Datum stbox_eq (PG_FUNCTION_ARGS)
 Returns true if the two spatiotemporal boxes are equal. More...
 
Datum stbox_ne (PG_FUNCTION_ARGS)
 Returns true if the two spatiotemporal boxes are different. More...
 
Datum stbox_lt (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box is less than the second one. More...
 
Datum stbox_le (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box is less than or equal to the second one. More...
 
Datum stbox_gt (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box is greater than the second one. More...
 
Datum stbox_ge (PG_FUNCTION_ARGS)
 Returns true if the first spatiotemporal box is greater than or equal to the second one. More...
 
int stbox_cmp_internal (const STBOX *box1, const STBOX *box2)
 Returns -1, 0, or 1 depending on whether the first spatiotemporal box is less than, equal, or greater than the second one (internal function) More...
 
bool stbox_eq_internal (const STBOX *box1, const STBOX *box2)
 Returns true if the two spatiotemporal boxes are equal (internal function) More...
 

Detailed Description

Functions for spatiotemporal bounding boxes.