public class GeoImageLayer extends AbstractModifiableLayer implements JumpToMarkerActions.JumpToMarkerLayer, NavigatableComponent.ZoomChangeListener, ImageData.ImageDataUpdateListener
| Modifier and Type | Class and Description |
|---|---|
private class |
GeoImageLayer.ImageMouseListener |
(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.SeparatorLayerActionAbstractMapViewPaintable.CompatibilityModeLayerPainterMapViewPaintable.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 java.awt.Point |
startPoint
The mouse point
|
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.
|
java.lang.String |
getChangesetSourceTag()
Get the source for the layer
|
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, unlockaddPropertyChangeListener, checkSaveConditions, createAndOpenSaveFileChooser, fireFilterStateChanged, fireOpacityChanged, fireVisibleChanged, getAssociatedFile, getColor, getDefaultLayerPosition, getName, getOpacity, getViewProjectionBounds, hasColor, isBackgroundLayer, isInfoResizable, isProjectionSupported, isRenamed, isSavable, isVisible, nameSupportedProjections, onPostLoadFromFile, projectionChanged, removePropertyChangeListener, rename, setAssociatedFile, setBackgroundLayer, setColor, setFilterStateChanged, setName, setOpacity, setVisible, toggleVisible, toStringaddInvalidationListener, createMapViewPainter, invalidate, removeInvalidationListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisSavableprivate 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 java.awt.Point startPoint
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()
Layerpublic static void registerMenuAddition(javax.swing.Action addition)
addition - the action to be addedpublic javax.swing.Action[] getMenuEntries()
LayerLayer.SeparatorLayerAction.INSTANCE instead of new JSeparatorgetMenuEntries in class Layerprivate java.lang.String infoText()
public java.lang.Object getInfoComponent()
LayergetInfoComponent in class LayerComponent describing the layer.public java.lang.String getToolTipText()
getToolTipText in class Layerpublic boolean isModified()
isModified in class AbstractModifiableLayertrue if data has been modified; false, otherwisepublic boolean isMergable(Layer other)
isMergable in class Layerother - The other layer that is tested to be mergable with this.public void mergeFrom(Layer from)
Layerprivate 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)
MapViewPaintablepaint in interface MapViewPaintableg - Graphicsmv - The object that can translate GeoPoints to screen coordinates.bounds - Bounding boxpublic void visitBoundingBox(BoundingXYVisitor v)
LayervisitBoundingBox in class Layerv - 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 SelectLassoAction 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()
LayerAbstractMapViewPaintable.attachToMapView(org.openstreetmap.josm.gui.layer.MapViewPaintable.MapViewEvent)hookUpMapView in class Layerpublic void destroy()
Layerdestroy in interface Destroyabledestroy in class Layerpublic 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 AbstractMapViewPaintableevent - the event.public void zoomChanged()
NavigatableComponent.ZoomChangeListenerzoomChanged in interface NavigatableComponent.ZoomChangeListenerpublic 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.JumpToMarkerLayerjumpToNextMarker in interface JumpToMarkerActions.JumpToMarkerLayerpublic void jumpToPreviousMarker()
JumpToMarkerActions.JumpToMarkerLayerjumpToPreviousMarker in interface JumpToMarkerActions.JumpToMarkerLayerpublic 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.ImageDataUpdateListenerselectedImageChanged in interface ImageData.ImageDataUpdateListenerdata - the image datapublic void imageDataUpdated(ImageData data)
ImageData.ImageDataUpdateListenerimageDataUpdated in interface ImageData.ImageDataUpdateListenerdata - the image datapublic java.lang.String getChangesetSourceTag()
LayergetChangesetSourceTag in class Layernull