Package net.sf.freecol.client.control
Class MapEditorController
- java.lang.Object
-
- net.sf.freecol.client.control.FreeColClientHolder
-
- net.sf.freecol.client.control.MapEditorController
-
public final class MapEditorController extends FreeColClientHolder
The map editor controller.
-
-
Field Summary
Fields Modifier and Type Field Description private MapTransform
currentMapTransform
The transform that should be applied to aTile
that is clicked on the map.private static java.util.logging.Logger
logger
private static int
MINI_MAP_THUMBNAIL_FINAL_HEIGHT
Map height in MapGeneratorOptionsDialog.
-
Constructor Summary
Constructors Constructor Description MapEditorController(FreeColClient freeColClient)
Creates a newMapEditorController
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.awt.image.BufferedImage
createMiniMapThumbNail()
Create a thumbnail for the minimap.Specification
getDefaultSpecification()
Get the default specification from the default TC.MapTransform
getMapTransform()
Gets the currentMapTransform
.void
loadGame()
Opens a dialog where the user should specify the filename and loads the game.private void
loadGame(java.io.File file)
Loads a game from the given file.void
newMap()
Creates a new map using aMapGenerator
.private void
requireNativeNations(Game game)
Require all native nation players to be present in a game.void
saveMapEditorGame()
Opens a dialog where the user should specify the filename and saves the game.void
saveMapEditorGame(java.io.File file)
Saves the game to the given file.void
setMapTransform(MapTransform mt)
Sets the currently chosenMapTransform
.void
startMapEditor()
Enters map editor mode.void
transform(Tile t)
-
Methods inherited from class net.sf.freecol.client.control.FreeColClientHolder
askServer, currentPlayerIsMyPlayer, getClientOptions, getConnectController, getFreeColClient, getFreeColServer, getGame, getGUI, getMap, getMyPlayer, getSpecification, igc, pgc
-
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
MINI_MAP_THUMBNAIL_FINAL_HEIGHT
private static final int MINI_MAP_THUMBNAIL_FINAL_HEIGHT
Map height in MapGeneratorOptionsDialog.- See Also:
- Constant Field Values
-
currentMapTransform
private MapTransform currentMapTransform
The transform that should be applied to aTile
that is clicked on the map.
-
-
Constructor Detail
-
MapEditorController
public MapEditorController(FreeColClient freeColClient)
Creates a newMapEditorController
.- Parameters:
freeColClient
- TheFreeColClient
for the game.
-
-
Method Detail
-
createMiniMapThumbNail
private java.awt.image.BufferedImage createMiniMapThumbNail()
Create a thumbnail for the minimap. FIXME: Delete all code inside this method and replace it with sensible code directly drawing in necessary size, without creating a throwaway GUI panel, drawing in wrong size and immediately resizing. Consider moving to ImageLibrary in due course, but not until the MiniMap dependency is gone.- Returns:
- The created
BufferedImage
.
-
requireNativeNations
private void requireNativeNations(Game game)
Require all native nation players to be present in a game.- Parameters:
game
- TheGame
to add native nations to.
-
startMapEditor
public void startMapEditor()
Enters map editor mode. FIXME: The TC and difficulty level can now be set at the command line, but we should do better.
-
getDefaultSpecification
public Specification getDefaultSpecification()
Get the default specification from the default TC.- Returns:
- A
Specification
to use in the map editor.
-
setMapTransform
public void setMapTransform(MapTransform mt)
Sets the currently chosenMapTransform
.- Parameters:
mt
- The transform that should be applied to aTile
that is clicked on the map.
-
getMapTransform
public MapTransform getMapTransform()
Gets the currentMapTransform
.- Returns:
- The transform that should be applied to a
Tile
that is clicked on the map.
-
transform
public void transform(Tile t)
- Parameters:
t
- TheTile
to be modified.
-
newMap
public void newMap()
Creates a new map using aMapGenerator
. A panel with theMapGeneratorOptions
is first displayed.- See Also:
MapGenerator
,MapGeneratorOptions
-
saveMapEditorGame
public void saveMapEditorGame()
Opens a dialog where the user should specify the filename and saves the game.
-
saveMapEditorGame
public void saveMapEditorGame(java.io.File file)
Saves the game to the given file.- Parameters:
file
- TheFile
.
-
loadGame
public void loadGame()
Opens a dialog where the user should specify the filename and loads the game.
-
loadGame
private void loadGame(java.io.File file)
Loads a game from the given file.- Parameters:
file
- TheFile
.
-
-