Class MapBoard

java.lang.Object
VASSAL.tools.imports.Importer
VASSAL.tools.imports.adc2.MapBoard

public class MapBoard extends Importer
The map board itself.
Author:
Michael Kiefte
  • Constructor Details

    • MapBoard

      public MapBoard()
  • Method Details

    • getDefaultFont

      protected static Font getDefaultFont(int size, int font)
      Get a font based on size and font index. If this font has not already been created, then it will be generated. Can be reused later if the same font was already created.
      Parameters:
      size - Font size.
      font - Font index. See MapBoard.java for format.
    • readScannedMapLayoutFile

      protected void readScannedMapLayoutFile(File f, Graphics2D g) throws IOException
      Many maps are actually just scanned images held in a separate file. The images are often broken up into sections. An extra file describes how the images are pasted together. This function pieces the images together using the Graphics2D object g.
      Throws:
      IOException
    • readMapBoardOverlaySymbolBlock

      protected void readMapBoardOverlaySymbolBlock(DataInputStream in) throws IOException
      Read symbol that is drawn on all hexes.
      Throws:
      IOException
    • readMapItemDrawFlagBlock

      protected void readMapItemDrawFlagBlock(DataInputStream in) throws IOException
      Block of flags to indicate which elements are actually displayed.
      Throws:
      IOException
    • readAttributeBlock

      protected void readAttributeBlock(DataInputStream in) throws IOException
      Attributes are tertiary symbols, any number of which can be attached to a specific hex. Otherwise, they function the same as primary or secondary hex symbols.
      Throws:
      IOException
    • readHexDataBlock

      protected void readHexDataBlock(DataInputStream in) throws IOException
      Read primary and secondary symbol information. Each hex may only have one of each. Additional symbols must be tertiary attributes.
      Throws:
      IOException
    • readHexLineBlock

      protected void readHexLineBlock(DataInputStream in) throws IOException
      Hex lines are like spokes of the hex and are typically used for things like roads or other elements that traverse from hex to hex. The direction of each spoke is encoded as bit flags, and while ADC2 could encode each hex with only one record, modules typically have a separate record for every spoke resulting in data inflation.
      Throws:
      IOException
    • readHexSideBlock

      protected void readHexSideBlock(DataInputStream in) throws IOException
      Information about hex sides which are used for things like rivers, etc. is read in.
      Throws:
      IOException
    • readLineDefinitionBlock

      protected void readLineDefinitionBlock(DataInputStream in) throws IOException
      Information about the width, colour and style of hex sides and hex lines is read in.
      Throws:
      IOException
    • readLineDrawPriorityBlock

      protected void readLineDrawPriorityBlock(DataInputStream in) throws IOException
      Read what order to draw the lines in.
      Throws:
      IOException
    • readMapSheetBlock

      protected void readMapSheetBlock(DataInputStream in) throws IOException
      Read information on hex numbering.
      Throws:
      IOException
    • readHexNumberingBlock

      protected void readHexNumberingBlock(DataInputStream in) throws IOException
      Read in information on hex sheets which define the hex numbering systems. This represents supplemental information--some map sheet info occurs earlier in the file. Only the coordinates of the top-left corner are read in here.
      Throws:
      IOException
    • readMapItemDrawingOrderBlock

      protected void readMapItemDrawingOrderBlock(DataInputStream in) throws IOException
      Read and set the order of the drawn element types.
      Throws:
      IOException
    • readVersionBlock

      protected void readVersionBlock(DataInputStream in) throws IOException
      Crude version information. Comes near the end of the file! Actually it's just a flag to indicate whether the version is less than 2.08. In version 2.08, the hexes are abutted slightly differently.
      Throws:
      IOException
    • readTableColorBlock

      protected void readTableColorBlock(DataInputStream in) throws IOException
      The colour to fill before any elements are drawn. The fast-scroll flag is also read.
      Throws:
      IOException
    • readPlaceNameBlock

      protected void readPlaceNameBlock(DataInputStream in) throws IOException
      Optional labels that can be added to hexes. Can also include a symbol that can be added with the label.
      Throws:
      IOException
    • getLayout

      protected MapBoard.Layout getLayout()
      Returns:
      The Layout object corresponding to this imported map.
    • getLineDefinition

      protected MapBoard.LineDefinition getLineDefinition(int index)
      Returns the LineDefinition object corresponding to the given index.
    • load

      protected void load(File f) throws IOException
      Description copied from class: Importer
      The method that actually loads the file and creates the classes containing information needed for the archive. The archive is written in writeToArchive.
      Overrides:
      load in class Importer
      Parameters:
      f - The base file to be imported.
      Throws:
      IOException - oops
    • writeToArchive

      public void writeToArchive() throws IOException
      Description copied from class: Importer
      Create the VASSAL module based on the classes created by load. This should not be called directly but rather importFile.
      Specified by:
      writeToArchive in class Importer
      Throws:
      IOException - oops
    • writePlaceNames

      protected void writePlaceNames(GameModule module)
      Write out place name information as non-stackable pieces which can be searched via the piece inventory.
      Parameters:
      module - - Game module to write to.
    • isValidImportFile

      public boolean isValidImportFile(File f) throws IOException
      Description copied from class: Importer
      Determine whether the file is valid for the given importer.
      Specified by:
      isValidImportFile in class Importer
      Parameters:
      f - File
      Returns:
      true if f is a valid file for this type.
      Throws:
      IOException - oops