Class StreetsideDownloader
- java.lang.Object
-
- org.openstreetmap.josm.plugins.streetside.io.download.StreetsideDownloader
-
public final class StreetsideDownloader extends java.lang.Object
Class that concentrates all the ways of downloading of the plugin. All the download petitions will be managed one by one.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStreetsideDownloader.DOWNLOAD_MODEPossible download modes.
-
Field Summary
Fields Modifier and Type Field Description private static java.util.concurrent.ThreadPoolExecutorexecutorExecutor that will run the petitions.(package private) static org.apache.log4j.Loggerloggerprivate static doubleMAX_AREAMax area to be downloadedprivate static booleanstoppedDownloadIndicates whether the last download request has been rejected because it requested an area that was too big.
-
Constructor Summary
Constructors Modifier Constructor Description privateStreetsideDownloader()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddownloadOSMArea()Downloads all images of the area covered by the OSM data.static voiddownloadVisibleArea()If some part of the current view has not been downloaded, it is downloaded.static voidgetImages(Bounds bounds)Gets the images within the given bounds.static voidgetImages(LatLon minLatLon, LatLon maxLatLon)Gets all the images in a square.static StreetsideDownloader.DOWNLOAD_MODEgetMode()Returns the current download mode.private static booleanisAreaTooBig(double area)Checks if the area for which Streetside images should be downloaded is too big.private static booleanisInBounds(LatLon latlon)Checks if the givenLatLonobject lies inside the bounds of the image.private static booleanisViewDownloaded(Bounds view)private static voidrun(java.lang.Runnable t)static voidstopAll()Stops all running threads.
-
-
-
Field Detail
-
logger
static final org.apache.log4j.Logger logger
-
MAX_AREA
private static final double MAX_AREA
Max area to be downloaded
-
executor
private static java.util.concurrent.ThreadPoolExecutor executor
Executor that will run the petitions.
-
stoppedDownload
private static boolean stoppedDownload
Indicates whether the last download request has been rejected because it requested an area that was too big. Iff true, the last download has been rejected, if false, it was executed.
-
-
Constructor Detail
-
StreetsideDownloader
private StreetsideDownloader()
-
-
Method Detail
-
getImages
public static void getImages(LatLon minLatLon, LatLon maxLatLon)
Gets all the images in a square. It downloads all the images of all the sequences that pass through the given rectangle.- Parameters:
minLatLon- The minimum latitude and longitude of the rectangle.maxLatLon- The maximum latitude and longitude of the rectangle
-
getImages
public static void getImages(Bounds bounds)
Gets the images within the given bounds.- Parameters:
bounds- ABoundsobject containing the area to be downloaded.
-
getMode
public static StreetsideDownloader.DOWNLOAD_MODE getMode()
Returns the current download mode.- Returns:
- the currently enabled
StreetsideDownloader.DOWNLOAD_MODE
-
run
private static void run(java.lang.Runnable t)
-
downloadVisibleArea
public static void downloadVisibleArea()
If some part of the current view has not been downloaded, it is downloaded.
-
isViewDownloaded
private static boolean isViewDownloaded(Bounds view)
-
isInBounds
private static boolean isInBounds(LatLon latlon)
Checks if the givenLatLonobject lies inside the bounds of the image.- Parameters:
latlon- The coordinates to check.- Returns:
- true if it lies inside the bounds; false otherwise;
-
downloadOSMArea
public static void downloadOSMArea()
Downloads all images of the area covered by the OSM data.
-
isAreaTooBig
private static boolean isAreaTooBig(double area)
Checks if the area for which Streetside images should be downloaded is too big. This means that probably lots of Streetside images are going to be downloaded, slowing down the program too much. A notification is shown when the download has stopped or continued.- Parameters:
area- area to check- Returns:
trueif the area is too big
-
stopAll
public static void stopAll()
Stops all running threads.
-
-