Package VASSAL.tools.imports.adc2
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
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classMapBoard.GridLayoutA layout consisting of squares in a checkerboard pattern (i.e. each square has four neighbours).protected classMapBoard.GridOffsetColumnLayoutA layout consisting of squares in which every second column is shifted downward by one half width.protected classMapBoard.GridOffsetRowLayoutA layout consisting of squares in which every second row is shifted to the right by one half-width.protected classMapBoard.HexDataMapboard element based on terrain symbol fromSymbolSet.protected classMapBoard.HexLineA line from a hex edge to the centre as in the spoke of a wheel.protected classMapBoard.HexSideThe edges of a hex or square.protected classMapBoard.HorizontalHexLayoutHexes aligned along rows.protected classMapBoard.HorizontalLayoutA layout in which every second row is offset by one-half hex or square.protected classMapBoard.LayoutHow the hexes or squares are organized on the map board.protected classMapBoard.LineA drawable line such as a river, border, or road.protected static classMapBoard.LineDefinitionLine styles for hex sides and hex lines.protected static classMapBoard.LineStyleline patter such as dashed or dotted or solidprotected classMapBoard.MapBoardOverlaySymbol that is placed in every hex.protected classMapBoard.MapDrawableAnything that can be drawn on the map and is associated with a particular hex.protected classMapBoard.MapLayerprotected classMapBoard.MapSheetDefines the numbering system for an ADC2 mapboard.protected classMapBoard.PlaceNamePlace name element which includes not only the name itself, but the font and style that it should be drawn with.protected static classMapBoard.PlaceNameOrientationprotected classMapBoard.VerticalHexLayoutHexes in columns.protected classMapBoard.VerticalLayoutA layout in which every second column is offset--either hexes or squares. -
Field Summary
-
Constructor Summary
Constructors Constructor Description MapBoard() -
Method Summary
Modifier and Type Method Description protected static FontgetDefaultFont(int size, int font)Get a font based on size and font index.protected MapBoard.LayoutgetLayout()protected MapBoard.LineDefinitiongetLineDefinition(int index)Returns the LineDefinition object corresponding to the given index.booleanisValidImportFile(File f)Determine whether the file is valid for the given importer.protected voidload(File f)The method that actually loads the file and creates the classes containing information needed for the archive.protected voidreadAttributeBlock(DataInputStream in)Attributes are tertiary symbols, any number of which can be attached to a specific hex.protected voidreadHexDataBlock(DataInputStream in)Read primary and secondary symbol information.protected voidreadHexLineBlock(DataInputStream in)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.protected voidreadHexNumberingBlock(DataInputStream in)Read in information on hex sheets which define the hex numbering systems.protected voidreadHexSideBlock(DataInputStream in)Information about hex sides which are used for things like rivers, etc.protected voidreadLineDefinitionBlock(DataInputStream in)Information about the width, colour and style of hex sides and hex lines is read in.protected voidreadLineDrawPriorityBlock(DataInputStream in)Read what order to draw the lines in.protected voidreadMapBoardOverlaySymbolBlock(DataInputStream in)Read symbol that is drawn on all hexes.protected voidreadMapItemDrawFlagBlock(DataInputStream in)Block of flags to indicate which elements are actually displayed.protected voidreadMapItemDrawingOrderBlock(DataInputStream in)Read and set the order of the drawn element types.protected voidreadMapSheetBlock(DataInputStream in)Read information on hex numbering.protected voidreadPlaceNameBlock(DataInputStream in)Optional labels that can be added to hexes.protected voidreadScannedMapLayoutFile(File f, Graphics2D g)Many maps are actually just scanned images held in a separate file.protected voidreadTableColorBlock(DataInputStream in)The colour to fill before any elements are drawn.protected voidreadVersionBlock(DataInputStream in)Crude version information.protected voidwritePlaceNames(GameModule module)Write out place name information as non-stackable pieces which can be searched via the piece inventory.voidwriteToArchive()Create the VASSAL module based on the classes created byload.Methods inherited from class VASSAL.tools.imports.Importer
forceExtension, getExtension, getFileName, getLayeredPieceCollection, getMainMap, getUniqueImageFileName, getUniqueImageFileName, importFile, insertComponent, readNullTerminatedString, readNullTerminatedString, readWindowsFileName, stripExtension
-
Constructor Details
-
MapBoard
public MapBoard()
-
-
Method Details
-
getDefaultFont
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
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 theGraphics2Dobjectg.- Throws:
IOException
-
readMapBoardOverlaySymbolBlock
Read symbol that is drawn on all hexes.- Throws:
IOException
-
readMapItemDrawFlagBlock
Block of flags to indicate which elements are actually displayed.- Throws:
IOException
-
readAttributeBlock
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
Read primary and secondary symbol information. Each hex may only have one of each. Additional symbols must be tertiary attributes.- Throws:
IOException
-
readHexLineBlock
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
Information about hex sides which are used for things like rivers, etc. is read in.- Throws:
IOException
-
readLineDefinitionBlock
Information about the width, colour and style of hex sides and hex lines is read in.- Throws:
IOException
-
readLineDrawPriorityBlock
Read what order to draw the lines in.- Throws:
IOException
-
readMapSheetBlock
Read information on hex numbering.- Throws:
IOException
-
readHexNumberingBlock
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
Read and set the order of the drawn element types.- Throws:
IOException
-
readVersionBlock
Crude version information. Comes near the end of the file! Actually it's just a flag to indicate whether the version is < 2.08. In version 2.08, the hexes are abutted slightly differently.- Throws:
IOException
-
readTableColorBlock
The colour to fill before any elements are drawn. The fast-scroll flag is also read.- Throws:
IOException
-
readPlaceNameBlock
Optional labels that can be added to hexes. Can also include a symbol that can be added with the label.- Throws:
IOException
-
getLayout
- Returns:
- The Layout object corresponding to this imported map.
-
getLineDefinition
Returns the LineDefinition object corresponding to the given index. -
load
Description copied from class:ImporterThe method that actually loads the file and creates the classes containing information needed for the archive. The archive is written inwriteToArchive.- Overrides:
loadin classImporter- Parameters:
f- The base file to be imported.- Throws:
IOException
-
writeToArchive
Description copied from class:ImporterCreate the VASSAL module based on the classes created byload. This should not be called directly but ratherimportFile.- Specified by:
writeToArchivein classImporter- Throws:
IOException
-
writePlaceNames
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
Description copied from class:ImporterDetermine whether the file is valid for the given importer.- Specified by:
isValidImportFilein classImporter- Returns:
trueiffis a valid file for this type.- Throws:
FileNotFoundExceptionIOException
-