public class GeoImageLayer extends AbstractModifiableLayer implements JumpToMarkerActions.JumpToMarkerLayer, NavigatableComponent.ZoomChangeListener, ImageData.ImageDataUpdateListener
Modifier and Type | Class and Description |
---|---|
(package private) static class |
GeoImageLayer.Loader
Loads a set of images, while displaying a dialog that indicates what the plugin is currently doing.
|
Layer.LayerAction, Layer.LayerGpxExportAction, Layer.LayerSaveAction, Layer.LayerSaveAsAction, Layer.MultiLayerAction, Layer.SeparatorLayerAction
AbstractMapViewPaintable.CompatibilityModeLayerPainter
MapViewPaintable.LayerPainter, MapViewPaintable.MapViewEvent, MapViewPaintable.PaintableInvalidationEvent, MapViewPaintable.PaintableInvalidationListener
Modifier and Type | Field and Description |
---|---|
private MainLayerManager.ActiveLayerChangeListener |
activeLayerChangeListener |
private boolean |
cycleModeArmed
Image cycle mode flag.
|
private ImageData |
data |
(package private) GpxLayer |
gpxFauxLayer |
(package private) GpxLayer |
gpxLayer |
private javax.swing.Icon |
icon |
private java.awt.Point |
lastSelPos
Mouse position where the last image was selected.
|
private MapFrame.MapModeChangeListener |
mapModeListener |
private static java.util.List<javax.swing.Action> |
menuAdditions |
private java.awt.event.MouseAdapter |
mouseAdapter |
private java.awt.event.MouseMotionAdapter |
mouseMotionAdapter |
private java.awt.image.BufferedImage |
offscreenBuffer |
private javax.swing.Icon |
selectedIcon |
private static java.util.List<MapMode> |
supportedMapModes |
(package private) boolean |
thumbsLoaded |
private ThumbsLoader |
thumbsloader |
private java.util.concurrent.ExecutorService |
thumbsLoaderExecutor |
private boolean |
thumbsLoaderRunning |
private boolean |
updateOffscreenBuffer |
(package private) boolean |
useThumbs |
FILTER_STATE_PROP, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP
Constructor and Description |
---|
GeoImageLayer(java.util.List<ImageEntry> data,
GpxLayer gpxLayer)
Constructs a new
GeoImageLayer . |
GeoImageLayer(java.util.List<ImageEntry> data,
GpxLayer gpxLayer,
boolean useThumbs)
Constructs a new
GeoImageLayer . |
GeoImageLayer(java.util.List<ImageEntry> data,
GpxLayer gpxLayer,
java.lang.String name)
Constructs a new
GeoImageLayer . |
GeoImageLayer(java.util.List<ImageEntry> data,
GpxLayer gpxLayer,
java.lang.String name,
boolean useThumbs)
Constructs a new
GeoImageLayer . |
Modifier and Type | Method and Description |
---|---|
MapViewPaintable.LayerPainter |
attachToMapView(MapViewPaintable.MapViewEvent event)
This method is called whenever this layer is added to a map view.
|
private void |
clearOtherCurrentPhotos()
Clears the currentPhoto of the other GeoImageLayer's.
|
static void |
create(java.util.Collection<java.io.File> files,
GpxLayer gpxLayer)
Create a GeoImageLayer asynchronously
|
void |
destroy()
Called, when the layer is removed from the mapview and is going to be destroyed.
|
GpxLayer |
getFauxGpxLayer()
Returns a faux GPX layer built from the images or the associated GPX layer.
|
GpxLayer |
getGpxLayer()
Returns the associated GPX layer.
|
javax.swing.Icon |
getIcon()
Return a representative small image for this layer.
|
ImageData |
getImageData()
Returns the image data store being used by this layer
|
java.util.List<ImageEntry> |
getImages()
Get list of images in layer.
|
java.lang.Object |
getInfoComponent()
Gets the layer information to display to the user.
|
javax.swing.Action[] |
getMenuEntries()
Returns list of actions.
|
private int |
getPhotoIdxUnderMouse(java.awt.event.MouseEvent evt)
Returns index of the image that matches the position of the mouse event.
|
private int |
getPhotoIdxUnderMouse(java.awt.event.MouseEvent evt,
boolean cycle)
Returns index of the image that matches the position of the mouse event.
|
ImageEntry |
getPhotoUnderMouse(java.awt.event.MouseEvent evt)
Returns the image that matches the position of the mouse event.
|
java.lang.String |
getToolTipText() |
void |
hookUpMapView()
Initialization code, that depends on Main.map.mapView.
|
void |
imageDataUpdated(ImageData data)
Called when the data change
|
private java.lang.String |
infoText()
Prepare the string that is displayed if layer information is requested.
|
boolean |
isMergable(Layer other) |
boolean |
isModified()
Determines if data managed by this layer has been modified.
|
private boolean |
isPhotoIdxUnderMouse(int idx,
java.awt.event.MouseEvent evt)
Check if the position of the mouse event is within the rectangle of the photo icon or thumbnail.
|
private static boolean |
isSupportedMapMode(MapMode mapMode)
Determines if the functionality of this layer is available in
the specified map mode.
|
boolean |
isUseThumbs()
Returns the current thumbnail display status.
|
void |
jumpToNextMarker()
Jump (move the viewport) to the next marker.
|
void |
jumpToPreviousMarker()
Jump (move the viewport) to the previous marker.
|
void |
mergeFrom(Layer from)
Merges the given layer into this layer.
|
void |
paint(java.awt.Graphics2D g,
MapView mv,
Bounds bounds)
Paint the dataset using the engine set.
|
private void |
paintImage(ImageEntry e,
MapView mv,
java.awt.Rectangle clip,
java.awt.Graphics2D tempG)
Paint one image.
|
static void |
registerMenuAddition(javax.swing.Action addition)
Register actions on the layer
|
static void |
registerSupportedMapMode(MapMode mapMode)
Registers a map mode for which the functionality of this layer should be available.
|
private static java.awt.Dimension |
scaledDimension(java.awt.Image thumb) |
void |
selectedImageChanged(ImageData data)
Called when the selection change
|
void |
setUseThumbs(boolean useThumbs)
Enables or disables the display of thumbnails.
|
void |
showCurrentPhoto()
Show current photo on map and in image viewer.
|
void |
startLoadThumbs()
Start to load thumbnails.
|
void |
stopLoadThumbs()
Stop to load thumbnails.
|
void |
thumbsLoaded()
Called to signal that the loading of thumbnails has finished.
|
void |
updateBufferAndRepaint()
Marks the offscreen buffer to be updated.
|
void |
visitBoundingBox(BoundingXYVisitor v)
Visits the content bounds of this layer.
|
void |
zoomChanged()
Method called when the zoom area has changed.
|
createUploadTask, getUploadDialog, isDownloadable, isLocked, isUploadable, isUploadDiscouraged, isUploadInProgress, lock, onPostSaveToFile, onPostUploadToServer, requiresSaveToFile, requiresUploadToServer, unlock
addPropertyChangeListener, checkSaveConditions, createAndOpenSaveFileChooser, fireFilterStateChanged, fireOpacityChanged, fireVisibleChanged, getAssociatedFile, getBaseColorProperty, getColorProperty, getDefaultLayerPosition, getName, getOpacity, getViewProjectionBounds, isBackgroundLayer, isInfoResizable, isProjectionSupported, isRenamed, isSavable, isVisible, nameSupportedProjections, onPostLoadFromFile, projectionChanged, removePropertyChangeListener, rename, setAssociatedFile, setBackgroundLayer, setFilterStateChanged, setName, setOpacity, setVisible, toggleVisible, toString
addInvalidationListener, createMapViewPainter, invalidate, removeInvalidationListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isSavable
private static java.util.List<javax.swing.Action> menuAdditions
private static volatile java.util.List<MapMode> supportedMapModes
GpxLayer gpxFauxLayer
private final javax.swing.Icon icon
private final javax.swing.Icon selectedIcon
boolean useThumbs
private final java.util.concurrent.ExecutorService thumbsLoaderExecutor
private ThumbsLoader thumbsloader
private boolean thumbsLoaderRunning
volatile boolean thumbsLoaded
private java.awt.image.BufferedImage offscreenBuffer
private boolean updateOffscreenBuffer
private java.awt.event.MouseAdapter mouseAdapter
private java.awt.event.MouseMotionAdapter mouseMotionAdapter
private MapFrame.MapModeChangeListener mapModeListener
private MainLayerManager.ActiveLayerChangeListener activeLayerChangeListener
private java.awt.Point lastSelPos
private boolean cycleModeArmed
public GeoImageLayer(java.util.List<ImageEntry> data, GpxLayer gpxLayer)
GeoImageLayer
.data
- The list of images to displaygpxLayer
- The associated GPX layerpublic GeoImageLayer(java.util.List<ImageEntry> data, GpxLayer gpxLayer, java.lang.String name)
GeoImageLayer
.data
- The list of images to displaygpxLayer
- The associated GPX layername
- Layer namepublic GeoImageLayer(java.util.List<ImageEntry> data, GpxLayer gpxLayer, boolean useThumbs)
GeoImageLayer
.data
- The list of images to displaygpxLayer
- The associated GPX layeruseThumbs
- Thumbnail display flagpublic GeoImageLayer(java.util.List<ImageEntry> data, GpxLayer gpxLayer, java.lang.String name, boolean useThumbs)
GeoImageLayer
.data
- The list of images to displaygpxLayer
- The associated GPX layername
- Layer nameuseThumbs
- Thumbnail display flagpublic static void create(java.util.Collection<java.io.File> files, GpxLayer gpxLayer)
files
- the list of image files to displaygpxLayer
- the gpx layerpublic javax.swing.Icon getIcon()
Layer
public static void registerMenuAddition(javax.swing.Action addition)
addition
- the action to be addedpublic javax.swing.Action[] getMenuEntries()
Layer
Layer.SeparatorLayerAction.INSTANCE
instead of new JSeparatorgetMenuEntries
in class Layer
private java.lang.String infoText()
public java.lang.Object getInfoComponent()
Layer
getInfoComponent
in class Layer
Component
describing the layer.public java.lang.String getToolTipText()
getToolTipText
in class Layer
public boolean isModified()
isModified
in class AbstractModifiableLayer
true
if data has been modified; false
, otherwisepublic boolean isMergable(Layer other)
isMergable
in class Layer
other
- The other layer that is tested to be mergable with this.public void mergeFrom(Layer from)
Layer
private static java.awt.Dimension scaledDimension(java.awt.Image thumb)
private void paintImage(ImageEntry e, MapView mv, java.awt.Rectangle clip, java.awt.Graphics2D tempG)
e
- Image to be paintedmv
- Map viewclip
- Bounding rectangle of the current clipping areatempG
- Temporary offscreen bufferpublic void paint(java.awt.Graphics2D g, MapView mv, Bounds bounds)
MapViewPaintable
paint
in interface MapViewPaintable
g
- Graphicsmv
- The object that can translate GeoPoints to screen coordinates.bounds
- Bounding boxpublic void visitBoundingBox(BoundingXYVisitor v)
Layer
visitBoundingBox
in class Layer
v
- The visitor that gets notified about the contents of this layer.public void showCurrentPhoto()
private boolean isPhotoIdxUnderMouse(int idx, java.awt.event.MouseEvent evt)
idx
- the image indexevt
- Mouse eventtrue
if the photo matches the mouse position, false
otherwiseprivate int getPhotoIdxUnderMouse(java.awt.event.MouseEvent evt, boolean cycle)
evt
- Mouse eventcycle
- Set to true
to cycle through the photos at the
current mouse position if multiple icons or thumbnails overlap.
If set to false
the topmost photo will be used.-1
if there is no image at the mouse positionprivate int getPhotoIdxUnderMouse(java.awt.event.MouseEvent evt)
evt
- Mouse event-1
if there is no image at the mouse positionpublic ImageEntry getPhotoUnderMouse(java.awt.event.MouseEvent evt)
evt
- Mouse eventnull
if there is no image at the mouse positionprivate void clearOtherCurrentPhotos()
public static void registerSupportedMapMode(MapMode mapMode)
mapMode
- Map mode to be registeredprivate static boolean isSupportedMapMode(MapMode mapMode)
SelectAction
and LassoModeAction
are supported by default,
other map modes can be registered.mapMode
- Map mode to be checkedtrue
if the map mode is supported,
false
otherwisepublic void hookUpMapView()
Layer
AbstractMapViewPaintable.attachToMapView(org.openstreetmap.josm.gui.layer.MapViewPaintable.MapViewEvent)
hookUpMapView
in class Layer
public void destroy()
Layer
destroy
in interface Destroyable
destroy
in class Layer
public MapViewPaintable.LayerPainter attachToMapView(MapViewPaintable.MapViewEvent event)
AbstractMapViewPaintable
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.
attachToMapView
in class AbstractMapViewPaintable
event
- the event.public void zoomChanged()
NavigatableComponent.ZoomChangeListener
zoomChanged
in interface NavigatableComponent.ZoomChangeListener
public void startLoadThumbs()
public void stopLoadThumbs()
public void thumbsLoaded()
ThumbsLoader
in another thread.public void updateBufferAndRepaint()
public java.util.List<ImageEntry> getImages()
public ImageData getImageData()
public GpxLayer getGpxLayer()
public GpxLayer getFauxGpxLayer()
public void jumpToNextMarker()
JumpToMarkerActions.JumpToMarkerLayer
jumpToNextMarker
in interface JumpToMarkerActions.JumpToMarkerLayer
public void jumpToPreviousMarker()
JumpToMarkerActions.JumpToMarkerLayer
jumpToPreviousMarker
in interface JumpToMarkerActions.JumpToMarkerLayer
public boolean isUseThumbs()
true
: thumbnails are displayed, false
: an icon is displayed instead of thumbnails.public void setUseThumbs(boolean useThumbs)
useThumbs
- New thumbnail display statuspublic void selectedImageChanged(ImageData data)
ImageData.ImageDataUpdateListener
selectedImageChanged
in interface ImageData.ImageDataUpdateListener
data
- the image datapublic void imageDataUpdated(ImageData data)
ImageData.ImageDataUpdateListener
imageDataUpdated
in interface ImageData.ImageDataUpdateListener
data
- the image data