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:
    org.openstreetmap.josm.data.osm.Lockable, org.openstreetmap.josm.data.projection.ProjectionChangeListener, org.openstreetmap.josm.gui.layer.DownloadFromServer, org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener, org.openstreetmap.josm.gui.layer.MapViewPaintable, org.openstreetmap.josm.gui.layer.SaveToFile, org.openstreetmap.josm.gui.layer.UploadToServer, StreetsideDataListener, org.openstreetmap.josm.tools.Destroyable

      public final class StreetsideLayer
      extends org.openstreetmap.josm.gui.layer.AbstractModifiableLayer
      implements org.openstreetmap.josm.gui.layer.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`

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

      `org.openstreetmap.josm.gui.layer.Layer.LayerAction, org.openstreetmap.josm.gui.layer.Layer.LayerGpxExportAction, org.openstreetmap.josm.gui.layer.Layer.LayerSaveAction, org.openstreetmap.josm.gui.layer.Layer.LayerSaveAsAction, org.openstreetmap.josm.gui.layer.Layer.MultiLayerAction, org.openstreetmap.josm.gui.layer.Layer.SeparatorLayerAction`

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

      `org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable.CompatibilityModeLayerPainter`

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

      `org.openstreetmap.josm.gui.layer.MapViewPaintable.LayerPainter, org.openstreetmap.josm.gui.layer.MapViewPaintable.MapViewEvent, org.openstreetmap.josm.gui.layer.MapViewPaintable.PaintableInvalidationEvent, org.openstreetmap.josm.gui.layer.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 org.openstreetmap.josm.data.osm.event.DataSetListenerAdapter` | `DATASET_LISTENER`
    `private java.awt.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`
    `(package private) static org.apache.log4j.Logger` | `logger`
    `AbstractMode` | `mode` Mode of the layer.
    `private StreetsideImage[]` | `nearestImages` The nearest images to the selected image from different sequences sorted by distance from selection.

    - ### 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(org.openstreetmap.josm.gui.layer.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(java.awt.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.
    `javax.swing.Icon` | `getIcon()`
    `java.lang.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.
    `javax.swing.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.
    `java.lang.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(org.openstreetmap.josm.gui.layer.Layer other)`
    `boolean` | `isModified()`
    `void` | `mergeFrom(org.openstreetmap.josm.gui.layer.Layer from)`
    `void` | `paint(java.awt.Graphics2D g, org.openstreetmap.josm.gui.MapView mv, org.openstreetmap.josm.data.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(org.openstreetmap.josm.data.osm.visitor.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

    - #### logger

          static final org.apache.log4j.Logger logger

    - #### 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

    - #### DATASET_LISTENER

          private static final org.openstreetmap.josm.data.osm.event.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 java.awt.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 `org.openstreetmap.josm.tools.Destroyable`
      Overrides:
        `destroy` in class `org.openstreetmap.josm.gui.layer.Layer`

    - #### isModified

          public boolean isModified()

      Specified by:
        `isModified` in class `org.openstreetmap.josm.gui.layer.AbstractModifiableLayer`

    - #### setVisible

          public void setVisible(boolean visible)

      Overrides:
        `setVisible` in class `org.openstreetmap.josm.gui.layer.Layer`

    - #### createHatchTexture

          private void createHatchTexture()

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

    - #### paint

          public void paint(java.awt.Graphics2D g,
                            org.openstreetmap.josm.gui.MapView mv,
                            org.openstreetmap.josm.data.Bounds box)

      Specified by:
        `paint` in interface `org.openstreetmap.josm.gui.layer.MapViewPaintable`

    - #### drawImageMarker

          private void drawImageMarker(java.awt.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 javax.swing.Icon getIcon()

      Specified by:
        `getIcon` in class `org.openstreetmap.josm.gui.layer.Layer`

    - #### isMergable

          public boolean isMergable(org.openstreetmap.josm.gui.layer.Layer other)

      Specified by:
        `isMergable` in class `org.openstreetmap.josm.gui.layer.Layer`

    - #### mergeFrom

          public void mergeFrom(org.openstreetmap.josm.gui.layer.Layer from)

      Specified by:
        `mergeFrom` in class `org.openstreetmap.josm.gui.layer.Layer`

    - #### getMenuEntries

          public javax.swing.Action[] getMenuEntries()

      Specified by:
        `getMenuEntries` in class `org.openstreetmap.josm.gui.layer.Layer`

    - #### getInfoComponent

          public java.lang.Object getInfoComponent()

      Specified by:
        `getInfoComponent` in class `org.openstreetmap.josm.gui.layer.Layer`

    - #### getToolTipText

          public java.lang.String getToolTipText()

      Specified by:
        `getToolTipText` in class `org.openstreetmap.josm.gui.layer.Layer`

    - #### activeOrEditLayerChanged

          public void activeOrEditLayerChanged(org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent e)

      Specified by:
        `activeOrEditLayerChanged` in interface `org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener`

    - #### visitBoundingBox

          public void visitBoundingBox(org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor v)

      Specified by:
        `visitBoundingBox` in class `org.openstreetmap.josm.gui.layer.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