org.openstreetmap.josm.plugins.streetside

## Class StreetsideLayer

- java.lang.Object
- - org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
  - - org.openstreetmap.josm.gui.layer.Layer
    - - org.openstreetmap.josm.gui.layer.AbstractModifiableLayer
      - - org.openstreetmap.josm.plugins.streetside.StreetsideLayer

- All Implemented Interfaces:
    Lockable, ProjectionChangeListener, DownloadFromServer, MainLayerManager.ActiveLayerChangeListener, MapViewPaintable, SaveToFile, UploadToServer, StreetsideDataListener, Destroyable

      public final class StreetsideLayer
      extends AbstractModifiableLayer
      implements MainLayerManager.ActiveLayerChangeListener, StreetsideDataListener

  This class represents the layer shown in JOSM. There can only exist one instance of this object.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `private static class` | `StreetsideLayer.NearestImgToTargetComparator` Action used to delete images.

    - ### Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.Layer

      `Layer.LayerAction, Layer.LayerGpxExportAction, Layer.LayerSaveAction, Layer.LayerSaveAsAction, Layer.MultiLayerAction, Layer.SeparatorLayerAction`

    - ### Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable

      `AbstractMapViewPaintable.CompatibilityModeLayerPainter`

    - ### Nested classes/interfaces inherited from interface org.openstreetmap.josm.gui.layer.MapViewPaintable

      `MapViewPaintable.LayerPainter, MapViewPaintable.MapViewEvent, MapViewPaintable.PaintableInvalidationEvent, MapViewPaintable.PaintableInvalidationListener`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static int` | `CA_INDICATOR_ANGLE` The angle of the circular sector that indicates the camera angle
    `private static int` | `CA_INDICATOR_RADIUS` The radius of the circular sector that indicates the camera angle
    `private StreetsideData` | `data` `StreetsideData` object that stores the database.
    `private static DataSetListenerAdapter` | `DATASET_LISTENER`
    `private TexturePaint` | `hatched`
    `private static int` | `IMG_MARKER_RADIUS` The radius of the image marker
    `private static StreetsideLayer` | `instance` Unique instance of the class.
    `private StreetsideLocationChangeset` | `locationChangeset`
    `AbstractMode` | `mode` Mode of the layer.
    `private StreetsideImage[]` | `nearestImages` The nearest images to the selected image from different sequences sorted by distance from selection.
    `private static double` | `TRAFFIC_SIGN_HEIGHT_3RD` A third of the height of the sign, for easier calculations
    `private static int` | `TRAFFIC_SIGN_SIZE` Length of the edge of the small sign, which indicates that traffic signs have been found in an image.

    - ### Fields inherited from class org.openstreetmap.josm.gui.layer.Layer

      `FILTER_STATE_PROP, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `activeOrEditLayerChanged(MainLayerManager.ActiveLayerChangeEvent e)`
    `private static void` | `clearInstance()`
    `private void` | `createHatchTexture()` Initialize the hatch pattern used to paint the non-downloaded area.
    `void` | `destroy()`
    `private void` | `drawImageMarker(Graphics2D g, StreetsideAbstractImage img)` Draws an image marker onto the given Graphics context.
    `StreetsideData` | `getData()` Returns the `StreetsideData` object, which acts as the database of the Layer.
    `Icon` | `getIcon()`
    `Object` | `getInfoComponent()`
    `static StreetsideLayer` | `getInstance()` Returns the unique instance of this class.
    `StreetsideLocationChangeset` | `getLocationChangeset()` Returns the `StreetsideLocationChangeset` object, which acts as the database of the Layer.
    `Action[]` | `getMenuEntries()`
    `private StreetsideImage[]` | `getNearestImagesFromDifferentSequences(StreetsideAbstractImage target, int limit)` Returns the closest images belonging to a different sequence and different from the specified target image.
    `StreetsideImage` | `getNNearestImage(int n)` Returns the n-nearest image, for n=1 the nearest one is returned, for n=2 the second nearest one and so on.
    `String` | `getToolTipText()`
    `static boolean` | `hasInstance()`
    `void` | `imagesAdded()` Fired when any image is added to the database.
    `private void` | `init()` Initializes the Layer.
    `static void` | `invalidateInstance()`
    `boolean` | `isMergable(Layer other)`
    `boolean` | `isModified()`
    `void` | `mergeFrom(Layer from)`
    `void` | `paint(Graphics2D g, MapView mv, Bounds box)`
    `void` | `selectedImageChanged(StreetsideAbstractImage oldImage, StreetsideAbstractImage newImage)` Fired when the selected image is changed by something different from manually clicking on the icon.
    `void` | `setMode(AbstractMode mode)` Changes the mode the the given one.
    `void` | `setVisible(boolean visible)`
    `private void` | `updateNearestImages()`
    `void` | `visitBoundingBox(BoundingXYVisitor v)`

    - ### Methods inherited from class org.openstreetmap.josm.gui.layer.AbstractModifiableLayer

      `createUploadTask, getUploadDialog, isDownloadable, isLocked, isUploadable, isUploadDiscouraged, isUploadInProgress, lock, onPostSaveToFile, onPostUploadToServer, requiresSaveToFile, requiresUploadToServer, unlock`

    - ### Methods inherited from class org.openstreetmap.josm.gui.layer.Layer

      `addPropertyChangeListener, checkSaveConditions, createAndOpenSaveFileChooser, fireFilterStateChanged, fireOpacityChanged, fireVisibleChanged, getAssociatedFile, getBaseColorProperty, getColorProperty, getDefaultLayerPosition, getName, getOpacity, getViewProjectionBounds, hookUpMapView, isBackgroundLayer, isInfoResizable, isProjectionSupported, isRenamed, isSavable, isVisible, nameSupportedProjections, onPostLoadFromFile, projectionChanged, removePropertyChangeListener, rename, setAssociatedFile, setBackgroundLayer, setFilterStateChanged, setName, setOpacity, toggleVisible, toString`

    - ### Methods inherited from class org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable

      `addInvalidationListener, attachToMapView, createMapViewPainter, invalidate, removeInvalidationListener`

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

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

    - ### Methods inherited from interface org.openstreetmap.josm.gui.layer.SaveToFile

      `isSavable`

- - ### Field Detail

    - #### IMG_MARKER_RADIUS

          private static final int IMG_MARKER_RADIUS

      The radius of the image marker
      See Also:
        Constant Field Values

    - #### CA_INDICATOR_RADIUS

          private static final int CA_INDICATOR_RADIUS

      The radius of the circular sector that indicates the camera angle
      See Also:
        Constant Field Values

    - #### CA_INDICATOR_ANGLE

          private static final int CA_INDICATOR_ANGLE

      The angle of the circular sector that indicates the camera angle
      See Also:
        Constant Field Values

    - #### TRAFFIC_SIGN_SIZE

          private static final int TRAFFIC_SIGN_SIZE

      Length of the edge of the small sign, which indicates that traffic signs have been found in an image.
      See Also:
        Constant Field Values

    - #### TRAFFIC_SIGN_HEIGHT_3RD

          private static final double TRAFFIC_SIGN_HEIGHT_3RD

      A third of the height of the sign, for easier calculations

    - #### DATASET_LISTENER

          private static final DataSetListenerAdapter DATASET_LISTENER

    - #### instance

          private static StreetsideLayer instance

      Unique instance of the class.

    - #### nearestImages

          private StreetsideImage[] nearestImages

      The nearest images to the selected image from different sequences sorted by distance from selection.

    - #### data

          private final StreetsideData data

      `StreetsideData` object that stores the database.

    - #### mode

          public AbstractMode mode

      Mode of the layer.

    - #### hatched

          private volatile TexturePaint hatched

    - #### locationChangeset

          private final StreetsideLocationChangeset locationChangeset

  - ### Constructor Detail

    - #### StreetsideLayer

          private StreetsideLayer()

  - ### Method Detail

    - #### init

          private void init()

      Initializes the Layer.

    - #### invalidateInstance

          public static void invalidateInstance()

    - #### setMode

          public void setMode(AbstractMode mode)

      Changes the mode the the given one.
      Parameters:
        `mode` - The mode that is going to be activated.

    - #### clearInstance

          private static void clearInstance()

    - #### getInstance

          public static StreetsideLayer getInstance()

      Returns the unique instance of this class.
      Returns:
        The unique instance of this class.

    - #### hasInstance

          public static boolean hasInstance()

      Returns:
        if the unique instance of this layer is currently instantiated

    - #### getData

          public StreetsideData getData()

      Returns the `StreetsideData` object, which acts as the database of the Layer.
      Returns:
        The `StreetsideData` object that stores the database.

    - #### getLocationChangeset

          public StreetsideLocationChangeset getLocationChangeset()

      Returns the `StreetsideLocationChangeset` object, which acts as the database of the Layer.
      Returns:
        The `StreetsideData` object that stores the database.

    - #### getNNearestImage

          public StreetsideImage getNNearestImage(int n)

      Returns the n-nearest image, for n=1 the nearest one is returned, for n=2 the second nearest one and so on. The "n-nearest image" is picked from the list of one image from every sequence that is nearest to the currently selected image, excluding the sequence to which the selected image belongs.
      Parameters:
        `n` - the index for picking from the list of "nearest images", beginning from 1
      Returns:
        the n-nearest image to the currently selected image

    - #### destroy

          public void destroy()

      Specified by:
        `destroy` in interface `Destroyable`
      Overrides:
        `destroy` in class `Layer`

    - #### isModified

          public boolean isModified()

      Specified by:
        `isModified` in class `AbstractModifiableLayer`

    - #### setVisible

          public void setVisible(boolean visible)

      Overrides:
        `setVisible` in class `Layer`

    - #### createHatchTexture

          private void createHatchTexture()

      Initialize the hatch pattern used to paint the non-downloaded area.

    - #### paint

          public void paint(Graphics2D g,
                            MapView mv,
                            Bounds box)

      Specified by:
        `paint` in interface `MapViewPaintable`

    - #### drawImageMarker

          private void drawImageMarker(Graphics2D g,
                                       StreetsideAbstractImage img)

      Draws an image marker onto the given Graphics context.
      Parameters:
        `g` - the Graphics context
        `img` - the image to be drawn onto the Graphics context

    - #### getIcon

          public Icon getIcon()

      Specified by:
        `getIcon` in class `Layer`

    - #### isMergable

          public boolean isMergable(Layer other)

      Specified by:
        `isMergable` in class `Layer`

    - #### mergeFrom

          public void mergeFrom(Layer from)

      Specified by:
        `mergeFrom` in class `Layer`

    - #### getMenuEntries

          public Action[] getMenuEntries()

      Specified by:
        `getMenuEntries` in class `Layer`

    - #### getInfoComponent

          public Object getInfoComponent()

      Specified by:
        `getInfoComponent` in class `Layer`

    - #### getToolTipText

          public String getToolTipText()

      Specified by:
        `getToolTipText` in class `Layer`

    - #### activeOrEditLayerChanged

          public void activeOrEditLayerChanged(MainLayerManager.ActiveLayerChangeEvent e)

      Specified by:
        `activeOrEditLayerChanged` in interface `MainLayerManager.ActiveLayerChangeListener`

    - #### visitBoundingBox

          public void visitBoundingBox(BoundingXYVisitor v)

      Specified by:
        `visitBoundingBox` in class `Layer`

    - #### imagesAdded

          public void imagesAdded()

      Description copied from interface: `StreetsideDataListener`
      Fired when any image is added to the database.
      Specified by:
        `imagesAdded` in interface `StreetsideDataListener`

    - #### selectedImageChanged

          public void selectedImageChanged(StreetsideAbstractImage oldImage,
                                           StreetsideAbstractImage newImage)

      Description copied from interface: `StreetsideDataListener`
      Fired when the selected image is changed by something different from manually clicking on the icon.
      Specified by:
        `selectedImageChanged` in interface `StreetsideDataListener`
      Parameters:
        `oldImage` - Old selected `StreetsideAbstractImage`
        `newImage` - New selected `StreetsideAbstractImage`

    - #### getNearestImagesFromDifferentSequences

          private StreetsideImage[] getNearestImagesFromDifferentSequences(StreetsideAbstractImage target,
                                                                           int limit)

      Returns the closest images belonging to a different sequence and different from the specified target image.
      Parameters:
        `target` - the image for which you want to find the nearest other images
        `limit` - the maximum length of the returned array
      Returns:
        An array containing the closest images belonging to different sequences sorted by distance from target.

    - #### updateNearestImages

          private void updateNearestImages()

JOSM Plugins