public class SelectAction extends MapMode implements AWTEventListener, SelectionManager.SelectionEnded
| Modifier and Type | Class and Description |
|---|---|
private class |
SelectAction.CycleManager |
(package private) static class |
SelectAction.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 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 MouseEvent |
oldEvent |
private Set<OsmPrimitive> |
oldHighlights
elements that have been highlighted in the previous iteration.
|
(package private) int |
previousModifiers |
private SelectionManager |
selectionManager |
(package private) EastNorth |
startEN
point where user pressed the mouse to start movement
|
private Point |
startingDraggingPos
The old cursor before the user pressed the mouse button.
|
(package private) SelectAction.VirtualManager |
virtualManager |
scchangeSupport, enabledACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON| Constructor and Description |
|---|
SelectAction(MapFrame mapFrame)
Create a new SelectAction
|
| Modifier and Type | Method and Description |
|---|---|
private void |
confirmOrUndoMovement(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(Collection<Node> affectedNodes,
Collection<Way> selectedWays) |
private boolean |
dragInProgress()
returns true whenever elements have been grabbed and moved (i.e. the initial
thresholds have been exceeded) and is still in progress (i.e. mouse button
still pressed)
|
void |
enterMode()
Makes this map mode active.
|
void |
eventDispatched(AWTEvent e)
This is called whenever the keyboard modifier status changes
|
void |
exitMode()
Makes this map mode inactive.
|
private Node |
findNodeToMergeTo(Point p)
Tries to find a node to merge to when in move-merge mode for the current mouse
position.
|
private Cursor |
getCursor(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
|
String |
getModeHelpText() |
private boolean |
giveUserFeedback(MouseEvent e)
handles adding highlights and updating the cursor for the given mouse event.
|
private boolean |
giveUserFeedback(MouseEvent e,
int modifiers)
handles adding highlights and updating the cursor for the given mouse event.
|
boolean |
layerIsSupported(Layer l) |
private void |
mergePrims(Point p)
Merges the selected nodes to the one closest to the given mouse position if the control
key is pressed.
|
void |
mouseDragged(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(MouseEvent e) |
void |
mouseMoved(MouseEvent e) |
void |
mousePressed(MouseEvent e)
Look, whether any object is selected.
|
void |
mouseReleased(MouseEvent e) |
private boolean |
removeHighlighting()
Removes all existing highlights.
|
private boolean |
repaintIfRequired(Set<OsmPrimitive> newHighlights) |
void |
selectionEnded(Rectangle r,
MouseEvent e)
Called, when the left mouse button was released.
|
private void |
selectPrims(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
private MouseEvent oldEvent
private SelectAction.Mode mode
private SelectionManager selectionManager
private boolean cancelDrawMode
private boolean drawTargetHighlight
private boolean didMouseDrag
private Point startingDraggingPos
private Point lastMousePos
private long mouseDownTime
private int mouseDownButton
private long mouseReleaseTime
private int initialMoveDelay
private int initialMoveThreshold
private boolean initialMoveThresholdExceeded
private 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 eventDispatched(AWTEvent e)
eventDispatched in interface AWTEventListenerprivate boolean giveUserFeedback(MouseEvent e)
e - MouseEvent which should be used as base for the feedbacktrue if repaint is requiredprivate boolean giveUserFeedback(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 Cursor getCursor(Collection<OsmPrimitive> nearbyStuff)
nearbyStuff - primitives near the cursorprivate boolean removeHighlighting()
private boolean repaintIfRequired(Set<OsmPrimitive> newHighlights)
public void mousePressed(MouseEvent e)
mousePressed in interface MouseListenermousePressed in class MapModepublic void mouseMoved(MouseEvent e)
mouseMoved in interface MouseMotionListenermouseMoved in class MapModepublic void mouseDragged(MouseEvent e)
mouseDragged in interface MouseMotionListenermouseDragged in class MapModepublic void mouseExited(MouseEvent e)
mouseExited in interface MouseListenermouseExited in class MapModepublic void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenermouseReleased in class MapModepublic void selectionEnded(Rectangle r, MouseEvent e)
SelectionManager.SelectionEndedselectionEnded in interface SelectionManager.SelectionEndedr - The rectangle that is currently the selection.e - The mouse event.InputEvent.getModifiersEx()private void determineMapMode(boolean hasSelectionNearby)
hasSelectionNearby - private final boolean dragInProgress()
private boolean updateCommandWhileDragging(EastNorth currentEN)
currentEN - - mouse positiontrue when action was performed)private boolean doesImpactStatusLine(Collection<Node> affectedNodes, Collection<Way> selectedWays)
private void useLastMoveCommandIfPossible()
private Command getLastCommand()
private void confirmOrUndoMovement(MouseEvent e)
e - the mouse event causing the action (mouse released)private final void mergePrims(Point p)
private final Node findNodeToMergeTo(Point p)
private void selectPrims(Collection<OsmPrimitive> prims, boolean released, boolean area)
public 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 otherwise