|
||||||||||
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.ExtrudeAction
public class ExtrudeAction
Makes a rectangle from a line, or modifies a rectangle.
Nested Class Summary | |
---|---|
(package private) static class |
ExtrudeAction.Mode
|
Field Summary | |
---|---|
private EastNorth |
activeMoveDirection
The direction that is currently active. |
private java.awt.event.AWTEventListener |
altKeyListener
This listener is used to indicate the 'create_new' mode, if the Alt modifier is pressed. |
private boolean |
alwaysCreateNodes
If true, when extruding create new node even if segments parallel. |
private java.awt.Cursor |
cursorCreateNew
The cursor for the 'create_new' mode. |
private java.awt.Point |
initialMousePos
The position of the mouse cursor when the drag action was initiated. |
private int |
initialMoveDelay
The time which needs to pass between click and release before something counts as a move, in milliseconds |
private EastNorth |
initialN1en
The initial EastNorths of node1 and node2 |
private EastNorth |
initialN2en
|
private ExtrudeAction.Mode |
mode
|
private long |
mouseDownTime
|
private MoveCommand |
moveCommand
the command that performed last move. |
private EastNorth |
newN1en
The new EastNorths of node1 and node2 |
private EastNorth |
newN2en
|
private java.util.List<EastNorth> |
possibleMoveDirections
Possible directions to move to. |
private java.awt.Color |
selectedColor
|
private WaySegment |
selectedSegment
|
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 | |
---|---|
ExtrudeAction(MapFrame mapFrame)
Create a new SelectAction |
Method Summary | |
---|---|
private static EastNorth |
calculateSegmentOffset(EastNorth segmentP1,
EastNorth segmentP2,
EastNorth moveDirection,
EastNorth targetPos)
This method calculates offset amount by witch to move the given segment perpendicularly for it to be in line with mouse position. |
private static java.awt.geom.Line2D |
createSemiInfiniteLine(java.awt.geom.Point2D start,
java.awt.geom.Point2D unitvector,
java.awt.Graphics2D g)
Create a new Line that extends off the edge of the viewport in one direction |
void |
enterMode()
|
void |
exitMode()
|
java.lang.String |
getModeHelpText()
|
private Node |
getNextNode(int index)
Gets a node from selected way before given index. |
private Node |
getPreviousNode(int index)
Gets a node from selected way before given index. |
private boolean |
hasNodeOtherWays(Node node,
Way myWay)
This method tests if a node has other ways apart from the given one. |
boolean |
layerIsSupported(Layer l)
|
void |
mouseDragged(java.awt.event.MouseEvent e)
Perform action depending on what mode we're in. |
void |
mousePressed(java.awt.event.MouseEvent e)
If the left mouse button is pressed over a segment, switch to either extrude, translate or create_new mode depending on whether Ctrl or Alt is held. |
void |
mouseReleased(java.awt.event.MouseEvent e)
Do anything that needs to be done, then switch back to select mode |
void |
paint(java.awt.Graphics2D g,
MapView mv,
Bounds box)
Paint the dataset using the engine set. |
Methods inherited from class org.openstreetmap.josm.actions.mapmode.MapMode |
---|
actionPerformed, mouseClicked, mouseEntered, mouseExited, mouseMoved, 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 |
Field Detail |
---|
private ExtrudeAction.Mode mode
private boolean alwaysCreateNodes
private long mouseDownTime
private WaySegment selectedSegment
private java.awt.Color selectedColor
private java.util.List<EastNorth> possibleMoveDirections
private EastNorth activeMoveDirection
private java.awt.Point initialMousePos
private int initialMoveDelay
private EastNorth initialN1en
private EastNorth initialN2en
private EastNorth newN1en
private EastNorth newN2en
private MoveCommand moveCommand
private final java.awt.Cursor cursorCreateNew
private final java.awt.event.AWTEventListener altKeyListener
Constructor Detail |
---|
public ExtrudeAction(MapFrame mapFrame)
mapFrame
- The MapFrame this action belongs to.Method Detail |
---|
public java.lang.String getModeHelpText()
getModeHelpText
in class MapMode
public boolean layerIsSupported(Layer l)
layerIsSupported
in class MapMode
public void enterMode()
enterMode
in class MapMode
public void exitMode()
exitMode
in class MapMode
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class MapMode
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseDragged
in class MapMode
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
in class MapMode
private boolean hasNodeOtherWays(Node node, Way myWay)
node
- myWay
-
private static EastNorth calculateSegmentOffset(EastNorth segmentP1, EastNorth segmentP2, EastNorth moveDirection, EastNorth targetPos)
segmentP1
- segmentP2
- targetPos
-
private Node getPreviousNode(int index)
index
- index of current node
private Node getNextNode(int index)
index
- index of current node
public void paint(java.awt.Graphics2D g, MapView mv, Bounds box)
MapViewPaintable
paint
in interface MapViewPaintable
mv
- The object that can translate GeoPoints to screen coordinates.private static java.awt.geom.Line2D createSemiInfiniteLine(java.awt.geom.Point2D start, java.awt.geom.Point2D unitvector, java.awt.Graphics2D g)
start
- The start point of the lineunitvector
- A unit vector denoting the direction of the lineg
- the Graphics2D object it will be used on
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |