MobilityDB 1.1
tnpoint.h
Go to the documentation of this file.
1/*****************************************************************************
2 *
3 * This MobilityDB code is provided under The PostgreSQL License.
4 * Copyright (c) 2016-2023, 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-2023, 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 __TNPOINT_H__
35#define __TNPOINT_H__
36
37/* PostgreSQL */
38#include <postgres.h>
39/* MEOS */
40#include "meos.h"
41#include "general/temporal.h"
42
43/*****************************************************************************
44 * Struct definitions
45 *****************************************************************************/
46
47/* Network-based point */
48
49typedef struct
50{
52 double pos;
53} Npoint;
54
55/* Network-based segment */
56
57typedef struct
58{
60 double pos1;
61 double pos2;
62} Nsegment;
63
64/*****************************************************************************
65 * fmgr macros
66 *****************************************************************************/
67
68/* Npoint */
69#define DatumGetNpointP(X) ((Npoint *) DatumGetPointer(X))
70#define NpointPGetDatum(X) PointerGetDatum(X)
71#define PG_GETARG_NPOINT_P(X) DatumGetNpointP(PG_GETARG_DATUM(X))
72#define PG_RETURN_NPOINT_P(X) PG_RETURN_POINTER(X)
73
74/* Nsegment */
75#define DatumGetNsegmentP(X) ((Nsegment *) DatumGetPointer(X))
76#define NsegmentPGetDatum(X) PointerGetDatum(X)
77#define PG_GETARG_NSEGMENT_P(X) DatumGetNsegmentP(PG_GETARG_DATUM(X))
78
79/*****************************************************************************/
80
81/* Input/output functions */
82
83/* Cast functions */
84
86#define NPOINT_TO_GEOM true
87#define GEOM_TO_NPOINT false
88
93extern Temporal *tnpoint_tgeompoint(const Temporal *temp);
94
99extern Temporal *tgeompoint_tnpoint(const Temporal *temp);
100
101/* Transformation functions */
102
103/* Accessor functions */
104
105extern Nsegment **tnpointinst_positions(const TInstant *inst);
106extern Nsegment **tnpointseq_positions(const TSequence *seq, int *count);
107extern Nsegment **tnpointseqset_positions(const TSequenceSet *ss, int *count);
108extern Nsegment **tnpoint_positions(const Temporal *temp, int *count);
109extern int64 tnpointinst_route(const TInstant *inst);
110extern int64 tnpoint_route(const Temporal *temp);
111extern Set *tnpointinst_routes(const TInstant *inst);
112extern Set *tnpointdiscseq_routes(const TSequence *is);
113extern Set *tnpointcontseq_routes(const TSequence *seq);
114extern Set *tnpointseqset_routes(const TSequenceSet *ss);
115extern Set *tnpoint_routes(const Temporal *temp);
116
118
119/*****************************************************************************/
120
121#endif /* __TNPOINT_H__ */
TSequence * tnpointcontseq_tgeompointcontseq(const TSequence *seq)
Cast a temporal network point as a temporal geometric point.
Definition: tnpoint.c:92
TInstant * tgeompointinst_tnpointinst(const TInstant *inst)
Cast a temporal geometric point as a temporal network point.
Definition: tnpoint.c:160
TSequenceSet * tnpointseqset_tgeompointseqset(const TSequenceSet *ss)
Cast a temporal network point as a temporal geometric point.
Definition: tnpoint.c:124
Set * tnpointseqset_routes(const TSequenceSet *ss)
Return the routes of a temporal network point.
Definition: tnpoint.c:456
Nsegment ** tnpoint_positions(const Temporal *temp, int *count)
Return the network segments covered by the temporal network point.
Definition: tnpoint.c:368
Set * tnpoint_routes(const Temporal *temp)
Return the array of routes of a temporal network point.
Definition: tnpoint.c:475
Set * tnpointdiscseq_routes(const TSequence *is)
Return the routes of a temporal network point.
Definition: tnpoint.c:426
TSequenceSet * tgeompointseqset_tnpointseqset(const TSequenceSet *ss)
Cast a temporal geometric point as a temporal network point.
Definition: tnpoint.c:199
Temporal * tgeompoint_tnpoint(const Temporal *temp)
Cast a temporal geometric point as a temporal network point.
Definition: tnpoint.c:221
TSequence * tgeompointdiscseq_tnpointdiscseq(const TSequence *is)
int64 tnpointinst_route(const TInstant *inst)
Return the route of the temporal network point.
Definition: tnpoint.c:390
Set * tnpointinst_routes(const TInstant *inst)
Return the routes of a temporal network point.
Definition: tnpoint.c:415
Nsegment ** tnpointinst_positions(const TInstant *inst)
Return the network segments covered by the temporal network point.
Definition: tnpoint.c:245
Temporal * tnpoint_tgeompoint(const Temporal *temp)
Cast a temporal network point as a temporal geometric point.
Definition: tnpoint.c:139
TInstant * tnpointinst_tgeompointinst(const TInstant *inst)
Basic functions for temporal network points.
Definition: tnpoint.c:62
TSequence * tgeompointseq_tnpointseq(const TSequence *seq)
Cast a temporal geometric point as a temporal network point.
Definition: tnpoint.c:175
Set * tnpointcontseq_routes(const TSequence *seq)
Return the routes of a temporal network point.
Definition: tnpoint.c:444
Nsegment ** tnpointseq_positions(const TSequence *seq, int *count)
Return the network segments covered by the temporal network point.
Definition: tnpoint.c:298
TSequence * tnpointdiscseq_tgeompointdiscseq(const TSequence *is)
Cast a temporal network point as a temporal geometric point.
Definition: tnpoint.c:76
int64 tnpoint_route(const Temporal *temp)
Return the single route of a temporal network point.
Definition: tnpoint.c:400
Nsegment * tnpointseq_linear_positions(const TSequence *seq)
Return the network segments covered by the temporal network point.
Definition: tnpoint.c:278
Nsegment ** tnpointseqset_positions(const TSequenceSet *ss, int *count)
Return the network segments covered by the temporal network point.
Definition: tnpoint.c:355
long int int64
Definition: pg_ext_defs.in.h:9
int64 rid
route identifier
Definition: tnpoint.h:51
double pos
position
Definition: tnpoint.h:52
Functions for temporal network points.
Definition: tnpoint.h:50
double pos2
position2
Definition: tnpoint.h:61
double pos1
position1
Definition: tnpoint.h:60
int64 rid
route identifier
Definition: tnpoint.h:59
Definition: tnpoint.h:58
API of the Mobility Engine Open Source (MEOS) library.
Definition: meos.h:56
Structure to represent temporal values of instant subtype.
Definition: meos.h:148
Structure to represent temporal values of sequence set subtype.
Definition: meos.h:186
Structure to represent temporal values of instant set or sequence subtype.
Definition: meos.h:165
Structure to represent the common structure of temporal values of any temporal subtype.
Definition: meos.h:136