diff --git a/pymeos/boxes/tbox.py b/pymeos/boxes/tbox.py index 8a955616..c95daa50 100644 --- a/pymeos/boxes/tbox.py +++ b/pymeos/boxes/tbox.py @@ -1082,10 +1082,7 @@ def nearest_approach_distance(self, other: TBox | TNumber) -> float: nad_tbox_tbox """ if isinstance(other, TBox): - if self._is_float(): - return nad_tboxfloat_tboxfloat(self._inner, other._inner) - else: - return nad_tboxint_tboxint(self._inner, other._inner) + return nad_tbox_tbox(self._inner, other._inner) elif isinstance(other, TInt): return nad_tint_tbox(other._inner, self._inner) elif isinstance(other, TFloat): diff --git a/pymeos/collections/base/spanset.py b/pymeos/collections/base/spanset.py index eaa62d7d..e69b6efa 100644 --- a/pymeos/collections/base/spanset.py +++ b/pymeos/collections/base/spanset.py @@ -127,7 +127,7 @@ def __repr__(self): A new :class:`str` instance MEOS Functions: - tstzspanset_out + spanset_out """ return f"{self.__class__.__name__}({self})" diff --git a/pymeos/collections/number/floatset.py b/pymeos/collections/number/floatset.py index 2d67661f..bc23062a 100644 --- a/pymeos/collections/number/floatset.py +++ b/pymeos/collections/number/floatset.py @@ -9,7 +9,6 @@ floatset_end_value, floatset_in, floatset_make, - floatset_out, floatset_shift_scale, floatset_start_value, floatset_value_n, @@ -23,6 +22,7 @@ overleft_set_float, overright_set_float, right_set_float, + set_out, union_set_float, union_set_set, ) @@ -78,9 +78,9 @@ def as_text(self, max_decimals: int = 15) -> str: A new :class:`str` instance MEOS Functions: - floatset_out + set_out """ - return floatset_out(self._inner, max_decimals) + return set_out(self._inner, max_decimals) # ------------------------- Conversions ----------------------------------- diff --git a/pymeos/collections/number/floatspan.py b/pymeos/collections/number/floatspan.py index 4ca773f6..18167558 100644 --- a/pymeos/collections/number/floatspan.py +++ b/pymeos/collections/number/floatspan.py @@ -12,7 +12,6 @@ floatspan_in, floatspan_lower, floatspan_make, - floatspan_out, floatspan_shift_scale, floatspan_to_intspan, floatspan_upper, @@ -28,6 +27,7 @@ overright_span_float, right_span_float, span_eq, + span_out, union_span_float, union_span_span, union_spanset_span, @@ -84,9 +84,9 @@ def as_text(self, max_decimals: int = 15) -> str: A new :class:`str` instance MEOS Functions: - floatspan_out + span_out """ - return floatspan_out(self._inner, max_decimals) + return span_out(self._inner, max_decimals) # ------------------------- Conversions ----------------------------------- diff --git a/pymeos/collections/number/floatspanset.py b/pymeos/collections/number/floatspanset.py index 3592dd94..4bff705b 100644 --- a/pymeos/collections/number/floatspanset.py +++ b/pymeos/collections/number/floatspanset.py @@ -10,7 +10,6 @@ distance_spanset_float, float_to_spanset, floatspanset_in, - floatspanset_out, floatspanset_shift_scale, floatspanset_to_intspanset, floatspanset_width, @@ -21,6 +20,7 @@ overright_spanset_float, right_spanset_float, spanset_eq, + spanset_out, union_spanset_float, ) @@ -72,9 +72,9 @@ def as_text(self, max_decimals: int = 15) -> str: A new :class:`str` instance MEOS Functions: - floatspanset_out + spanset_out """ - return floatspanset_out(self._inner, max_decimals) + return spanset_out(self._inner, max_decimals) # ------------------------- Conversions ----------------------------------- diff --git a/pymeos/collections/number/intset.py b/pymeos/collections/number/intset.py index 3eb96247..f7c8ba29 100644 --- a/pymeos/collections/number/intset.py +++ b/pymeos/collections/number/intset.py @@ -11,7 +11,6 @@ intset_end_value, intset_in, intset_make, - intset_out, intset_shift_scale, intset_start_value, intset_value_n, @@ -23,6 +22,7 @@ overleft_set_int, overright_set_int, right_set_int, + set_out, union_set_int, union_set_set, ) @@ -77,9 +77,9 @@ def as_text(self) -> str: A new :class:`str` instance MEOS Functions: - intset_out + set_out """ - return intset_out(self._inner) + return set_out(self._inner, 0) # ------------------------- Conversions ----------------------------------- diff --git a/pymeos/collections/number/intspan.py b/pymeos/collections/number/intspan.py index fab27b5f..f20c9adf 100644 --- a/pymeos/collections/number/intspan.py +++ b/pymeos/collections/number/intspan.py @@ -15,7 +15,6 @@ intspan_in, intspan_lower, intspan_make, - intspan_out, intspan_shift_scale, intspan_to_floatspan, intspan_upper, @@ -28,6 +27,7 @@ overright_span_int, right_span_int, span_eq, + span_out, union_span_int, union_span_span, union_spanset_span, @@ -83,9 +83,9 @@ def as_text(self) -> str: A new :class:`str` instance MEOS Functions: - intspan_out + span_out """ - return intspan_out(self._inner) + return span_out(self._inner, 0) # ------------------------- Conversions ----------------------------------- diff --git a/pymeos/collections/number/intspanset.py b/pymeos/collections/number/intspanset.py index df91ff15..8bcca984 100644 --- a/pymeos/collections/number/intspanset.py +++ b/pymeos/collections/number/intspanset.py @@ -11,7 +11,6 @@ int_to_spanset, intersection_spanset_int, intspanset_in, - intspanset_out, intspanset_shift_scale, intspanset_to_floatspanset, intspanset_width, @@ -21,6 +20,7 @@ overright_spanset_int, right_spanset_int, spanset_eq, + spanset_out, union_spanset_int, ) @@ -72,9 +72,9 @@ def as_text(self) -> str: A new :class:`str` instance MEOS Functions: - intspanset_out + spanset_out """ - return intspanset_out(self._inner) + return spanset_out(self._inner, 0) # ------------------------- Conversions ----------------------------------- diff --git a/pymeos/collections/text/textset.py b/pymeos/collections/text/textset.py index bd5871cd..fe34915b 100644 --- a/pymeos/collections/text/textset.py +++ b/pymeos/collections/text/textset.py @@ -49,9 +49,9 @@ def as_text(self) -> str: A new :class:`str` instance MEOS Functions: - textset_out + set_out """ - return textset_out(self._inner) + return set_out(self._inner, 0) # ------------------------- Conversions ----------------------------------- diff --git a/pymeos/collections/time/dateset.py b/pymeos/collections/time/dateset.py index a552ccfe..0fea2dc0 100644 --- a/pymeos/collections/time/dateset.py +++ b/pymeos/collections/time/dateset.py @@ -13,7 +13,6 @@ dateset_end_value, dateset_in, dateset_make, - dateset_out, dateset_shift_scale, dateset_start_value, dateset_value_n, @@ -27,6 +26,7 @@ minus_set_set, overafter_set_date, overbefore_set_date, + set_out, union_set_date, union_set_set, ) @@ -83,9 +83,9 @@ def as_text(self) -> str: A new :class:`str` instance MEOS Functions: - dateset_out + set_out """ - return dateset_out(self._inner) + return set_out(self._inner, 0) # ------------------------- Conversions ----------------------------------- diff --git a/pymeos/collections/time/datespan.py b/pymeos/collections/time/datespan.py index 5bf41043..7fb93ddc 100644 --- a/pymeos/collections/time/datespan.py +++ b/pymeos/collections/time/datespan.py @@ -15,7 +15,6 @@ datespan_in, datespan_lower, datespan_make, - datespan_out, datespan_shift_scale, datespan_to_tstzspan, datespan_upper, @@ -31,6 +30,7 @@ minus_span_spanset, overafter_span_date, overbefore_span_date, + span_out, union_span_date, ) @@ -89,9 +89,9 @@ def as_text(self) -> str: A new :class:`str` instance MEOS Functions: - datespan_out + span_out """ - return datespan_out(self._inner) + return span_out(self._inner, 0) # ------------------------- Conversions ----------------------------------- diff --git a/pymeos/collections/time/datespanset.py b/pymeos/collections/time/datespanset.py index 0b8e456c..6db98f0e 100644 --- a/pymeos/collections/time/datespanset.py +++ b/pymeos/collections/time/datespanset.py @@ -20,7 +20,6 @@ datespanset_end_date, datespanset_in, datespanset_num_dates, - datespanset_out, datespanset_shift_scale, datespanset_start_date, datespanset_to_tstzspanset, @@ -30,6 +29,7 @@ minus_spanset_date, overafter_spanset_date, overbefore_spanset_date, + spanset_out, union_spanset_date, ) @@ -84,9 +84,9 @@ def as_text(self) -> str: A new :class:`str` instance MEOS Functions: - datespanset_out + spanset_out """ - return datespanset_out(self._inner) + return spanset_out(self._inner, 0) # ------------------------- Conversions ----------------------------------- diff --git a/pymeos/collections/time/tstzset.py b/pymeos/collections/time/tstzset.py index 6403760a..b436a3a2 100644 --- a/pymeos/collections/time/tstzset.py +++ b/pymeos/collections/time/tstzset.py @@ -59,9 +59,9 @@ def as_text(self) -> str: A new :class:`str` instance MEOS Functions: - tstzset_out + set_out """ - return tstzset_out(self._inner) + return set_out(self._inner, 0) # ------------------------- Conversions ----------------------------------- # ------------------------- Accessors ------------------------------------- diff --git a/pymeos/collections/time/tstzspan.py b/pymeos/collections/time/tstzspan.py index 913842f5..0c2d983d 100644 --- a/pymeos/collections/time/tstzspan.py +++ b/pymeos/collections/time/tstzspan.py @@ -61,9 +61,9 @@ def as_text(self) -> str: A new :class:`str` instance MEOS Functions: - tstzspan_out + span_out """ - return tstzspan_out(self._inner) + return span_out(self._inner, 0) # ------------------------- Conversions ----------------------------------- diff --git a/pymeos/collections/time/tstzspanset.py b/pymeos/collections/time/tstzspanset.py index 03d21bcf..1fd42ff6 100644 --- a/pymeos/collections/time/tstzspanset.py +++ b/pymeos/collections/time/tstzspanset.py @@ -59,9 +59,9 @@ def as_text(self) -> str: A new :class:`str` instance MEOS Functions: - tstzspanset_out + spanset_out """ - return tstzspanset_out(self._inner) + return spanset_out(self._inner, 0) # ------------------------- Conversions ----------------------------------- diff --git a/pymeos/main/_generated/tgeogpoint_methods.py b/pymeos/main/_generated/tgeogpoint_methods.py index d4b86e4e..50ca724d 100644 --- a/pymeos/main/_generated/tgeogpoint_methods.py +++ b/pymeos/main/_generated/tgeogpoint_methods.py @@ -85,7 +85,7 @@ def at(self, other): """Generated regular ``at``. MEOS Functions: - tgeo_at_geom, tgeo_at_stbox, tgeo_at_value, tpoint_at_elevation, tpoint_at_geom, tpoint_at_value + tgeo_at_geom, tgeo_at_stbox, tgeo_at_value, tpoint_at_elevation """ from ...boxes import STBox @@ -109,7 +109,9 @@ def disjoint(self, other): """ from ..tpoint import TGeogPoint - if isinstance(other, TGeogPoint): + if isinstance(other, shpb.BaseGeometry): + result = tdisjoint_tgeo_geo(self._inner, geo_to_gserialized(other, True)) + elif isinstance(other, TGeogPoint): result = tdisjoint_tgeo_tgeo(self._inner, other._inner) else: raise TypeError(f"Operation not supported with type {other.__class__}") @@ -187,7 +189,9 @@ def intersects(self, other): """ from ..tpoint import TGeogPoint - if isinstance(other, TGeogPoint): + if isinstance(other, shpb.BaseGeometry): + result = tintersects_tgeo_geo(self._inner, geo_to_gserialized(other, True)) + elif isinstance(other, TGeogPoint): result = tintersects_tgeo_tgeo(self._inner, other._inner) else: raise TypeError(f"Operation not supported with type {other.__class__}") @@ -217,7 +221,9 @@ def is_always_within_distance(self, other, distance): """ from ..tpoint import TGeogPoint - if isinstance(other, TGeogPoint): + if isinstance(other, shpb.BaseGeometry): + result = adwithin_tgeo_geo(self._inner, geo_to_gserialized(other, True), distance, True) + elif isinstance(other, TGeogPoint): result = adwithin_tgeo_tgeo(self._inner, other._inner, distance, True) else: raise TypeError(f"Operation not supported with type {other.__class__}") @@ -259,7 +265,7 @@ def minus(self, other): """Generated regular ``minus``. MEOS Functions: - tgeo_minus_geom, tgeo_minus_stbox, tgeo_minus_value, tpoint_minus_elevation, tpoint_minus_geom, tpoint_minus_value + tgeo_minus_geom, tgeo_minus_stbox, tgeo_minus_value, tpoint_minus_elevation """ from ...boxes import STBox diff --git a/pymeos/main/_generated/tgeompoint_methods.py b/pymeos/main/_generated/tgeompoint_methods.py index d997e851..219dd719 100644 --- a/pymeos/main/_generated/tgeompoint_methods.py +++ b/pymeos/main/_generated/tgeompoint_methods.py @@ -97,7 +97,7 @@ def at(self, other): """Generated regular ``at``. MEOS Functions: - tgeo_at_geom, tgeo_at_stbox, tgeo_at_value, tpoint_at_elevation, tpoint_at_geom, tpoint_at_value + tgeo_at_geom, tgeo_at_stbox, tgeo_at_value, tpoint_at_elevation """ from ...boxes import STBox @@ -289,7 +289,7 @@ def minus(self, other): """Generated regular ``minus``. MEOS Functions: - tgeo_minus_geom, tgeo_minus_stbox, tgeo_minus_value, tpoint_minus_elevation, tpoint_minus_geom, tpoint_minus_value + tgeo_minus_geom, tgeo_minus_stbox, tgeo_minus_value, tpoint_minus_elevation """ from ...boxes import STBox diff --git a/pymeos/main/_generated/trgeometry_methods.py b/pymeos/main/_generated/trgeometry_methods.py index 416d6c24..5aa82e9c 100644 --- a/pymeos/main/_generated/trgeometry_methods.py +++ b/pymeos/main/_generated/trgeometry_methods.py @@ -16,14 +16,12 @@ from __future__ import annotations -from datetime import datetime from typing import TYPE_CHECKING import shapely.geometry.base as shpb from pymeos_cffi import * -from ...collections import TsTzSet, TsTzSpan, TsTzSpanSet -from ...collections.pose import Pose, PoseSet +from ...collections.pose import Pose from ...temporal import Temporal from ..tpoint import TPoint @@ -99,7 +97,7 @@ def at(self, other): """Generated regular ``at``. MEOS Functions: - trgeometry_at_geom, trgeometry_at_stbox, trgeometry_at_timestamptz, trgeometry_at_tstzset, trgeometry_at_tstzspan, trgeometry_at_tstzspanset, trgeometry_at_value, trgeometry_at_values + trgeometry_at_geom, trgeometry_at_stbox, trgeometry_at_value """ from ...boxes import STBox @@ -107,22 +105,28 @@ def at(self, other): result = trgeometry_at_value(self._inner, other._inner) elif isinstance(other, shpb.BaseGeometry): result = trgeometry_at_geom(self._inner, geometry_to_gserialized(other)) - elif isinstance(other, PoseSet): - result = trgeometry_at_values(self._inner, other._inner) elif isinstance(other, STBox): result = trgeometry_at_stbox(self._inner, other._inner, True) - elif isinstance(other, datetime): - result = trgeometry_at_timestamptz(self._inner, datetime_to_timestamptz(other)) - elif isinstance(other, TsTzSet): - result = trgeometry_at_tstzset(self._inner, other._inner) - elif isinstance(other, TsTzSpan): - result = trgeometry_at_tstzspan(self._inner, other._inner) - elif isinstance(other, TsTzSpanSet): - result = trgeometry_at_tstzspanset(self._inner, other._inner) else: return super().at(other) return Temporal._factory(result) + def disjoint(self, other): + """Generated regular ``disjoint``. + + MEOS Functions: + tdisjoint_geo_trgeometry, tdisjoint_trgeometry_geo, tdisjoint_trgeometry_trgeometry + """ + from ..trgeometry import TRgeometry + + if isinstance(other, shpb.BaseGeometry): + result = tdisjoint_trgeometry_geo(self._inner, geometry_to_gserialized(other)) + elif isinstance(other, TRgeometry): + result = tdisjoint_trgeometry_trgeometry(self._inner, other._inner) + else: + raise TypeError(f"Operation not supported with type {other.__class__}") + return Temporal._factory(result) + def distance(self, other): """Generated regular ``distance``. @@ -201,6 +205,22 @@ def ever_touches(self, other): raise TypeError(f"Operation not supported with type {other.__class__}") return result == 1 + def intersects(self, other): + """Generated regular ``intersects``. + + MEOS Functions: + tintersects_geo_trgeometry, tintersects_trgeometry_geo, tintersects_trgeometry_trgeometry + """ + from ..trgeometry import TRgeometry + + if isinstance(other, shpb.BaseGeometry): + result = tintersects_trgeometry_geo(self._inner, geometry_to_gserialized(other)) + elif isinstance(other, TRgeometry): + result = tintersects_trgeometry_trgeometry(self._inner, other._inner) + else: + raise TypeError(f"Operation not supported with type {other.__class__}") + return Temporal._factory(result) + def is_always_covers(self, other): """Generated regular ``is_always_covers``. @@ -293,7 +313,7 @@ def minus(self, other): """Generated regular ``minus``. MEOS Functions: - trgeometry_minus_geom, trgeometry_minus_stbox, trgeometry_minus_timestamptz, trgeometry_minus_tstzset, trgeometry_minus_tstzspan, trgeometry_minus_tstzspanset, trgeometry_minus_value, trgeometry_minus_values + trgeometry_minus_geom, trgeometry_minus_stbox, trgeometry_minus_value """ from ...boxes import STBox @@ -301,18 +321,8 @@ def minus(self, other): result = trgeometry_minus_value(self._inner, other._inner) elif isinstance(other, shpb.BaseGeometry): result = trgeometry_minus_geom(self._inner, geometry_to_gserialized(other)) - elif isinstance(other, PoseSet): - result = trgeometry_minus_values(self._inner, other._inner) elif isinstance(other, STBox): result = trgeometry_minus_stbox(self._inner, other._inner, True) - elif isinstance(other, datetime): - result = trgeometry_minus_timestamptz(self._inner, datetime_to_timestamptz(other)) - elif isinstance(other, TsTzSet): - result = trgeometry_minus_tstzset(self._inner, other._inner) - elif isinstance(other, TsTzSpan): - result = trgeometry_minus_tstzspan(self._inner, other._inner) - elif isinstance(other, TsTzSpanSet): - result = trgeometry_minus_tstzspanset(self._inner, other._inner) else: return super().minus(other) return Temporal._factory(result) diff --git a/pymeos/main/tbool.py b/pymeos/main/tbool.py index 368c41d1..44211d59 100644 --- a/pymeos/main/tbool.py +++ b/pymeos/main/tbool.py @@ -112,18 +112,18 @@ def as_text(self) -> str: Returns the string representation of `self`. MEOS Function: - tbool_out + temporal_out """ - return tbool_out(self._inner) + return temporal_out(self._inner, 0) def as_wkt(self): """ Returns the string representation of `self` in WKT format. MEOS Function: - tbool_out + temporal_out """ - return tbool_out(self._inner) + return temporal_out(self._inner, 0) # ------------------------- Accessors ------------------------------------- def value_set(self) -> set[bool]: diff --git a/pymeos/main/tfloat.py b/pymeos/main/tfloat.py index 432a3cab..b21d3f8e 100644 --- a/pymeos/main/tfloat.py +++ b/pymeos/main/tfloat.py @@ -133,9 +133,9 @@ def as_text(self, max_decimals: int = 15) -> str: A string representation of `self`. MEOS Functions: - tfloat_out + temporal_out """ - return tfloat_out(self._inner, max_decimals) + return temporal_out(self._inner, max_decimals) def as_wkt(self, max_decimals: int = 15) -> str: """ @@ -148,9 +148,9 @@ def as_wkt(self, max_decimals: int = 15) -> str: A WKT representation of `self`. MEOS Functions: - tfloat_out + temporal_out """ - return tfloat_out(self._inner, max_decimals) + return temporal_out(self._inner, max_decimals) # ------------------------- Conversions ---------------------------------- def to_tint(self) -> TInt: diff --git a/pymeos/main/tint.py b/pymeos/main/tint.py index 3862c8a6..33d7c181 100644 --- a/pymeos/main/tint.py +++ b/pymeos/main/tint.py @@ -121,9 +121,9 @@ def as_text(self) -> str: A string representation of `self`. MEOS Functions: - tint_out + temporal_out """ - return tint_out(self._inner) + return temporal_out(self._inner, 0) def as_wkt(self): """ @@ -135,7 +135,7 @@ def as_wkt(self): MEOS Functions: tint_as_wkt """ - return tint_out(self._inner) + return temporal_out(self._inner, 0) # ------------------------- Conversions ---------------------------------- def to_tfloat(self) -> TFloat: diff --git a/pymeos/main/tpoint.py b/pymeos/main/tpoint.py index c9927d77..7b82f7e0 100644 --- a/pymeos/main/tpoint.py +++ b/pymeos/main/tpoint.py @@ -364,7 +364,7 @@ def bearing(self, other: shpb.BaseGeometry | TPoint) -> TFloat: """ if isinstance(other, shpb.BaseGeometry): gs = geo_to_gserialized(other, isinstance(self, TGeogPoint)) - result = bearing_tpoint_point(self._inner, gs, False) + result = bearing_tpoint_point(self._inner, gs) elif isinstance(other, TPoint): result = bearing_tpoint_tpoint(self._inner, other._inner) else: diff --git a/pymeos/main/trgeometry.py b/pymeos/main/trgeometry.py index 6de0b7a2..47e115b0 100644 --- a/pymeos/main/trgeometry.py +++ b/pymeos/main/trgeometry.py @@ -323,9 +323,9 @@ def start_instant(self: Self) -> TRgeometryInst: A new :class:`TRgeometryInst` object. MEOS Functions: - trgeometry_start_instant + temporal_start_instant """ - return Temporal._factory(trgeometry_start_instant(self._inner)) + return Temporal._factory(temporal_start_instant(self._inner)) def end_instant(self: Self) -> TRgeometryInst: """ @@ -335,9 +335,9 @@ def end_instant(self: Self) -> TRgeometryInst: A new :class:`TRgeometryInst` object. MEOS Functions: - trgeometry_end_instant + temporal_end_instant """ - return Temporal._factory(trgeometry_end_instant(self._inner)) + return Temporal._factory(temporal_end_instant(self._inner)) def instant_n(self, n: int) -> TRgeometryInst: """ @@ -350,9 +350,9 @@ def instant_n(self, n: int) -> TRgeometryInst: A new :class:`TRgeometryInst` object. MEOS Functions: - trgeometry_instant_n + temporal_instant_n """ - return Temporal._factory(trgeometry_instant_n(self._inner, n + 1)) + return Temporal._factory(temporal_instant_n(self._inner, n + 1)) def instants(self) -> list[TRgeometryInst]: """ @@ -362,9 +362,9 @@ def instants(self) -> list[TRgeometryInst]: A :class:`list` of :class:`TRgeometryInst` objects. MEOS Functions: - trgeometry_instants + temporal_instants """ - ins, count = trgeometry_instants(self._inner) + ins, count = temporal_instants(self._inner) return [Temporal._factory(ins[i]) for i in range(count)] def points(self) -> GeometrySet: @@ -449,9 +449,9 @@ def round(self, max_decimals: int = 0) -> TRgeometry: A new :class:`TRgeometry` object. MEOS Functions: - trgeometry_round + temporal_round """ - result = trgeometry_round(self._inner, max_decimals) + result = temporal_round(self._inner, max_decimals) return Temporal._factory(result) def transform(self: Self, srid: int) -> Self: @@ -481,9 +481,9 @@ def set_interpolation(self: Self, interpolation: TInterpolation) -> Self: A new :class:`TRgeometry` instance. MEOS Functions: - trgeometry_set_interp + temporal_set_interp """ - result = trgeometry_set_interp(self._inner, interpolation.value) + result = temporal_set_interp(self._inner, interpolation.value) return Temporal._factory(result) def append_instant( @@ -504,11 +504,11 @@ def append_instant( A new :class:`TRgeometry` object. MEOS Functions: - trgeometry_append_tinstant + temporal_append_tinstant """ interp = self.interpolation() mt = timedelta_to_interval(max_time) if max_time is not None else None - result = trgeometry_append_tinstant(self._inner, instant._inner, interp.value, max_dist, mt, False) + result = temporal_append_tinstant(self._inner, instant._inner, interp.value, max_dist, mt, False) return Temporal._factory(result) def append_sequence(self: Self, sequence: TRgeometrySeq) -> TRgeometry: @@ -522,9 +522,9 @@ def append_sequence(self: Self, sequence: TRgeometrySeq) -> TRgeometry: A new :class:`TRgeometry` object. MEOS Functions: - trgeometry_append_tsequence + temporal_append_tsequence """ - result = trgeometry_append_tsequence(self._inner, sequence._inner, False) + result = temporal_append_tsequence(self._inner, sequence._inner, False) return Temporal._factory(result) # ------------------------- Ever and Always Comparisons ------------------- @@ -630,9 +630,9 @@ def segments(self) -> list[TRgeometrySeq]: Returns the temporal segments of `self`. MEOS Functions: - trgeometry_segments + temporal_segments """ - seqs, count = trgeometry_segments(self._inner) + seqs, count = temporal_segments(self._inner) return [Temporal._factory(seqs[i]) for i in range(count)] # ------------------------- Modifications --------------------------------- @@ -646,17 +646,17 @@ def delete(self, other: Time, connect: bool = True) -> TRgeometry: connect: Whether to connect the resulting segments. MEOS Functions: - trgeometry_delete_timestamptz, trgeometry_delete_tstzset, - trgeometry_delete_tstzspan, trgeometry_delete_tstzspanset + temporal_delete_timestamptz, temporal_delete_tstzset, + temporal_delete_tstzspan, temporal_delete_tstzspanset """ if isinstance(other, datetime): - result = trgeometry_delete_timestamptz(self._inner, datetime_to_timestamptz(other), connect) + result = temporal_delete_timestamptz(self._inner, datetime_to_timestamptz(other), connect) elif isinstance(other, TsTzSet): - result = trgeometry_delete_tstzset(self._inner, other._inner, connect) + result = temporal_delete_tstzset(self._inner, other._inner, connect) elif isinstance(other, TsTzSpan): - result = trgeometry_delete_tstzspan(self._inner, other._inner, connect) + result = temporal_delete_tstzspan(self._inner, other._inner, connect) elif isinstance(other, TsTzSpanSet): - result = trgeometry_delete_tstzspanset(self._inner, other._inner, connect) + result = temporal_delete_tstzspanset(self._inner, other._inner, connect) else: return super().delete(other, connect) return Temporal._factory(result) @@ -671,9 +671,9 @@ def before(self, timestamp: datetime, strict: bool = False) -> TRgeometry: strict: Whether the bound is strict. MEOS Functions: - trgeometry_before_timestamptz + temporal_before_timestamptz """ - result = trgeometry_before_timestamptz(self._inner, datetime_to_timestamptz(timestamp), strict) + result = temporal_before_timestamptz(self._inner, datetime_to_timestamptz(timestamp), strict) return Temporal._factory(result) def after(self, timestamp: datetime, strict: bool = False) -> TRgeometry: @@ -686,9 +686,9 @@ def after(self, timestamp: datetime, strict: bool = False) -> TRgeometry: strict: Whether the bound is strict. MEOS Functions: - trgeometry_after_timestamptz + temporal_after_timestamptz """ - result = trgeometry_after_timestamptz(self._inner, datetime_to_timestamptz(timestamp), strict) + result = temporal_after_timestamptz(self._inner, datetime_to_timestamptz(timestamp), strict) return Temporal._factory(result) # ------------------------- Distance Operations --------------------------- @@ -839,34 +839,34 @@ def start_sequence(self) -> TRgeometrySeq: Returns the first sequence of `self`. MEOS Functions: - trgeometry_start_sequence + temporal_start_sequence """ - return self.ComponentClass(_inner=trgeometry_start_sequence(self._inner)) + return self.ComponentClass(_inner=temporal_start_sequence(self._inner)) def end_sequence(self) -> TRgeometrySeq: """ Returns the last sequence of `self`. MEOS Functions: - trgeometry_end_sequence + temporal_end_sequence """ - return self.ComponentClass(_inner=trgeometry_end_sequence(self._inner)) + return self.ComponentClass(_inner=temporal_end_sequence(self._inner)) def sequence_n(self, n: int) -> TRgeometrySeq: """ Returns the ``n``-th sequence of `self` (0-based). MEOS Functions: - trgeometry_sequence_n + temporal_sequence_n """ - return self.ComponentClass(_inner=trgeometry_sequence_n(self._inner, n + 1)) + return self.ComponentClass(_inner=temporal_sequence_n(self._inner, n + 1)) def sequences(self) -> list[TRgeometrySeq]: """ Returns the list of sequences of `self`. MEOS Functions: - trgeometry_sequences + temporal_sequences """ - seqs, count = trgeometry_sequences(self._inner) + seqs, count = temporal_sequences(self._inner) return [self.ComponentClass(_inner=seqs[i]) for i in range(count)] diff --git a/pymeos/main/ttext.py b/pymeos/main/ttext.py index 61898471..bd5934a4 100644 --- a/pymeos/main/ttext.py +++ b/pymeos/main/ttext.py @@ -121,9 +121,9 @@ def as_text(self) -> str: A string with the string representation of `self`. MEOS Functions: - ttext_out + temporal_out """ - return ttext_out(self._inner) + return temporal_out(self._inner, 0) def as_wkt(self) -> str: """ @@ -135,7 +135,7 @@ def as_wkt(self) -> str: MEOS Functions: ttext_as_wkt """ - return ttext_out(self._inner) + return temporal_out(self._inner, 0) # ------------------------- Accessors ------------------------------------- def value_set(self) -> set[str]: diff --git a/tests/boxes/stbox_test.py b/tests/boxes/stbox_test.py index dcc56572..10d6a0c1 100644 --- a/tests/boxes/stbox_test.py +++ b/tests/boxes/stbox_test.py @@ -451,20 +451,20 @@ def test_repr(self, stbox, expected): [ ( stbx, - "0101000000000000F03F0000000000000040000000000000F03F0000000000000040", + "01190001000000000000F03F0000000000000040000000000000F03F0000000000000040", ), ( stbz, - "0111000000000000F03F0000000000000040000000000000F03F0000000000000040000000000000F03F0000000000000040", + "01190011000000000000F03F0000000000000040000000000000F03F0000000000000040000000000000F03F0000000000000040", ), - (stbt, "010227000300A01E4E713402000000F66B85340200"), + (stbt, "0119000227000300A01E4E713402000000F66B85340200"), ( stbxt, - "010327000300A01E4E713402000000F66B85340200000000000000F03F0000000000000040000000000000F03F0000000000000040", + "0119000327000300A01E4E713402000000F66B85340200000000000000F03F0000000000000040000000000000F03F0000000000000040", ), ( stbzt, - "011327000300A01E4E713402000000F66B85340200000000000000F03F0000000000000040000000000000F03F0000000000000040000000000000F03F0000000000000040", + "0119001327000300A01E4E713402000000F66B85340200000000000000F03F0000000000000040000000000000F03F0000000000000040000000000000F03F0000000000000040", ), ], ids=["STBox X", "STBox Z", "STBox T", "STBox XT", "STBox ZT"], diff --git a/tests/main/tbool_test.py b/tests/main/tbool_test.py index d71d658e..c84dc687 100644 --- a/tests/main/tbool_test.py +++ b/tests/main/tbool_test.py @@ -1198,9 +1198,7 @@ class TestTBoolModifications(TestTBool): ( tbss, TBoolSeq("[True@2019-09-06]"), - TBoolSeqSet( - "{[True@2019-09-01, False@2019-09-02],[True@2019-09-03, True@2019-09-05],[True@2019-09-06]}" - ), + TBoolSeqSet("{[True@2019-09-01, False@2019-09-02],[True@2019-09-03, True@2019-09-06]}"), ), ], ids=["Instant", "Discrete Sequence", "Sequence", "SequenceSet"], @@ -1248,12 +1246,12 @@ def test_update(self, temporal, instant, expected): ( tbs, datetime(year=2019, month=9, day=1, tzinfo=timezone.utc), - TBoolSeqSet("{(True@2019-09-01, False@2019-09-02]}"), + TBoolSeq("[False@2019-09-02]"), ), ( tbss, datetime(year=2019, month=9, day=1, tzinfo=timezone.utc), - TBoolSeqSet("{(True@2019-09-01, False@2019-09-02],[True@2019-09-03, True@2019-09-05]}"), + TBoolSeqSet("{[False@2019-09-02],[True@2019-09-03, True@2019-09-05]}"), ), ], ids=[ diff --git a/tests/main/tfloat_test.py b/tests/main/tfloat_test.py index fd12b4d0..13f10ba1 100644 --- a/tests/main/tfloat_test.py +++ b/tests/main/tfloat_test.py @@ -1693,7 +1693,7 @@ class TestTFloatModifications(TestTFloat): ( tfss, TFloatSeq("[1.5@2019-09-06]"), - TFloatSeqSet("{[1.5@2019-09-01, 2.5@2019-09-02],[1.5@2019-09-03, 1.5@2019-09-05],[1.5@2019-09-06]}"), + TFloatSeqSet("{[1.5@2019-09-01, 2.5@2019-09-02],[1.5@2019-09-03, 1.5@2019-09-06]}"), ), ], ids=["Instant", "Discrete Sequence", "Sequence", "SequenceSet"], @@ -1739,12 +1739,12 @@ def test_update(self, temporal, instant, expected): ( tfs, datetime(year=2019, month=9, day=1, tzinfo=timezone.utc), - TFloatSeqSet("{(1.5@2019-09-01, 2.5@2019-09-02]}"), + TFloatSeq("[2.5@2019-09-02]"), ), ( tfss, datetime(year=2019, month=9, day=1, tzinfo=timezone.utc), - TFloatSeqSet("{(1.5@2019-09-01, 2.5@2019-09-02],[1.5@2019-09-03, 1.5@2019-09-05]}"), + TFloatSeqSet("{[2.5@2019-09-02],[1.5@2019-09-03, 1.5@2019-09-05]}"), ), ], ids=[ diff --git a/tests/main/tgeogpoint_test.py b/tests/main/tgeogpoint_test.py index b30d449b..58c1d161 100644 --- a/tests/main/tgeogpoint_test.py +++ b/tests/main/tgeogpoint_test.py @@ -1,4 +1,3 @@ -import platform from copy import copy from datetime import datetime, timedelta, timezone from operator import not_ @@ -1977,7 +1976,7 @@ class TestTGeogPointModifications(TestTGeogPoint): tpss, TGeogPointSeq("[Point(1 1)@2019-09-06]"), TGeogPointSeqSet( - "{[Point(1 1)@2019-09-01, Point(2 2)@2019-09-02],[Point(1 1)@2019-09-03, Point(1 1)@2019-09-05],[Point(1 1)@2019-09-06]}" + "{[Point(1 1)@2019-09-01, Point(2 2)@2019-09-02],[Point(1 1)@2019-09-03, Point(1 1)@2019-09-06]}" ), ), ], @@ -2030,14 +2029,12 @@ def test_update(self, temporal, instant, expected): ( tps, datetime(year=2019, month=9, day=1, tzinfo=timezone.utc), - TGeogPointSeqSet("{(Point(1 1)@2019-09-01, Point(2 2)@2019-09-02]}"), + TGeogPointSeq("[Point(2 2)@2019-09-02]"), ), ( tpss, datetime(year=2019, month=9, day=1, tzinfo=timezone.utc), - TGeogPointSeqSet( - "{(Point(1 1)@2019-09-01, Point(2 2)@2019-09-02],[Point(1 1)@2019-09-03, Point(1 1)@2019-09-05]}" - ), + TGeogPointSeqSet("{[Point(2 2)@2019-09-02],[Point(1 1)@2019-09-03, Point(1 1)@2019-09-05]}"), ), ], ids=[ @@ -2786,18 +2783,6 @@ def test_ever_equal_always_not_equal(self, temporal, argument, expected): assert temporal.never_equal(argument) == not_(expected) -# MEOS dates the meeting of two geodetic segments with the Cartesian fraction of -# tgeogpointsegm_distance_turnpt and tests the two great-circle points it interpolates there -# for exact equality, so the meeting at 12:00 is found only where the two roundings agree: on -# x86 they do, on arm64 they do not. Strict, so the mark fails the run once MEOS dates the -# meeting exactly on every platform. -GEODETIC_CROSSING_ON_ARM64 = pytest.mark.xfail( - platform.machine() in ("arm64", "aarch64"), - reason="MEOS dates a geodetic crossing by a Cartesian fraction and exact point equality", - strict=True, -) - - class TestTGeogPointTemporalComparisons(TestTGeogPoint): tpi = TGeogPointInst("Point(1 1)@2019-09-01") tpds = TGeogPointSeq("{Point(1 1)@2019-09-01, Point(2 2)@2019-09-02}") @@ -2812,20 +2797,18 @@ class TestTGeogPointTemporalComparisons(TestTGeogPoint): [ (tpi, TBoolInst("False@2019-09-01")), (tpds, TBoolSeq("{False@2019-09-01, False@2019-09-02}")), - pytest.param( + ( tps, TBoolSeqSet( "{[False@2019-09-01, True@2019-09-01 12:00:00+00],(False@2019-09-01 12:00:00+00, False@2019-09-02]}" ), - marks=GEODETIC_CROSSING_ON_ARM64, ), - pytest.param( + ( tpss, TBoolSeqSet( "{[False@2019-09-01, True@2019-09-01 12:00:00+00]," "(False@2019-09-01 12:00:00+00, False@2019-09-02],[True@2019-09-03]}" ), - marks=GEODETIC_CROSSING_ON_ARM64, ), ], ids=["Instant", "Discrete Sequence", "Sequence", "SequenceSet"], diff --git a/tests/main/tgeompoint_test.py b/tests/main/tgeompoint_test.py index 551cd9fe..7a6ec933 100644 --- a/tests/main/tgeompoint_test.py +++ b/tests/main/tgeompoint_test.py @@ -2071,7 +2071,7 @@ class TestTGeomPointModifications(TestTGeomPoint): tpss, TGeomPointSeq("[Point(1 1)@2019-09-06]"), TGeomPointSeqSet( - "{[Point(1 1)@2019-09-01, Point(2 2)@2019-09-02],[Point(1 1)@2019-09-03, Point(1 1)@2019-09-05],[Point(1 1)@2019-09-06]}" + "{[Point(1 1)@2019-09-01, Point(2 2)@2019-09-02],[Point(1 1)@2019-09-03, Point(1 1)@2019-09-06]}" ), ), ], @@ -2124,14 +2124,12 @@ def test_update(self, temporal, instant, expected): ( tps, datetime(year=2019, month=9, day=1, tzinfo=timezone.utc), - TGeomPointSeqSet("{(Point(1 1)@2019-09-01, Point(2 2)@2019-09-02]}"), + TGeomPointSeq("[Point(2 2)@2019-09-02]"), ), ( tpss, datetime(year=2019, month=9, day=1, tzinfo=timezone.utc), - TGeomPointSeqSet( - "{(Point(1 1)@2019-09-01, Point(2 2)@2019-09-02],[Point(1 1)@2019-09-03, Point(1 1)@2019-09-05]}" - ), + TGeomPointSeqSet("{[Point(2 2)@2019-09-02],[Point(1 1)@2019-09-03, Point(1 1)@2019-09-05]}"), ), ], ids=[ @@ -2958,21 +2956,24 @@ def test_temporal_ever_contained_withindist_intersects(self, temporal, expected) assert temporal.ever_intersects(Point(1, 1)) == expected assert temporal.ever_intersects(TGeomPointInst("Point(1 1)@2019-09-01")) == expected - # etouches_tpoint_geo, the function of eTouches(tgeompoint, geometry): the - # boundary of the trajectory of a sequence starting at Point(1 1) holds - # Point(1 1), and a trajectory of points has an empty boundary + # etouches_tpoint_geo, the function of eTouches(tgeompoint, geometry): a + # point touches a geometry where it lies on the boundary of the geometry, + # and Point(1 1) has an empty boundary, so no temporal point touches it, + # while every value below stands at Point(1 1), a corner of the unit square; + # two geometries per value, as #test_temporal_ever_contained_withindist_intersects @pytest.mark.parametrize( "temporal, expected", [ (tpi, False), (tpds, False), - (tps, True), - (tpss, True), + (tps, False), + (tpss, False), ], ids=["Instant", "Discrete Sequence", "Sequence", "SequenceSet"], ) def test_temporal_ever_touches(self, temporal, expected): assert temporal.ever_touches(Point(1, 1)) == expected + assert temporal.ever_touches(Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)])) is True @pytest.mark.parametrize( "temporal, expected", diff --git a/tests/main/tint_test.py b/tests/main/tint_test.py index 28c51eed..5919c1c3 100644 --- a/tests/main/tint_test.py +++ b/tests/main/tint_test.py @@ -1440,7 +1440,7 @@ class TestTIntModifications(TestTInt): ( tiss, TIntSeq("[1@2019-09-06]"), - TIntSeqSet("{[1@2019-09-01, 2@2019-09-02],[1@2019-09-03, 1@2019-09-05],[1@2019-09-06]}"), + TIntSeqSet("{[1@2019-09-01, 2@2019-09-02],[1@2019-09-03, 1@2019-09-06]}"), ), ], ids=["Instant", "Discrete Sequence", "Sequence", "SequenceSet"], @@ -1482,12 +1482,12 @@ def test_update(self, temporal, instant, expected): ( tis, datetime(year=2019, month=9, day=1, tzinfo=timezone.utc), - TIntSeqSet("{(1@2019-09-01, 2@2019-09-02]}"), + TIntSeq("[2@2019-09-02]"), ), ( tiss, datetime(year=2019, month=9, day=1, tzinfo=timezone.utc), - TIntSeqSet("{(1@2019-09-01, 2@2019-09-02],[1@2019-09-03, 1@2019-09-05]}"), + TIntSeqSet("{[2@2019-09-02],[1@2019-09-03, 1@2019-09-05]}"), ), ], ids=[ diff --git a/tests/main/trgeometry_test.py b/tests/main/trgeometry_test.py index 27fab869..e7aa4ba7 100644 --- a/tests/main/trgeometry_test.py +++ b/tests/main/trgeometry_test.py @@ -2,6 +2,7 @@ from datetime import datetime, timezone import pytest +from pymeos_cffi import MeosInvalidArgValueError from shapely import Point, Polygon from pymeos import ( @@ -167,32 +168,44 @@ class TestTRgeometrySpatialRelationships(TestTRgeometry): far_trs = TRgeometry.from_geometry_tpose( geometry, TPoseSeq("[Pose(Point(100 100), 0)@2019-09-01, Pose(Point(101 101), 0)@2019-09-02]") ) + # A body in linear motion moves and turns between its poses: intersects, + # disjoint and within distance read that motion, while contains, covers and + # touches refuse it and read the body at the same poses held with step + # interpolation; the assertions are those of #TestTCbufferSpatialRelationships. + trs_step = TRgeometry.from_geometry_tpose( + geometry, TPoseSeq("Interp=Step;[Pose(Point(1 1), 0.5)@2019-09-01, Pose(Point(2 2), 0.3)@2019-09-02]") + ) def test_ever_relationships(self): - assert self.trs.is_ever_contained_in(self.around) is True - assert self.trs.is_ever_coveredby(self.around) is True - assert self.trs.is_ever_coveredby(self.far) is False - assert self.trs.is_ever_covers(self.far) is False + assert self.trs_step.is_ever_contained_in(self.around) is True + assert self.trs_step.is_ever_coveredby(self.around) is True + assert self.trs_step.is_ever_coveredby(self.far) is False + assert self.trs_step.is_ever_covers(self.far) is False + with pytest.raises(MeosInvalidArgValueError): + self.trs.is_ever_contained_in(self.around) assert self.trs.is_ever_disjoint(self.far) is True assert self.trs.is_ever_disjoint(self.far_trs) is True assert self.trs.is_ever_within_distance(self.far, 1.0) is False assert self.trs.is_ever_within_distance(self.far_trs, 1000.0) is True assert self.trs.ever_intersects(self.around) is True assert self.trs.ever_intersects(self.far_trs) is False - assert self.trs.ever_touches(self.far) is False + assert self.trs_step.ever_touches(self.far) is False + # The always twin of #test_ever_relationships. def test_always_relationships(self): - assert self.trs.is_always_contained_in(self.around) is True - assert self.trs.is_always_coveredby(self.around) is True - assert self.trs.is_always_coveredby(self.far) is False - assert self.trs.is_always_covers(self.far) is False + assert self.trs_step.is_always_contained_in(self.around) is True + assert self.trs_step.is_always_coveredby(self.around) is True + assert self.trs_step.is_always_coveredby(self.far) is False + assert self.trs_step.is_always_covers(self.far) is False + with pytest.raises(MeosInvalidArgValueError): + self.trs.is_always_contained_in(self.around) assert self.trs.is_always_disjoint(self.far) is True assert self.trs.is_always_disjoint(self.far_trs) is True assert self.trs.is_always_within_distance(self.far, 1.0) is False assert self.trs.is_always_within_distance(self.far_trs, 1000.0) is True assert self.trs.always_intersects(self.around) is True assert self.trs.always_intersects(self.far_trs) is False - assert self.trs.always_touches(self.far) is False + assert self.trs_step.always_touches(self.far) is False class TestTRgeometryRestrictions(TestTRgeometry): diff --git a/tests/main/ttext_test.py b/tests/main/ttext_test.py index f63d1a16..bd6ab3e6 100644 --- a/tests/main/ttext_test.py +++ b/tests/main/ttext_test.py @@ -1203,7 +1203,7 @@ class TestTTextModifications(TestTText): ( ttss, TTextSeq("[AAA@2019-09-06]"), - TTextSeqSet("{[AAA@2019-09-01, BBB@2019-09-02],[AAA@2019-09-03, AAA@2019-09-05],[AAA@2019-09-06]}"), + TTextSeqSet("{[AAA@2019-09-01, BBB@2019-09-02],[AAA@2019-09-03, AAA@2019-09-06]}"), ), ], ids=["Instant", "Discrete Sequence", "Sequence", "SequenceSet"], @@ -1249,12 +1249,12 @@ def test_update(self, temporal, instant, expected): ( tts, datetime(year=2019, month=9, day=1, tzinfo=timezone.utc), - TTextSeqSet("{(AAA@2019-09-01, BBB@2019-09-02]}"), + TTextSeq("[BBB@2019-09-02]"), ), ( ttss, datetime(year=2019, month=9, day=1, tzinfo=timezone.utc), - TTextSeqSet("{(AAA@2019-09-01, BBB@2019-09-02],[AAA@2019-09-03, AAA@2019-09-05]}"), + TTextSeqSet("{[BBB@2019-09-02],[AAA@2019-09-03, AAA@2019-09-05]}"), ), ], ids=[