net.refractions.udig.tools.edit.behaviour
Class MoveVertexBehaviour

java.lang.Object
  extended by net.refractions.udig.tools.edit.behaviour.MoveVertexBehaviour
All Implemented Interfaces:
EventBehaviour, LockingBehaviour
Direct Known Subclasses:
MoveGeometryBehaviour

public class MoveVertexBehaviour
extends java.lang.Object
implements EventBehaviour, LockingBehaviour

Mode that moves Vertices

Requirements:

Action:

Since:
1.1.0
Author:
Jesse

Nested Class Summary
 class MoveVertexBehaviour.PositionTracker
           
 
Constructor Summary
MoveVertexBehaviour()
           
 
Method Summary
protected  void doMove(int deltaX, int deltaY, EditToolHandler handler, EditBlackboard editBlackboard2, Selection selectionToMove)
           
 UndoableMapCommand getCommand(EditToolHandler handler, MapMouseEvent e, EventType eventType)
          The action to be performed by this EventBehaviour.
 java.lang.Object getKey(EditToolHandler handler)
          If the object returned by getKey() is the same as the object that the EditToolHandler has as its lock this object may unlock the EditToolHandler and is also permitted to run.
protected  Selection getPointsToMove(EditToolHandler handler, EditBlackboard blackboard)
          Returns the points that will be moved.
 void handleError(EditToolHandler handler, java.lang.Throwable error, UndoableMapCommand command)
          This method is called if an exception occurs during the execution of the run method.
protected  boolean isSnappingValid()
          Returns true if snapping should be used.
 boolean isValid(EditToolHandler handler, MapMouseEvent e, EventType eventType)
          Called to determine whether this EventBehaviour is applicable and should be run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoveVertexBehaviour

public MoveVertexBehaviour()
Method Detail

isValid

public boolean isValid(EditToolHandler handler,
                       MapMouseEvent e,
                       EventType eventType)
Description copied from interface: EventBehaviour
Called to determine whether this EventBehaviour is applicable and should be run.

Specified by:
isValid in interface EventBehaviour
Parameters:
handler - handler that calls this Behaviour
e - mouse event that just occurred.
eventType - the type of event that just occurred
Returns:
true if this mode is applicable and should be run.

getCommand

public UndoableMapCommand getCommand(EditToolHandler handler,
                                     MapMouseEvent e,
                                     EventType eventType)
Description copied from interface: EventBehaviour
The action to be performed by this EventBehaviour. This action takes place in the event thread so it must perform VERY quickly.

Specified by:
getCommand in interface EventBehaviour
Parameters:
handler - handler that calls this Behaviour
e - Event that occurred.
eventType - The type of event that has occurred
Returns:
Command that will be executed in order to perform the behaviour

doMove

protected void doMove(int deltaX,
                      int deltaY,
                      EditToolHandler handler,
                      EditBlackboard editBlackboard2,
                      Selection selectionToMove)

isSnappingValid

protected boolean isSnappingValid()
Returns true if snapping should be used.

Returns:

getPointsToMove

protected Selection getPointsToMove(EditToolHandler handler,
                                    EditBlackboard blackboard)
Returns the points that will be moved.

Parameters:
handler -
Returns:
the points that will be moved.

handleError

public void handleError(EditToolHandler handler,
                        java.lang.Throwable error,
                        UndoableMapCommand command)
Description copied from interface: EventBehaviour
This method is called if an exception occurs during the execution of the run method.

This method should

  1. Rollback the changes made during the run method
  2. Log the error in the plugin's log

Specified by:
handleError in interface EventBehaviour
Parameters:
handler - handler that calls this Behaviour
error - Error that occurred
command - Command retrieved from getCommandMethod. May be null if exception occurred while executing getCommand();

getKey

public java.lang.Object getKey(EditToolHandler handler)
Description copied from interface: LockingBehaviour
If the object returned by getKey() is the same as the object that the EditToolHandler has as its lock this object may unlock the EditToolHandler and is also permitted to run.

Specified by:
getKey in interface LockingBehaviour
Parameters:
handler - handler that is calling getKey.
Returns:
the object that this behaviour uses as a key.