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 class
MapBoard.GridLayout
A layout consisting of squares in a checkerboard pattern (i.e. each square has four neighbours).protected class
MapBoard.GridOffsetColumnLayout
A layout consisting of squares in which every second column is shifted downward by one half width.protected class
MapBoard.GridOffsetRowLayout
A layout consisting of squares in which every second row is shifted to the right by one half-width.protected class
MapBoard.HexData
Mapboard element based on terrain symbol fromSymbolSet
.protected class
MapBoard.HexLine
A line from a hex edge to the centre as in the spoke of a wheel.protected class
MapBoard.HexSide
The edges of a hex or square.protected class
MapBoard.HorizontalHexLayout
Hexes aligned along rows.protected class
MapBoard.HorizontalLayout
A layout in which every second row is offset by one-half hex or square.protected class
MapBoard.Layout
How the hexes or squares are organized on the map board.protected class
MapBoard.Line
A drawable line such as a river, border, or road.protected static class
MapBoard.LineDefinition
Line styles for hex sides and hex lines.protected static class
MapBoard.LineStyle
line patter such as dashed or dotted or solidprotected class
MapBoard.MapBoardOverlay
Symbol that is placed in every hex.protected class
MapBoard.MapDrawable
Anything that can be drawn on the map and is associated with a particular hex.protected class
MapBoard.MapLayer
protected class
MapBoard.MapSheet
Defines the numbering system for an ADC2 mapboard.protected class
MapBoard.PlaceName
Place name element which includes not only the name itself, but the font and style that it should be drawn with.protected static class
MapBoard.PlaceNameOrientation
protected class
MapBoard.VerticalHexLayout
Hexes in columns.protected class
MapBoard.VerticalLayout
A 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 Font
getDefaultFont(int size, int font)
Get a font based on size and font index.protected MapBoard.Layout
getLayout()
protected MapBoard.LineDefinition
getLineDefinition(int index)
Returns the LineDefinition object corresponding to the given index.boolean
isValidImportFile(File f)
Determine whether the file is valid for the given importer.protected void
load(File f)
The method that actually loads the file and creates the classes containing information needed for the archive.protected void
readAttributeBlock(DataInputStream in)
Attributes are tertiary symbols, any number of which can be attached to a specific hex.protected void
readHexDataBlock(DataInputStream in)
Read primary and secondary symbol information.protected void
readHexLineBlock(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 void
readHexNumberingBlock(DataInputStream in)
Read in information on hex sheets which define the hex numbering systems.protected void
readHexSideBlock(DataInputStream in)
Information about hex sides which are used for things like rivers, etc.protected void
readLineDefinitionBlock(DataInputStream in)
Information about the width, colour and style of hex sides and hex lines is read in.protected void
readLineDrawPriorityBlock(DataInputStream in)
Read what order to draw the lines in.protected void
readMapBoardOverlaySymbolBlock(DataInputStream in)
Read symbol that is drawn on all hexes.protected void
readMapItemDrawFlagBlock(DataInputStream in)
Block of flags to indicate which elements are actually displayed.protected void
readMapItemDrawingOrderBlock(DataInputStream in)
Read and set the order of the drawn element types.protected void
readMapSheetBlock(DataInputStream in)
Read information on hex numbering.protected void
readPlaceNameBlock(DataInputStream in)
Optional labels that can be added to hexes.protected void
readScannedMapLayoutFile(File f, Graphics2D g)
Many maps are actually just scanned images held in a separate file.protected void
readTableColorBlock(DataInputStream in)
The colour to fill before any elements are drawn.protected void
readVersionBlock(DataInputStream in)
Crude version information.protected void
writePlaceNames(GameModule module)
Write out place name information as non-stackable pieces which can be searched via the piece inventory.void
writeToArchive()
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 theGraphics2D
objectg
.- 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:Importer
The method that actually loads the file and creates the classes containing information needed for the archive. The archive is written inwriteToArchive
.- Overrides:
load
in classImporter
- Parameters:
f
- The base file to be imported.- Throws:
IOException
-
writeToArchive
Description copied from class:Importer
Create the VASSAL module based on the classes created byload
. This should not be called directly but ratherimportFile
.- Specified by:
writeToArchive
in 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:Importer
Determine whether the file is valid for the given importer.- Specified by:
isValidImportFile
in classImporter
- Returns:
true
iff
is a valid file for this type.- Throws:
FileNotFoundException
IOException
-