MobilityDB 1.3
Loading...
Searching...
No Matches
tgeo_tile.h
Go to the documentation of this file.
1/*****************************************************************************
2 *
3 * This MobilityDB code is provided under The PostgreSQL License.
4 * Copyright (c) 2016-2025, Université libre de Bruxelles and MobilityDB
5 * contributors
6 *
7 * MobilityDB includes portions of PostGIS version 3 source code released
8 * under the GNU General Public License (GPLv2 or later).
9 * Copyright (c) 2001-2025, PostGIS contributors
10 *
11 * Permission to use, copy, modify, and distribute this software and its
12 * documentation for any purpose, without fee, and without a written
13 * agreement is hereby granted, provided that the above copyright notice and
14 * this paragraph and the following two paragraphs appear in all copies.
15 *
16 * IN NO EVENT SHALL UNIVERSITE LIBRE DE BRUXELLES BE LIABLE TO ANY PARTY FOR
17 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
18 * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
19 * EVEN IF UNIVERSITE LIBRE DE BRUXELLES HAS BEEN ADVISED OF THE POSSIBILITY
20 * OF SUCH DAMAGE.
21 *
22 * UNIVERSITE LIBRE DE BRUXELLES SPECIFICALLY DISCLAIMS ANY WARRANTIES,
23 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
25 * AN "AS IS" BASIS, AND UNIVERSITE LIBRE DE BRUXELLES HAS NO OBLIGATIONS TO
26 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
27 *
28 *****************************************************************************/
29
34#ifndef __TPOINT_TILE_H__
35#define __TPOINT_TILE_H__
36
37/* PostGIS */
38#include <liblwgeom.h>
39/* MEOS */
40#include <meos.h>
41
42#define MAXDIMS 4
43
44/*****************************************************************************/
45
49typedef struct
50{
51 int ndims;
52 int count[MAXDIMS];
53 uint8_t byte[1];
54} BitMatrix;
55
60typedef struct STboxGridState
61{
62 bool done;
63 bool hasx;
64 bool hasz;
65 bool hast;
66 int i;
67 double xsize;
68 double ysize;
69 double zsize;
72 const Temporal *temp;
75 double x;
76 double y;
77 double z;
79 int ntiles;
83
84/*****************************************************************************/
85
86extern BitMatrix *bitmatrix_make(int *count, int ndims);
87extern int tpoint_set_tiles(const Temporal *temp, const STboxGridState *state,
88 BitMatrix *bm);
89extern Temporal *tpoint_at_tile(const Temporal *temp, const STBox *box);
90
91extern void stbox_tile_state_set(double x, double y, double z, TimestampTz t,
92 double xsize, double ysize, double zsize, int64 tunits, bool hasx, bool hasz,
93 bool hast, int32 srid, STBox *result);
95 const STBox *box, double xsize, double ysize, double zsize,
96 const Interval *duration, POINT3DZ sorigin, TimestampTz torigin,
97 bool border_inc);
100
102 double xsize, double ysize, double zsize, const Interval *duration,
103 const GSERIALIZED *sorigin, TimestampTz torigin, bool bitmatrix,
104 bool border_inc, int *ntiles);
105
106extern STBox *stbox_space_time_tile(const GSERIALIZED *point, TimestampTz t,
107 double xsize, double ysize, double zsize, const Interval *duration,
108 const GSERIALIZED *sorigin, TimestampTz torigin, bool hasx, bool hast);
109
110/*****************************************************************************/
111
112#endif
External API of the Mobility Engine Open Source (MEOS) library.
int64 TimestampTz
Definition: postgres_ext_defs.in.h:22
signed int int32
Definition: postgres_ext_defs.in.h:11
long int int64
Definition: postgres_ext_defs.in.h:12
int ndims
Number of dimensions.
Definition: tgeo_tile.h:51
Structure for storing a bit matrix.
Definition: tgeo_tile.h:50
Definition: postgis_ext_defs.in.h:170
Definition: postgres_ext_defs.in.h:27
Definition: postgis_ext_defs.in.h:122
Structure to represent spatiotemporal boxes.
Definition: meos.h:134
bool hasx
True when tiles have X dimension.
Definition: tgeo_tile.h:63
double xsize
Size of the x dimension.
Definition: tgeo_tile.h:67
BitMatrix * bm
Optional bit matrix for speeding up the computation of the split functions.
Definition: tgeo_tile.h:73
int max_coords[MAXDIMS]
Maximum coordinates of the tiles.
Definition: tgeo_tile.h:80
int coords[MAXDIMS]
Coordinates of the current tile.
Definition: tgeo_tile.h:81
double y
Minimum y value of the current tile.
Definition: tgeo_tile.h:76
STBox box
Bounding box of the grid.
Definition: tgeo_tile.h:71
int64 tunits
Size of the time dimension, 0 for spatial only.
Definition: tgeo_tile.h:70
TimestampTz t
Minimum t value of the current tile, if any.
Definition: tgeo_tile.h:78
double x
Minimum x value of the current tile.
Definition: tgeo_tile.h:75
bool hast
True when tiles have T dimension.
Definition: tgeo_tile.h:65
bool done
True when all tiles have been processed.
Definition: tgeo_tile.h:62
int i
Number of current tile.
Definition: tgeo_tile.h:66
int ntiles
Total number of tiles.
Definition: tgeo_tile.h:79
const Temporal * temp
Optional temporal point to be split.
Definition: tgeo_tile.h:72
double ysize
Size of the y dimension.
Definition: tgeo_tile.h:68
double z
Minimum z value of the current tile, if any.
Definition: tgeo_tile.h:77
bool hasz
True when tiles have Z dimension.
Definition: tgeo_tile.h:64
double zsize
Size of the z dimension, 0 for 2D.
Definition: tgeo_tile.h:69
Struct for storing the state that persists across multiple calls generating a multidimensional grid.
Definition: tgeo_tile.h:61
Structure to represent the common structure of temporal values of any temporal subtype.
Definition: meos.h:173
Definition: pgtz.h:42
BitMatrix * bitmatrix_make(int *count, int ndims)
Create a bit matrix.
Definition: tgeo_tile.c:63
bool stbox_tile_state_get(STboxGridState *state, STBox *box)
Get the current tile of the multidimensional grid.
Definition: tgeo_tile.c:637
#define MAXDIMS
Functions for spatiotemporal bounding boxes.
Definition: tgeo_tile.h:42
void stbox_tile_state_next(STboxGridState *state)
Increment the current state to the next tile of the multidimensional grid.
Definition: tgeo_tile.c:539
int tpoint_set_tiles(const Temporal *temp, const STboxGridState *state, BitMatrix *bm)
Set the bit corresponding to the tiles intersecting a temporal point.
Definition: tgeo_tile.c:1242
void stbox_tile_state_set(double x, double y, double z, TimestampTz t, double xsize, double ysize, double zsize, int64 tunits, bool hasx, bool hasz, bool hast, int32 srid, STBox *result)
Generate a tile from the current state of the multidimensional grid.
Definition: tgeo_tile.c:502
STboxGridState * tgeo_space_time_tile_init(const Temporal *temp, double xsize, double ysize, double zsize, const Interval *duration, const GSERIALIZED *sorigin, TimestampTz torigin, bool bitmatrix, bool border_inc, int *ntiles)
Set the state with a temporal point and a space and possibly time grid for splitting or obtaining a s...
Definition: tgeo_tile.c:1272
STBox * stbox_space_time_tile(const GSERIALIZED *point, TimestampTz t, double xsize, double ysize, double zsize, const Interval *duration, const GSERIALIZED *sorigin, TimestampTz torigin, bool hasx, bool hast)
Return a tile in the multidimensional grid of a spatiotemporal box.
Definition: tgeo_tile.c:821
Temporal * tpoint_at_tile(const Temporal *temp, const STBox *box)
Restrict a temporal point to a tile defined by a spatiotemporal box.
Definition: tile.c:26
STboxGridState * stbox_tile_state_make(const Temporal *temp, const STBox *box, double xsize, double ysize, double zsize, const Interval *duration, POINT3DZ sorigin, TimestampTz torigin, bool border_inc)
Create the initial state that persists across multiple calls of the function.
Definition: tgeo_tile.c:374