devisor2.grid.backend
Class GridHotspotter

java.lang.Object
  extended bydevisor2.grid.backend.BaseSelector
      extended bydevisor2.grid.backend.GridHotspotter
Direct Known Subclasses:
GridSelector

public abstract class GridHotspotter
extends BaseSelector

This class adds the hotspotting mechanism to the BaseSelector.


Field Summary
static int HOTSPOT_BOTTOMCENTER
           
static int HOTSPOT_BOTTOMLEFT
           
static int HOTSPOT_BOTTOMRIGHT
           
static int HOTSPOT_CENTERCENTER
           
static int HOTSPOT_CENTERLEFT
           
static int HOTSPOT_CENTERRIGHT
           
static int HOTSPOT_NONE
          constant to indicate that no hotspot has been hit
static int HOTSPOT_TOPCENTER
           
static int HOTSPOT_TOPLEFT
          constants to indicate the number of the hotspot that has been hit
static int HOTSPOT_TOPRIGHT
           
protected  boolean[] hotspotMask
          this array holds the flags which hotspots are currently active and are therefore to be drawn and have to be sensitive to user input read it top to bottom left to right
static boolean[] MASK_ALL
          the hotspot mask for all hotspots
static boolean[] MASK_CIRCLES
          the hotspot mask for scaling when circles are involved
static boolean[] MASK_NODES
          the hotspot mask for nodes only
static boolean[] MASK_ROTATE
          the hotspot mask for rotating
 
Fields inherited from class devisor2.grid.backend.BaseSelector
boundaryNodesOnly, cc, containsCircles, currentRect, da, g, nodesonly, perimeter, previousRectDrawn, rectToDraw, root
 
Constructor Summary
GridHotspotter(MainFrame mf, DrawingArea da)
          The constructor just sets references correctly and initializes some variables
 
Method Summary
 java.awt.Point getCenterHotspot()
           
 int getClickedHotspot(int x, int y)
          determines what hotspot has been hit (use constants provided).
 java.awt.Point getClickedHotspotCoords(int hotspot)
           
 boolean[] getHotspotMask()
           
 java.awt.Point getOppositeHotspotCoords(int hotspot)
           
 java.awt.Point getTopLeftHotspot()
          same for the topleft corner
 void setHotspotMask(boolean[] mask)
          sets the hotspot mask to the given value, please use MASK??? constants provided
 void setPerimeter(java.awt.Rectangle peri)
          sets the perimeter rectangle used for scaling, rotating and translating, especially for the visual feedback for these operations
 void updateHotspots()
          updates the hotspot display, as XOR painting is used, this method draws hotspots if there are none, and removes them if they are already visible.
 
Methods inherited from class devisor2.grid.backend.BaseSelector
clearSelectBox, containsCircles, getClickedItem, getSelectBox, getSelectedItems, isBoundaryNodesOnly, isNodesOnly, paintSelectBox, setGraphics, startSelectBox, updateSelectBox
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hotspotMask

protected boolean[] hotspotMask
this array holds the flags which hotspots are currently active and are therefore to be drawn and have to be sensitive to user input read it top to bottom left to right


HOTSPOT_NONE

public static final int HOTSPOT_NONE
constant to indicate that no hotspot has been hit

See Also:
Constant Field Values

HOTSPOT_TOPLEFT

public static final int HOTSPOT_TOPLEFT
constants to indicate the number of the hotspot that has been hit

See Also:
Constant Field Values

HOTSPOT_TOPCENTER

public static final int HOTSPOT_TOPCENTER
See Also:
Constant Field Values

HOTSPOT_TOPRIGHT

public static final int HOTSPOT_TOPRIGHT
See Also:
Constant Field Values

HOTSPOT_CENTERLEFT

public static final int HOTSPOT_CENTERLEFT
See Also:
Constant Field Values

HOTSPOT_CENTERCENTER

public static final int HOTSPOT_CENTERCENTER
See Also:
Constant Field Values

HOTSPOT_CENTERRIGHT

public static final int HOTSPOT_CENTERRIGHT
See Also:
Constant Field Values

HOTSPOT_BOTTOMLEFT

public static final int HOTSPOT_BOTTOMLEFT
See Also:
Constant Field Values

HOTSPOT_BOTTOMCENTER

public static final int HOTSPOT_BOTTOMCENTER
See Also:
Constant Field Values

HOTSPOT_BOTTOMRIGHT

public static final int HOTSPOT_BOTTOMRIGHT
See Also:
Constant Field Values

MASK_ALL

public static final boolean[] MASK_ALL
the hotspot mask for all hotspots


MASK_NODES

public static final boolean[] MASK_NODES
the hotspot mask for nodes only


MASK_ROTATE

public static final boolean[] MASK_ROTATE
the hotspot mask for rotating


MASK_CIRCLES

public static final boolean[] MASK_CIRCLES
the hotspot mask for scaling when circles are involved

Constructor Detail

GridHotspotter

public GridHotspotter(MainFrame mf,
                      DrawingArea da)
The constructor just sets references correctly and initializes some variables

Parameters:
mf - - the MainFrame reference
da - - the drawing area where the select box will be painted on
Method Detail

setHotspotMask

public void setHotspotMask(boolean[] mask)
sets the hotspot mask to the given value, please use MASK??? constants provided

Parameters:
mask - - the new gotspot mask, use constants provided

getHotspotMask

public boolean[] getHotspotMask()
Returns:
the currently active hotspot mask

updateHotspots

public void updateHotspots()
updates the hotspot display, as XOR painting is used, this method draws hotspots if there are none, and removes them if they are already visible. Of course, the current hotspot mask is used.

See Also:
setHotspotMask

getCenterHotspot

public java.awt.Point getCenterHotspot()
Returns:
the screen coords of the center hotspot

getTopLeftHotspot

public java.awt.Point getTopLeftHotspot()
same for the topleft corner


getClickedHotspotCoords

public java.awt.Point getClickedHotspotCoords(int hotspot)
Returns:
the screen coords of the clicked hotspot

getOppositeHotspotCoords

public java.awt.Point getOppositeHotspotCoords(int hotspot)
Parameters:
hotspot - - the hotspot last clicked on
Returns:
the screen coords of the hotspot opposite the one clicked on, e.g. if hotspot equals TOPLEFT, the coords of the BOTTOMRIGHT hotspot are returned

setPerimeter

public void setPerimeter(java.awt.Rectangle peri)
sets the perimeter rectangle used for scaling, rotating and translating, especially for the visual feedback for these operations


getClickedHotspot

public int getClickedHotspot(int x,
                             int y)
determines what hotspot has been hit (use constants provided). Only hotspots that siut the hotspot mask currently set are accepted. If no hotspot is currently visible, alwazs NONE is returned.

Returns:
one of the hotspot constants (see below)