Class LinePathConverter
- java.lang.Object
-
- ch.sahits.game.openpatrician.display.service.LinePathConverter
-
- All Implemented Interfaces:
ch.sahits.game.openpatrician.clientserverinterface.service.IPathConverter
public class LinePathConverter extends java.lang.Object implements ch.sahits.game.openpatrician.clientserverinterface.service.IPathConverterConverts 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
-
-
Constructor Summary
Constructors Constructor Description LinePathConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcalculateDuration(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel, ch.sahits.game.openpatrician.clientserverinterface.service.PathInterpolator interpolator, double fraction)No real implementation here.java.util.Optional<javafx.scene.shape.Path>createPath(ch.sahits.game.openpatrician.model.ship.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)No actual reduction of points happens.
-
-
-
Method Detail
-
createPath
public java.util.Optional<javafx.scene.shape.Path> createPath(ch.sahits.game.openpatrician.model.ship.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:
createPathin interfacech.sahits.game.openpatrician.clientserverinterface.service.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)
No actual reduction of points happens.- Specified by:
reduceLinePointsin interfacech.sahits.game.openpatrician.clientserverinterface.service.IPathConverter- Parameters:
initialPoints- list of initial points- Returns:
- List of points
-
calculateDuration
public long calculateDuration(ch.sahits.game.openpatrician.model.ship.INavigableVessel vessel, ch.sahits.game.openpatrician.clientserverinterface.service.PathInterpolator interpolator, double fraction)No real implementation here.- Specified by:
calculateDurationin interfacech.sahits.game.openpatrician.clientserverinterface.service.IPathConverter- Parameters:
vessel- that is travelinginterpolator- used to hold the path informationfraction- value between [0,1]. 1 means that the whole distance is traveled.- Returns:
- calculated travel duration.
-
-