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 MapTransformcurrentMapTransformThe transform that should be applied to aTilethat is clicked on the map.private static java.util.logging.Loggerloggerprivate static intMINI_MAP_THUMBNAIL_FINAL_HEIGHTMap 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.BufferedImagecreateMiniMapThumbNail()Create a thumbnail for the minimap.SpecificationgetDefaultSpecification()Get the default specification from the default TC.MapTransformgetMapTransform()Gets the currentMapTransform.voidloadGame()Opens a dialog where the user should specify the filename and loads the game.private voidloadGame(java.io.File file)Loads a game from the given file.voidnewMap()Creates a new map using aMapGenerator.private voidrequireNativeNations(Game game)Require all native nation players to be present in a game.voidsaveMapEditorGame()Opens a dialog where the user should specify the filename and saves the game.voidsaveMapEditorGame(java.io.File file)Saves the game to the given file.voidsetMapTransform(MapTransform mt)Sets the currently chosenMapTransform.voidstartMapEditor()Enters map editor mode.voidtransform(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 aTilethat is clicked on the map.
-
-
Constructor Detail
-
MapEditorController
public MapEditorController(FreeColClient freeColClient)
Creates a newMapEditorController.- Parameters:
freeColClient- TheFreeColClientfor 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- TheGameto 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
Specificationto use in the map editor.
-
setMapTransform
public void setMapTransform(MapTransform mt)
Sets the currently chosenMapTransform.- Parameters:
mt- The transform that should be applied to aTilethat is clicked on the map.
-
getMapTransform
public MapTransform getMapTransform()
Gets the currentMapTransform.- Returns:
- The transform that should be applied to a
Tilethat is clicked on the map.
-
transform
public void transform(Tile t)
- Parameters:
t- TheTileto be modified.
-
newMap
public void newMap()
Creates a new map using aMapGenerator. A panel with theMapGeneratorOptionsis 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.
-
-