megamek.client.ui.swing
Class HexTileset

java.lang.Object
  extended by megamek.client.ui.swing.HexTileset

public class HexTileset
extends java.lang.Object

Matches each hex with an appropriate image.

Author:
Ben

Constructor Summary
HexTileset()
          Creates new HexTileset
 
Method Summary
 java.lang.Object[] assignMatch(IHex hex, java.awt.Component comp)
          This assigns images to a hex based on the best matches it can find.
 void clearHex(IHex hex)
           
 java.awt.Image getBase(IHex hex, java.awt.Component comp)
           
 java.util.List<java.awt.Image> getSupers(IHex hex, java.awt.Component comp)
           
 void loadAllImages(java.awt.Component comp, java.awt.MediaTracker tracker)
          Initializes all the images in this tileset and adds them to the tracker
 void loadFromFile(java.lang.String filename)
           
 void loadHexImage(IHex hex, java.awt.Component comp, java.awt.MediaTracker tracker)
          Loads the image for this hex.
 void reset()
           
 void trackHexImages(IHex hex, java.awt.MediaTracker tracker)
          Adds all images associated with the hex to the specified tracker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HexTileset

public HexTileset()
Creates new HexTileset

Method Detail

clearHex

public void clearHex(IHex hex)

assignMatch

public java.lang.Object[] assignMatch(IHex hex,
                                      java.awt.Component comp)
This assigns images to a hex based on the best matches it can find.

First it assigns any images to be superimposed on a hex. These images must have a match value of 1.0 to be added, and any time a match of this level is achieved, any terrain involved in the match is removed from further consideration.

Any terrain left is used to match a base image for the hex. This time, a match can be any value, and the first, best image is used.


getBase

public java.awt.Image getBase(IHex hex,
                              java.awt.Component comp)

getSupers

public java.util.List<java.awt.Image> getSupers(IHex hex,
                                                java.awt.Component comp)

loadFromFile

public void loadFromFile(java.lang.String filename)
                  throws java.io.IOException
Throws:
java.io.IOException

loadAllImages

public void loadAllImages(java.awt.Component comp,
                          java.awt.MediaTracker tracker)
Initializes all the images in this tileset and adds them to the tracker


trackHexImages

public void trackHexImages(IHex hex,
                           java.awt.MediaTracker tracker)
Adds all images associated with the hex to the specified tracker


loadHexImage

public void loadHexImage(IHex hex,
                         java.awt.Component comp,
                         java.awt.MediaTracker tracker)
Loads the image for this hex.


reset

public void reset()