Class StreetsideData
- java.lang.Object
-
- org.openstreetmap.josm.plugins.streetside.StreetsideData
-
- All Implemented Interfaces:
Data
public class StreetsideData extends java.lang.Object implements Data
Database class for all theStreetsideAbstractImageobjects.- See Also:
StreetsideAbstractImage,StreetsideSequence
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<Bounds>boundsThe bounds of the areas for which the pictures have been downloaded.private StreetsideAbstractImagehighlightedImageThe image under the cursor.private java.util.Set<StreetsideAbstractImage>imagesprivate java.util.List<StreetsideDataListener>listenersListeners of the class.private java.util.Set<StreetsideAbstractImage>multiSelectedImagesAll the images selected, can be more than one.private StreetsideAbstractImageselectedImageThe image currently selected, this is the one being shown.
-
Constructor Summary
Constructors Modifier Constructor Description protectedStreetsideData()Creates a new object and adds the initial set of listeners.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(StreetsideAbstractImage image)Adds an StreetsideImage to the object, and then repaints mapView.voidadd(StreetsideAbstractImage image, boolean update)Adds a StreetsideImage to the object, but doesn't repaint mapView.voidaddAll(java.util.Collection<? extends StreetsideAbstractImage> images)Adds a set of StreetsideImages to the object, and then repaints mapView.voidaddAll(java.util.Collection<? extends StreetsideAbstractImage> newImages, boolean update)Adds a set of {link StreetsideAbstractImage} objects to this object.voidaddListener(StreetsideDataListener lis)Adds a new listener.voidaddMultiSelectedImage(java.util.Collection<StreetsideAbstractImage> images)Adds a set ofStreetsideAbstractImageobjects to the list of selected images.voidaddMultiSelectedImage(StreetsideAbstractImage image)Adds aStreetsideImageobject to the list of selected images, (when ctrl + click)static voiddownloadSurroundingCubemaps(StreetsideImage streetsideImage)Downloads surrounding images of this mapillary image in background threadsprivate static voiddownloadSurroundingImages(StreetsideImage streetsideImage)Downloads surrounding images of this mapillary image in background threadsprivate voidfireImagesAdded()private voidfireSelectedImageChanged(StreetsideAbstractImage oldImage, StreetsideAbstractImage newImage)java.util.List<Bounds>getBounds()java.util.Collection<DataSource>getDataSources()StreetsideAbstractImagegetHighlightedImage()Returns the image under the mouse cursor.java.util.Set<StreetsideAbstractImage>getImages()Returns a Set containing all images.java.util.Set<StreetsideAbstractImage>getMultiSelectedImages()Returns a List containing allStreetsideAbstractImageobjects selected with ctrl + click.StreetsideAbstractImagegetSelectedImage()Returns the StreetsideImage object that is currently selected.java.util.Set<StreetsideSequence>getSequences()Returns a Set of all sequences, that the images are part of.voidremoveListener(StreetsideDataListener lis)Removes a listener.voidselectNext()If the selected StreetsideImage is part of a StreetsideSequence then the following visible StreetsideImage is selected.voidselectNext(boolean moveToPicture)If the selected StreetsideImage is part of a StreetsideSequence then the following visible StreetsideImage is selected.voidselectPrevious()If the selected StreetsideImage is part of a StreetsideSequence then the previous visible StreetsideImage is selected.voidselectPrevious(boolean moveToPicture)If the selected StreetsideImage is part of a StreetsideSequence then the previous visible StreetsideImage is selected.voidsetHighlightedImage(StreetsideAbstractImage image)Highlights the image under the cursor.voidsetImages(java.util.Collection<StreetsideAbstractImage> newImages)Sets a newCollectionobject as the used set of images.voidsetSelectedImage(StreetsideAbstractImage image)Selects a new image.If the user does ctrl + click, this isn't triggered.voidsetSelectedImage(StreetsideAbstractImage image, boolean zoom)Selects a new image.If the user does ctrl+click, this isn't triggered.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.data.Data
getDataSourceArea, getDataSourceBounds
-
-
-
-
Field Detail
-
images
private final java.util.Set<StreetsideAbstractImage> images
-
selectedImage
private StreetsideAbstractImage selectedImage
The image currently selected, this is the one being shown.
-
highlightedImage
private StreetsideAbstractImage highlightedImage
The image under the cursor.
-
multiSelectedImages
private final java.util.Set<StreetsideAbstractImage> multiSelectedImages
All the images selected, can be more than one.
-
listeners
private final java.util.List<StreetsideDataListener> listeners
Listeners of the class.
-
-
Constructor Detail
-
StreetsideData
protected StreetsideData()
Creates a new object and adds the initial set of listeners.
-
-
Method Detail
-
add
public void add(StreetsideAbstractImage image)
Adds an StreetsideImage to the object, and then repaints mapView.- Parameters:
image- The image to be added.
-
add
public void add(StreetsideAbstractImage image, boolean update)
Adds a StreetsideImage to the object, but doesn't repaint mapView. This is needed for concurrency.- Parameters:
image- The image to be added.update- Whether the map must be updated or not (updates are currently unsupported by Streetside).
-
addAll
public void addAll(java.util.Collection<? extends StreetsideAbstractImage> images)
Adds a set of StreetsideImages to the object, and then repaints mapView.- Parameters:
images- The set of images to be added.
-
addAll
public void addAll(java.util.Collection<? extends StreetsideAbstractImage> newImages, boolean update)
Adds a set of {link StreetsideAbstractImage} objects to this object.- Parameters:
newImages- The set of images to be added.update- Whether the map must be updated or not.
-
addListener
public final void addListener(StreetsideDataListener lis)
Adds a new listener.- Parameters:
lis- Listener to be added.
-
addMultiSelectedImage
public void addMultiSelectedImage(StreetsideAbstractImage image)
Adds aStreetsideImageobject to the list of selected images, (when ctrl + click)- Parameters:
image- TheStreetsideImageobject to be added.
-
addMultiSelectedImage
public void addMultiSelectedImage(java.util.Collection<StreetsideAbstractImage> images)
Adds a set ofStreetsideAbstractImageobjects to the list of selected images.- Parameters:
images- ACollectionobject containing the set of images to be added.
-
removeListener
public void removeListener(StreetsideDataListener lis)
Removes a listener.- Parameters:
lis- Listener to be removed.
-
setHighlightedImage
public void setHighlightedImage(StreetsideAbstractImage image)
Highlights the image under the cursor.- Parameters:
image- The image under the cursor.
-
getHighlightedImage
public StreetsideAbstractImage getHighlightedImage()
Returns the image under the mouse cursor.- Returns:
- The image under the mouse cursor.
-
getImages
public java.util.Set<StreetsideAbstractImage> getImages()
Returns a Set containing all images.- Returns:
- A Set object containing all images.
-
getSequences
public java.util.Set<StreetsideSequence> getSequences()
Returns a Set of all sequences, that the images are part of.- Returns:
- all sequences that are contained in the Streetside data
-
getSelectedImage
public StreetsideAbstractImage getSelectedImage()
Returns the StreetsideImage object that is currently selected.- Returns:
- The selected StreetsideImage object.
-
fireImagesAdded
private void fireImagesAdded()
-
selectNext
public void selectNext()
If the selected StreetsideImage is part of a StreetsideSequence then the following visible StreetsideImage is selected. In case there is none, does nothing.- Throws:
java.lang.IllegalStateException- if the selected image is null or the selected image doesn't belong to a sequence.
-
selectNext
public void selectNext(boolean moveToPicture)
If the selected StreetsideImage is part of a StreetsideSequence then the following visible StreetsideImage is selected. In case there is none, does nothing.- Parameters:
moveToPicture- True if the view must me moved to the next picture.- Throws:
java.lang.IllegalStateException- if the selected image is null or the selected image doesn't belong to a sequence.
-
selectPrevious
public void selectPrevious()
If the selected StreetsideImage is part of a StreetsideSequence then the previous visible StreetsideImage is selected. In case there is none, does nothing.- Throws:
java.lang.IllegalStateException- if the selected image is null or the selected image doesn't belong to a sequence.
-
selectPrevious
public void selectPrevious(boolean moveToPicture)
If the selected StreetsideImage is part of a StreetsideSequence then the previous visible StreetsideImage is selected. In case there is none, does nothing. * @throws IllegalStateException if the selected image is null or the selected image doesn't belong to a sequence.- Parameters:
moveToPicture- True if the view must me moved to the previous picture.- Throws:
java.lang.IllegalStateException- if the selected image is null or the selected image doesn't belong to a sequence.
-
setSelectedImage
public void setSelectedImage(StreetsideAbstractImage image)
Selects a new image.If the user does ctrl + click, this isn't triggered.- Parameters:
image- The StreetsideImage which is going to be selected
-
setSelectedImage
public void setSelectedImage(StreetsideAbstractImage image, boolean zoom)
Selects a new image.If the user does ctrl+click, this isn't triggered. You can choose whether to center the view on the new image or not.- Parameters:
image- TheStreetsideImagewhich is going to be selected.zoom- True if the view must be centered on the image; false otherwise.
-
downloadSurroundingImages
private static void downloadSurroundingImages(StreetsideImage streetsideImage)
Downloads surrounding images of this mapillary image in background threads- Parameters:
streetsideImage- the image for which the surrounding images should be downloaded
-
downloadSurroundingCubemaps
public static void downloadSurroundingCubemaps(StreetsideImage streetsideImage)
Downloads surrounding images of this mapillary image in background threads- Parameters:
streetsideImage- the image for which the surrounding images should be downloaded
-
fireSelectedImageChanged
private void fireSelectedImageChanged(StreetsideAbstractImage oldImage, StreetsideAbstractImage newImage)
-
getMultiSelectedImages
public java.util.Set<StreetsideAbstractImage> getMultiSelectedImages()
Returns a List containing allStreetsideAbstractImageobjects selected with ctrl + click.- Returns:
- A List object containing all the images selected.
-
setImages
public void setImages(java.util.Collection<StreetsideAbstractImage> newImages)
Sets a newCollectionobject as the used set of images. Any images that are already present, are removed.- Parameters:
newImages- the new image list (previously set images are completely replaced)
-
getDataSources
public java.util.Collection<DataSource> getDataSources()
- Specified by:
getDataSourcesin interfaceData
-
-