com.ibm.geolib.st

Interface MovingGeometry<T extends Geometry>

  • Type Parameters:
    T - - type representing a geometry value at a specific moment
    All Superinterfaces:
    java.lang.Cloneable, Geometry, Moving, Spatial
    All Known Subinterfaces:
    SolidMovingGeometry<T>


    public interface MovingGeometry<T extends Geometry>
    extends Moving, Geometry
    This class serves for tracking movement of a spatial object over time. The common scenario for using moving geometry is as follows:
    1. Create a new moving geometry object using MovingGeometryFactory
    2. Report geometry changes over time via setGeometryAtTime()
    3. Call other methods for queries over the tracked history of the object's movement (e.g. get geometry value at given time moment, compute speed, detect geofence breaches etc.)
    A snapshot represents the geometry value at a specific moment. Any geometry change performed by either of the above methods is stored as a snapshot. Conceptually the movement history can be represented as a sequence of snapshots.

    Theoretically one can imagine a moving geometry that tracks the entire history of an object's movement from its creation to its end of life, which in some cases might not be limited in time. However, in reality this is impractical and often not necessary. Therefore one can limit the size of the geometry history by providing a value for the history time limit. By default the history is limited to 24 hours.

    • Method Detail

      • setHistoryTimeLimit

        void setHistoryTimeLimit(java.time.Duration duration)
        Parameters:
        duration -
      • getHistoryTimeLimit

        java.time.Duration getHistoryTimeLimit()
        Returns:
        the duration limit for recording the history
      • getGeometry

        T getGeometry()
        Description copied from interface: Spatial
        Get the associated geometry
        Specified by:
        getGeometry in interface Spatial
        Returns:
        the latest known geometry is returned. The returned value equals that of getLastObservedGeometry().
        See Also:
        Spatial#getGeometry()}, MovingGeometry#getLastObservedGeometry()}
      • getGeometryAtTime

        Geometry getGeometryAtTime(java.time.ZonedDateTime timestamp)
        Parameters:
        timestamp -
        Returns:
        the geometry expected to be at a specific time
      • setGeometryAtTime

        void setGeometryAtTime(T geometry,
                             java.time.ZonedDateTime timestamp)
        Report a geometry value at a specific moment
        Parameters:
        geometry -
        timestamp -
      • getSnapshot

        Snapshot<T> getSnapshot(int index)
        Get a snapshot by index
        Parameters:
        index -
        Returns:
        the snapshot at the specific index
      • getSnapshots

        java.util.List<Snapshot<T>> getSnapshots()
        Returns:
        all the snapshots
      • getSnapshots

        java.util.List<Snapshot<T>> getSnapshots(TimeInterval timeInterval)
        Parameters:
        timeInterval -
        Returns:
        a list of the snapshots that were reported during the time interval
      • getSnapshots

        java.util.List<Snapshot<T>> getSnapshots(java.util.List<TimeInterval> timeIntervals)
        Parameters:
        timeIntervals -
        Returns:
        a list of the snapshots that were reported during the time intervals
      • getNumberOfSnapshots

        int getNumberOfSnapshots()
        Returns:
        the number of snapshots that have been stored for this moving geometry
      • isApproaching

        boolean isApproaching(Geometry geometry)
        Check if the object is approaching the given geometry
        Parameters:
        geometry - - geometry to which this object is approaching
        Returns:
        true if this object is moving towards the geometry argument, false - otherwise
      • isLeaving

        boolean isLeaving(Geometry geometry)
        Check if the object is leaving the given geometry
        Parameters:
        geometry - - geometry which this object is leaving
        Returns:
        true if this object is moving away from the geometry argument, false - otherwise
      • hasEntered

        boolean hasEntered(Polygon area)
        Check whether this object has entered the specified area during its known history. Note: the known history is the history limited according to the specified history time limit.
        Parameters:
        area -
        Returns:
        true if this object has entered the area during its (stored) history, false - otherwise
      • hasEnteredSince

        boolean hasEnteredSince(Polygon area,
                              java.time.ZonedDateTime time)
        Check whether this object has entered the specified area since the specified moment
        Parameters:
        area -
        time -
        Returns:
        true if this object has entered the specified area since the specified moment, false - otherwise
      • hasExited

        boolean hasExited(Polygon area)
        Check whether this object has exited the specified area during its known history. Note: the known history is the history limited according to the specified history time limit.
        Parameters:
        area -
        Returns:
        true if this object has exited the area during its (stored) history, false - otherwise
      • hasExitedSince

        boolean hasExitedSince(Polygon area,
                             java.time.ZonedDateTime time)
        Check whether this object has exited the specified area since the specified moment
        Parameters:
        area -
        time -
        Returns:
        true if this object has exited the specified area since the specified moment, false - otherwise
      • hasBeenDwellingInAreaSince

        boolean hasBeenDwellingInAreaSince(Polygon area,
                                         java.time.ZonedDateTime time)
        Check whether this object existed (its first sample occurred before time) and has been dwelling within the area since time. It is assumed that the object stays in the same location until the next sample is reported. Only the samples are considered - no interpolation is performed.
        Parameters:
        area -
        time -
        Returns:
        true if the conditions above are satisfied
      • hasBeenDwellingInAreaDuringTimePeriod

        boolean hasBeenDwellingInAreaDuringTimePeriod(Polygon area,
                                                    TimeInterval timeInterval)
        Check whether this object existed (its first sample occurred before the beginning of timeInterval) and has been dwelling within the area during the duration of timeInterval. It is assumed that the object stays in the same location until the next sample is reported. Only the samples are considered - no interpolation is performed.
        Parameters:
        area -
        timeInterval -
        Returns:
        true if the conditions above are satisfied
      • hasBeenDwellingWithinDistanceDuringTimePeriod

        boolean hasBeenDwellingWithinDistanceDuringTimePeriod(Geometry geometry,
                                                            TimeInterval timeInterval,
                                                            double distance,
                                                            LengthUnit units)
        Check whether this object existed (its first sample occurred before the beginning of timeInterval) and has been dwelling within the specified distance during the duration of timeInterval. It is assumed that the object stays in the same location until the next sample is reported. Only the samples are considered - no interpolation is performed.
        Parameters:
        geometry - the other geometry
        timeInterval -
        distance - maximal distance limit
        units - the distance units
        Returns:
        true if the condisions above are satisfied
      • hasBeenDwellingWithinDistanceSince

        boolean hasBeenDwellingWithinDistanceSince(Geometry geometry,
                                                 java.time.ZonedDateTime time,
                                                 double distance,
                                                 LengthUnit units)
        Check whether this object existed (its first sample occurred before time) and has been dwelling within the specified distance since time. It is assumed that the object stays in the same location until the next sample is reported. Only the samples are considered - no interpolation is performed.
        Parameters:
        geometry - the other geometry
        time -
        distance -
        units - maximal distance limit
        Returns:
        true if the above conditions are satisfied
      • getFirstObservedTime

        java.time.ZonedDateTime getFirstObservedTime()
        Returns:
        the earliest time when this object's location was reported. Note that the history might be truncated because of the history time limit. In case time is earlier than the first sample or later than the last one, a false is returned The test is with each sample separately - no interpolation is performed
      • getLastObservedTime

        java.time.ZonedDateTime getLastObservedTime()
        Returns:
        the latest time when this object's location was reported.
      • getFirstObservedGeometry

        T getFirstObservedGeometry()
        Returns:
        the earliest geometry value reported. Note that the history might be truncated because of the history time limit.
      • getLastObservedGeometry

        T getLastObservedGeometry()
        Returns:
        the latest geometry value reported.
      • getEncounters

        java.util.List<TimeInterval> getEncounters(Geometry geometry,
                                                 double maxDistance,
                                                 LengthUnit distanceUnits)
        Compute the time intervals in which encounters between this object and the other (argument) geometry occurred. The encounter is determined by the maximal distance between two objects that qualifies as an encounter in the given problem domain.
        Parameters:
        geometry -
        maxDistance - maximal distance that qualifies as an encounter
        distanceUnits -
        Returns:
        the time intervals corresponding to the encounters
      • getDuration

        java.time.Duration getDuration()
        Returns:
        the total duration stored for this moving geometry
      • getSubtrajectory

        MovingGeometry<T> getSubtrajectory(TimeInterval interval)
        Parameters:
        interval -
        Returns:
        the sub-trajectory of the instance during the time defined by the time interval
      • getLineString

        LineString getLineString()
        Returns:
        the trajectory of the moving geometry in the form of a line string
      • getSynchronizedDistanceMax

        double getSynchronizedDistanceMax(MovingGeometry<? extends Geometry> otherTrjectory,
                                        LengthUnit units)
        Compute the maximum distance between the moving geometries, synchronizing them with the time
        Parameters:
        interval - the interval for which the subtrajectory is requires
        Returns:
      • getSynchronizedDistanceMin

        double getSynchronizedDistanceMin(MovingGeometry<? extends Geometry> otherTrjectory,
                                        LengthUnit units)
        Compute the minimum distance between the moving geometries, synchronizing them with the time
        Parameters:
        otherMovingGeometry - the other instance to compute the distance to
        Returns:
      • getSynchronizedDistanceSum

        double getSynchronizedDistanceSum(MovingGeometry<? extends Geometry> otherMovingGeometry,
                                        LengthUnit units)
        Compute the sum of distances between the moving geometries, synchronizing them with the time
        Parameters:
        otherMovingGeometry - the other instance to compute the distance to
        Returns:
      • getFretchetDistance

        double getFretchetDistance(MovingGeometry<? extends Geometry> otherMovingGeometry,
                                 LengthUnit units)
        Compute the Fretchet distance between the moving geometries. The Fretchet is a common measure for the similarity of the trajectories induced by the moving geometries
        Parameters:
        otherMovingGeometry -
        units - - the length unit of the result
        Returns:
      • getDynamicTimeWarpingDistance

        double getDynamicTimeWarpingDistance(MovingGeometry<? extends Geometry> otherMovingGeometry,
                                           LengthUnit units)
        Compute the dynamic time warping distance between the moving geometries. The dynamic time warping is a common measure for the similarity of the trajectories induced by the moving geometries
        Parameters:
        otherSolidMovingGeometry -
        units - - the length unit of the result
        Returns:
      • getMinRouteDistance

        double getMinRouteDistance(MovingGeometry<T> stg,
                                 LengthUnit units)
        Compute the minimum distance between the routes of the moving geometries
        Parameters:
        otherSolidMovingGeometry -
        units - - the length unit of the result
        Returns:
      • getAcceleration

        double getAcceleration(AccelerationUnit accelerationUnit)
        Parameters:
        accelerationUnit -
        Returns:
        the current acceleration in the units specified by accelerationUnit
      • getAcceleration

        double getAcceleration(java.time.ZonedDateTime timestamp,
                             AccelerationUnit accelerationUnit)
        Parameters:
        accelerationUnit -
        Returns:
        the acceleration at time specified by timestamp in the units specified by accelerationUnit
      • isAccelerating

        boolean isAccelerating()
        Returns:
        whether the instance is accelerating at the current time
      • isAccelerating

        boolean isAccelerating(java.time.ZonedDateTime timestamp)
        Parameters:
        timestamp -
        Returns:
        whether the instance was accelerating at the time specified by timestamp
      • isDecelerating

        boolean isDecelerating()
        Returns:
        whether the instance is decelerating at the current time
      • isDecelerating

        boolean isDecelerating(java.time.ZonedDateTime timestamp)
        Parameters:
        timestamp -
        Returns:
        whether the instance was decelerating at the time specified by timestamp
      • getSpeed

        double getSpeed(SpeedUnit speedUnit)
        Parameters:
        speedUnit -
        Returns:
        the current speed in the units specified by speedUnit
      • getSpeed

        double getSpeed(java.time.ZonedDateTime timestamp,
                      SpeedUnit speedUnit)
        Parameters:
        timestamp -
        speedUnit -
        Returns:
        the speed at a specific time specified by timeStamp in the units specified by speedUnit
      • getAvgSpeed

        double getAvgSpeed(SpeedUnit speedUnit,
                         TimeInterval timeInterval)
        Parameters:
        speedUnit -
        timeInterval -
        Returns:
        the average speed during the interval specified by timeInterval in the units specified by speedUnit
      • getMinSpeed

        double getMinSpeed(SpeedUnit speedUnit,
                         TimeInterval timeInterval)
        Parameters:
        speedUnit -
        timeInterval -
        Returns:
        the minimal speed during the interval specified by timeInterval in the units specified by speedUnit
      • getMaxSpeed

        double getMaxSpeed(SpeedUnit speedUnit,
                         TimeInterval timeInterval)
        Parameters:
        speedUnit -
        timeInterval -
        Returns:
        the maximal speed during the interval specified by timeInterval in the units specified by speedUnit
      • getAvgSpeed

        double getAvgSpeed(SpeedUnit speedUnit)
        Parameters:
        speedUnit -
        timeInterval -
        Returns:
        the average speed over the entire stored period for this object in the units specified by speedUnit
      • getMinSpeed

        double getMinSpeed(SpeedUnit speedUnit)
        Parameters:
        speedUnit -
        Returns:
        the minimum speed over the entire stored period for this object in the units specified by speedUnit
      • getMaxSpeed

        double getMaxSpeed(SpeedUnit speedUnit)
        Parameters:
        speedUnit -
        Returns:
        the maximum speed over the entire stored period for this object in the units
      • getLength

        double getLength(LengthUnit units)
        Returns:
        the total length reported for the moving geometry
      • isMoving

        boolean isMoving(double threshold,
                       SpeedUnit speedUnit)
        Check whether this object is moving. The decision is based on the threshold that determines the minimal speed that is considered movement.
        Parameters:
        threshold - - the minimal speed which qualifies as movement
        speedUnit - - units for speed
        Returns:
        true if this object is moving, otherwise - false
      • setId

        void setId(java.lang.String id)
        Set the id of the gometry
        Parameters:
        id -
      • getId

        java.lang.String getId()
        Returns:
        the id of the geometry

© Copyright IBM 2017