Package org.openstreetmap.josm.data
Class ImageData
- java.lang.Object
-
- org.openstreetmap.josm.data.ImageData
-
- All Implemented Interfaces:
Data
public class ImageData extends java.lang.Object implements Data
Class to holdImageEntry
and the current selection- Since:
- 14590
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ImageData.ImageDataUpdateListener
A listener that is informed when the current selection change
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<ImageEntry>
data
private QuadBuckets<ImageEntry>
geoImages
private Layer
layer
private ListenerList<ImageData.ImageDataUpdateListener>
listeners
private java.util.List<java.lang.Integer>
selectedImagesIndex
-
Constructor Summary
Constructors Constructor Description ImageData()
Construct a new image container without imagesImageData(java.util.List<ImageEntry> data)
Construct a new image container with a list of images
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addImageDataUpdateListener(ImageData.ImageDataUpdateListener listener)
Add a listener that listens to image data changesvoid
addImageToSelection(ImageEntry image)
Add image to the list of selected imagesprivate void
afterImageUpdated(ImageEntry img)
void
clearSelectedImage()
Clear the selected image(s)void
fireNodeMoved(ImageEntry gpxImageEntry)
Indicate that an entry has changedjava.util.Collection<DataSource>
getDataSources()
Returns the collection of data sources.ImageEntry
getFirstImage()
Get the first image on the layerjava.util.List<ImageEntry>
getImages()
Returns the imagesImageEntry
getLastImage()
Get the last image in the layerLayer
getLayer()
Get the layer that this data is associated with.ImageEntry
getNextImage()
Get the image next to the current imageImageEntry
getPreviousImage()
Get the image previous to the current imageImageEntry
getSelectedImage()
Return the first currently selected imagejava.util.List<ImageEntry>
getSelectedImages()
Return the current selected imagesboolean
hasNextImage()
Check if there is a next image in the sequenceboolean
hasPreviousImage()
Check if there is a previous image in the sequenceboolean
isImageSelected(ImageEntry image)
Determines if the image is selectedboolean
isModified()
Determines if one image has modified GPS data.void
mergeFrom(ImageData otherData)
Merge 2 ImageDatavoid
notifyImageUpdate()
Manually trigger theImageData.ImageDataUpdateListener.imageDataUpdated(ImageData)
void
removeImage(ImageEntry img)
Remove the image from the list and trigger update listenervoid
removeImage(ImageEntry img, boolean fireUpdateEvent)
Remove the image from the list and optionally trigger update listenervoid
removeImageDataUpdateListener(ImageData.ImageDataUpdateListener listener)
Removes a listener that listens to image data changesprivate void
removeImages(java.util.List<ImageEntry> selectedImages)
void
removeImageToSelection(ImageEntry image)
Remove the image from the list of selected imagesvoid
removeSelectedImages()
Remove the current selected image from the listjava.util.Collection<ImageEntry>
searchImages(Bounds bounds)
Search for images in a boundsvoid
setLayer(Layer layer)
Set the layer for use withImageViewerDialog.displayImages(List)
void
setSelectedImage(ImageEntry image)
Select as the selected the given imageprivate void
setSelectedImageIndex(int index)
private void
setSelectedImageIndex(int index, boolean forceTrigger)
void
updateImageDirection(ImageEntry img, double direction)
Update the image direction of the image and trigger updatevoid
updateImagePosition(ImageEntry img, LatLon newPos)
Update the position of the image and trigger updatevoid
updateSelectedImage()
Update the selected image after removal of one or more images.-
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
-
data
private final java.util.List<ImageEntry> data
-
selectedImagesIndex
private final java.util.List<java.lang.Integer> selectedImagesIndex
-
listeners
private final ListenerList<ImageData.ImageDataUpdateListener> listeners
-
geoImages
private final QuadBuckets<ImageEntry> geoImages
-
-
Constructor Detail
-
ImageData
public ImageData()
Construct a new image container without images
-
ImageData
public ImageData(java.util.List<ImageEntry> data)
Construct a new image container with a list of images- Parameters:
data
- the list ofImageEntry
-
-
Method Detail
-
getImages
public java.util.List<ImageEntry> getImages()
Returns the images- Returns:
- the images
-
isModified
public boolean isModified()
Determines if one image has modified GPS data.- Returns:
true
if data has been modified;false
, otherwise
-
mergeFrom
public void mergeFrom(ImageData otherData)
Merge 2 ImageData- Parameters:
otherData
-ImageData
to merge
-
getSelectedImage
public ImageEntry getSelectedImage()
Return the first currently selected image- Returns:
- the first selected image as
ImageEntry
or null - See Also:
getSelectedImages()
-
getSelectedImages
public java.util.List<ImageEntry> getSelectedImages()
Return the current selected images- Returns:
- the selected images as list
ImageEntry
- Since:
- 15333
-
getFirstImage
public ImageEntry getFirstImage()
Get the first image on the layer- Returns:
- The first image
- Since:
- 18246
-
getLastImage
public ImageEntry getLastImage()
Get the last image in the layer- Returns:
- The last image
- Since:
- 18246
-
hasNextImage
public boolean hasNextImage()
Check if there is a next image in the sequence- Returns:
true
is there is a next image,false
otherwise
-
searchImages
public java.util.Collection<ImageEntry> searchImages(Bounds bounds)
Search for images in a bounds- Parameters:
bounds
- The bounds to search- Returns:
- images in the bounds
- Since:
- 17459
-
getNextImage
public ImageEntry getNextImage()
Get the image next to the current image- Returns:
- The next image
- Since:
- 18246
-
getPreviousImage
public ImageEntry getPreviousImage()
Get the image previous to the current image- Returns:
- The previous image
- Since:
- 18246
-
hasPreviousImage
public boolean hasPreviousImage()
Check if there is a previous image in the sequence- Returns:
true
is there is a previous image,false
otherwise
-
setSelectedImage
public void setSelectedImage(ImageEntry image)
Select as the selected the given image- Parameters:
image
- the selected image
-
addImageToSelection
public void addImageToSelection(ImageEntry image)
Add image to the list of selected images- Parameters:
image
-ImageEntry
the image to add- Since:
- 15333
-
fireNodeMoved
public void fireNodeMoved(ImageEntry gpxImageEntry)
Indicate that an entry has changed- Parameters:
gpxImageEntry
- The entry to update- Since:
- 17574
-
removeImageToSelection
public void removeImageToSelection(ImageEntry image)
Remove the image from the list of selected images- Parameters:
image
-ImageEntry
the image to remove- Since:
- 15333
-
clearSelectedImage
public void clearSelectedImage()
Clear the selected image(s)
-
setSelectedImageIndex
private void setSelectedImageIndex(int index)
-
setSelectedImageIndex
private void setSelectedImageIndex(int index, boolean forceTrigger)
-
removeSelectedImages
public void removeSelectedImages()
Remove the current selected image from the list- Since:
- 15348
-
removeImages
private void removeImages(java.util.List<ImageEntry> selectedImages)
-
updateSelectedImage
public void updateSelectedImage()
Update the selected image after removal of one or more images.- Since:
- 18049
-
isImageSelected
public boolean isImageSelected(ImageEntry image)
Determines if the image is selected- Parameters:
image
- theImageEntry
image- Returns:
true
is the image is selected,false
otherwise- Since:
- 15333
-
removeImage
public void removeImage(ImageEntry img)
Remove the image from the list and trigger update listener- Parameters:
img
- theImageEntry
to remove
-
removeImage
public void removeImage(ImageEntry img, boolean fireUpdateEvent)
Remove the image from the list and optionally trigger update listener- Parameters:
img
- theImageEntry
to removefireUpdateEvent
- iftrue
, notifies listeners of image update- Since:
- 18049
-
updateImagePosition
public void updateImagePosition(ImageEntry img, LatLon newPos)
Update the position of the image and trigger update- Parameters:
img
- the image to updatenewPos
- the new position
-
updateImageDirection
public void updateImageDirection(ImageEntry img, double direction)
Update the image direction of the image and trigger update- Parameters:
img
- the image to updatedirection
- the new direction
-
notifyImageUpdate
public void notifyImageUpdate()
Manually trigger theImageData.ImageDataUpdateListener.imageDataUpdated(ImageData)
-
afterImageUpdated
private void afterImageUpdated(ImageEntry img)
-
setLayer
public void setLayer(Layer layer)
Set the layer for use withImageViewerDialog.displayImages(List)
- Parameters:
layer
- The layer to use for organization- Since:
- 18591
-
getLayer
public Layer getLayer()
Get the layer that this data is associated with. May benull
.- Returns:
- The layer this data is associated with.
- Since:
- 18591
-
addImageDataUpdateListener
public void addImageDataUpdateListener(ImageData.ImageDataUpdateListener listener)
Add a listener that listens to image data changes- Parameters:
listener
- theImageData.ImageDataUpdateListener
-
removeImageDataUpdateListener
public void removeImageDataUpdateListener(ImageData.ImageDataUpdateListener listener)
Removes a listener that listens to image data changes- Parameters:
listener
- The listener
-
getDataSources
public java.util.Collection<DataSource> getDataSources()
Description copied from interface:Data
Returns the collection of data sources.- Specified by:
getDataSources
in interfaceData
- Returns:
- the collection of data sources.
-
-