org.openstreetmap.josm.gui.layer
Class GpxLayer.DownloadAlongTrackAction
java.lang.Object
javax.swing.AbstractAction
org.openstreetmap.josm.gui.layer.GpxLayer.DownloadAlongTrackAction
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
- Enclosing class:
- GpxLayer
public class GpxLayer.DownloadAlongTrackAction
- extends javax.swing.AbstractAction
Action that issues a series of download requests to the API, following the GPX track.
- See Also:
- Serialized Form
Field Summary |
(package private) java.lang.Integer[] |
area
|
(package private) java.lang.Integer[] |
dist
|
(package private) static int |
NEAR_BOTH
|
(package private) static int |
NEAR_TRACK
|
(package private) static int |
NEAR_WAYPOINTS
|
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 |
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 |
NEAR_TRACK
static final int NEAR_TRACK
- See Also:
- Constant Field Values
NEAR_WAYPOINTS
static final int NEAR_WAYPOINTS
- See Also:
- Constant Field Values
NEAR_BOTH
static final int NEAR_BOTH
- See Also:
- Constant Field Values
dist
final java.lang.Integer[] dist
area
final java.lang.Integer[] area
GpxLayer.DownloadAlongTrackAction
public GpxLayer.DownloadAlongTrackAction()
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
confirmAndDownloadAreas
private void confirmAndDownloadAreas(java.awt.geom.Area a,
double max_area,
ProgressMonitor progressMonitor)
- Area "a" contains the hull that we would like to download data for. however we
can only download rectangles, so the following is an attempt at finding a number of
rectangles to download.
The idea is simply: Start out with the full bounding box. If it is too large, then
split it in half and repeat recursively for each half until you arrive at something
small enough to download. The algorithm is improved by always using the intersection
between the rectangle and the actual desired area. For example, if you have a track
that goes like this: +----+ | /| | / | | / | |/ | +----+ then we would first look at
downloading the whole rectangle (assume it's too big), after that we split it in half
(upper and lower half), but we donot request the full upper and lower rectangle, only
the part of the upper/lower rectangle that actually has something in it.
This functions calculates the rectangles, asks the user to continue and downloads
the areas if applicable.
JOSM