MobilityDB  1.0
stbox.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * This MobilityDB code is provided under The PostgreSQL License.
4  *
5  * Copyright (c) 2016-2021, Université libre de Bruxelles and MobilityDB
6  * contributors
7  *
8  * Permission to use, copy, modify, and distribute this software and its
9  * documentation for any purpose, without fee, and without a written
10  * agreement is hereby granted, provided that the above copyright notice and
11  * this paragraph and the following two paragraphs appear in all copies.
12  *
13  * IN NO EVENT SHALL UNIVERSITE LIBRE DE BRUXELLES BE LIABLE TO ANY PARTY FOR
14  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
15  * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
16  * EVEN IF UNIVERSITE LIBRE DE BRUXELLES HAS BEEN ADVISED OF THE POSSIBILITY
17  * OF SUCH DAMAGE.
18  *
19  * UNIVERSITE LIBRE DE BRUXELLES SPECIFICALLY DISCLAIMS ANY WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
22  * AN "AS IS" BASIS, AND UNIVERSITE LIBRE DE BRUXELLES HAS NO OBLIGATIONS TO
23  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 
24  *
25  *****************************************************************************/
26 
32 #ifndef __STBOX_H__
33 #define __STBOX_H__
34 
35 #include <postgres.h>
36 #include <catalog/pg_type.h>
37 #if POSTGRESQL_VERSION_NUMBER < 110000
38 #include <utils/timestamp.h>
39 #endif
40 #include <liblwgeom.h>
41 
42 #include "general/timetypes.h"
43 
44 /*****************************************************************************
45  * Struct definition
46  *****************************************************************************/
47 
51 typedef struct
52 {
53  double xmin;
54  double xmax;
55  double ymin;
56  double ymax;
57  double zmin;
58  double zmax;
59  TimestampTz tmin;
60  TimestampTz tmax;
61  int32 srid;
62  int16 flags;
63 } STBOX;
64 
65 /*****************************************************************************
66  * fmgr macros
67  *****************************************************************************/
68 
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)
73 
74 /*****************************************************************************/
75 
76 /* Miscellaneous functions */
77 
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);
84 extern STBOX *stbox_copy(const STBOX *box);
85 extern void stbox_expand(STBOX *box1, const STBOX *box2);
86 extern void stbox_shift_tscale(STBOX *box, const Interval *start,
87  const Interval *duration);
88 
89 /* Parameter tests */
90 
91 extern void ensure_has_X_stbox(const STBOX *box);
92 extern void ensure_has_T_stbox(const STBOX *box);
93 
94 /* Input/Ouput functions */
95 
96 extern Datum stbox_in(PG_FUNCTION_ARGS);
97 extern Datum stbox_out(PG_FUNCTION_ARGS);
98 
99 /* Constructor functions */
100 
101 extern Datum stbox_constructor_t(PG_FUNCTION_ARGS);
102 extern Datum stbox_constructor(PG_FUNCTION_ARGS);
103 extern Datum stbox_constructor_z(PG_FUNCTION_ARGS);
104 extern Datum stbox_constructor_zt(PG_FUNCTION_ARGS);
105 extern Datum geodstbox_constructor_t(PG_FUNCTION_ARGS);
106 extern Datum geodstbox_constructor(PG_FUNCTION_ARGS);
107 extern Datum geodstbox_constructor_z(PG_FUNCTION_ARGS);
108 extern Datum geodstbox_constructor_zt(PG_FUNCTION_ARGS);
109 
110 /* Casting */
111 
112 extern Datum stbox_to_period(PG_FUNCTION_ARGS);
113 extern Datum stbox_to_box2d(PG_FUNCTION_ARGS);
114 extern Datum stbox_to_box3d(PG_FUNCTION_ARGS);
115 
116 extern BOX3D *stbox_to_box3d_internal(const STBOX *box);
117 extern GBOX *stbox_to_gbox(const STBOX *box);
118 
119 /* Transform a <Type> to a STBOX */
120 
121 extern Datum box2d_to_stbox(PG_FUNCTION_ARGS);
122 extern Datum box3d_to_stbox(PG_FUNCTION_ARGS);
123 extern Datum geo_to_stbox(PG_FUNCTION_ARGS);
124 extern Datum timestamp_to_stbox(PG_FUNCTION_ARGS);
125 extern Datum timestampset_to_stbox(PG_FUNCTION_ARGS);
126 extern Datum period_to_stbox(PG_FUNCTION_ARGS);
127 extern Datum periodset_to_stbox(PG_FUNCTION_ARGS);
128 extern Datum geo_timestamp_to_stbox(PG_FUNCTION_ARGS);
129 extern Datum geo_period_to_stbox(PG_FUNCTION_ARGS);
130 
131 extern bool geo_to_stbox_internal(STBOX *box, const GSERIALIZED *gs);
132 extern void timestamp_to_stbox_internal(STBOX *box, TimestampTz t);
133 extern void timestampset_to_stbox_internal(STBOX *box, const TimestampSet *ps);
134 extern void period_to_stbox_internal(STBOX *box, const Period *p);
135 extern void periodset_to_stbox_internal(STBOX *box, const PeriodSet *ps);
136 
137 /* Accessor functions */
138 
139 extern Datum stbox_hasx(PG_FUNCTION_ARGS);
140 extern Datum stbox_hasz(PG_FUNCTION_ARGS);
141 extern Datum stbox_hast(PG_FUNCTION_ARGS);
142 extern Datum stbox_geodetic(PG_FUNCTION_ARGS);
143 extern Datum stbox_xmin(PG_FUNCTION_ARGS);
144 extern Datum stbox_xmax(PG_FUNCTION_ARGS);
145 extern Datum stbox_ymin(PG_FUNCTION_ARGS);
146 extern Datum stbox_ymax(PG_FUNCTION_ARGS);
147 extern Datum stbox_zmin(PG_FUNCTION_ARGS);
148 extern Datum stbox_zmax(PG_FUNCTION_ARGS);
149 extern Datum stbox_tmin(PG_FUNCTION_ARGS);
150 extern Datum stbox_tmax(PG_FUNCTION_ARGS);
151 
152 /* SRID functions */
153 
154 extern Datum stbox_srid(PG_FUNCTION_ARGS);
155 extern Datum stbox_set_srid(PG_FUNCTION_ARGS);
156 extern Datum stbox_transform(PG_FUNCTION_ARGS);
157 
158 /* Transformation functions */
159 
160 extern Datum stbox_expand_spatial(PG_FUNCTION_ARGS);
161 extern Datum stbox_expand_temporal(PG_FUNCTION_ARGS);
162 extern Datum stbox_set_precision(PG_FUNCTION_ARGS);
163 
164 extern STBOX *stbox_expand_spatial_internal(STBOX *box, double d);
165 extern STBOX *stbox_expand_temporal_internal(STBOX *box, Datum interval);
166 
167 /* Topological operators */
168 
169 extern Datum contains_stbox_stbox(PG_FUNCTION_ARGS);
170 extern Datum contained_stbox_stbox(PG_FUNCTION_ARGS);
171 extern Datum overlaps_stbox_stbox(PG_FUNCTION_ARGS);
172 extern Datum same_stbox_stbox(PG_FUNCTION_ARGS);
173 extern Datum adjacent_stbox_stbox(PG_FUNCTION_ARGS);
174 
175 extern bool contains_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
176 extern bool contained_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
177 extern bool overlaps_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
178 extern bool same_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
179 extern bool adjacent_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
180 
181 /* Position operators */
182 
183 extern Datum left_stbox_stbox(PG_FUNCTION_ARGS);
184 extern Datum overleft_stbox_stbox(PG_FUNCTION_ARGS);
185 extern Datum right_stbox_stbox(PG_FUNCTION_ARGS);
186 extern Datum overright_stbox_stbox(PG_FUNCTION_ARGS);
187 extern Datum below_stbox_stbox(PG_FUNCTION_ARGS);
188 extern Datum overbelow_stbox_stbox(PG_FUNCTION_ARGS);
189 extern Datum above_stbox_stbox(PG_FUNCTION_ARGS);
190 extern Datum overabove_stbox_stbox(PG_FUNCTION_ARGS);
191 extern Datum front_stbox_stbox(PG_FUNCTION_ARGS);
192 extern Datum overfront_stbox_stbox(PG_FUNCTION_ARGS);
193 extern Datum back_stbox_stbox(PG_FUNCTION_ARGS);
194 extern Datum overback_stbox_stbox(PG_FUNCTION_ARGS);
195 extern Datum before_stbox_stbox(PG_FUNCTION_ARGS);
196 extern Datum overbefore_stbox_stbox(PG_FUNCTION_ARGS);
197 extern Datum after_stbox_stbox(PG_FUNCTION_ARGS);
198 extern Datum overafter_stbox_stbox(PG_FUNCTION_ARGS);
199 
200 extern bool left_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
201 extern bool overleft_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
202 extern bool right_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
203 extern bool overright_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
204 extern bool below_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
205 extern bool overbelow_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
206 extern bool above_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
207 extern bool overabove_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
208 extern bool front_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
209 extern bool overfront_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
210 extern bool back_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
211 extern bool overback_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
212 extern bool before_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
213 extern bool overbefore_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
214 extern bool after_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
215 extern bool overafter_stbox_stbox_internal(const STBOX *box1, const STBOX *box2);
216 
217 /* Set operators */
218 
219 extern Datum stbox_union(PG_FUNCTION_ARGS);
220 extern Datum stbox_intersection(PG_FUNCTION_ARGS);
221 
222 extern STBOX *stbox_union_internal(const STBOX *box1, const STBOX *box2,
223  bool strict);
224 extern STBOX *stbox_intersection_internal(const STBOX *box1, const STBOX *box2);
225 
226 /* Comparison functions */
227 
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);
235 
236 extern int stbox_cmp_internal(const STBOX *box1, const STBOX *box2);
237 extern bool stbox_eq_internal(const STBOX *box1, const STBOX *box2);
238 
239 /*****************************************************************************/
240 
241 #endif
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