MobilityDB 1.3
Loading...
Searching...
No Matches
tgeo_spatialrels.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 __TGEO_SPATIALRELS_H__
35#define __TGEO_SPATIALRELS_H__
36
37/* PostgreSQL */
38#include <postgres.h>
39/* MEOS */
40#include <meos.h>
41#include "temporal/temporal.h"
42
43#define INVERT_RESULT(result) (result < 0 ? -1 : (result > 0) ? 0 : 1)
44
45/*****************************************************************************/
46
47extern Datum datum_geom_contains(Datum geom1, Datum geom2);
48extern Datum datum_geom_covers(Datum geom1, Datum geom2);
49extern Datum datum_geom_disjoint2d(Datum geom1, Datum geom2);
50extern Datum datum_geom_disjoint3d(Datum geom1, Datum geom2);
51extern Datum datum_geog_disjoint(Datum geog1, Datum geog2);
52extern Datum datum_geom_intersects2d(Datum geom1, Datum geom2);
53extern Datum datum_geom_intersects3d(Datum geom1, Datum geom2);
54extern Datum datum_geog_intersects(Datum geog1, Datum geog2);
55extern Datum datum_geom_touches(Datum geom1, Datum geom2);
56extern Datum datum_geom_dwithin2d(Datum geom1, Datum geom2, Datum dist);
57extern Datum datum_geom_dwithin3d(Datum geom1, Datum geom2, Datum dist);
58extern Datum datum_geog_dwithin(Datum geog1, Datum geog2, Datum dist);
59extern Datum datum_geom_relate_pattern(Datum geog1, Datum geog2, Datum p);
60extern Datum datum_geom_touches(Datum geom1, Datum geom2);
61
62extern datum_func2 geo_disjoint_fn(int16 flags1, int16 flags2);
63extern datum_func2 geo_disjoint_fn_geo(int16 flags1, uint8_t flags2);
64extern datum_func2 geo_intersects_fn(int16 flags1, int16 flags2);
65extern datum_func2 geo_intersects_fn_geo(int16 flags1, uint8_t flags2);
66extern datum_func3 geo_dwithin_fn(int16 flags1, int16 flags2);
67extern datum_func3 geo_dwithin_fn_geo(int16 flags1, uint8_t flags2);
68
69/*****************************************************************************/
70
71extern int tpointsegm_tdwithin_turnpt(Datum start1, Datum end1, Datum start2,
72 Datum end2, Datum value, TimestampTz lower, TimestampTz upper,
73 TimestampTz *t1, TimestampTz *t2);
74
75extern int spatialrel_geo_geo(const GSERIALIZED *gs1, const GSERIALIZED *gs2,
76 Datum param, varfunc func, int numparam, bool invert);
77extern int spatialrel_tgeo_tgeo(const Temporal *temp1, const Temporal *temp2,
78 Datum param, varfunc func, int numparam);
79
80extern int ea_contains_geo_tgeo(const GSERIALIZED *gs, const Temporal *temp,
81 bool ever);
82extern int ea_contains_tgeo_geo(const Temporal *temp, const GSERIALIZED *gs,
83 bool ever);
84extern int ea_contains_tgeo_tgeo(const Temporal *temp, const Temporal *temp2,
85 bool ever);
86
87extern int ea_covers_geo_tgeo(const GSERIALIZED *gs, const Temporal *temp,
88 bool ever);
89extern int ea_covers_tgeo_geo(const Temporal *temp, const GSERIALIZED *gs,
90 bool ever);
91extern int ea_covers_tgeo_tgeo(const Temporal *temp, const Temporal *temp2,
92 bool ever);
93
94extern int ea_disjoint_geo_tgeo(const GSERIALIZED *gs, const Temporal *temp,
95 bool ever);
96extern int ea_disjoint_tgeo_geo(const Temporal *temp, const GSERIALIZED *gs,
97 bool ever);
98extern int ea_disjoint_tgeo_tgeo(const Temporal *temp, const Temporal *temp2,
99 bool ever);
100
101extern int ea_intersects_geo_tgeo(const GSERIALIZED *gs, const Temporal *temp,
102 bool ever);
103extern int ea_intersects_tgeo_geo(const Temporal *temp, const GSERIALIZED *gs,
104 bool ever);
105extern int ea_intersects_tgeo_tgeo(const Temporal *temp, const Temporal *temp2,
106 bool ever);
107
108extern int ea_touches_tpoint_geo(const Temporal *temp, const GSERIALIZED *gs,
109 bool ever);
110extern int ea_touches_tgeo_geo(const Temporal *temp, const GSERIALIZED *gs,
111 bool ever);
112extern int ea_touches_tgeo_tgeo(const Temporal *temp, const Temporal *temp2,
113 bool ever);
114
115extern int ea_dwithin_tgeo_geo(const Temporal *temp, const GSERIALIZED *gs,
116 double dist, bool ever);
117extern int ea_dwithin_tgeo_tgeo(const Temporal *temp1, const Temporal *temp2,
118 double dist, bool ever);
119
120extern int ea_spatialrel_tspatial_geo(const Temporal *temp,
121 const GSERIALIZED *gs, datum_func2 func, bool ever, bool invert);
122extern int ea_spatialrel_tspatial_tspatial(const Temporal *temp1,
123 const Temporal *temp2, datum_func2 func, bool ever);
124
125/*****************************************************************************/
126
127#endif
int ea_disjoint_tgeo_geo(const Temporal *temp, const GSERIALIZED *gs, bool ever)
Return 1 if a temporal geometry and a geometry are ever disjoint, 0 if not, and -1 on error or if the...
Definition: tgeo_spatialrels.c:927
int ea_dwithin_tgeo_geo(const Temporal *temp, const GSERIALIZED *gs, double dist, bool ever)
Return 1 if a geometry and a temporal geo are ever within the given distance, 0 if not,...
Definition: tgeo_spatialrels.c:1445
int ea_intersects_tgeo_geo(const Temporal *temp, const GSERIALIZED *gs, bool ever)
Return 1 if a temporal geometry ever/always intersects a geometry, 0 if not, and -1 on error or if th...
Definition: tgeo_spatialrels.c:1080
int ea_intersects_geo_tgeo(const GSERIALIZED *gs, const Temporal *temp, bool ever)
Return 1 if a geometry intersects a temporal geometry, 0 if not, and -1 on error or if the geometry i...
Definition: tgeo_spatialrels.c:1103
int ea_disjoint_geo_tgeo(const GSERIALIZED *gs, const Temporal *temp, bool ever)
Return 1 if a temporal geometry and a geometry are ever disjoint, 0 if not, and -1 on error or if the...
Definition: tgeo_spatialrels.c:975
int ea_touches_tgeo_geo(const Temporal *temp, const GSERIALIZED *gs, bool ever)
Return 1 if a temporal geometry ever/always touches a geometry, 0 if not, and -1 on error or if the g...
Definition: tgeo_spatialrels.c:1313
int ea_covers_geo_tgeo(const GSERIALIZED *gs, const Temporal *temp, bool ever)
Return 1 if a temporal geometry ever/always covers a geo, 0 if not, and -1 on error or if the geometr...
Definition: tgeo_spatialrels.c:777
int ea_intersects_tgeo_tgeo(const Temporal *temp, const Temporal *temp2, bool ever)
Return 1 if the temporal geos ever/always intersect, 0 if not, and -1 on error or if the temporal geo...
Definition: tgeo_spatialrels.c:1151
int ea_covers_tgeo_tgeo(const Temporal *temp, const Temporal *temp2, bool ever)
Return 1 if a temporal geometry ever covers another one, 0 if not, and -1 on error.
Definition: tgeo_spatialrels.c:872
int ea_contains_tgeo_tgeo(const Temporal *temp, const Temporal *temp2, bool ever)
Return 1 if a temporal geometry ever contains another temporal geometry, 0 if not,...
Definition: tgeo_spatialrels.c:696
int ea_disjoint_tgeo_tgeo(const Temporal *temp, const Temporal *temp2, bool ever)
Return 1 if the temporal geos ever/always intersect, 0 if not, and -1 on error or if the temporal geo...
Definition: tgeo_spatialrels.c:1023
int ea_contains_geo_tgeo(const GSERIALIZED *gs, const Temporal *temp, bool ever)
Return 1 if a temporal geometry ever/always contains a geo, 0 if not, and -1 on error or if the geome...
Definition: tgeo_spatialrels.c:601
int ea_contains_tgeo_geo(const Temporal *temp, const GSERIALIZED *gs, bool ever)
Return 1 if a temporal geometry ever/always contains a geo, 0 if not, and -1 on error or if the geome...
Definition: tgeo_spatialrels.c:612
int ea_covers_tgeo_geo(const Temporal *temp, const GSERIALIZED *gs, bool ever)
Return 1 if a temporal geometry ever/always covers a geo, 0 if not, and -1 on error or if the geometr...
Definition: tgeo_spatialrels.c:788
int ea_touches_tgeo_tgeo(const Temporal *temp, const Temporal *temp2, bool ever)
Return 1 if a temporal geometry ever/always touches another one, 0 if not, and -1 on error.
Definition: tgeo_spatialrels.c:1380
Datum(* varfunc)(Datum,...)
Definition: temporal.h:283
Datum(* datum_func2)(Datum, Datum)
Definition: temporal.h:296
Datum(* datum_func3)(Datum, Datum, Datum)
Definition: temporal.h:297
External API of the Mobility Engine Open Source (MEOS) library.
int64 TimestampTz
Definition: postgres_ext_defs.in.h:22
signed short int16
Definition: postgres_ext_defs.in.h:10
uintptr_t Datum
Definition: postgres_ext_defs.in.h:7
Definition: postgis_ext_defs.in.h:170
Structure to represent the common structure of temporal values of any temporal subtype.
Definition: meos.h:173
datum_func3 geo_dwithin_fn_geo(int16 flags1, uint8_t flags2)
Select the appropriate dwithin function depending on the flags.
Definition: tgeo_spatialrels.c:279
int spatialrel_geo_geo(const GSERIALIZED *gs1, const GSERIALIZED *gs2, Datum param, varfunc func, int numparam, bool invert)
Return 1 if two geometries satisfy a spatial relationship.
Definition: tcbuffer_spatialrels.c:123
Datum datum_geom_disjoint2d(Datum geom1, Datum geom2)
Return a Datum true if two geometries are disjoint in 2D.
Definition: tgeo_spatialrels.c:91
Datum datum_geom_intersects2d(Datum geom1, Datum geom2)
Return a Datum true if two geometries intersect in 2D.
Definition: tgeo_spatialrels.c:121
Datum datum_geom_dwithin2d(Datum geom1, Datum geom2, Datum dist)
Return a Datum true if two 2D geometries are within a distance.
Definition: tgeo_spatialrels.c:151
Datum datum_geom_touches(Datum geom1, Datum geom2)
Return a Datum true if the first geometry covers the second one.
Definition: tgeo_spatialrels.c:191
Datum datum_geom_covers(Datum geom1, Datum geom2)
Return a Datum true if the first geometry covers the second one.
Definition: tgeo_spatialrels.c:81
int tpointsegm_tdwithin_turnpt(Datum start1, Datum end1, Datum start2, Datum end2, Datum value, TimestampTz lower, TimestampTz upper, TimestampTz *t1, TimestampTz *t2)
Return the value and timestamp at which the two temporal geo segments are at the minimum distance.
Definition: tgeo_spatialrels.c:1516
int ea_spatialrel_tspatial_geo(const Temporal *temp, const GSERIALIZED *gs, datum_func2 func, bool ever, bool invert)
Return true if two temporal geos ever/always satisfy a spatial relationship.
Definition: tgeo_spatialrels.c:454
Datum datum_geom_relate_pattern(Datum geog1, Datum geog2, Datum p)
Return a Datum true if two 2D geometries are within a distance.
Definition: tgeo_spatialrels.c:181
int spatialrel_tgeo_tgeo(const Temporal *temp1, const Temporal *temp2, Datum param, varfunc func, int numparam)
Generic spatial relationship for the trajectory or traversed area of two temporal geometries.
Definition: tgeo_spatialrels.c:380
Datum datum_geom_intersects3d(Datum geom1, Datum geom2)
Return a Datum true if two geometries intersect in 3D.
Definition: tgeo_spatialrels.c:131
Datum datum_geom_dwithin3d(Datum geom1, Datum geom2, Datum dist)
Return a Datum true if two 3D geometries are within a distance.
Definition: tgeo_spatialrels.c:161
int ea_touches_tpoint_geo(const Temporal *temp, const GSERIALIZED *gs, bool ever)
Return 1 if a temporal point ever/always touches a geometry, 0 if not, and -1 on error or if the geom...
Definition: tgeo_spatialrels.c:1213
int ea_dwithin_tgeo_tgeo(const Temporal *temp1, const Temporal *temp2, double dist, bool ever)
Return 1 if two temporal geos are ever/always within a distance, 0 if not, -1 on error or if the temp...
Definition: tgeo_spatialrels.c:1675
Datum datum_geom_contains(Datum geom1, Datum geom2)
Return a Datum true if the first geometry covers the second one.
Definition: tgeo_spatialrels.c:71
datum_func2 geo_disjoint_fn(int16 flags1, int16 flags2)
Select the appropriate disjoint function depending on the flags.
Definition: tgeo_spatialrels.c:204
Datum datum_geog_intersects(Datum geog1, Datum geog2)
Return a Datum true if two geographies intersect.
Definition: tgeo_spatialrels.c:141
datum_func3 geo_dwithin_fn(int16 flags1, int16 flags2)
Select the appropriate dwithin function depending on the flags.
Definition: tgeo_spatialrels.c:264
int ea_spatialrel_tspatial_tspatial(const Temporal *temp1, const Temporal *temp2, datum_func2 func, bool ever)
Return true if two temporal geometries ever/always satisfy a spatial relationship.
Definition: tgeo_spatialrels.c:494
Datum datum_geog_disjoint(Datum geog1, Datum geog2)
Return a Datum true if two geographies are disjoint.
Definition: tgeo_spatialrels.c:111
datum_func2 geo_intersects_fn_geo(int16 flags1, uint8_t flags2)
Select the appropriate intersects function depending on the flags.
Definition: tgeo_spatialrels.c:249
datum_func2 geo_disjoint_fn_geo(int16 flags1, uint8_t flags2)
Select the appropriate disjoint function depending on the flags.
Definition: tgeo_spatialrels.c:219
Datum datum_geog_dwithin(Datum geog1, Datum geog2, Datum dist)
Return a Datum true if two geographies are within a distance.
Definition: tgeo_spatialrels.c:171
Datum datum_geom_disjoint3d(Datum geom1, Datum geom2)
Return a Datum true if two geometries are disjoint in 3D.
Definition: tgeo_spatialrels.c:101
datum_func2 geo_intersects_fn(int16 flags1, int16 flags2)
Select the appropriate intersects function depending on the flags.
Definition: tgeo_spatialrels.c:234
int const GSERIALIZED * gs
Definition: trgeo_spatialrels.h:52
int const GSERIALIZED bool ever
Definition: trgeo_spatialrels.h:53