rl.common.mapping
Class HexBoard

java.lang.Object
  extended by rl.common.mapping.Board
      extended by rl.common.mapping.HexBoard
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CenturionBoard, LeviathanBoard

public abstract class HexBoard
extends Board

See Also:
Serialized Form

Field Summary
(package private) static long serialVersionUID
           
 
Constructor Summary
HexBoard()
           
 
Method Summary
 void addMap(HexMap map, Coordinate coord)
           
 void addMap(Map map, Coordinate coord)
           
 void clear()
           
 void completedAddingMaps()
           
 int getDirectionOfHex(Coordinate source, Coordinate target)
          this routine returns the direction of an adjacent hex
 int getDistanceBetweenLocations(Coordinate sourceCoord, Coordinate targetCoord)
           
 int getDistanceBetweenLocations(Location source, Location target)
           
 int getHeight()
           
 HexGrid getHexGrid()
           
 MapHex getHexInDirection(Coordinate c, int direction)
          Code from Megamek Gets the hex in the specified direction from the specified starting coordinates.
 MapHex getHexInDirection(int x, int y, int direction)
          Code from Megamek Gets the hex in the specified direction from the specified starting coordinates.
 java.util.Vector<Coordinate> getInterveningCoordinates(Coordinate sourceCoord, Coordinate targetCoord)
           
 MapHex getMapHex(Coordinate coord)
           
 MapHex getMapHex(int x, int y)
           
 java.lang.String getMapType()
           
 int getOppositeDir(int direction)
           
 int getWidth()
           
 boolean isOffboardCoordinate(Coordinate coord)
           
 boolean isOffboardLocation(Location l)
           
 boolean isValidBoard()
           
 
Methods inherited from class rl.common.mapping.Board
getName, loadFromFile, loadFromTemplate, saveToFile, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

HexBoard

public HexBoard()
Method Detail

getMapType

public java.lang.String getMapType()
Specified by:
getMapType in class Board

clear

public void clear()
Specified by:
clear in class Board

addMap

public void addMap(Map map,
                   Coordinate coord)
            throws java.lang.Exception
Specified by:
addMap in class Board
Throws:
java.lang.Exception

addMap

public void addMap(HexMap map,
                   Coordinate coord)
            throws java.lang.Exception
Throws:
java.lang.Exception

completedAddingMaps

public void completedAddingMaps()
Specified by:
completedAddingMaps in class Board

getHexGrid

public final HexGrid getHexGrid()

isValidBoard

public boolean isValidBoard()

getMapHex

public MapHex getMapHex(int x,
                        int y)

getMapHex

public MapHex getMapHex(Coordinate coord)

getHexInDirection

public MapHex getHexInDirection(Coordinate c,
                                int direction)
Code from Megamek Gets the hex in the specified direction from the specified starting coordinates.


getHexInDirection

public MapHex getHexInDirection(int x,
                                int y,
                                int direction)
Code from Megamek Gets the hex in the specified direction from the specified starting coordinates. Avoids calls to Coords.translated, and thus, object construction.


getDirectionOfHex

public int getDirectionOfHex(Coordinate source,
                             Coordinate target)
this routine returns the direction of an adjacent hex

Parameters:
source -
target -
Returns:
the directed of the target coordinate relative to the source coordinate

getOppositeDir

public int getOppositeDir(int direction)

getWidth

public int getWidth()

getHeight

public int getHeight()

getInterveningCoordinates

public java.util.Vector<Coordinate> getInterveningCoordinates(Coordinate sourceCoord,
                                                              Coordinate targetCoord)

getDistanceBetweenLocations

public int getDistanceBetweenLocations(Coordinate sourceCoord,
                                       Coordinate targetCoord)

getDistanceBetweenLocations

public int getDistanceBetweenLocations(Location source,
                                       Location target)

isOffboardCoordinate

public boolean isOffboardCoordinate(Coordinate coord)

isOffboardLocation

public boolean isOffboardLocation(Location l)