|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.AbstractAction
org.openstreetmap.josm.actions.JosmAction
org.openstreetmap.josm.actions.mapmode.MapMode
org.openstreetmap.josm.actions.mapmode.SelectAction
public class SelectAction
Move is an action that can move all kind of OsmPrimitives (except keys for now). If an selected object is under the mouse when dragging, move all selected objects. If an unselected object is under the mouse when dragging, it becomes selected and will be moved. If no object is under the mouse, move all selected objects (if any)
| Nested Class Summary | |
|---|---|
private class |
SelectAction.CycleManager
|
(package private) static class |
SelectAction.Mode
|
private static class |
SelectAction.SelectActionCursor
|
private class |
SelectAction.VirtualManager
|
| Field Summary | |
|---|---|
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
|
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
|
| Fields inherited from class org.openstreetmap.josm.actions.mapmode.MapMode |
|---|
alt, ctrl, cursor, shift |
| Fields inherited from class org.openstreetmap.josm.actions.JosmAction |
|---|
sc |
| Fields inherited from class javax.swing.AbstractAction |
|---|
changeSupport, enabled |
| Fields inherited from interface javax.swing.Action |
|---|
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON |
| Constructor Summary | |
|---|---|
SelectAction(MapFrame mapFrame)
Create a new SelectAction |
|
| Method Summary | |
|---|---|
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 |
dragInProgress()
returns true whenever elements have been grabbed and moved (i.e. |
void |
enterMode()
|
void |
eventDispatched(java.awt.AWTEvent e)
This is called whenever the keyboard modifier status changes |
void |
exitMode()
|
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 |
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 iff the control key is pressed. |
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.HashSet<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)
|
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 |
| Methods inherited from class org.openstreetmap.josm.actions.mapmode.MapMode |
|---|
actionPerformed, mouseClicked, mouseEntered, updateKeyModifiers, updateKeyModifiers, updateKeyModifiers, updateStatusLine |
| Methods inherited from class org.openstreetmap.josm.actions.JosmAction |
|---|
destroy, getCurrentDataSet, getEditLayer, getShortcut, initEnabledState, installAdapters, setTooltip, updateEnabledState, updateEnabledState |
| Methods inherited from class javax.swing.AbstractAction |
|---|
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.openstreetmap.josm.gui.SelectionManager.SelectionEnded |
|---|
addPropertyChangeListener, removePropertyChangeListener |
| Field Detail |
|---|
private boolean lassoMode
private java.awt.event.MouseEvent oldEvent
private SelectAction.Mode mode
private SelectionManager selectionManager
private boolean cancelDrawMode
private boolean drawTargetHighlight
private boolean didMouseDrag
private final MapView mv
private java.awt.Point startingDraggingPos
EastNorth startEN
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
| Constructor Detail |
|---|
public SelectAction(MapFrame mapFrame)
mapFrame - The MapFrame this action belongs to.| Method Detail |
|---|
public void enterMode()
enterMode in class MapModepublic void exitMode()
exitMode in class MapModepublic void eventDispatched(java.awt.AWTEvent e)
eventDispatched in interface java.awt.event.AWTEventListenerprivate boolean giveUserFeedback(java.awt.event.MouseEvent e)
MouseEvent - which should be used as base for the feedback
private boolean giveUserFeedback(java.awt.event.MouseEvent e,
int modifiers)
MouseEvent - which should be used as base for the feedbackdefine - custom keyboard modifiers if the ones from MouseEvent are outdated or similar
private java.awt.Cursor getCursor(java.util.Collection<OsmPrimitive> nearbyStuff)
nearbyStuff - primitives near the cursor
private boolean removeHighlighting()
private boolean repaintIfRequired(java.util.HashSet<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 MapMode
public void selectionEnded(java.awt.Rectangle r,
java.awt.event.MouseEvent e)
SelectionManager.SelectionEnded
selectionEnded 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 position
true when action was performed)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 java.lang.String getModeHelpText()
getModeHelpText in class MapModepublic boolean layerIsSupported(Layer l)
layerIsSupported in class MapModepublic void setLassoMode(boolean lassoMode)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||