dip.gui.map
Class DefaultMapRenderer2

java.lang.Object
  extended bydip.gui.map.MapRenderer2
      extended bydip.gui.map.DefaultMapRenderer2

public class DefaultMapRenderer2
extends MapRenderer2

Default Rendering logic.

Debugging Hint: To see if the DOM has been altered, it can be 'dumped' by using File | Export Map As... | SVG and looking at the SVG output.


Nested Class Summary
protected  class DefaultMapRenderer2.DMRMapInfo
          Implicit class for MapInfo interface
protected  class DefaultMapRenderer2.Tracker
          Keeps track of the DOM Elements and other info to monitor changes; ONE (and only one) Tracker object will exist for each Province with any items to be rendered (SC, units, etc.)
 
Field Summary
protected static java.lang.String HIGHEST_ORDER_LAYER
          Layer: Highest (z=0) Orders
static java.lang.String LABEL_LAYER_BRIEF
          Label Layer: Abbreviated
static java.lang.String LABEL_LAYER_FULL
          Label Layer: Full
protected static java.lang.String[] LABEL_LAYERS
          All Label layers
protected static java.lang.String LAYER_DISLODGED_UNITS
          Layer: Dislodged Units
static java.lang.String LAYER_MAP
          Layer: Map
protected static java.lang.String LAYER_MOUSE
          Layer: region definitions for mouse
protected static java.lang.String LAYER_ORDERS
          Layer: Orders
protected static java.lang.String LAYER_SC
          Layer: Supply Center
protected static java.lang.String LAYER_UNITS
          Layer: Units
protected  java.util.HashMap layerMap
           
protected static java.lang.String[] LAYERS
          All Layers
protected static java.lang.String NOPOWER
           
protected static java.lang.String SC_NOPOWER
           
static java.lang.String SYMBOL_ARMY
          Army symbol ID
static java.lang.String SYMBOL_BUILDUNIT
          Build marker symbol ID
static java.lang.String SYMBOL_DISLODGED_ARMY
          Dislodged Army symbol ID
static java.lang.String SYMBOL_DISLODGED_FLEET
          Dislodged Fleet symbol ID
static java.lang.String SYMBOL_DISLODGED_WING
          Dislodged Wing symbol ID
static java.lang.String SYMBOL_FAILEDORDER
          Failed Order symbol ID
static java.lang.String SYMBOL_FLEET
          Fleet symbol ID
static java.lang.String SYMBOL_REMOVEUNIT
          Remove (and disband) symbol ID
static java.lang.String SYMBOL_SC
          Supply Center symbol ID
static java.lang.String SYMBOL_WAIVEDBUILD
          Waived Build symbol ID
static java.lang.String SYMBOL_WING
          Wing symbol ID
static java.lang.String[] SYMBOLS
          Symbol List
protected  java.util.Map trackerMap
           
protected static java.lang.String UNORDERED
           
 
Fields inherited from class dip.gui.map.MapRenderer2
doc, KEY_INFLUENCE_MODE, KEY_LABELS, KEY_SHOW_DISLODGED_UNITS, KEY_SHOW_MAP, KEY_SHOW_ORDERS_FOR_POWERS, KEY_SHOW_SUPPLY_CENTERS, KEY_SHOW_UNITS, KEY_SHOW_UNORDERED, mapPanel, propListener, svgCanvas, VALUE_LABELS_BRIEF, VALUE_LABELS_FULL, VALUE_LABELS_NONE
 
Constructor Summary
DefaultMapRenderer2(MapPanel mp, SymbolPack sp)
          Creates a DefaultMapRenderer object
 
Method Summary
 void close()
          Close the MapRenderer, releasing all resources.
protected  void displayablePowersChanged(Power[] diplayPowers)
          Called when the displayable powers have changed
 org.w3c.dom.svg.SVGGElement getLayer(java.lang.String key)
          Get a mapped layer
 Location getLocation(java.lang.String id)
          Gets the location that corresponds to a given string id
Assumes ID is lowercase!
 MapMetadata getMapMetadata()
          Gets the MapMetadata object
 RenderCommandFactory getRenderCommandFactory()
          Returns a DMR2RenderCommandFactory
 java.lang.Object getRenderSetting(java.lang.Object key)
          Get a map rendering setting
 java.lang.String getSymbolName(Unit.Type unitType)
          Get the Symbol Name for the given unit type
protected  void multipleOrdersCreated(GUIOrder[] orders)
          Called when multiple orders have been added from the order list
protected  void multipleOrdersDeleted(GUIOrder[] orders)
          Called when multiple orders have been deleted from the order list
protected  void orderCreated(GUIOrder order)
          Called when an order has been added to the order list
protected  void orderDeleted(GUIOrder order)
          Called when an order has been deleted from the order list
protected  void setElementVisibility(org.w3c.dom.svg.SVGElement element, boolean value)
          Set the visibility of an element
protected  void setRenderSetting(java.lang.Object key, java.lang.Object value)
          Internally set a Render Setting
protected  void setTurnState(TurnState ts)
          Sets the current TurnState object for the renderer.
protected  void unsyncDestroyAllOrders()
          Makes sure that all orders have been removed from the order tree and have no associated SVGElement.
protected  void unsyncRecreateAllOrders()
          Refresh and/or re-render all orders
protected  void unsyncRemoveAllOrdersFromDOM()
          Removes ALL orders, for all powers, in all layers.
protected  void unsyncSetInfluenceMode(boolean value)
          Implements Influence mode.
protected  void unsyncSetVisiblePowers()
          Uses the KEY_SHOW_ORDERS_FOR_POWERS value to determine which orders should be displayed.
protected  void unsyncUpdateAllProvinces()
          Unsynchronized updater: Renders ALL provinces but NOT orders
protected  void unsyncUpdateDependentOrders(GUIOrder[] addedOrders)
          Find orders that are dependent, and call their updateDOM() method again for possible re-rendering.
protected  void unsyncUpdateProvince(DefaultMapRenderer2.Tracker tracker, Province province, boolean force)
          Unsynchronized province updater, used in both update methods.
protected  void unsyncUpdateProvince(Province province)
          Convenience method: non-forced.
protected  void unsyncUpdateProvince(Province province, boolean forceUpdate)
          Unsynchronized province updater, used in both update methods.
protected  void unsyncUpdateSC(Province province)
          Updates an SC element with new position information.
 
Methods inherited from class dip.gui.map.MapRenderer2
clearAndExecute, execRenderCommand, getClientFrame, getRunnableQueue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYMBOL_ARMY

public static final java.lang.String SYMBOL_ARMY
Army symbol ID

See Also:
Constant Field Values

SYMBOL_FLEET

public static final java.lang.String SYMBOL_FLEET
Fleet symbol ID

See Also:
Constant Field Values

SYMBOL_DISLODGED_ARMY

public static final java.lang.String SYMBOL_DISLODGED_ARMY
Dislodged Army symbol ID

See Also:
Constant Field Values

SYMBOL_DISLODGED_FLEET

public static final java.lang.String SYMBOL_DISLODGED_FLEET
Dislodged Fleet symbol ID

See Also:
Constant Field Values

SYMBOL_SC

public static final java.lang.String SYMBOL_SC
Supply Center symbol ID

See Also:
Constant Field Values

SYMBOL_WING

public static final java.lang.String SYMBOL_WING
Wing symbol ID

See Also:
Constant Field Values

SYMBOL_DISLODGED_WING

public static final java.lang.String SYMBOL_DISLODGED_WING
Dislodged Wing symbol ID

See Also:
Constant Field Values

SYMBOL_FAILEDORDER

public static final java.lang.String SYMBOL_FAILEDORDER
Failed Order symbol ID

See Also:
Constant Field Values

SYMBOL_BUILDUNIT

public static final java.lang.String SYMBOL_BUILDUNIT
Build marker symbol ID

See Also:
Constant Field Values

SYMBOL_REMOVEUNIT

public static final java.lang.String SYMBOL_REMOVEUNIT
Remove (and disband) symbol ID

See Also:
Constant Field Values

SYMBOL_WAIVEDBUILD

public static final java.lang.String SYMBOL_WAIVEDBUILD
Waived Build symbol ID

See Also:
Constant Field Values

SYMBOLS

public static final java.lang.String[] SYMBOLS
Symbol List


LAYER_MAP

public static final java.lang.String LAYER_MAP
Layer: Map

See Also:
Constant Field Values

LAYER_SC

protected static final java.lang.String LAYER_SC
Layer: Supply Center

See Also:
Constant Field Values

LAYER_ORDERS

protected static final java.lang.String LAYER_ORDERS
Layer: Orders

See Also:
Constant Field Values

HIGHEST_ORDER_LAYER

protected static final java.lang.String HIGHEST_ORDER_LAYER
Layer: Highest (z=0) Orders

See Also:
Constant Field Values

LAYER_UNITS

protected static final java.lang.String LAYER_UNITS
Layer: Units

See Also:
Constant Field Values

LAYER_DISLODGED_UNITS

protected static final java.lang.String LAYER_DISLODGED_UNITS
Layer: Dislodged Units

See Also:
Constant Field Values

LAYER_MOUSE

protected static final java.lang.String LAYER_MOUSE
Layer: region definitions for mouse

See Also:
Constant Field Values

LABEL_LAYER_BRIEF

public static final java.lang.String LABEL_LAYER_BRIEF
Label Layer: Abbreviated

See Also:
Constant Field Values

LABEL_LAYER_FULL

public static final java.lang.String LABEL_LAYER_FULL
Label Layer: Full

See Also:
Constant Field Values

LABEL_LAYERS

protected static final java.lang.String[] LABEL_LAYERS
All Label layers


LAYERS

protected static final java.lang.String[] LAYERS
All Layers


NOPOWER

protected static final java.lang.String NOPOWER
See Also:
Constant Field Values

SC_NOPOWER

protected static final java.lang.String SC_NOPOWER
See Also:
Constant Field Values

UNORDERED

protected static final java.lang.String UNORDERED
See Also:
Constant Field Values

trackerMap

protected final java.util.Map trackerMap

layerMap

protected final java.util.HashMap layerMap
Constructor Detail

DefaultMapRenderer2

public DefaultMapRenderer2(MapPanel mp,
                           SymbolPack sp)
                    throws MapException
Creates a DefaultMapRenderer object

Method Detail

getRenderCommandFactory

public RenderCommandFactory getRenderCommandFactory()
Returns a DMR2RenderCommandFactory

Specified by:
getRenderCommandFactory in class MapRenderer2

close

public void close()
Close the MapRenderer, releasing all resources.

WARNING: render events must not be processed after or during a call to this method.

Overrides:
close in class MapRenderer2

getMapMetadata

public MapMetadata getMapMetadata()
Gets the MapMetadata object

Specified by:
getMapMetadata in class MapRenderer2

getLayer

public org.w3c.dom.svg.SVGGElement getLayer(java.lang.String key)
Get a mapped layer


orderCreated

protected void orderCreated(GUIOrder order)
Called when an order has been added to the order list

Specified by:
orderCreated in class MapRenderer2

orderDeleted

protected void orderDeleted(GUIOrder order)
Called when an order has been deleted from the order list

Specified by:
orderDeleted in class MapRenderer2

multipleOrdersCreated

protected void multipleOrdersCreated(GUIOrder[] orders)
Called when multiple orders have been added from the order list

Specified by:
multipleOrdersCreated in class MapRenderer2

multipleOrdersDeleted

protected void multipleOrdersDeleted(GUIOrder[] orders)
Called when multiple orders have been deleted from the order list

Specified by:
multipleOrdersDeleted in class MapRenderer2

displayablePowersChanged

protected void displayablePowersChanged(Power[] diplayPowers)
Called when the displayable powers have changed

Specified by:
displayablePowersChanged in class MapRenderer2

setTurnState

protected void setTurnState(TurnState ts)
Sets the current TurnState object for the renderer. This should only operate within a run() method... if the turnState is changed while another run() method is activated, bad things can happen.


getRenderSetting

public java.lang.Object getRenderSetting(java.lang.Object key)
Get a map rendering setting

Specified by:
getRenderSetting in class MapRenderer2

setRenderSetting

protected void setRenderSetting(java.lang.Object key,
                                java.lang.Object value)
Internally set a Render Setting


getSymbolName

public java.lang.String getSymbolName(Unit.Type unitType)
Get the Symbol Name for the given unit type

Specified by:
getSymbolName in class MapRenderer2

getLocation

public Location getLocation(java.lang.String id)
Gets the location that corresponds to a given string id
Assumes ID is lowercase!

Specified by:
getLocation in class MapRenderer2

unsyncDestroyAllOrders

protected void unsyncDestroyAllOrders()
Makes sure that all orders have been removed from the order tree and have no associated SVGElement.


unsyncSetVisiblePowers

protected void unsyncSetVisiblePowers()
Uses the KEY_SHOW_ORDERS_FOR_POWERS value to determine which orders should be displayed.


unsyncRemoveAllOrdersFromDOM

protected void unsyncRemoveAllOrdersFromDOM()
Removes ALL orders, for all powers, in all layers. Power layer G parent elements remain unaltered.


unsyncSetInfluenceMode

protected void unsyncSetInfluenceMode(boolean value)
Implements Influence mode. Saves and restores old mapRenderer settings.


unsyncUpdateDependentOrders

protected void unsyncUpdateDependentOrders(GUIOrder[] addedOrders)
Find orders that are dependent, and call their updateDOM() method again for possible re-rendering. This is called whenever an order is added, deleted, or changed. If an order has just been added or changed, it's update() method is not called.


unsyncRecreateAllOrders

protected void unsyncRecreateAllOrders()
Refresh and/or re-render all orders


unsyncUpdateAllProvinces

protected void unsyncUpdateAllProvinces()
Unsynchronized updater: Renders ALL provinces but NOT orders


unsyncUpdateProvince

protected void unsyncUpdateProvince(Province province,
                                    boolean forceUpdate)
Unsynchronized province updater, used in both update methods. We must synchronize around this because this method will alter the DOM.


unsyncUpdateProvince

protected void unsyncUpdateProvince(Province province)
Convenience method: non-forced.


unsyncUpdateProvince

protected void unsyncUpdateProvince(DefaultMapRenderer2.Tracker tracker,
                                    Province province,
                                    boolean force)
Unsynchronized province updater, used in both update methods. We must synchronize around this because this method will alter the DOM. If the 'force' flag is true, we will update the unit information EVEN IF it hasn't changed.


unsyncUpdateSC

protected void unsyncUpdateSC(Province province)
Updates an SC element with new position information. No change made to CSS.


setElementVisibility

protected void setElementVisibility(org.w3c.dom.svg.SVGElement element,
                                    boolean value)
Set the visibility of an element



Copyright 2002-2004 Zachary DelProposto / jDip Development Team. All Rights Reserved.