public class SelectAction extends MapMode implements ModifierListener, KeyPressReleaseListener, SelectionManager.SelectionEnded
| Modifier and Type | Class and Description |
|---|---|
private class |
SelectAction.CycleManager |
static class |
SelectAction.Mode
Select action mode.
|
private static class |
SelectAction.SelectActionCursor |
private class |
SelectAction.VirtualManager |
| Modifier and Type | Field and Description |
|---|---|
private boolean |
cancelDrawMode |
(package private) SelectAction.CycleManager |
cycleManager |
private boolean |
didMouseDrag |
private boolean |
drawTargetHighlight |
private int |
initialMoveDelay
The time which needs to pass between click and release before something
counts as a move, in milliseconds
|
private int |
initialMoveThreshold
The screen distance which needs to be travelled before something
counts as a move, in pixels
|
private boolean |
initialMoveThresholdExceeded |
private boolean |
lassoMode |
private java.awt.Point |
lastMousePos
The last known position of the mouse.
|
private SelectAction.Mode |
mode |
private int |
mouseDownButton
The pressed button of the user mouse down event.
|
private long |
mouseDownTime
The time of the user mouse down event.
|
private long |
mouseReleaseTime
The time of the user mouse down event.
|
private MapView |
mv
The component this SelectAction is associated with.
|
private java.awt.event.MouseEvent |
oldEvent |
private java.util.Set<OsmPrimitive> |
oldHighlights
elements that have been highlighted in the previous iteration.
|
(package private) int |
previousModifiers |
boolean |
repeatedKeySwitchLassoOption |
private SelectionManager |
selectionManager |
(package private) EastNorth |
startEN
point where user pressed the mouse to start movement
|
private java.awt.Point |
startingDraggingPos
The old cursor before the user pressed the mouse button.
|
(package private) SelectAction.VirtualManager |
virtualManager |
sc| Constructor and Description |
|---|
SelectAction(MapFrame mapFrame)
Create a new SelectAction
|
| Modifier and Type | Method and Description |
|---|---|
protected static <T> java.util.Collection<T> |
asColl(T o) |
private void |
confirmOrUndoMovement(java.awt.event.MouseEvent e)
Present warning in case of large and possibly unwanted movements and undo
unwanted movements.
|
private void |
determineMapMode(boolean hasSelectionNearby)
sets the mapmode according to key modifiers and if there are any
selectables nearby.
|
private boolean |
doesImpactStatusLine(java.util.Collection<Node> affectedNodes,
java.util.Collection<Way> selectedWays) |
void |
doKeyPressed(java.awt.event.KeyEvent e)
This is called when key press event is actually pressed
(no fake events while holding key)
|
void |
doKeyReleased(java.awt.event.KeyEvent e)
This is called when key press event is actually released
(no fake events while holding key)
|
private boolean |
dragInProgress()
returns true whenever elements have been grabbed and moved (i.e.
|
void |
enterMode()
Makes this map mode active.
|
void |
exitMode()
Makes this map mode inactive.
|
private Node |
findNodeToMergeTo(java.awt.Point p)
Tries to find a node to merge to when in move-merge mode for the current mouse
position.
|
private java.awt.Cursor |
getCursor(java.util.Collection<OsmPrimitive> nearbyStuff)
works out which cursor should be displayed for most of SelectAction's
features.
|
private Command |
getLastCommand()
Obtain command in undoRedo stack to "continue" when dragging
|
SelectAction.Mode |
getMode()
Returns the current select mode.
|
java.lang.String |
getModeHelpText() |
private boolean |
giveUserFeedback(java.awt.event.MouseEvent e)
handles adding highlights and updating the cursor for the given mouse event.
|
private boolean |
giveUserFeedback(java.awt.event.MouseEvent e,
int modifiers)
handles adding highlights and updating the cursor for the given mouse event.
|
boolean |
layerIsSupported(Layer l) |
private void |
mergePrims(java.awt.Point p)
Merges the selected nodes to the one closest to the given mouse position if the control
key is pressed.
|
void |
modifiersChanged(int modifiers) |
void |
mouseDragged(java.awt.event.MouseEvent e)
If the left mouse button is pressed, move all currently selected
objects (if one of them is under the mouse) or the current one under the
mouse (which will become selected).
|
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mouseMoved(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e)
Look, whether any object is selected.
|
void |
mouseReleased(java.awt.event.MouseEvent e) |
private boolean |
removeHighlighting()
Removes all existing highlights.
|
private boolean |
repaintIfRequired(java.util.Set<OsmPrimitive> newHighlights) |
void |
selectionEnded(java.awt.Rectangle r,
java.awt.event.MouseEvent e)
Called, when the left mouse button was released.
|
private void |
selectPrims(java.util.Collection<OsmPrimitive> prims,
boolean released,
boolean area) |
void |
setLassoMode(boolean lassoMode)
Enable or diable the lasso mode
|
private boolean |
updateCommandWhileDragging(EastNorth currentEN)
Create or update data modification command while dragging mouse - implementation of
continuous moving, scaling and rotation
|
private void |
useLastMoveCommandIfPossible()
Adapt last move command (if it is suitable) to work with next drag, started at point startEN
|
actionPerformed, mouseClicked, mouseEntered, requestFocusInMapView, updateKeyModifiers, updateKeyModifiers, updateKeyModifiers, updateStatusLinedestroy, getCurrentDataSet, getEditLayer, getShortcut, initEnabledState, installAdapters, setTooltip, updateEnabledState, updateEnabledStateaddPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabledequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddPropertyChangeListener, removePropertyChangeListenerprivate boolean lassoMode
public boolean repeatedKeySwitchLassoOption
private java.awt.event.MouseEvent oldEvent
private SelectAction.Mode mode
private final SelectionManager selectionManager
private boolean cancelDrawMode
private boolean drawTargetHighlight
private boolean didMouseDrag
private java.awt.Point startingDraggingPos
private java.awt.Point lastMousePos
private long mouseDownTime
private int mouseDownButton
private long mouseReleaseTime
private int initialMoveDelay
private int initialMoveThreshold
private boolean initialMoveThresholdExceeded
private java.util.Set<OsmPrimitive> oldHighlights
int previousModifiers
SelectAction.CycleManager cycleManager
SelectAction.VirtualManager virtualManager
public SelectAction(MapFrame mapFrame)
mapFrame - The MapFrame this action belongs to.public void enterMode()
MapModepublic void exitMode()
MapModepublic void modifiersChanged(int modifiers)
modifiersChanged in interface ModifierListenerprivate boolean giveUserFeedback(java.awt.event.MouseEvent e)
e - MouseEvent which should be used as base for the feedbacktrue if repaint is requiredprivate boolean giveUserFeedback(java.awt.event.MouseEvent e, int modifiers)
e - MouseEvent which should be used as base for the feedbackmodifiers - define custom keyboard modifiers if the ones from MouseEvent are outdated or similartrue if repaint is requiredprivate java.awt.Cursor getCursor(java.util.Collection<OsmPrimitive> nearbyStuff)
nearbyStuff - primitives near the cursorprivate boolean removeHighlighting()
private boolean repaintIfRequired(java.util.Set<OsmPrimitive> newHighlights)
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenermousePressed in class MapModepublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenermouseMoved in class MapModepublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenermouseDragged in class MapModepublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenermouseExited in class MapModepublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenermouseReleased in class MapModepublic void selectionEnded(java.awt.Rectangle r, java.awt.event.MouseEvent e)
SelectionManager.SelectionEndedselectionEnded in interface SelectionManager.SelectionEndedr - The rectangle that is currently the selection.e - The mouse event.InputEvent.getModifiersEx()public void doKeyPressed(java.awt.event.KeyEvent e)
KeyPressReleaseListenerdoKeyPressed in interface KeyPressReleaseListenerpublic void doKeyReleased(java.awt.event.KeyEvent e)
KeyPressReleaseListenerdoKeyReleased in interface KeyPressReleaseListenerprivate void determineMapMode(boolean hasSelectionNearby)
hasSelectionNearby - private final boolean dragInProgress()
private boolean updateCommandWhileDragging(EastNorth currentEN)
currentEN - - mouse positiontrue when action was performed)private boolean doesImpactStatusLine(java.util.Collection<Node> affectedNodes, java.util.Collection<Way> selectedWays)
private void useLastMoveCommandIfPossible()
private Command getLastCommand()
private void confirmOrUndoMovement(java.awt.event.MouseEvent e)
e - the mouse event causing the action (mouse released)private final void mergePrims(java.awt.Point p)
private final Node findNodeToMergeTo(java.awt.Point p)
private void selectPrims(java.util.Collection<OsmPrimitive> prims, boolean released, boolean area)
public final SelectAction.Mode getMode()
public java.lang.String getModeHelpText()
getModeHelpText in class MapModepublic boolean layerIsSupported(Layer l)
layerIsSupported in class MapModepublic void setLassoMode(boolean lassoMode)
lassoMode - true to enable the lasso mode, false otherwiseprotected static <T> java.util.Collection<T> asColl(T o)