Class LocationTracker
- java.lang.Object
-
- ch.sahits.game.openpatrician.engine.sea.LocationTracker
-
- All Implemented Interfaces:
ch.sahits.game.openpatrician.model.sea.ILocationTracker
@Component @Lazy public class LocationTracker extends java.lang.Object implements ch.sahits.game.openpatrician.model.sea.ILocationTrackerComponent that helps split up the amount of ships into segements of the navigable map. This reduces the omount of ships that need to be checked if a ship nearby is searched.- Author:
- Andi Hotz, (c) Sahits GmbH, 2015 Created on Dec 13, 2015
-
-
Field Summary
Fields Modifier and Type Field Description protected com.google.common.collect.Interner<javafx.geometry.Point2D>pointInterner
-
Constructor Summary
Constructors Constructor Description LocationTracker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)java.util.List<ch.sahits.game.openpatrician.model.ship.INavigableVessel>getShipsInSegment(javafx.geometry.Point2D location)java.util.List<ch.sahits.game.openpatrician.model.ship.INavigableVessel>getShipsInSegments(javafx.geometry.Point2D location, int radius)voidhandleGameLoad(ch.sahits.game.openpatrician.event.GameStateChange gameStateChange)voidhandleShipMove(ch.sahits.game.openpatrician.event.data.ShipPositionUpdateEvent event)voidremove(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)voidupdateSegmentSize(int nbShips)
-
-
-
Method Detail
-
updateSegmentSize
public void updateSegmentSize(int nbShips)
-
add
public void add(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)
- Specified by:
addin interfacech.sahits.game.openpatrician.model.sea.ILocationTracker
-
remove
public void remove(ch.sahits.game.openpatrician.model.ship.INavigableVessel ship)
-
getShipsInSegment
public java.util.List<ch.sahits.game.openpatrician.model.ship.INavigableVessel> getShipsInSegment(javafx.geometry.Point2D location)
-
getShipsInSegments
public java.util.List<ch.sahits.game.openpatrician.model.ship.INavigableVessel> getShipsInSegments(javafx.geometry.Point2D location, int radius)
-
handleShipMove
public void handleShipMove(ch.sahits.game.openpatrician.event.data.ShipPositionUpdateEvent event)
-
handleGameLoad
public void handleGameLoad(ch.sahits.game.openpatrician.event.GameStateChange gameStateChange)
-
-