Class LinePathConverter

  • All Implemented Interfaces:
    IPathConverter

    public class LinePathConverter
    extends java.lang.Object
    implements IPathConverter
    Converts a list of point into a shape that can be used as path. This algorithm uses straight lines.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2016 Created on Jan 05, 2016
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long calculateDuration​(INavigableVessel vessel, PathInterpolator interpolator, double fraction)
      No real implementation here.
      java.util.Optional<javafx.scene.shape.Path> createPath​(INavigableVessel vessel, java.util.List<javafx.geometry.Point2D> pointedPath, double scale)
      Create a path shape out of a list of points.
      java.util.List<javafx.geometry.Point2D> reduceLinePoints​(java.util.List<javafx.geometry.Point2D> initialPoints)
      Reduce the number of points that are needed to describe the path.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LinePathConverter

        public LinePathConverter()
    • Method Detail

      • createPath

        public java.util.Optional<javafx.scene.shape.Path> createPath​(INavigableVessel vessel,
                                                                      java.util.List<javafx.geometry.Point2D> pointedPath,
                                                                      double scale)
        Create a path shape out of a list of points. When the path is created the vessel will be added to the TravellingVessels container.
        Specified by:
        createPath in interface IPathConverter
        Parameters:
        vessel - vessel that is traveling the path.
        pointedPath - input points.
        scale - scaling that is used on the path due to the sacle of the map.
        Returns:
        shape representing a path.
      • reduceLinePoints

        public java.util.List<javafx.geometry.Point2D> reduceLinePoints​(java.util.List<javafx.geometry.Point2D> initialPoints)
        Reduce the number of points that are needed to describe the path. No actual reduction of points happens.
        Specified by:
        reduceLinePoints in interface IPathConverter
        Parameters:
        initialPoints - list of initial points
        Returns:
        List of points
      • calculateDuration

        public long calculateDuration​(INavigableVessel vessel,
                                      PathInterpolator interpolator,
                                      double fraction)
        No real implementation here.
        Specified by:
        calculateDuration in interface IPathConverter
        Parameters:
        vessel - that is traveling
        interpolator - used to hold the path information
        fraction - value between [0,1]. 1 means that the whole distance is traveled.
        Returns:
        calculated travel duration.