Class 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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.concurrent.ThreadPoolExecutor executor
      Executor that will run the petitions.
      (package private) static org.apache.log4j.Logger logger  
      private static double MAX_AREA
      Max area to be downloaded
      private static boolean stoppedDownload
      Indicates whether the last download request has been rejected because it requested an area that was too big.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void downloadOSMArea()
      Downloads all images of the area covered by the OSM data.
      static void downloadVisibleArea()
      If some part of the current view has not been downloaded, it is downloaded.
      static void getImages​(Bounds bounds)
      Gets the images within the given bounds.
      static void getImages​(LatLon minLatLon, LatLon maxLatLon)
      Gets all the images in a square.
      static StreetsideDownloader.DOWNLOAD_MODE getMode()
      Returns the current download mode.
      private static boolean isAreaTooBig​(double area)
      Checks if the area for which Streetside images should be downloaded is too big.
      private static boolean isInBounds​(LatLon latlon)
      Checks if the given LatLon object lies inside the bounds of the image.
      private static boolean isViewDownloaded​(Bounds view)  
      private static void run​(java.lang.Runnable t)  
      static void stopAll()
      Stops all running threads.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.
    • 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 - A Bounds object containing the area to be downloaded.
      • 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.
      • isInBounds

        private static boolean isInBounds​(LatLon latlon)
        Checks if the given LatLon object 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:
        true if the area is too big
      • stopAll

        public static void stopAll()
        Stops all running threads.