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 Description private static classStreetsideLayer.NearestImgToTargetComparator-
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 Description private static intCA_INDICATOR_ANGLEThe angle of the circular sector that indicates the camera angleprivate static intCA_INDICATOR_RADIUSThe radius of the circular sector that indicates the camera angleprivate StreetsideDatadataStreetsideDataobject that stores the database.private static DataSetListenerAdapterDATASET_LISTENERprivate java.awt.TexturePainthatchedprivate static intIMG_MARKER_RADIUSThe radius of the image markerprivate static StreetsideLayerinstanceUnique instance of the class.(package private) static org.apache.log4j.LoggerloggerAbstractModemodeMode of the layer.private StreetsideImage[]nearestImagesThe 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 Description privateStreetsideLayer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactiveOrEditLayerChanged(MainLayerManager.ActiveLayerChangeEvent e)private static voidclearInstance()private voidcreateHatchTexture()Initialize the hatch pattern used to paint the non-downloaded area.voiddestroy()private voiddrawImageMarker(java.awt.Graphics2D g, StreetsideAbstractImage img)Draws an image marker onto the given Graphics context.StreetsideDatagetData()Returns theStreetsideDataobject, which acts as the database of the Layer.javax.swing.IcongetIcon()java.lang.ObjectgetInfoComponent()static StreetsideLayergetInstance()Returns the unique instance of this class.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.StreetsideImagegetNNearestImage(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.StringgetToolTipText()static booleanhasInstance()voidimagesAdded()Fired when any image is added to the database.private voidinit()Initializes the Layer.static voidinvalidateInstance()booleanisMergable(Layer other)booleanisModified()voidmergeFrom(Layer from)voidpaint(java.awt.Graphics2D g, MapView mv, Bounds box)voidselectedImageChanged(StreetsideAbstractImage oldImage, StreetsideAbstractImage newImage)Fired when the selected image is changed by something different from manually clicking on the icon.voidsetMode(AbstractMode mode)Changes the mode the the given one.voidsetVisible(boolean visible)private voidupdateNearestImages()voidvisitBoundingBox(BoundingXYVisitor v)-
Methods inherited from class org.openstreetmap.josm.gui.layer.AbstractModifiableLayer
autosave, 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, getChangesetSourceTag, getColor, getDefaultLayerPosition, getLabel, getName, getOpacity, getViewProjectionBounds, hasColor, hookUpMapView, isBackgroundLayer, isInfoResizable, isProjectionSupported, isRenamed, isSavable, isVisible, nameSupportedProjections, onPostLoadFromFile, projectionChanged, removePropertyChangeListener, rename, setAssociatedFile, setBackgroundLayer, setColor, 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 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
StreetsideDataobject that stores the database.
-
mode
public AbstractMode mode
Mode of the layer.
-
hatched
private volatile java.awt.TexturePaint hatched
-
-
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 theStreetsideDataobject, which acts as the database of the Layer.- Overrides:
getDatain classAbstractModifiableLayer- Returns:
- The
StreetsideDataobject 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:
destroyin interfaceDestroyable- Overrides:
destroyin classLayer
-
isModified
public boolean isModified()
- Specified by:
isModifiedin classAbstractModifiableLayer
-
setVisible
public void setVisible(boolean visible)
- Overrides:
setVisiblein classLayer
-
createHatchTexture
private void createHatchTexture()
Initialize the hatch pattern used to paint the non-downloaded area.
-
paint
public void paint(java.awt.Graphics2D g, MapView mv, Bounds box)
- Specified by:
paintin interfaceMapViewPaintable
-
drawImageMarker
private void drawImageMarker(java.awt.Graphics2D g, StreetsideAbstractImage img)
Draws an image marker onto the given Graphics context.- Parameters:
g- the Graphics contextimg- the image to be drawn onto the Graphics context
-
isMergable
public boolean isMergable(Layer other)
- Specified by:
isMergablein classLayer
-
getMenuEntries
public javax.swing.Action[] getMenuEntries()
- Specified by:
getMenuEntriesin classLayer
-
getInfoComponent
public java.lang.Object getInfoComponent()
- Specified by:
getInfoComponentin classLayer
-
getToolTipText
public java.lang.String getToolTipText()
- Specified by:
getToolTipTextin classLayer
-
activeOrEditLayerChanged
public void activeOrEditLayerChanged(MainLayerManager.ActiveLayerChangeEvent e)
- Specified by:
activeOrEditLayerChangedin interfaceMainLayerManager.ActiveLayerChangeListener
-
visitBoundingBox
public void visitBoundingBox(BoundingXYVisitor v)
- Specified by:
visitBoundingBoxin classLayer
-
imagesAdded
public void imagesAdded()
Description copied from interface:StreetsideDataListenerFired when any image is added to the database.- Specified by:
imagesAddedin interfaceStreetsideDataListener
-
selectedImageChanged
public void selectedImageChanged(StreetsideAbstractImage oldImage, StreetsideAbstractImage newImage)
Description copied from interface:StreetsideDataListenerFired when the selected image is changed by something different from manually clicking on the icon.- Specified by:
selectedImageChangedin interfaceStreetsideDataListener- Parameters:
oldImage- Old selectedStreetsideAbstractImagenewImage- New selectedStreetsideAbstractImage
-
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 imageslimit- 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()
-
-