![]() |
MobilityDB 1.3
|
Network-based static point and segment types. More...
#include "npoint/tnpoint.h"
#include <assert.h>
#include <float.h>
#include <limits.h>
#include <postgres.h>
#include <liblwgeom.h>
#include <meos.h>
#include <meos_geo.h>
#include <meos_npoint.h>
#include <meos_internal.h>
#include <meos_internal_geo.h>
#include "temporal/postgres_types.h"
#include "temporal/span.h"
#include "temporal/tsequence.h"
#include "temporal/type_inout.h"
#include "temporal/type_parser.h"
#include "temporal/type_util.h"
#include "geo/postgis_funcs.h"
#include "geo/tgeo.h"
#include "geo/tgeo_spatialfuncs.h"
#include "geo/tspatial_parser.h"
#include "npoint/tnpoint_parser.h"
Macros | |
#define | NPOINT_MAXLEN 128 |
Buffer size for input and output of npoint and nsegment values. More... | |
#define | NSEGMENT_MAXLEN 128 |
#define | SQL_ROUTE_MAXLEN 64 |
Functions | |
Datum | datum_npoint_round (Datum npoint, Datum size) |
Return a network point with the precision of the position set to a number of decimal places. More... | |
bool | ensure_route_exists (int64 rid) |
Ensure that a route exists in the ways table. More... | |
bool | ensure_valid_position (double pos) |
Ensure valid position. More... | |
Nsegment * | geom_to_nsegment (const GSERIALIZED *gs) |
Transform a geometry into a network segment. More... | |
char * | npoint_as_ewkt (const Npoint *np, int maxdd) |
Return the Extended Well-Known Text (EWKT) representation of a network point. More... | |
char * | npoint_as_hexwkb (const Npoint *np, uint8_t variant, size_t *size_out) |
Return the ASCII hex-encoded Well-Known Binary (HexWKB) representation of a network point. More... | |
char * | npoint_as_text (const Npoint *np, int maxdd) |
Return the Well-Known Text (WKT) representation of a network point. More... | |
uint8_t * | npoint_as_wkb (const Npoint *np, uint8_t variant, size_t *size_out) |
Return the Well-Known Binary (WKB) representation of a circular buffer. More... | |
int | npoint_cmp (const Npoint *np1, const Npoint *np2) |
Return -1, 0, or 1 depending on whether the first network point is less than, equal to, or greater than the second one. More... | |
bool | npoint_collinear (const Npoint *np1, const Npoint *np2, const Npoint *np3, double ratio) |
Return true if the three values are collinear. More... | |
bool | npoint_eq (const Npoint *np1, const Npoint *np2) |
Return true if the first network point is equal to the second one. More... | |
Npoint * | npoint_from_hexwkb (const char *hexwkb) |
Return a network point from its ASCII hex-encoded Well-Known Binary (WKB) representation. More... | |
Npoint * | npoint_from_wkb (const uint8_t *wkb, size_t size) |
Return a network point from its Well-Known Binary (WKB) representation. More... | |
bool | npoint_ge (const Npoint *np1, const Npoint *np2) |
Return true if the first network point is greater than or equal to the second one. More... | |
bool | npoint_gt (const Npoint *np1, const Npoint *np2) |
Return true if the first network point is greater than the second one. More... | |
uint32 | npoint_hash (const Npoint *np) |
Return the 32-bit hash value of a network point. More... | |
uint64 | npoint_hash_extended (const Npoint *np, uint64 seed) |
Return the 64-bit hash value of a network point using a seed. More... | |
Npoint * | npoint_in (const char *str) |
Return a network point from its string representation. More... | |
bool | npoint_le (const Npoint *np1, const Npoint *np2) |
Return true if the first network point is less than or equal to the second one. More... | |
bool | npoint_lt (const Npoint *np1, const Npoint *np2) |
Return true if the first network point is less than the second one. More... | |
Npoint * | npoint_make (int64 rid, double pos) |
Return a network point from a route identifier and a position. More... | |
bool | npoint_ne (const Npoint *np1, const Npoint *np2) |
Return true if the first network point is not equal to the second one. More... | |
char * | npoint_out (const Npoint *np, int maxdd) |
Return the string representation of a network point. More... | |
Npoint * | npoint_parse (const char **str, bool end) |
Parse a network point from its string representation. More... | |
double | npoint_position (const Npoint *np) |
Return the position of a network point. More... | |
Npoint * | npoint_round (const Npoint *np, int maxdd) |
Return a network point with the precision of the position set to a number of decimal places. More... | |
int64 | npoint_route (const Npoint *np) |
Return the route of a network point. More... | |
void | npoint_set (int64 rid, double pos, Npoint *np) |
Return in the last argument a network point constructed from a route identifier and a position. More... | |
bool | npoint_set_stbox (const Npoint *np, STBox *box) |
Return in the last argument the spatiotemporal box of a network point. More... | |
int32_t | npoint_srid (const Npoint *np UNUSED) |
Return the SRID of a network point. More... | |
bool | npoint_timestamptz_set_stbox (const Npoint *np, TimestampTz t, STBox *box) |
Return in the last argument a spatiotemporal box constructed from a network point and a timestamptz. More... | |
STBox * | npoint_timestamptz_to_stbox (const Npoint *np, TimestampTz t) |
Return a spatiotemporal box constructed from a network point and a timestamptz. More... | |
GSERIALIZED * | npoint_to_geompoint (const Npoint *np) |
Transform a network point into a geometry. More... | |
Nsegment * | npoint_to_nsegment (const Npoint *np) |
Convert a network point into a network segment. More... | |
STBox * | npoint_to_stbox (const Npoint *np) |
Convert a network point into a spatiotemporal box. More... | |
bool | npoint_tstzspan_set_stbox (const Npoint *np, const Span *s, STBox *box) |
Return in the last argument a spatiotemporal box constructed from a network point and a timestamptz span. More... | |
STBox * | npoint_tstzspan_to_stbox (const Npoint *np, const Span *s) |
Return a spatiotemporal box constructed from a network point and a timestamptz. More... | |
char * | npoint_wkt_out (Datum value, int maxdd) |
Output a network point in the Well-Known Text (WKT) representation (internal function) More... | |
GSERIALIZED * | npointarr_geom (Npoint **points, int count) |
Return a geometry converted from an array of network points. More... | |
void | npointarr_set_stbox (const Datum *values, int count, STBox *box) |
Return in the last argument a spatiotemporal box constructed from an array of network points. More... | |
Npoint * | npointsegm_interpolate (const Npoint *start, const Npoint *end, long double ratio) |
Return a network point interpolated from a network point segment with respect to a fraction of its total length. More... | |
long double | npointsegm_locate (const Npoint *start, const Npoint *end, const Npoint *value) |
Return a float in (0,1) if a network point segment intersects a network point, return -1.0 if the network point is not located in the segment or if it is approximately equal to the start or the end valuess. More... | |
int | nsegment_cmp (const Nsegment *ns1, const Nsegment *ns2) |
Return -1, 0, or 1 depending on whether the first network segment is less than, equal to, or greater than the second one. More... | |
double | nsegment_end_position (const Nsegment *ns) |
Return the end position of a network segment. More... | |
bool | nsegment_eq (const Nsegment *ns1, const Nsegment *ns2) |
Return true if the first network segment is equal to the second one. More... | |
bool | nsegment_ge (const Nsegment *ns1, const Nsegment *ns2) |
Return true if the first network segment is greater than or equal to the second one. More... | |
bool | nsegment_gt (const Nsegment *ns1, const Nsegment *ns2) |
Return true if the first network segment is greater than the second one. More... | |
Nsegment * | nsegment_in (const char *str) |
Return a network point from its string representation. More... | |
bool | nsegment_le (const Nsegment *ns1, const Nsegment *ns2) |
Return true if the first network segment is less than or equal to the second one. More... | |
bool | nsegment_lt (const Nsegment *ns1, const Nsegment *ns2) |
Return true if the first network segment is less than the second one. More... | |
Nsegment * | nsegment_make (int64 rid, double pos1, double pos2) |
Return a network segment from a route identifier and two positions. More... | |
bool | nsegment_ne (const Nsegment *ns1, const Nsegment *ns2) |
Return true if the first network segment is not equal to the second one. More... | |
char * | nsegment_out (const Nsegment *ns, int maxdd) |
Return the string representation of a network segment. More... | |
Nsegment * | nsegment_parse (const char **str) |
Parse a network segment from its string representation. More... | |
Nsegment * | nsegment_round (const Nsegment *ns, int maxdd) |
Return a network segment with the precision of the positions set to a number of decimal places. More... | |
int64 | nsegment_route (const Nsegment *ns) |
Return the route of a network segment. More... | |
void | nsegment_set (int64 rid, double pos1, double pos2, Nsegment *ns) |
Return in the last argument a network segment constructed from a route identifier and two positions. More... | |
bool | nsegment_set_stbox (const Nsegment *ns, STBox *box) |
Return the bounding box of the network segment value. More... | |
static int | nsegment_sort_cmp (Nsegment **l, Nsegment **r) |
Comparator function for network segments. More... | |
int32_t | nsegment_srid (const Nsegment *ns UNUSED) |
Return the SRID of a network segment. More... | |
double | nsegment_start_position (const Nsegment *ns) |
Return the start position of a network segment. More... | |
GSERIALIZED * | nsegment_to_geom (const Nsegment *ns) |
Transform a network segment into a geometry. More... | |
STBox * | nsegment_to_stbox (const Nsegment *ns) |
Convert a network segment into a spatiotemporal box. More... | |
GSERIALIZED * | nsegmentarr_geom (Nsegment **segments, int count) |
Return a geometry converted from an array of network segments. More... | |
Nsegment ** | nsegmentarr_normalize (Nsegment **segments, int *count) |
Normalize an array of temporal segments. More... | |
static void | nsegmentarr_sort (Nsegment **segments, int count) |
Sort function for network segments. More... | |
Network-based static point and segment types.