civquest.swing.quadmap.fieldview
Class QuadFlatLayTerrainView

java.lang.Object
  extended bycivquest.swing.fieldview.BasicFieldView
      extended bycivquest.swing.quadmap.fieldview.QuadFlatLayTerrainView
All Implemented Interfaces:
FieldView, QuadFieldView, QuadFlatFieldView, TerrainView

public class QuadFlatLayTerrainView
extends BasicFieldView
implements QuadFlatFieldView, TerrainView

A layered terrain view for quad flat maps.


Field Summary
 
Fields inherited from class civquest.swing.fieldview.BasicFieldView
field, parent
 
Constructor Summary
QuadFlatLayTerrainView(Field field, FieldViewManager parent, Registry registry)
           
 
Method Summary
 java.util.List getListenerSectionsForParent()
          Returns a List of Sections defining which GameChanges this FieldView listens to.
 Coordinate getPaintSize()
          Returns the size of the area this FieldView paints to.
 void paint(Coordinate coordinate, java.awt.Graphics graphics)
          Paints (some parts of) the field this FieldView is assigned to.
 void updateImage()
          If this FieldView stores some images (and doesn't just load and calculate the needed images inside the paint-method), this method recalculates that images.
 
Methods inherited from class civquest.swing.fieldview.BasicFieldView
getField
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface civquest.swing.fieldview.FieldView
getField
 

Constructor Detail

QuadFlatLayTerrainView

public QuadFlatLayTerrainView(Field field,
                              FieldViewManager parent,
                              Registry registry)
Method Detail

paint

public void paint(Coordinate coordinate,
                  java.awt.Graphics graphics)
Description copied from interface: FieldView
Paints (some parts of) the field this FieldView is assigned to. Painting is performed relative to the given Coordinate using the given Graphics-object.

Specified by:
paint in interface FieldView
Parameters:
coordinate -
graphics -

getPaintSize

public Coordinate getPaintSize()
Description copied from interface: FieldView
Returns the size of the area this FieldView paints to.

Specified by:
getPaintSize in interface FieldView
Returns:

updateImage

public void updateImage()
Description copied from interface: FieldView
If this FieldView stores some images (and doesn't just load and calculate the needed images inside the paint-method), this method recalculates that images.

So this method should be called whenever some data the FieldView displays changes.

Note: Subinterfaces / implementing classes may specify that they listen to all required GameChanges directly. Then, calling this method from the XXXChanged-methods inside the FieldView suffices. (This behaviour can't be standard since some thousand Fields listening to a GameChange affecting just one or two Fields would be pretty inefficient).

Specified by:
updateImage in interface FieldView

getListenerSectionsForParent

public java.util.List getListenerSectionsForParent()
Description copied from interface: FieldView
Returns a List of Sections defining which GameChanges this FieldView listens to. Only those sections which have to be processed by the parent of this FieldView (because this FieldView doesn't process them itself) are inserted into this List.

Specified by:
getListenerSectionsForParent in interface FieldView
Returns:
a List of Section as defined