Class HexMap

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
BattleMap, PickEntrySide, ShowBattleMap

public class HexMap extends JPanel
Class HexMap displays a basic battle map.
Author:
David Ripton, Romain Dolbeau
See Also:
  • Field Details

    • LOGGER

      private static final Logger LOGGER
    • masterHex

      private final MasterHex masterHex
    • h

      protected final GUIBattleHex[][] h
    • hexes

      protected final List<GUIBattleHex> hexes
    • entrances

      private final GUIBattleHex[] entrances
      ne, e, se, sw, w, nw
    • VISIBLE_HEXES

      public static final boolean[][] VISIBLE_HEXES
    • scale

      private final int scale
    • cx

      protected final int cx
    • cy

      protected final int cy
    • displayName

      private String displayName
    • basicName

      private String basicName
    • subtitle

      private String subtitle
  • Constructor Details

    • HexMap

      public HexMap(MasterHex masterHex)
    • HexMap

      public HexMap(MasterHex masterHex, boolean doSetup)
  • Method Details

    • getMasterHex

      protected MasterHex getMasterHex()
    • setupHexes

      protected void setupHexes()
    • setupHexesGUI

      protected final void setupHexesGUI()
    • setupHexesGameState

      private static void setupHexesGameState(MasterBoardTerrain masterBoardTerrain, GUIBattleHex[][] h, boolean serverSideFirstLoad)
      Add terrain, hexsides, elevation, and exits to hexes. Cliffs are bidirectional; other hexside obstacles are noted only on the high side, since they only interfere with uphill movement.
    • setupNeighbors

      protected static final void setupNeighbors(GUIBattleHex[][] h)
      Add references to neighbor hexes.
    • setupEntrances

      private void setupEntrances()
    • setupEntrancesGUI

      private void setupEntrancesGUI()
    • unselectAllHexes

      protected void unselectAllHexes()
    • unselectHex

      protected void unselectHex(BattleHex battleHex)
    • selectHex

      protected void selectHex(BattleHex battleHex)
    • selectHexes

      protected void selectHexes(Set<BattleHex> battleHexes)
    • getGUIHexByModelHex

      protected GUIBattleHex getGUIHexByModelHex(BattleHex battleHex)
      Do a brute-force search through the hex array, looking for a match. Return the hex, or null.
    • getHexByLabel

      public BattleHex getHexByLabel(String hexLabel)
    • getHexContainingPoint

      protected GUIBattleHex getHexContainingPoint(Point point)
      Return the GUIBattleHex that contains the given point, or null if none does.
    • getAllHexes

      protected Set<BattleHex> getAllHexes()
    • paintComponent

      public void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent
    • getMinimumSize

      public Dimension getMinimumSize()
      Overrides:
      getMinimumSize in class JComponent
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
    • getBasicName

      public String getBasicName()
      Returns:
      the basicName
    • setBasicName

      public void setBasicName(String basicName)
      Parameters:
      basicName - the basicName to set
    • getDisplayName

      public String getDisplayName()
      Returns:
      the displayName
    • setDisplayName

      public void setDisplayName(String displayName)
      Parameters:
      displayName - the displayName to set
    • getSubtitle

      public String getSubtitle()
      Returns:
      the subtitle
    • setSubtitle

      public void setSubtitle(String subtitle)
      Parameters:
      subtitle - the subtitle to set