Class GameMap
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.map.impl.GameMap
-
- All Implemented Interfaces:
IMap
@Component @Lazy @DependentInitialisation(StartNewGameBean.class) public class GameMap extends java.lang.Object implements IMap
Implementation of the game map. This singleton is instaniated by the Game Factory.- Author:
- Andi Hotz, (c) Sahits GmbH, 2011 Created on Sep 16, 2011
-
-
Field Summary
Fields Modifier and Type Field Description private CaptainsState
captainsState
private java.util.LinkedList<ICity>
cities
private java.util.List<javafx.geometry.Point2D>
cityCoordinates
private com.google.common.eventbus.AsyncEventBus
clientServerEventBus
private javafx.geometry.Dimension2D
dimension
private java.util.List<IFutureTowns>
futureTowns
private java.util.List<ILandBridge>
landbridges
private java.lang.String
mapBWImagePath
private java.lang.String
mapImagePath
private double
numberOfPixelPerKilometer
private java.util.List<PirateNest>
pirateNests
private com.google.common.collect.Multimap<IPlayer,ICity>
townsInFounding
private java.util.Set<ITradeRoute>
tradeRoutes
-
Constructor Summary
Constructors Constructor Description GameMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(ICity city)
Add a new city.void
addTradeRoute(ITradeRoute tradeRoute)
ICity
findCity(java.lang.String cityName)
Find a city by its name.java.util.Optional<ICity>
findCity(javafx.geometry.Point2D location)
Find the city at the given coordinates.java.util.List<ICity>
getCities()
Retrieve an unmodifiable list of all the cities in the mapjava.util.List<ICity>
getCities(IPlayer player)
Retrieve an unmodifiable list of all the cities in the map also including the once only visible to the player.int
getNumberCities()
Retrieve the number of cities that are on the map.void
setup(java.util.Collection<ICity> cities, javafx.geometry.Dimension2D dim, java.lang.String mapName, java.lang.String bwImageName, double numberOfPixelPerKilometer)
Initialize the map by means of a list of its cities.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ch.sahits.game.openpatrician.model.map.IMap
getCityCoordinates, getDimension, getFutureTowns, getLandbridges, getMapBWImagePath, getMapImagePath, getNumberOfPixelPerKilometer, getPirateNests, getTownsInFounding, getTradeRoutes
-
-
-
-
Field Detail
-
cities
private final java.util.LinkedList<ICity> cities
-
captainsState
@Autowired private CaptainsState captainsState
-
dimension
private javafx.geometry.Dimension2D dimension
-
mapImagePath
private java.lang.String mapImagePath
-
mapBWImagePath
private java.lang.String mapBWImagePath
-
numberOfPixelPerKilometer
private double numberOfPixelPerKilometer
-
futureTowns
private final java.util.List<IFutureTowns> futureTowns
-
landbridges
private final java.util.List<ILandBridge> landbridges
-
pirateNests
private final java.util.List<PirateNest> pirateNests
-
cityCoordinates
private java.util.List<javafx.geometry.Point2D> cityCoordinates
-
tradeRoutes
private java.util.Set<ITradeRoute> tradeRoutes
-
clientServerEventBus
@Autowired @Qualifier("serverClientEventBus") private com.google.common.eventbus.AsyncEventBus clientServerEventBus
-
-
Method Detail
-
setup
public void setup(java.util.Collection<ICity> cities, javafx.geometry.Dimension2D dim, java.lang.String mapName, java.lang.String bwImageName, double numberOfPixelPerKilometer)
Initialize the map by means of a list of its cities.- Parameters:
cities
- List of cities for which to set up the mapdim
- dimensions of the mapbwImageName
- black and white image filename distinguishing land and seamapName
- image filenamenumberOfPixelPerKilometer
- ratio of pixels that make up one km on the map
-
getNumberCities
public int getNumberCities()
Description copied from interface:IMap
Retrieve the number of cities that are on the map.- Specified by:
getNumberCities
in interfaceIMap
- Returns:
- number of cities on the map.
-
getCities
public java.util.List<ICity> getCities()
Description copied from interface:IMap
Retrieve an unmodifiable list of all the cities in the map
-
findCity
public ICity findCity(java.lang.String cityName)
Description copied from interface:IMap
Find a city by its name.
-
getCities
public java.util.List<ICity> getCities(IPlayer player)
Description copied from interface:IMap
Retrieve an unmodifiable list of all the cities in the map also including the once only visible to the player.
-
findCity
public java.util.Optional<ICity> findCity(javafx.geometry.Point2D location)
Description copied from interface:IMap
Find the city at the given coordinates.
-
addTradeRoute
public void addTradeRoute(ITradeRoute tradeRoute)
-
-