Class GeoImageLayer
- All Implemented Interfaces:
ImageData.ImageDataUpdateListener,Lockable,ProjectionChangeListener,DownloadFromServer,IGeoImageLayer,JumpToMarkerActions.JumpToMarkerLayer,MapViewPaintable,SaveToFile,UploadToServer,NavigatableComponent.ZoomChangeListener,Destroyable
- Direct Known Subclasses:
WikimediaCommonsLayer
- Since:
- 99
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.Layer
Layer.LayerAction, Layer.LayerGpxExportAction, Layer.LayerSaveAction, Layer.LayerSaveAsAction, Layer.MultiLayerAction, Layer.SeparatorLayerActionNested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
AbstractMapViewPaintable.CompatibilityModeLayerPainterNested classes/interfaces inherited from interface org.openstreetmap.josm.gui.layer.geoimage.IGeoImageLayer
IGeoImageLayer.ImageChangeListenerNested classes/interfaces inherited from interface org.openstreetmap.josm.gui.layer.MapViewPaintable
MapViewPaintable.LayerPainter, MapViewPaintable.MapViewEvent, MapViewPaintable.PaintableInvalidationEvent, MapViewPaintable.PaintableInvalidationListener -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanImage cycle mode flag.private final ImageDataprivate CorrelateGpxWithImages(package private) GpxData(package private) GpxData(package private) GpxLayerprivate final Iconprivate final ListenerList<IGeoImageLayer.ImageChangeListener>private PointMouse position where the last image was selected.private MapFrame.MapModeChangeListenerprivate MouseAdapterprivate MouseMotionAdapterprivate BufferedImageprivate final Iconprivate final Iconprivate PointThe mouse point(package private) booleanprivate ThumbsLoaderprivate final ExecutorServiceprivate booleanprivate boolean(package private) booleanFields inherited from class org.openstreetmap.josm.gui.layer.AbstractModifiableLayer
REQUIRES_SAVE_TO_DISK_PROPFields inherited from class org.openstreetmap.josm.gui.layer.Layer
FILTER_STATE_PROP, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP -
Constructor Summary
ConstructorsConstructorDescriptionGeoImageLayer(List<ImageEntry> data, GpxData gpxData, String name, boolean useThumbs) Constructs a newGeoImageLayer.GeoImageLayer(List<ImageEntry> data, GpxLayer gpxLayer) Constructs a newGeoImageLayer.GeoImageLayer(List<ImageEntry> data, GpxLayer gpxLayer, boolean useThumbs) Constructs a newGeoImageLayer.GeoImageLayer(List<ImageEntry> data, GpxLayer gpxLayer, String name) Constructs a newGeoImageLayer.GeoImageLayer(List<ImageEntry> data, GpxLayer gpxLayer, String name, boolean useThumbs) Constructs a newGeoImageLayer. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a listener for when images change(package private) voidapplyTmp()This method is called whenever this layer is added to a map view.voidClear the selection of the layerbooleancontainsImage(IImageEntry<?> imageEntry) Check if the layer contains the specified imagestatic voidcreate(Collection<File> files, GpxLayer gpxLayer) Create a GeoImageLayer asynchronouslyvoiddestroy()Called, when the layer is removed from the mapview and is going to be destroyed.(package private) voidprotected static voiddrawDirectionArrow(Graphics2D g, Point p, double dir, Dimension imgDim) protected static voiddrawDirectionArrow(Graphics2D g, Point p, double dir, Dimension imgDim, Color color) private static IcongenerateSelectedIconNotImageViewer(Icon selectedIcon) Get the source for the layergetData()Get the data for the modifiable layerReturns a faux GPX data built from the images or the associated GPX layer data.Returns a faux GPX layer built from the images or the associated GPX layer.Returns the gpxCorrelateActionReturns the associated GPX data if any.Returns the associated GPX layer if any.getIcon()Return a representative small image for this layer.Returns the image data store being used by this layerprotected DimensionGet list of images in layer.Gets the layer information to display to the user.List<IImageEntry<?>>Get the invalid geo images for this layer (specifically, those that cannot be displayed on the map)Action[]Returns list of actions.private intReturns index of the image that matches the position of the mouse event.private intgetPhotoIdxUnderMouse(MouseEvent evt, boolean cycle) Returns index of the image that matches the position of the mouse event.Returns the image that matches the position of the mouse event.Get the current selection(package private) List<ImageEntry>getSortedImgList(boolean exif, boolean tagged, TimeSource timeSource) Returns a list of images that fulfill the given criteria.Returns a small tooltip hint about some statistics for this layer.voidInitialization code, that depends on Main.map.mapView.voidimageDataUpdated(ImageData data) Called when the data changeprivate StringinfoText()Prepare the string that is displayed if layer information is requested.booleanisMergable(Layer other) Determines if the other layer can be merged into this layer.booleanDetermines if data managed by this layer has been modified.private booleanisPhotoIdxUnderMouse(int idx, MouseEvent evt) Check if the position of the mouse event is within the rectangle of the photo icon or thumbnail.private static booleanisSupportedMapMode(MapMode mapMode) Determines if the functionality of this layer is available in the specified map mode.booleanReturns the current thumbnail display status.voidJump (move the viewport) to the next marker.voidJump (move the viewport) to the previous marker.voidMerges the given layer into this layer.voidpaint(Graphics2D g, MapView mv, Bounds bounds) Paint the dataset using the engine set.private voidpaintImage(ImageEntry e, MapView mv, Rectangle clip, Graphics2D tempG) Paint one image.static voidregisterMenuAddition(Action addition) Register actions on the layerstatic voidregisterSupportedMapMode(MapMode mapMode) Registers a map mode for which the functionality of this layer should be available.voidRemove a listener for when images changeprivate static DimensionscaledDimension(Image thumb) voidCalled when the selection changevoidsetUseThumbs(boolean useThumbs) Enables or disables the display of thumbnails.voidShow current photo on map and in image viewer.voidStart to load thumbnails.voidStop to load thumbnails.voidCalled to signal that the loading of thumbnails has finished.voidMarks the offscreen buffer to be updated.voidVisits the content bounds of this layer.voidMethod called when the zoom area has changed.Methods inherited from class org.openstreetmap.josm.gui.layer.AbstractModifiableLayer
autosave, createUploadTask, getUploadDialog, isDirty, isDownloadable, isLocked, isUploadable, isUploadDiscouraged, isUploadInProgress, lock, onPostSaveToFile, onPostUploadToServer, requiresSaveToFile, requiresUploadToServer, unlockMethods inherited from class org.openstreetmap.josm.gui.layer.Layer
addPropertyChangeListener, checkSaveConditions, createAndOpenSaveFileChooser, fireFilterStateChanged, fireOpacityChanged, fireVisibleChanged, getAssociatedFile, getColor, getDefaultLayerPosition, getLabel, getName, getOpacity, getViewProjectionBounds, hasColor, isBackgroundLayer, isInfoResizable, isProjectionSupported, isRenamed, isSavable, isVisible, nameSupportedProjections, onPostLoadFromFile, projectionChanged, removePropertyChangeListener, rename, setAssociatedFile, setBackgroundLayer, setColor, setFilterStateChanged, setName, setOpacity, setVisible, toggleVisible, toStringMethods inherited from class org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
addInvalidationListener, createMapViewPainter, invalidate, removeInvalidationListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.gui.layer.SaveToFile
isSavable
-
Field Details
-
supportedMapModes
-
data
-
imageChangeListeners
-
gpxData
-
gpxFauxLayer
-
gpxFauxData
-
gpxCorrelateAction
-
icon
-
selectedIcon
-
selectedIconNotImageViewer
-
useThumbs
boolean useThumbs -
thumbsLoaderExecutor
-
thumbsloader
-
thumbsLoaderRunning
-
thumbsLoaded
-
offscreenBuffer
-
updateOffscreenBuffer
-
mouseAdapter
-
mouseMotionAdapter
-
mapModeListener
-
activeLayerChangeListener
-
lastSelPos
Mouse position where the last image was selected. -
startPoint
The mouse point -
cycleModeArmed
Image cycle mode flag. It is possible that a mouse button release triggers multiple mouseReleased() events. To prevent the cycling in such a case we wait for the next mouse button press event before it is cycled to the next image.
-
Constructor Details
-
GeoImageLayer
Constructs a newGeoImageLayer.- Parameters:
data- The list of images to displaygpxLayer- The associated GPX layer
-
GeoImageLayer
Constructs a newGeoImageLayer.- Parameters:
data- The list of images to displaygpxLayer- The associated GPX layername- Layer name- Since:
- 6392
-
GeoImageLayer
Constructs a newGeoImageLayer.- Parameters:
data- The list of images to displaygpxLayer- The associated GPX layeruseThumbs- Thumbnail display flag- Since:
- 6392
-
GeoImageLayer
Constructs a newGeoImageLayer.- Parameters:
data- The list of images to displaygpxLayer- The associated GPX layername- Layer nameuseThumbs- Thumbnail display flag- Since:
- 6392
-
GeoImageLayer
Constructs a newGeoImageLayer.- Parameters:
data- The list of images to displaygpxData- The associated GPX dataname- Layer nameuseThumbs- Thumbnail display flag- Since:
- 18078
-
-
Method Details
-
generateSelectedIconNotImageViewer
-
create
Create a GeoImageLayer asynchronously- Parameters:
files- the list of image files to displaygpxLayer- the gpx layer
-
clearSelection
Description copied from interface:IGeoImageLayerClear the selection of the layer- Specified by:
clearSelectionin interfaceIGeoImageLayer
-
containsImage
Description copied from interface:IGeoImageLayerCheck if the layer contains the specified image- Specified by:
containsImagein interfaceIGeoImageLayer- Parameters:
imageEntry- The entry to look for- Returns:
trueif this layer contains the image
-
getIcon
Description copied from class:LayerReturn a representative small image for this layer. The image must not be larger than 64 pixel in any dimension. -
getSelection
Description copied from interface:IGeoImageLayerGet the current selection- Specified by:
getSelectionin interfaceIGeoImageLayer- Returns:
- The currently selected images
-
getInvalidGeoImages
Description copied from interface:IGeoImageLayerGet the invalid geo images for this layer (specifically, those that cannot be displayed on the map)- Specified by:
getInvalidGeoImagesin interfaceIGeoImageLayer- Returns:
- The list of invalid geo images
-
addImageChangeListener
Description copied from interface:IGeoImageLayerAdd a listener for when images change- Specified by:
addImageChangeListenerin interfaceIGeoImageLayer- Parameters:
listener- The listener to call
-
removeImageChangeListener
Description copied from interface:IGeoImageLayerRemove a listener for when images change- Specified by:
removeImageChangeListenerin interfaceIGeoImageLayer- Parameters:
listener- The listener to remove
-
registerMenuAddition
Register actions on the layer- Parameters:
addition- the action to be added
-
getMenuEntries
Description copied from class:LayerReturns list of actions. Action can implement LayerAction interface when it needs to be represented by other menu component than JMenuItem or when it supports multiple layers. Actions that support multiple layers should also have correct equals implementation.Use
Layer.SeparatorLayerAction.INSTANCEinstead of new JSeparator- Specified by:
getMenuEntriesin classLayer- Returns:
- menu actions for this layer
-
infoText
Prepare the string that is displayed if layer information is requested.- Returns:
- String with layer information
-
getInfoComponent
Description copied from class:LayerGets the layer information to display to the user. This is used if the user requests information about this layer. It should display a description of the layer content.- Specified by:
getInfoComponentin classLayer- Returns:
- Either a String or a
Componentdescribing the layer.
-
getToolTipText
Description copied from class:LayerReturns a small tooltip hint about some statistics for this layer.- Specified by:
getToolTipTextin classLayer- Returns:
- A small tooltip hint about some statistics for this layer.
-
isModified
Determines if data managed by this layer has been modified. That is the case if one image has modified GPS data.- Specified by:
isModifiedin classAbstractModifiableLayer- Returns:
trueif data has been modified;false, otherwise
-
isMergable
Description copied from class:LayerDetermines if the other layer can be merged into this layer.- Specified by:
isMergablein classLayer- Parameters:
other- The other layer that is tested to be mergable with this.- Returns:
- Whether the other layer can be merged into this layer.
-
mergeFrom
Description copied from class:LayerMerges the given layer into this layer. Throws if the layer types are incompatible. -
scaledDimension
-
paintImage
Paint one image.- Parameters:
e- Image to be paintedmv- Map viewclip- Bounding rectangle of the current clipping areatempG- Temporary offscreen buffer
-
paint
Description copied from interface:MapViewPaintablePaint the dataset using the engine set.- Specified by:
paintin interfaceMapViewPaintable- Parameters:
g- Graphicsmv- The object that can translate GeoPoints to screen coordinates.bounds- Bounding box
-
getImageDimension
-
drawDirectionArrow
-
drawDirectionArrow
protected static void drawDirectionArrow(Graphics2D g, Point p, double dir, Dimension imgDim, Color color) -
visitBoundingBox
Description copied from class:LayerVisits the content bounds of this layer. The behavior of this method depends on the layer, but each implementation should attempt to cover the relevant content of the layer in this method.- Specified by:
visitBoundingBoxin classLayer- Parameters:
v- The visitor that gets notified about the contents of this layer.
-
showCurrentPhoto
Show current photo on map and in image viewer. -
isPhotoIdxUnderMouse
Check if the position of the mouse event is within the rectangle of the photo icon or thumbnail.- Parameters:
idx- the image indexevt- Mouse event- Returns:
trueif the photo matches the mouse position,falseotherwise
-
getPhotoIdxUnderMouse
Returns index of the image that matches the position of the mouse event.- Parameters:
evt- Mouse eventcycle- Set totrueto cycle through the photos at the current mouse position if multiple icons or thumbnails overlap. If set tofalsethe topmost photo will be used.- Returns:
- Image index at mouse position, range 0 .. size-1,
or
-1if there is no image at the mouse position
-
getPhotoIdxUnderMouse
Returns index of the image that matches the position of the mouse event. The topmost photo is picked if multiple icons or thumbnails overlap.- Parameters:
evt- Mouse event- Returns:
- Image index at mouse position, range 0 .. size-1,
or
-1if there is no image at the mouse position
-
getPhotoUnderMouse
Returns the image that matches the position of the mouse event. The topmost photo is picked of multiple icons or thumbnails overlap.- Parameters:
evt- Mouse event- Returns:
- Image at mouse position, or
nullif there is no image at the mouse position - Since:
- 6392
-
registerSupportedMapMode
Registers a map mode for which the functionality of this layer should be available.- Parameters:
mapMode- Map mode to be registered- Since:
- 6392
-
isSupportedMapMode
Determines if the functionality of this layer is available in the specified map mode.SelectActionandSelectLassoActionare supported by default, other map modes can be registered.- Parameters:
mapMode- Map mode to be checked- Returns:
trueif the map mode is supported,falseotherwise
-
hookUpMapView
Description copied from class:LayerInitialization code, that depends on Main.map.mapView.It is always called in the event dispatching thread. Note that Main.map is null as long as no layer has been added, so do not execute code in the constructor, that assumes Main.map.mapView is not null.
If you need to execute code when this layer is added to the map view, use
AbstractMapViewPaintable.attachToMapView(org.openstreetmap.josm.gui.layer.MapViewPaintable.MapViewEvent)- Overrides:
hookUpMapViewin classLayer
-
destroy
Description copied from class:LayerCalled, when the layer is removed from the mapview and is going to be destroyed.This is because the Layer constructor cannot add itself safely as a listener to the layerlist dialog, because there may be no such dialog yet (loaded via command line parameter).
- Specified by:
destroyin interfaceDestroyable- Overrides:
destroyin classLayer
-
attachToMapView
Description copied from class:AbstractMapViewPaintableThis method is called whenever this layer is added to a map view.You need to return a painter here. The
MapViewPaintable.LayerPainter.detachFromMapView(org.openstreetmap.josm.gui.layer.MapViewPaintable.MapViewEvent)method is called when the layer is removed from that map view. You are free to reuse painters.You should always call the super method. See
AbstractMapViewPaintable.createMapViewPainter(org.openstreetmap.josm.gui.layer.MapViewPaintable.MapViewEvent)if you want to influence painter creation.This replaces
Layer.hookUpMapView()in the long run.- Overrides:
attachToMapViewin classAbstractMapViewPaintable- Parameters:
event- the event.- Returns:
- A layer painter.
-
zoomChanged
Description copied from interface:NavigatableComponent.ZoomChangeListenerMethod called when the zoom area has changed.- Specified by:
zoomChangedin interfaceNavigatableComponent.ZoomChangeListener
-
startLoadThumbs
Start to load thumbnails. -
stopLoadThumbs
Stop to load thumbnails.Can be called at any time to make sure that the thumbnail loader is stopped.
-
thumbsLoaded
Called to signal that the loading of thumbnails has finished.Usually called from
ThumbsLoaderin another thread. -
updateBufferAndRepaint
Marks the offscreen buffer to be updated. -
getImages
Get list of images in layer.- Returns:
- List of images in layer
-
getImageData
Returns the image data store being used by this layer- Returns:
- imageData
- Since:
- 14590
-
getGpxData
Returns the associated GPX data if any.- Returns:
- The associated GPX data or
null - Since:
- 18078
-
getGpxLayer
Returns the associated GPX layer if any.- Returns:
- The associated GPX layer or
null
-
getGpxCorrelateAction
Returns the gpxCorrelateAction- Returns:
- the gpxCorrelateAction
-
getFauxGpxLayer
Returns a faux GPX layer built from the images or the associated GPX layer.- Returns:
- A faux GPX layer or the associated GPX layer
- Since:
- 14802
-
getFauxGpxData
Returns a faux GPX data built from the images or the associated GPX layer data.- Returns:
- A faux GPX data or the associated GPX layer data
- Since:
- 18065
-
jumpToNextMarker
Description copied from interface:JumpToMarkerActions.JumpToMarkerLayerJump (move the viewport) to the next marker.- Specified by:
jumpToNextMarkerin interfaceJumpToMarkerActions.JumpToMarkerLayer
-
jumpToPreviousMarker
Description copied from interface:JumpToMarkerActions.JumpToMarkerLayerJump (move the viewport) to the previous marker.- Specified by:
jumpToPreviousMarkerin interfaceJumpToMarkerActions.JumpToMarkerLayer
-
isUseThumbs
Returns the current thumbnail display status.true: thumbnails are displayed,false: an icon is displayed instead of thumbnails.- Returns:
- Current thumbnail display status
- Since:
- 6392
-
setUseThumbs
Enables or disables the display of thumbnails. Does not update the display.- Parameters:
useThumbs- New thumbnail display status- Since:
- 6392
-
selectedImageChanged
Description copied from interface:ImageData.ImageDataUpdateListenerCalled when the selection change- Specified by:
selectedImageChangedin interfaceImageData.ImageDataUpdateListener- Parameters:
data- the image data
-
imageDataUpdated
Description copied from interface:ImageData.ImageDataUpdateListenerCalled when the data change- Specified by:
imageDataUpdatedin interfaceImageData.ImageDataUpdateListener- Parameters:
data- the image data
-
getChangesetSourceTag
Description copied from class:LayerGet the source for the layer- Overrides:
getChangesetSourceTagin classLayer- Returns:
- The string for the changeset source tag or
null
-
getData
Description copied from class:AbstractModifiableLayerGet the data for the modifiable layer- Overrides:
getDatain classAbstractModifiableLayer- Returns:
- The data object
-
applyTmp
void applyTmp() -
discardTmp
void discardTmp() -
getSortedImgList
Returns a list of images that fulfill the given criteria. Default setting is to return untagged images, but may be overwritten.- Parameters:
exif- also returns images with exif-gps infotagged- also returns tagged imagestimeSource- allows to use GPS Time or Camera RTC Time- Returns:
- matching images
- Since:
- 19455 gpsTime was added
-