org.openstreetmap.josm.actions
Class SimplifyWayAction
java.lang.Object
javax.swing.AbstractAction
org.openstreetmap.josm.actions.JosmAction
org.openstreetmap.josm.actions.SimplifyWayAction
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action, Destroyable
public class SimplifyWayAction
- extends JosmAction
- See Also:
- Serialized Form
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 |
Method Summary |
void |
actionPerformed(java.awt.event.ActionEvent e)
|
protected void |
alertSelectAtLeastOneWay()
|
protected void |
buildSimplifiedNodeList(java.util.List<Node> wnew,
int from,
int to,
double threshold,
java.util.List<Node> simplifiedNodes)
Builds the simplified list of nodes for a way segment given by a lower index from
and an upper index to |
protected boolean |
confirmSimplifyManyWays(int numWays)
|
protected boolean |
confirmWayWithNodesOutsideBoundingBox(java.util.List<? extends OsmPrimitive> primitives)
|
static double |
course(double lat1,
double lon1,
double lat2,
double lon2)
|
static double |
dist(double lat1,
double lon1,
double lat2,
double lon2)
|
protected boolean |
isRequiredNode(Way way,
Node node)
Replies true if node is a required node which can't be removed
in order to simplify the way. |
SequenceCommand |
simplifyWay(Way w,
DataSet ds)
Simplifies a way |
protected void |
updateEnabledState()
Override in subclasses to update the enabled state of the action when
something in the JOSM state changes, i.e. |
protected void |
updateEnabledState(java.util.Collection<? extends OsmPrimitive> selection)
Override in subclasses to update the enabled state of the action if the
collection of selected primitives changes. |
static double |
xtd(double lat1,
double lon1,
double lat2,
double lon2,
double lat3,
double lon3)
|
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 |
EARTH_RAD
public static final double EARTH_RAD
- See Also:
- Constant Field Values
SimplifyWayAction
public SimplifyWayAction()
confirmWayWithNodesOutsideBoundingBox
protected boolean confirmWayWithNodesOutsideBoundingBox(java.util.List<? extends OsmPrimitive> primitives)
alertSelectAtLeastOneWay
protected void alertSelectAtLeastOneWay()
confirmSimplifyManyWays
protected boolean confirmSimplifyManyWays(int numWays)
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
isRequiredNode
protected boolean isRequiredNode(Way way,
Node node)
- Replies true if
node
is a required node which can't be removed
in order to simplify the way.
- Parameters:
way
- the way to be simplifiednode
- the node to check
- Returns:
- true if
node
is a required node which can't be removed
in order to simplify the way.
simplifyWay
public SequenceCommand simplifyWay(Way w,
DataSet ds)
- Simplifies a way
- Parameters:
w
- the way to simplify
buildSimplifiedNodeList
protected void buildSimplifiedNodeList(java.util.List<Node> wnew,
int from,
int to,
double threshold,
java.util.List<Node> simplifiedNodes)
- Builds the simplified list of nodes for a way segment given by a lower index
from
and an upper index to
- Parameters:
wnew
- the way to simplifyfrom
- the lower indexto
- the upper indexthreshold
-
dist
public static double dist(double lat1,
double lon1,
double lat2,
double lon2)
course
public static double course(double lat1,
double lon1,
double lat2,
double lon2)
xtd
public static double xtd(double lat1,
double lon1,
double lat2,
double lon2,
double lat3,
double lon3)
updateEnabledState
protected void updateEnabledState()
- Description copied from class:
JosmAction
- Override in subclasses to update the enabled state of the action when
something in the JOSM state changes, i.e. when a layer is removed or added.
See
JosmAction.updateEnabledState(Collection)
to respond to changes in the collection
of selected primitives.
Default behavior is empty.
- Overrides:
updateEnabledState
in class JosmAction
- See Also:
JosmAction.updateEnabledState(Collection)
,
JosmAction.initEnabledState()
updateEnabledState
protected void updateEnabledState(java.util.Collection<? extends OsmPrimitive> selection)
- Description copied from class:
JosmAction
- Override in subclasses to update the enabled state of the action if the
collection of selected primitives changes. This method is called with the
new selection.
- Overrides:
updateEnabledState
in class JosmAction
- Parameters:
selection
- the collection of selected primitives; may be empty, but not null- See Also:
JosmAction.updateEnabledState()
,
JosmAction.initEnabledState()
JOSM