public class DeleteAction extends MapMode implements ModifierListener
| Modifier and Type | Class and Description |
|---|---|
private static class |
DeleteAction.DeleteMode |
private static class |
DeleteAction.DeleteParameters |
| Modifier and Type | Field and Description |
|---|---|
private boolean |
drawTargetHighlight |
private static HighlightHelper |
highlightHelper |
private java.awt.event.MouseEvent |
oldEvent |
private WaySegment |
oldHighlightedWaySegment
elements that have been highlighted in the previous iteration.
|
sc| Constructor and Description |
|---|
DeleteAction(MapFrame mapFrame)
Construct a new DeleteAction.
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Call selectMapMode(this) on the parent mapFrame.
|
private void |
addHighlighting(java.awt.event.MouseEvent e,
int modifiers)
handles everything related to highlighting primitives and way
segments for the given pointer position (via MouseEvent) and
modifiers.
|
private Command |
buildDeleteCommands(java.awt.event.MouseEvent e,
int modifiers,
boolean silent)
This function takes any mouse event argument and builds the list of elements
that should be deleted but does not actually delete them.
|
static void |
deleteRelation(OsmDataLayer layer,
Relation toDelete)
Deletes the relation in the context of the given layer.
|
static void |
doActionPerformed(java.awt.event.ActionEvent e)
Invoked when the action occurs.
|
void |
enterMode()
Makes this map mode active.
|
void |
exitMode()
Makes this map mode inactive.
|
private DeleteAction.DeleteParameters |
getDeleteParameters(java.awt.event.MouseEvent e,
int modifiers) |
java.lang.String |
getModeHelpText() |
private void |
giveUserFeedback(java.awt.event.MouseEvent e)
Gives the user feedback for the action he/she is about to do.
|
private void |
giveUserFeedback(java.awt.event.MouseEvent e,
int modifiers)
Gives the user feedback for the action he/she is about to do.
|
boolean |
layerIsSupported(Layer l) |
void |
modifiersChanged(int modifiers)
This is required to update the cursors when ctrl/shift/alt is pressed
|
void |
mouseDragged(java.awt.event.MouseEvent e) |
void |
mouseMoved(java.awt.event.MouseEvent e)
Listen to mouse move to be able to update the cursor (and highlights)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
If user clicked with the left button, delete the nearest object.
|
private void |
removeHighlighting()
removes any highlighting that may have been set beforehand.
|
private void |
repaintIfRequired(java.util.Set<OsmPrimitive> newHighlights,
WaySegment newHighlightedWaySegment) |
private void |
updateCursor(java.awt.event.MouseEvent e,
int modifiers)
This function handles all work related to updating the cursor and
highlights
|
protected void |
updateEnabledState()
Override in subclasses to update the enabled state of the action when
something in the JOSM state changes, i.e.
|
mouseClicked, mouseEntered, mouseExited, mousePressed, requestFocusInMapView, updateKeyModifiers, updateKeyModifiers, updateKeyModifiers, updateStatusLinedestroy, getCurrentDataSet, getEditLayer, getShortcut, initEnabledState, installAdapters, setTooltip, updateEnabledStateprivate java.awt.event.MouseEvent oldEvent
private WaySegment oldHighlightedWaySegment
private static final HighlightHelper highlightHelper
private boolean drawTargetHighlight
public DeleteAction(MapFrame mapFrame)
mapFrame - The frame this action belongs to.public void enterMode()
MapModepublic void exitMode()
MapModepublic void actionPerformed(java.awt.event.ActionEvent e)
MapModeactionPerformed in interface java.awt.event.ActionListeneractionPerformed in class MapModepublic static void doActionPerformed(java.awt.event.ActionEvent e)
e - Action eventpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenermouseDragged in class MapModepublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenermouseMoved in class MapModee - The mouse event that has been capturedprivate void removeHighlighting()
private void addHighlighting(java.awt.event.MouseEvent e, int modifiers)
e - modifiers - private void repaintIfRequired(java.util.Set<OsmPrimitive> newHighlights, WaySegment newHighlightedWaySegment)
private void updateCursor(java.awt.event.MouseEvent e, int modifiers)
e - modifiers - private void giveUserFeedback(java.awt.event.MouseEvent e, int modifiers)
private void giveUserFeedback(java.awt.event.MouseEvent e)
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenermouseReleased in class MapModepublic java.lang.String getModeHelpText()
getModeHelpText in class MapModepublic boolean layerIsSupported(Layer l)
layerIsSupported in class MapModeprotected void updateEnabledState()
JosmActionJosmAction.updateEnabledState(Collection) to respond to changes in the collection
of selected primitives.
Default behavior is empty.updateEnabledState in class JosmActionJosmAction.updateEnabledState(Collection),
JosmAction.initEnabledState()public static void deleteRelation(OsmDataLayer layer, Relation toDelete)
layer - the layer in whose context the relation is deleted. Must not be null.toDelete - the relation to be deleted. Must not be null.java.lang.IllegalArgumentException - thrown if layer is nulljava.lang.IllegalArgumentException - thrown if toDelete is nulprivate DeleteAction.DeleteParameters getDeleteParameters(java.awt.event.MouseEvent e, int modifiers)
private Command buildDeleteCommands(java.awt.event.MouseEvent e, int modifiers, boolean silent)
e - MouseEvent from which modifiers and position are takenmodifiers - For explanation, see updateCursor(java.awt.event.MouseEvent, int)silent - Set to true if the user should not be bugged with additional
dialogspublic void modifiersChanged(int modifiers)
modifiersChanged in interface ModifierListener