MobilityDB
1.0
|
Functions for temporal bounding boxes. More...
#include "general/tbox.h"
#include <assert.h>
#include <utils/builtins.h>
#include "general/tempcache.h"
#include "general/timestampset.h"
#include "general/period.h"
#include "general/periodset.h"
#include "general/rangetypes_ext.h"
#include "general/temporal.h"
#include "general/temporal_parser.h"
#include "general/temporal_util.h"
#include "general/tnumber_mathfuncs.h"
Macros | |
#define | MAXTBOXLEN 128 |
Buffer size for input and output of TBOX values. More... | |
Functions | |
TBOX * | tbox_make (bool hasx, bool hast, double xmin, double xmax, TimestampTz tmin, TimestampTz tmax) |
Constructs a newly allocated temporal box. More... | |
void | tbox_set (TBOX *box, bool hasx, bool hast, double xmin, double xmax, TimestampTz tmin, TimestampTz tmax) |
Set the temporal box from the argument values. More... | |
TBOX * | tbox_copy (const TBOX *box) |
Returns a copy of the temporal box value. More... | |
void | tbox_expand (TBOX *box1, const TBOX *box2) |
Expand the first temporal box value with the second one. More... | |
void | tbox_shift_tscale (TBOX *box, const Interval *start, const Interval *duration) |
Shift and/or scale the time span of the temporal box by the interval. More... | |
void | ensure_has_X_tbox (const TBOX *box) |
Ensure that the temporal box has X values. More... | |
void | ensure_has_T_tbox (const TBOX *box) |
Ensure that the temporal box has T values. More... | |
void | ensure_same_dimensionality_tbox (const TBOX *box1, const TBOX *box2) |
Ensure that the temporal boxes have the same dimensionality. More... | |
PGDLLEXPORT Datum | tbox_in (PG_FUNCTION_ARGS) |
Input function for temporal boxes. More... | |
static char * | tbox_to_string (const TBOX *box) |
Returns the string representation of the temporal box. More... | |
PGDLLEXPORT Datum | tbox_out (PG_FUNCTION_ARGS) |
Output function for temporal boxes. More... | |
PGDLLEXPORT Datum | tbox_constructor (PG_FUNCTION_ARGS) |
Construct a temporal box value from the arguments. More... | |
PGDLLEXPORT Datum | tbox_constructor_t (PG_FUNCTION_ARGS) |
Construct a temporal box value from the timestamps. More... | |
void | number_to_box (TBOX *box, Datum value, Oid basetypid) |
Transform the value to a temporal box (internal function only) More... | |
void | int_to_tbox_internal (TBOX *box, int i) |
Transform the integer to a temporal box (internal function) More... | |
PGDLLEXPORT Datum | int_to_tbox (PG_FUNCTION_ARGS) |
Transform the integer to a temporal box. More... | |
void | float_to_tbox_internal (TBOX *box, double d) |
Transform the float to a temporal box (internal function) More... | |
PGDLLEXPORT Datum | float_to_tbox (PG_FUNCTION_ARGS) |
Transform the float to a temporal box. More... | |
PGDLLEXPORT Datum | numeric_to_tbox (PG_FUNCTION_ARGS) |
Transform the numeric to a temporal box. More... | |
void | range_to_tbox_internal (TBOX *box, const RangeType *range) |
Transform the range to a temporal box (internal function) More... | |
PGDLLEXPORT Datum | range_to_tbox (PG_FUNCTION_ARGS) |
Transform the range to a temporal box. More... | |
void | timestamp_to_tbox_internal (TBOX *box, TimestampTz t) |
Transform the timestamp to a temporal box (internal function) More... | |
PGDLLEXPORT Datum | timestamp_to_tbox (PG_FUNCTION_ARGS) |
Transform the timestamp to a temporal box. More... | |
void | timestampset_to_tbox_internal (TBOX *box, const TimestampSet *ts) |
Transform the period set to a temporal box (internal function) More... | |
PGDLLEXPORT Datum | timestampset_to_tbox (PG_FUNCTION_ARGS) |
Transform the period set to a temporal box. More... | |
void | period_to_tbox_internal (TBOX *box, const Period *p) |
Transform the period to a temporal box (internal function) More... | |
PGDLLEXPORT Datum | period_to_tbox (PG_FUNCTION_ARGS) |
Transform the period to a temporal box. More... | |
void | periodset_to_tbox_internal (TBOX *box, const PeriodSet *ps) |
Transform the period set to a temporal box (internal function) More... | |
PGDLLEXPORT Datum | periodset_to_tbox (PG_FUNCTION_ARGS) |
Transform the period set to a temporal box. More... | |
PGDLLEXPORT Datum | int_timestamp_to_tbox (PG_FUNCTION_ARGS) |
Transform the integer and the timestamp to a temporal box. More... | |
PGDLLEXPORT Datum | float_timestamp_to_tbox (PG_FUNCTION_ARGS) |
Transform the float and the timestamp to a temporal box. More... | |
PGDLLEXPORT Datum | int_period_to_tbox (PG_FUNCTION_ARGS) |
Transform the integer and the period to a temporal box. More... | |
PGDLLEXPORT Datum | float_period_to_tbox (PG_FUNCTION_ARGS) |
Transform the float and the period to a temporal box. More... | |
PGDLLEXPORT Datum | range_timestamp_to_tbox (PG_FUNCTION_ARGS) |
Transform the range and the timestamp to a temporal box. More... | |
PGDLLEXPORT Datum | range_period_to_tbox (PG_FUNCTION_ARGS) |
Transform the range and the period to a temporal box. More... | |
PGDLLEXPORT Datum | tbox_to_floatrange (PG_FUNCTION_ARGS) |
Cast the temporal box value as a float range value. More... | |
PGDLLEXPORT Datum | tbox_to_period (PG_FUNCTION_ARGS) |
Cast the temporal box value as a period value. More... | |
PGDLLEXPORT Datum | tbox_hasx (PG_FUNCTION_ARGS) |
Returns true if the temporal box has X dimension. More... | |
PGDLLEXPORT Datum | tbox_hast (PG_FUNCTION_ARGS) |
Returns true if the temporal box has T dimension. More... | |
PGDLLEXPORT Datum | tbox_xmin (PG_FUNCTION_ARGS) |
Returns the minimum X value of the temporal box value. More... | |
PGDLLEXPORT Datum | tbox_xmax (PG_FUNCTION_ARGS) |
Returns the maximum X value of the temporal box value. More... | |
PGDLLEXPORT Datum | tbox_tmin (PG_FUNCTION_ARGS) |
Returns the minimum timestamp of the temporal box value. More... | |
PGDLLEXPORT Datum | tbox_tmax (PG_FUNCTION_ARGS) |
Returns the maximum timestamp of the temporal box value. More... | |
static TBOX * | tbox_expand_value_internal (const TBOX *box, const double d) |
Expand the value dimension of the temporal box with the double value (internal function) More... | |
PGDLLEXPORT Datum | tbox_expand_value (PG_FUNCTION_ARGS) |
Expand the value dimension of the temporal box with the double value. More... | |
static TBOX * | tbox_expand_temporal_internal (const TBOX *box, const Datum interval) |
Expand the time dimension of the temporal box with the interval value (internal function) More... | |
PGDLLEXPORT Datum | tbox_expand_temporal (PG_FUNCTION_ARGS) |
Expand the time dimension of the temporal box with the interval value. More... | |
PGDLLEXPORT Datum | tbox_set_precision (PG_FUNCTION_ARGS) |
Set the precision of the value dimension of the temporal box to the number of decimal places. More... | |
static void | tbox_tbox_flags (const TBOX *box1, const TBOX *box2, bool *hasx, bool *hast) |
Set the ouput variables with the values of the flags of the boxes. More... | |
static void | topo_tbox_tbox_init (const TBOX *box1, const TBOX *box2, bool *hasx, bool *hast) |
Set the ouput variables with the values of the flags of the boxes. More... | |
bool | contains_tbox_tbox_internal (const TBOX *box1, const TBOX *box2) |
Returns true if the first temporal box contains the second one (internal function) More... | |
PGDLLEXPORT Datum | contains_tbox_tbox (PG_FUNCTION_ARGS) |
Returns true if the first temporal box contains the second one. More... | |
bool | contained_tbox_tbox_internal (const TBOX *box1, const TBOX *box2) |
Returns true if the first temporal box is contained by the second one (internal function) More... | |
PGDLLEXPORT Datum | contained_tbox_tbox (PG_FUNCTION_ARGS) |
Returns true if the first temporal box is contained by the second one. More... | |
bool | overlaps_tbox_tbox_internal (const TBOX *box1, const TBOX *box2) |
Returns true if the temporal boxes overlap (internal function) More... | |
PGDLLEXPORT Datum | overlaps_tbox_tbox (PG_FUNCTION_ARGS) |
Returns true if the temporal boxes overlap. More... | |
bool | same_tbox_tbox_internal (const TBOX *box1, const TBOX *box2) |
Returns true if the temporal boxes are equal on the common dimensions (internal function) More... | |
PGDLLEXPORT Datum | same_tbox_tbox (PG_FUNCTION_ARGS) |
Returns true if the temporal boxes are equal on the common dimensions. More... | |
bool | adjacent_tbox_tbox_internal (const TBOX *box1, const TBOX *box2) |
Returns true if the temporal boxes are adjacent (internal function) More... | |
PGDLLEXPORT Datum | adjacent_tbox_tbox (PG_FUNCTION_ARGS) |
Returns true if the temporal boxes are adjacent. More... | |
bool | left_tbox_tbox_internal (const TBOX *box1, const TBOX *box2) |
Returns true if the first temporal box is strictly to the left of the second one (internal function) More... | |
PGDLLEXPORT Datum | left_tbox_tbox (PG_FUNCTION_ARGS) |
Returns true if the first temporal box is strictly to the left of the second one. More... | |
bool | overleft_tbox_tbox_internal (const TBOX *box1, const TBOX *box2) |
Returns true if the first temporal box does not extend to the right of the second one (internal function) More... | |
PGDLLEXPORT Datum | overleft_tbox_tbox (PG_FUNCTION_ARGS) |
Returns true if the first temporal box does not extend to the right of the second one. More... | |
bool | right_tbox_tbox_internal (const TBOX *box1, const TBOX *box2) |
Returns true if the first temporal box is strictly to the right of the second one (internal function) More... | |
PGDLLEXPORT Datum | right_tbox_tbox (PG_FUNCTION_ARGS) |
Returns true if the first temporal box is strictly to the right of the second one. More... | |
bool | overright_tbox_tbox_internal (const TBOX *box1, const TBOX *box2) |
Returns true if the first temporal box does not extend to the left of the second one (internal function) More... | |
PGDLLEXPORT Datum | overright_tbox_tbox (PG_FUNCTION_ARGS) |
Returns true if the first temporal box does not extend to the left of the second one. More... | |
bool | before_tbox_tbox_internal (const TBOX *box1, const TBOX *box2) |
Returns true if the first temporal box is strictly before the second one (internal function) More... | |
PGDLLEXPORT Datum | before_tbox_tbox (PG_FUNCTION_ARGS) |
Returns true if the first temporal box is strictly before the second one. More... | |
bool | overbefore_tbox_tbox_internal (const TBOX *box1, const TBOX *box2) |
Returns true if the first temporal box does not extend after the second one (internal function) More... | |
PGDLLEXPORT Datum | overbefore_tbox_tbox (PG_FUNCTION_ARGS) |
Returns true if the first temporal box does not extend after the second one. More... | |
bool | after_tbox_tbox_internal (const TBOX *box1, const TBOX *box2) |
Returns true if the first temporal box is strictly after the second one (internal function) More... | |
PGDLLEXPORT Datum | after_tbox_tbox (PG_FUNCTION_ARGS) |
Returns true if the first temporal box is strictly after the second one. More... | |
bool | overafter_tbox_tbox_internal (const TBOX *box1, const TBOX *box2) |
Returns true if the first temporal box does not extend before the second one (internal function) More... | |
PGDLLEXPORT Datum | overafter_tbox_tbox (PG_FUNCTION_ARGS) |
Returns true if the first temporal box does not extend before the second one. More... | |
TBOX * | tbox_union_internal (const TBOX *box1, const TBOX *box2) |
Returns the union of the temporal boxes (internal function) More... | |
PGDLLEXPORT Datum | tbox_union (PG_FUNCTION_ARGS) |
Returns the union of the temporal boxes. More... | |
TBOX * | tbox_intersection_internal (const TBOX *box1, const TBOX *box2) |
Returns the intersection of the temporal boxes (internal function) More... | |
PGDLLEXPORT Datum | tbox_intersection (PG_FUNCTION_ARGS) |
Returns the intersection of the temporal boxes. More... | |
PGDLLEXPORT Datum | tbox_extent_transfn (PG_FUNCTION_ARGS) |
Transition function for extent aggregation for boxes. More... | |
PGDLLEXPORT Datum | tbox_extent_combinefn (PG_FUNCTION_ARGS) |
Combine function for extent aggregation for boxes. More... | |
int | tbox_cmp_internal (const TBOX *box1, const TBOX *box2) |
Returns -1, 0, or 1 depending on whether the first temporal box value is less than, equal to, or greater than the second one (internal function). More... | |
PGDLLEXPORT Datum | tbox_cmp (PG_FUNCTION_ARGS) |
Returns -1, 0, or 1 depending on whether the first temporal box value is less than, equal, or greater than the second one. More... | |
PGDLLEXPORT Datum | tbox_lt (PG_FUNCTION_ARGS) |
Returns true if the first temporal box value is less than the second one. More... | |
PGDLLEXPORT Datum | tbox_le (PG_FUNCTION_ARGS) |
Returns true if the first temporal box value is less than or equal to the second one. More... | |
PGDLLEXPORT Datum | tbox_ge (PG_FUNCTION_ARGS) |
Returns true if the first temporal box value is greater than or equal to the second one. More... | |
PGDLLEXPORT Datum | tbox_gt (PG_FUNCTION_ARGS) |
Returns true if the first temporal box value is greater than the second one. More... | |
bool | tbox_eq_internal (const TBOX *box1, const TBOX *box2) |
Returns true if the two temporal boxes are equal (internal function) More... | |
PGDLLEXPORT Datum | tbox_eq (PG_FUNCTION_ARGS) |
Returns true if the two temporal boxes are equal. More... | |
PGDLLEXPORT Datum | tbox_ne (PG_FUNCTION_ARGS) |
Returns true if the two temporal boxes are different. More... | |
Functions for temporal bounding boxes.