Package org.openstreetmap.josm.io
Class BoundingBoxDownloader
- java.lang.Object
-
- org.openstreetmap.josm.io.OsmConnection
-
- org.openstreetmap.josm.io.OsmServerReader
-
- org.openstreetmap.josm.io.BoundingBoxDownloader
-
- Direct Known Subclasses:
OverpassDownloadReader
public class BoundingBoxDownloader extends OsmServerReader
Read content from OSM server for a given bounding box- Since:
- 627
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BoundingBoxDownloader.MoreNotesException
Indicates that the number of fetched notes equals the specified limit.-
Nested classes/interfaces inherited from class org.openstreetmap.josm.io.OsmServerReader
OsmServerReader.DomParser<R>
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.io.OsmConnection
OsmConnection.OAuthAccessTokenFetcher
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
crosses180th
protected double
lat1
The boundings of the desired map data.protected double
lat2
protected double
lon1
protected double
lon2
-
Fields inherited from class org.openstreetmap.josm.io.OsmServerReader
contentType, gpxParsedProperly
-
Fields inherited from class org.openstreetmap.josm.io.OsmConnection
activeConnection, cancel, fetcher, oAuth20Parameters
-
-
Constructor Summary
Constructors Constructor Description BoundingBoxDownloader(Bounds downloadArea)
Constructs a newBoundingBoxDownloader
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
considerAsFullDownload()
Determines if download is complete for the given bounding box.private GpxData
downloadRawGps(Bounds b, ProgressMonitor progressMonitor)
protected java.util.Collection<Bounds>
getBounds()
Get the bounds for this downloaderprotected java.lang.String
getRequestForBbox(double lon1, double lat1, double lon2, double lat2)
Builds the request part for the bounding box.protected java.lang.String
getTaskName()
Returns the name of the download task to be displayed in theProgressMonitor
.protected DataSet
parseDataSet(java.io.InputStream source, ProgressMonitor progressMonitor)
Parse the given input source and return the dataset.java.util.List<Note>
parseNotes(int noteLimit, int daysClosed, ProgressMonitor progressMonitor)
Downloads notes from the API, given API limit parametersDataSet
parseOsm(ProgressMonitor progressMonitor)
Download OSM files from somewhereGpxData
parseRawGps(ProgressMonitor progressMonitor)
Retrieve raw gps waypoints from the server API.-
Methods inherited from class org.openstreetmap.josm.io.OsmServerReader
adaptRequest, fetchData, getAttribute, getBaseUrl, getInputStream, getInputStream, getInputStreamRaw, getInputStreamRaw, getInputStreamRaw, getInputStreamRaw, isDoAuthenticate, isGpxParsedProperly, parseOsm, parseOsmChange, parseOsmChange, parseRawGps, parseRawNotes, parseRawNotes, setDoAuthenticate
-
Methods inherited from class org.openstreetmap.josm.io.OsmConnection
addAuth, addBasicAuthorizationHeader, addOAuth20AuthorizationHeader, cancel, isCanceled, retrieveBasicAuthorizationLogin, setOAuthAccessTokenFetcher
-
-
-
-
Field Detail
-
lat1
protected final double lat1
The boundings of the desired map data.
-
lon1
protected final double lon1
-
lat2
protected final double lat2
-
lon2
protected final double lon2
-
crosses180th
protected final boolean crosses180th
-
-
Constructor Detail
-
BoundingBoxDownloader
public BoundingBoxDownloader(Bounds downloadArea)
Constructs a newBoundingBoxDownloader
.- Parameters:
downloadArea
- The area to download
-
-
Method Detail
-
downloadRawGps
private GpxData downloadRawGps(Bounds b, ProgressMonitor progressMonitor) throws java.io.IOException, OsmTransferException, org.xml.sax.SAXException
- Throws:
java.io.IOException
OsmTransferException
org.xml.sax.SAXException
-
parseRawGps
public GpxData parseRawGps(ProgressMonitor progressMonitor) throws OsmTransferException
Description copied from class:OsmServerReader
Retrieve raw gps waypoints from the server API.- Overrides:
parseRawGps
in classOsmServerReader
- Parameters:
progressMonitor
- The progress monitor- Returns:
- The corresponding GPX tracks
- Throws:
OsmTransferException
- if any error occurs
-
getTaskName
protected java.lang.String getTaskName()
Returns the name of the download task to be displayed in theProgressMonitor
.- Returns:
- task name
-
getRequestForBbox
protected java.lang.String getRequestForBbox(double lon1, double lat1, double lon2, double lat2)
Builds the request part for the bounding box.- Parameters:
lon1
- leftlat1
- bottomlon2
- rightlat2
- top- Returns:
- "map?bbox=left,bottom,right,top"
-
parseDataSet
protected DataSet parseDataSet(java.io.InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException
Parse the given input source and return the dataset.- Parameters:
source
- input streamprogressMonitor
- progress monitor- Returns:
- dataset
- Throws:
IllegalDataException
- if an error was found while parsing the OSM data- See Also:
OsmReader.parseDataSet(InputStream, ProgressMonitor)
-
parseOsm
public DataSet parseOsm(ProgressMonitor progressMonitor) throws OsmTransferException
Description copied from class:OsmServerReader
Download OSM files from somewhere- Specified by:
parseOsm
in classOsmServerReader
- Parameters:
progressMonitor
- The progress monitor- Returns:
- The corresponding dataset
- Throws:
OsmTransferException
- if any error occurs
-
parseNotes
public java.util.List<Note> parseNotes(int noteLimit, int daysClosed, ProgressMonitor progressMonitor) throws OsmTransferException
Description copied from class:OsmServerReader
Downloads notes from the API, given API limit parameters- Overrides:
parseNotes
in classOsmServerReader
- Parameters:
noteLimit
- How many notes to download.daysClosed
- Return notes closed this many days in the past. -1 means all notes, ever. 0 means only unresolved notes.progressMonitor
- Progress monitor for user feedback- Returns:
- List of notes returned by the API
- Throws:
OsmTransferException
- if any errors happen
-
considerAsFullDownload
public boolean considerAsFullDownload()
Determines if download is complete for the given bounding box.- Returns:
- true if download is complete for the given bounding box (not filtered)
-
-