36 #include <catalog/pg_type.h> 37 #if POSTGRESQL_VERSION_NUMBER < 110000 38 #include <utils/timestamp.h> 40 #include <liblwgeom.h> 69 #define DatumGetSTboxP(X) ((STBOX *) DatumGetPointer(X)) 70 #define STboxPGetDatum(X) PointerGetDatum(X) 71 #define PG_GETARG_STBOX_P(n) DatumGetSTboxP(PG_GETARG_DATUM(n)) 72 #define PG_RETURN_STBOX_P(x) return STboxPGetDatum(x) 78 extern STBOX *
stbox_make(
bool hasx,
bool hasz,
bool hast,
bool geodetic,
79 int32 srid,
double xmin,
double xmax,
double ymin,
double ymax,
double zmin,
80 double zmax, TimestampTz tmin, TimestampTz tmax);
81 extern void stbox_set(
STBOX *box,
bool hasx,
bool hasz,
bool hast,
bool geodetic,
82 int32 srid,
double xmin,
double xmax,
double ymin,
double ymax,
double zmin,
83 double zmax, TimestampTz tmin, TimestampTz tmax);
87 const Interval *duration);
96 extern Datum
stbox_in(PG_FUNCTION_ARGS);
228 extern Datum
stbox_cmp(PG_FUNCTION_ARGS);
229 extern Datum
stbox_eq(PG_FUNCTION_ARGS);
230 extern Datum
stbox_ne(PG_FUNCTION_ARGS);
231 extern Datum
stbox_lt(PG_FUNCTION_ARGS);
232 extern Datum
stbox_le(PG_FUNCTION_ARGS);
233 extern Datum
stbox_gt(PG_FUNCTION_ARGS);
234 extern Datum
stbox_ge(PG_FUNCTION_ARGS);
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.
Definition: stbox.c:1960
GBOX * stbox_to_gbox(const STBOX *box)
Cast the spatiotemporal box as a GBOX value for PostGIS.
Definition: stbox.c:546
Structure to represent periods.
Definition: timetypes.h:52
Datum overback_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box does not extend to the front of the second one...
Definition: stbox.c:1613
Datum stbox_expand_spatial(PG_FUNCTION_ARGS)
Expand the spatial dimension of the spatiotemporal box with the double value.
Definition: stbox.c:1039
Datum box3d_to_stbox(PG_FUNCTION_ARGS)
Transform a box3d to a spatiotemporal box.
Definition: stbox.c:641
Datum timestampset_to_stbox(PG_FUNCTION_ARGS)
Transform a timestamp set to a spatiotemporal box.
Definition: stbox.c:753
Datum overafter_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first temporal box does not extend before the second one.
Definition: stbox.c:1709
STBOX * stbox_intersection_internal(const STBOX *box1, const STBOX *box2)
Returns the intersection of the spatiotemporal boxes (internal function)
Definition: stbox.c:1758
Datum stbox_constructor_t(PG_FUNCTION_ARGS)
Construct a spatiotemporal box from the arguments.
Definition: stbox.c:456
Datum stbox_ymax(PG_FUNCTION_ARGS)
Returns the maximum Y value of the spatiotemporal box.
Definition: stbox.c:949
Datum right_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box is strictly to the right of the second one...
Definition: stbox.c:1388
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...
Definition: stbox.c:1600
Datum stbox_to_period(PG_FUNCTION_ARGS)
Cast the spatiotemporal box as a period.
Definition: stbox.c:559
Datum geodstbox_constructor_z(PG_FUNCTION_ARGS)
Construct a spatiotemporal box from the arguments.
Definition: stbox.c:523
Datum stbox_geodetic(PG_FUNCTION_ARGS)
int32 srid
SRID.
Definition: stbox.h:61
Datum stbox_in(PG_FUNCTION_ARGS)
Input function for spatiotemporal boxes.
Definition: stbox.c:273
Datum geodstbox_constructor(PG_FUNCTION_ARGS)
Construct a spatiotemporal box from the arguments.
Definition: stbox.c:513
Datum stbox_xmax(PG_FUNCTION_ARGS)
Returns the maximum X value of the spatiotemporal box.
Definition: stbox.c:923
Datum geo_period_to_stbox(PG_FUNCTION_ARGS)
Transform a geometry/geography and a period to a spatiotemporal box.
Definition: stbox.c:838
Datum after_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box is strictly after the second one.
Definition: stbox.c:1685
double xmin
minimum x value
Definition: stbox.h:53
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 func...
Definition: stbox.c:1325
Structure to represent spatiotemporal boxes.
Definition: stbox.h:51
Datum stbox_constructor_zt(PG_FUNCTION_ARGS)
Construct a spatiotemporal box from the arguments.
Definition: stbox.c:488
Datum back_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box is strictly back of the second one.
Definition: stbox.c:1588
Datum period_to_stbox(PG_FUNCTION_ARGS)
Transform a period to a spatiotemporal box.
Definition: stbox.c:779
void ensure_has_T_stbox(const STBOX *box)
Ensure that the temporal value has T dimension.
Definition: stbox.c:240
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) ...
Definition: stbox.c:1673
Datum geo_to_stbox(PG_FUNCTION_ARGS)
Transform a geometry/geography to a spatiotemporal box.
Definition: stbox.c:698
TimestampTz tmin
minimum timestamp
Definition: stbox.h:59
BOX3D * stbox_to_box3d_internal(const STBOX *box)
Definition: stbox.c:586
Datum stbox_ymin(PG_FUNCTION_ARGS)
Returns the minimum Y value of the spatiotemporal box.
Definition: stbox.c:936
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) ...
Definition: stbox.c:1649
STBOX * stbox_union_internal(const STBOX *box1, const STBOX *box2, bool strict)
Returns the union of the spatiotemporal boxes (internal function)
Definition: stbox.c:1725
Datum stbox_hasz(PG_FUNCTION_ARGS)
Returns true if the spatiotemporal box has Z dimension.
Definition: stbox.c:874
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.
Definition: stbox.c:76
double xmax
maximum x value
Definition: stbox.h:54
bool stbox_eq_internal(const STBOX *box1, const STBOX *box2)
Returns true if the two spatiotemporal boxes are equal (internal function)
Definition: stbox.c:2029
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) ...
Definition: stbox.c:1475
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...
Definition: stbox.c:1400
Datum stbox_zmax(PG_FUNCTION_ARGS)
Returns the maximum Z value of the spatiotemporal box.
Definition: stbox.c:975
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) ...
Definition: stbox.c:1575
Datum same_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the spatiotemporal boxes are equal on the common dimensions.
Definition: stbox.c:1249
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) ...
Definition: stbox.c:1177
bool geo_to_stbox_internal(STBOX *box, const GSERIALIZED *gs)
Transform a geometry/geography to a spatiotemporal box (internal function)
Definition: stbox.c:654
Datum stbox_lt(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box is less than the second one.
Definition: stbox.c:1973
Datum stbox_gt(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box is greater than the second one.
Definition: stbox.c:2014
Datum stbox_ge(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box is greater than or equal to the second one...
Definition: stbox.c:2001
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...
Definition: stbox.c:1413
Datum geodstbox_constructor_zt(PG_FUNCTION_ARGS)
Construct a spatiotemporal box from the arguments.
Definition: stbox.c:533
double ymin
minimum y value
Definition: stbox.h:55
Structure to represent period sets.
Definition: timetypes.h:84
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 ...
Definition: stbox.c:1550
Datum periodset_to_stbox(PG_FUNCTION_ARGS)
Transform a period set to a spatiotemporal box.
Definition: stbox.c:805
Datum stbox_le(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box is less than or equal to the second one.
Definition: stbox.c:1987
Datum contains_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box contains the second one.
Definition: stbox.c:1165
Datum adjacent_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the spatiotemporal boxes are adjacent.
Definition: stbox.c:1296
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) ...
Definition: stbox.c:1697
Datum geodstbox_constructor_t(PG_FUNCTION_ARGS)
Construct a spatiotemporal box from the arguments.
Definition: stbox.c:501
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.
Definition: stbox.c:185
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) ...
Definition: stbox.c:1625
Datum stbox_to_box3d(PG_FUNCTION_ARGS)
Cast the spatiotemporal box as a BOX3D value for PostGIS.
Definition: stbox.c:611
Datum stbox_expand_temporal(PG_FUNCTION_ARGS)
Expand the temporal dimension of the spatiotemporal box with the interval value.
Definition: stbox.c:1067
void timestamp_to_stbox_internal(STBOX *box, TimestampTz t)
Transform a timestampt to a spatiotemporal box (internal function)
Definition: stbox.c:714
Datum stbox_ne(PG_FUNCTION_ARGS)
Returns true if the two spatiotemporal boxes are different.
Definition: stbox.c:2058
Functions for time types based on TimestampTz, that is, TimestampSet, Period, and PeriodSet...
Datum stbox_intersection(PG_FUNCTION_ARGS)
Returns the intersection of the spatiotemporal boxes.
Definition: stbox.c:1804
Datum left_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box is strictly to the left of the second one...
Definition: stbox.c:1338
void periodset_to_stbox_internal(STBOX *box, const PeriodSet *ps)
Transform a period set to a spatiotemporal box (internal function)
Definition: stbox.c:792
Datum above_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box is strictly above of the second one. ...
Definition: stbox.c:1488
Datum stbox_eq(PG_FUNCTION_ARGS)
Returns true if the two spatiotemporal boxes are equal.
Definition: stbox.c:2046
Datum stbox_tmax(PG_FUNCTION_ARGS)
Returns the maximum timestamp value of the spatiotemporal box.
Definition: stbox.c:1001
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 functi...
Definition: stbox.c:1450
Datum geo_timestamp_to_stbox(PG_FUNCTION_ARGS)
Transform a geometry/geography and a timestamp to a spatiotemporal box.
Definition: stbox.c:819
Structure to represent timestamp sets.
Definition: timetypes.h:73
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) ...
Definition: stbox.c:1425
TimestampTz tmax
maximum timestamp
Definition: stbox.h:60
Datum stbox_constructor_z(PG_FUNCTION_ARGS)
Construct a spatiotemporal box from the arguments.
Definition: stbox.c:478
Datum before_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box is strictly before the second one.
Definition: stbox.c:1637
Datum front_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box is strictly in front of the second one.
Definition: stbox.c:1538
Datum stbox_hast(PG_FUNCTION_ARGS)
Returns true if the spatiotemporal box has T dimension.
Definition: stbox.c:886
Datum stbox_to_box2d(PG_FUNCTION_ARGS)
Cast the spatiotemporal box as a GBOX value for PostGIS.
Definition: stbox.c:576
Datum stbox_set_srid(PG_FUNCTION_ARGS)
Sets the SRID of the spatiotemporal box.
Definition: tpoint_spatialfuncs.c:1574
Datum overfront_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box does not extend to the back of the second one...
Definition: stbox.c:1563
Datum stbox_constructor(PG_FUNCTION_ARGS)
Construct a spatiotemporal box from the arguments.
Definition: stbox.c:468
STBOX * stbox_expand_temporal_internal(STBOX *box, Datum interval)
Expand the temporal dimension of the spatiotemporal box with the interval value (internal function) ...
Definition: stbox.c:1051
Datum stbox_set_precision(PG_FUNCTION_ARGS)
Sets the precision of the coordinates of the spatiotemporal box.
Definition: stbox.c:1079
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 functio...
Definition: stbox.c:1525
Datum stbox_zmin(PG_FUNCTION_ARGS)
Returns the minimum Z value of the spatiotemporal box.
Definition: stbox.c:962
Datum timestamp_to_stbox(PG_FUNCTION_ARGS)
Transform a timestampt to a spatiotemporal box.
Definition: stbox.c:727
Datum stbox_union(PG_FUNCTION_ARGS)
Returns the union of the spatiotemporal boxes.
Definition: stbox.c:1745
Datum stbox_srid(PG_FUNCTION_ARGS)
Returns the SRID of the spatiotemporal box.
Definition: tpoint_spatialfuncs.c:1563
Datum overabove_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box does not extend below of the second one.
Definition: stbox.c:1513
STBOX * stbox_copy(const STBOX *box)
Returns a copy of the spatiotemporal box.
Definition: stbox.c:145
Datum overlaps_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the spatiotemporal boxes overlap.
Definition: stbox.c:1218
Datum overbefore_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first temporal box does not extend after the second one.
Definition: stbox.c:1661
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)
Definition: stbox.c:1885
Datum stbox_transform(PG_FUNCTION_ARGS)
Transform a spatiotemporal box into another spatial reference system.
Definition: tpoint_spatialfuncs.c:1789
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 functi...
Definition: stbox.c:1500
bool overlaps_stbox_stbox_internal(const STBOX *box1, const STBOX *box2)
Returns true if the spatiotemporal boxes overlap (internal function)
Definition: stbox.c:1199
Datum box2d_to_stbox(PG_FUNCTION_ARGS)
Transform a box2d to a spatiotemporal box.
Definition: stbox.c:628
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 fun...
Definition: stbox.c:1375
STBOX * stbox_expand_spatial_internal(STBOX *box, double d)
Expand the spatial dimension of the spatiotemporal box with the double value (internal function) ...
Definition: stbox.c:1018
void period_to_stbox_internal(STBOX *box, const Period *p)
Transform a period to a spatiotemporal box (internal function)
Definition: stbox.c:767
void ensure_has_X_stbox(const STBOX *box)
Ensure that the temporal value has XY dimension.
Definition: stbox.c:228
STBOX * stbox_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.
Definition: stbox.c:61
double ymax
maximum y value
Definition: stbox.h:56
Datum overleft_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box does not extend to the right of the second one...
Definition: stbox.c:1363
void stbox_expand(STBOX *box1, const STBOX *box2)
Expand the first spatiotemporal box with the second one.
Definition: stbox.c:159
double zmin
minimum z value
Definition: stbox.h:57
double zmax
maximum z value
Definition: stbox.h:58
Datum stbox_out(PG_FUNCTION_ARGS)
Output function for spatiotemporal boxes.
Definition: stbox.c:374
Datum stbox_hasx(PG_FUNCTION_ARGS)
Returns true if the spatiotemporal box has X dimension.
Definition: stbox.c:862
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) ...
Definition: stbox.c:1230
int16 flags
flags
Definition: stbox.h:62
Datum below_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box is strictly below of the second one. ...
Definition: stbox.c:1438
Datum contained_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box is contained by the second one.
Definition: stbox.c:1187
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...
Definition: stbox.c:1350
bool contains_stbox_stbox_internal(const STBOX *box1, const STBOX *box2)
Returns true if the first spatiotemporal box contains the second one (internal function) ...
Definition: stbox.c:1146
void timestampset_to_stbox_internal(STBOX *box, const TimestampSet *ps)
Transform a timestamp set to a spatiotemporal box (internal function)
Definition: stbox.c:740
Datum stbox_tmin(PG_FUNCTION_ARGS)
Returns the minimum timestamp value of the spatiotemporal box.
Definition: stbox.c:988
bool adjacent_stbox_stbox_internal(const STBOX *box1, const STBOX *box2)
Returns true if the spatiotemporal boxes are adjacent (internal function)
Definition: stbox.c:1261
Datum stbox_xmin(PG_FUNCTION_ARGS)
Returns the minimum X value of the spatiotemporal box.
Definition: stbox.c:910
Datum overbelow_stbox_stbox(PG_FUNCTION_ARGS)
Returns true if the first spatiotemporal box does not extend above of the second one.
Definition: stbox.c:1463