devisor2.grid.backend
Class GridSelector

java.lang.Object
  extended bydevisor2.grid.backend.BaseSelector
      extended bydevisor2.grid.backend.GridHotspotter
          extended bydevisor2.grid.backend.GridSelector

public class GridSelector
extends GridHotspotter

This class finally adds the GUI feedback for scaling, translating and rotating to the BaseSelector. Only use this class for full support, the other ones are not instanciable.


Field Summary
protected  double angle
           
protected  int baseline_x
           
protected  int baseline_y
           
protected  java.awt.Point bottomleft
           
protected  java.awt.Point bottomright
           
protected  java.awt.geom.Point2D newbottomleft
           
protected  java.awt.geom.Point2D newbottomright
           
protected  java.awt.geom.Point2D newtopleft
           
protected  java.awt.geom.Point2D newtopright
           
protected  java.awt.Rectangle rotateBackup
           
protected  java.awt.geom.AffineTransform rotmatrix
           
protected  java.awt.Point topleft
           
protected  java.awt.Point topright
           
protected  int vector_x
           
protected  int vector_y
           
 
Fields inherited from class devisor2.grid.backend.GridHotspotter
HOTSPOT_BOTTOMCENTER, HOTSPOT_BOTTOMLEFT, HOTSPOT_BOTTOMRIGHT, HOTSPOT_CENTERCENTER, HOTSPOT_CENTERLEFT, HOTSPOT_CENTERRIGHT, HOTSPOT_NONE, HOTSPOT_TOPCENTER, HOTSPOT_TOPLEFT, HOTSPOT_TOPRIGHT, hotspotMask, MASK_ALL, MASK_CIRCLES, MASK_NODES, MASK_ROTATE
 
Fields inherited from class devisor2.grid.backend.BaseSelector
boundaryNodesOnly, cc, containsCircles, currentRect, da, g, nodesonly, perimeter, previousRectDrawn, rectToDraw, root
 
Constructor Summary
GridSelector(MainFrame mf, DrawingArea da)
          The constructor just sets references correctly and initializes some variables
 
Method Summary
 void endScaleSelectBox()
          fixes negative orientation of the perimeter variable
 double getRotateAngle()
           
 void rotateSelectBox(int x, int y, int hotspot, boolean first)
          rotates the select box around the angle defined by the baseline and and the line from the perimeter's center to the current mouse position
 void scaleSelectBox(int x, int y, int hotspot, boolean first)
          performs the update of the select box for the scale operation
 void startRotateSelectBox(int hotspot)
          starts the rotate GUI feedback by defining the baseline against which to rotate
 void startScaleSelectBox(int hotspot)
          starts the scaling GUI feedback by setting the neccessary parameters
 void translateSelectBox(int x, int y, boolean first)
          performs the update of the select box for the move operation
 
Methods inherited from class devisor2.grid.backend.GridHotspotter
getCenterHotspot, getClickedHotspot, getClickedHotspotCoords, getHotspotMask, getOppositeHotspotCoords, getTopLeftHotspot, setHotspotMask, setPerimeter, updateHotspots
 
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

baseline_x

protected int baseline_x

baseline_y

protected int baseline_y

vector_x

protected int vector_x

vector_y

protected int vector_y

angle

protected double angle

rotateBackup

protected java.awt.Rectangle rotateBackup

topleft

protected java.awt.Point topleft

topright

protected java.awt.Point topright

bottomleft

protected java.awt.Point bottomleft

bottomright

protected java.awt.Point bottomright

newtopleft

protected java.awt.geom.Point2D newtopleft

newtopright

protected java.awt.geom.Point2D newtopright

newbottomleft

protected java.awt.geom.Point2D newbottomleft

newbottomright

protected java.awt.geom.Point2D newbottomright

rotmatrix

protected java.awt.geom.AffineTransform rotmatrix
Constructor Detail

GridSelector

public GridSelector(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

translateSelectBox

public void translateSelectBox(int x,
                               int y,
                               boolean first)
performs the update of the select box for the move operation

Parameters:
first - - hack to indicate that a third drawing is neccessary

startScaleSelectBox

public void startScaleSelectBox(int hotspot)
starts the scaling GUI feedback by setting the neccessary parameters

Parameters:
hotspot - - the hotspot with which to scale

scaleSelectBox

public void scaleSelectBox(int x,
                           int y,
                           int hotspot,
                           boolean first)
performs the update of the select box for the scale operation

Parameters:
hotspot - - the hotspot through which scaling is applied
first - - hack to indicate that a third drawing is neccessary

endScaleSelectBox

public void endScaleSelectBox()
fixes negative orientation of the perimeter variable


startRotateSelectBox

public void startRotateSelectBox(int hotspot)
starts the rotate GUI feedback by defining the baseline against which to rotate

Parameters:
hotspot - - the hotspot clicked on

rotateSelectBox

public void rotateSelectBox(int x,
                            int y,
                            int hotspot,
                            boolean first)
rotates the select box around the angle defined by the baseline and and the line from the perimeter's center to the current mouse position

Parameters:
hotspot - - the hotspot originally defining the baseline
first - - flag to hack, same as above

getRotateAngle

public double getRotateAngle()
Returns:
the angle which defines the rotation