Class MapEditorController


  • public final class MapEditorController
    extends FreeColClientHolder
    The map editor controller.
    • 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 a Tile that is clicked on the map.
    • Constructor Detail

      • MapEditorController

        public MapEditorController​(FreeColClient freeColClient)
        Creates a new MapEditorController.
        Parameters:
        freeColClient - The FreeColClient 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 - The Game 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 chosen MapTransform.
        Parameters:
        mt - The transform that should be applied to a Tile that is clicked on the map.
      • getMapTransform

        public MapTransform getMapTransform()
        Gets the current MapTransform.
        Returns:
        The transform that should be applied to a Tile that is clicked on the map.
      • transform

        public void transform​(Tile t)
        Transforms the given Tile using the getMapTransform() current MapTransform.
        Parameters:
        t - The Tile to be modified.
      • newMap

        public void newMap()
        Creates a new map using a MapGenerator. A panel with the MapGeneratorOptions 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 - The File.
      • 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 - The File.