org.openstreetmap.josm.plugins.streetside.utils

## Class StreetsideUtils

- java.lang.Object
- - org.openstreetmap.josm.plugins.streetside.utils.StreetsideUtils

-     public final class StreetsideUtils
      extends Object

  Set of utilities.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static double` | `MIN_ZOOM_SQUARE_SIDE`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `private` | `StreetsideUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `browse(URL url)` Open the default browser in the given URL.
    `static String` | `currentDate()` Returns the current date formatted as EXIF timestamp.
    `static long` | `currentTime()` Returns current time in Epoch format (milliseconds since 1970-01-01T00:00:00+0000)
    `static double` | `degMinSecToDouble(org.apache.commons.imaging.common.RationalNumber[] degMinSec, String ref)` Calculates the decimal degree-value from a degree value given in degrees-minutes-seconds-format
    `static long` | `getEpoch(String date, String format)` Parses a string with a given format and returns the Epoch time.
    `static void` | `join(StreetsideAbstractImage imgA, StreetsideAbstractImage imgB)` Joins two images into the same sequence.
    `static void` | `showAllPictures()` Zooms to fit all the `StreetsideAbstractImage` objects stored in the database.
    `static void` | `showPictures(Set<StreetsideAbstractImage> images, boolean select)` Zooms to fit all the given `StreetsideAbstractImage` objects.
    `static List<StreetsideAbstractImage>` | `sortImagesInSequence(List<StreetsideAbstractImage> images)`
    `static void` | `unjoin(StreetsideAbstractImage imgA, StreetsideAbstractImage imgB)` Separates two images belonging to the same sequence.
    `static void` | `updateHelpText()` Updates the help text at the bottom of the window.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### MIN_ZOOM_SQUARE_SIDE

          private static final double MIN_ZOOM_SQUARE_SIDE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### StreetsideUtils

          private StreetsideUtils()

  - ### Method Detail

    - #### browse

          public static void browse(URL url)
                             throws IOException

      Open the default browser in the given URL.
      Parameters:
        `url` - The (not-null) URL that is going to be opened.
      Throws:
        `IOException` - when the URL could not be opened

    - #### currentDate

          public static String currentDate()

      Returns the current date formatted as EXIF timestamp. As timezone the default timezone of the JVM is used (`TimeZone.getDefault()`).
      Returns:
        A `String` object containing the current date.

    - #### currentTime

          public static long currentTime()

      Returns current time in Epoch format (milliseconds since 1970-01-01T00:00:00+0000)
      Returns:
        The current date in Epoch format.

    - #### getEpoch

          public static long getEpoch(String date,
                                      String format)
                               throws ParseException

      Parses a string with a given format and returns the Epoch time. If no timezone information is given, the default timezone of the JVM is used (`TimeZone.getDefault()`).
      Parameters:
        `date` - The string containing the date.
        `format` - The format of the date.
      Returns:
        The date in Epoch format.
      Throws:
        `ParseException` - if the date cannot be parsed with the given format

    - #### degMinSecToDouble

          public static double degMinSecToDouble(org.apache.commons.imaging.common.RationalNumber[] degMinSec,
                                                 String ref)

      Calculates the decimal degree-value from a degree value given in degrees-minutes-seconds-format
      Parameters:
        `degMinSec` - an array of length 3, the values in there are (in this order) degrees, minutes and seconds
        `ref` - the latitude or longitude reference determining if the given value is:
        - north ( `GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF_VALUE_NORTH`) or south ( `GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF_VALUE_SOUTH`) of the equator
        - east ( `GpsTagConstants.GPS_TAG_GPS_LONGITUDE_REF_VALUE_EAST`) or west (`GpsTagConstants.GPS_TAG_GPS_LONGITUDE_REF_VALUE_WEST` ) of the equator
      Returns:
        the decimal degree-value for the given input, negative when west of 0-meridian or south of equator, positive otherwise
      Throws:
        `IllegalArgumentException` - if `degMinSec` doesn't have length 3 or if `ref` is not one of the values mentioned above

    - #### join

          public static void join(StreetsideAbstractImage imgA,
                                  StreetsideAbstractImage imgB)

      Joins two images into the same sequence. One of them must be the last image of a sequence, the other one the beginning of a different one.
      Parameters:
        `imgA` - the first image, into whose sequence the images from the sequence of the second image are merged
        `imgB` - the second image, whose sequence is merged into the sequence of the first image

    - #### showAllPictures

          public static void showAllPictures()

      Zooms to fit all the `StreetsideAbstractImage` objects stored in the database.

    - #### showPictures

          public static void showPictures(Set<StreetsideAbstractImage> images,
                                          boolean select)

      Zooms to fit all the given `StreetsideAbstractImage` objects.
      Parameters:
        `images` - The images your are zooming to.
        `select` - Whether the added images must be selected or not.

    - #### unjoin

          public static void unjoin(StreetsideAbstractImage imgA,
                                    StreetsideAbstractImage imgB)

      Separates two images belonging to the same sequence. The two images have to be consecutive in the same sequence. Two new sequences are created and all images up to (and including) either `imgA` or `imgB` (whichever appears first in the sequence) are put into the first of the two sequences. All others are put into the second new sequence.
      Parameters:
        `imgA` - one of the images marking where to split the sequence
        `imgB` - the other image marking where to split the sequence, needs to be a direct neighbour of `imgA` in the sequence.

    - #### updateHelpText

          public static void updateHelpText()

      Updates the help text at the bottom of the window.

    - #### sortImagesInSequence

          public static List<StreetsideAbstractImage> sortImagesInSequence(List<StreetsideAbstractImage> images)

JOSM Plugins