Package org.openstreetmap.josm.gui.layer
Class ImageryLayer
- java.lang.Object
-
- org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
-
- org.openstreetmap.josm.gui.layer.Layer
-
- org.openstreetmap.josm.gui.layer.ImageryLayer
-
- All Implemented Interfaces:
ProjectionChangeListener
,MapViewPaintable
,Destroyable
- Direct Known Subclasses:
AbstractTileSourceLayer
public abstract class ImageryLayer extends Layer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ImageryLayer.ApplyOffsetAction
class
ImageryLayer.OffsetAction
Create an offset for an imagery layerstatic interface
ImageryLayer.OffsetMenuEntry
An additional menu entry in the imagery offset menu.-
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.Layer
Layer.LayerAction, Layer.LayerGpxExportAction, Layer.LayerSaveAction, Layer.LayerSaveAsAction, Layer.MultiLayerAction, Layer.SeparatorLayerAction
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
AbstractMapViewPaintable.CompatibilityModeLayerPainter
-
Nested classes/interfaces inherited from interface org.openstreetmap.josm.gui.layer.MapViewPaintable
MapViewPaintable.LayerPainter, MapViewPaintable.MapViewEvent, MapViewPaintable.PaintableInvalidationEvent, MapViewPaintable.PaintableInvalidationListener
-
-
Field Summary
Fields Modifier and Type Field Description private ImageryFilterSettings
filterSettings
protected javax.swing.Icon
icon
private java.util.List<ImageProcessor>
imageProcessors
protected ImageryInfo
info
static IntegerProperty
PROP_SHARPEN_LEVEL
The default value for the sharpen filter for each imagery layer.-
Fields inherited from class org.openstreetmap.josm.gui.layer.Layer
FILTER_STATE_PROP, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ImageryLayer(ImageryInfo info)
Constructs a newImageryLayer
.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
addImageProcessor(ImageProcessor processor)
This method adds theImageProcessor
to this Layer if it is notnull
.java.awt.image.BufferedImage
applyImageProcessors(java.awt.image.BufferedImage img)
Applies all the chosenImageProcessor
s to the imagestatic ImageryLayer
create(ImageryInfo info)
Create a new imagery layerstatic ImageProcessor
createImageProcessor(java.awt.image.BufferedImageOp op, boolean inPlace)
Wraps aBufferedImageOp
to be used asImageProcessor
.protected javax.swing.JComponent
createTextField(java.lang.String text)
protected abstract javax.swing.Action
getAdjustAction()
java.lang.String
getChangesetSourceTag()
Get the source for the layerImageryFilterSettings
getFilterSettings()
Gets the settings for the filter that is applied to this layer.javax.swing.Icon
getIcon()
Return a representative small image for this layer.java.util.List<ImageProcessor>
getImageProcessors()
This method gets allImageProcessor
s of the layerImageryInfo
getInfo()
Returns imagery info.java.lang.Object
getInfoComponent()
Gets the layer information to display to the user.protected abstract java.util.List<ImageryLayer.OffsetMenuEntry>
getOffsetMenuEntries()
javax.swing.JMenuItem
getOffsetMenuItem()
Create the menu item that should be added to the offset menu.javax.swing.JComponent
getOffsetMenuItem(javax.swing.JComponent subMenu)
Create the submenu or the menu item to set the offset of the layer.double
getPPD()
boolean
isMergable(Layer other)
Determines if the other layer can be merged into this layer.void
mergeFrom(Layer from)
Merges the given layer into this layer.boolean
removeImageProcessor(ImageProcessor processor)
This method removes givenImageProcessor
from this layerjava.lang.String
toString()
-
Methods inherited from class org.openstreetmap.josm.gui.layer.Layer
addPropertyChangeListener, checkSaveConditions, createAndOpenSaveFileChooser, destroy, fireFilterStateChanged, fireOpacityChanged, fireVisibleChanged, getAssociatedFile, getColor, getDefaultLayerPosition, getLabel, getMenuEntries, getName, getOpacity, getToolTipText, getViewProjectionBounds, hasColor, hookUpMapView, isBackgroundLayer, isInfoResizable, isProjectionSupported, isRenamed, isSavable, isVisible, nameSupportedProjections, onPostLoadFromFile, projectionChanged, removePropertyChangeListener, rename, setAssociatedFile, setBackgroundLayer, setColor, setFilterStateChanged, setName, setOpacity, setVisible, toggleVisible, visitBoundingBox
-
Methods inherited from class org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
addInvalidationListener, attachToMapView, createMapViewPainter, invalidate, removeInvalidationListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.gui.layer.MapViewPaintable
paint
-
-
-
-
Field Detail
-
PROP_SHARPEN_LEVEL
public static final IntegerProperty PROP_SHARPEN_LEVEL
The default value for the sharpen filter for each imagery layer.
-
imageProcessors
private final java.util.List<ImageProcessor> imageProcessors
-
info
protected final ImageryInfo info
-
icon
protected javax.swing.Icon icon
-
filterSettings
private final ImageryFilterSettings filterSettings
-
-
Constructor Detail
-
ImageryLayer
protected ImageryLayer(ImageryInfo info)
Constructs a newImageryLayer
.- Parameters:
info
- imagery info
-
-
Method Detail
-
getPPD
public double getPPD()
-
getInfo
public ImageryInfo getInfo()
Returns imagery info.- Returns:
- imagery info
-
getIcon
public javax.swing.Icon getIcon()
Description copied from class:Layer
Return a representative small image for this layer. The image must not be larger than 64 pixel in any dimension.
-
isMergable
public boolean isMergable(Layer other)
Description copied from class:Layer
Determines if the other layer can be merged into this layer.- Specified by:
isMergable
in 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
public void mergeFrom(Layer from)
Description copied from class:Layer
Merges the given layer into this layer. Throws if the layer types are incompatible.
-
getInfoComponent
public java.lang.Object getInfoComponent()
Description copied from class:Layer
Gets 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:
getInfoComponent
in classLayer
- Returns:
- Either a String or a
Component
describing the layer.
-
createTextField
protected javax.swing.JComponent createTextField(java.lang.String text)
-
create
public static ImageryLayer create(ImageryInfo info)
Create a new imagery layer- Parameters:
info
- The imagery info to use as base- Returns:
- The created layer
-
getOffsetMenuItem
public javax.swing.JMenuItem getOffsetMenuItem()
Create the menu item that should be added to the offset menu. It may have a sub menu of e.g. bookmarks added to it.- Returns:
- The menu item to add to the imagery menu.
-
getOffsetMenuItem
public javax.swing.JComponent getOffsetMenuItem(javax.swing.JComponent subMenu)
Create the submenu or the menu item to set the offset of the layer.If only one menu item for this layer exists, it is returned by this method.
If there are multiple, this method appends them to the subMenu and then returns the reference to the subMenu.
- Parameters:
subMenu
- The subMenu to use- Returns:
- A single menu item to adjust the layer or the passed subMenu to which the menu items were appended.
-
getAdjustAction
protected abstract javax.swing.Action getAdjustAction()
-
getOffsetMenuEntries
protected abstract java.util.List<ImageryLayer.OffsetMenuEntry> getOffsetMenuEntries()
-
getFilterSettings
public ImageryFilterSettings getFilterSettings()
Gets the settings for the filter that is applied to this layer.- Returns:
- The filter settings.
- Since:
- 10547
-
addImageProcessor
public boolean addImageProcessor(ImageProcessor processor)
This method adds theImageProcessor
to this Layer if it is notnull
.- Parameters:
processor
- that processes the image- Returns:
- true if processor was added, false otherwise
-
removeImageProcessor
public boolean removeImageProcessor(ImageProcessor processor)
This method removes givenImageProcessor
from this layer- Parameters:
processor
- which is needed to be removed- Returns:
- true if processor was removed
-
createImageProcessor
public static ImageProcessor createImageProcessor(java.awt.image.BufferedImageOp op, boolean inPlace)
Wraps aBufferedImageOp
to be used asImageProcessor
.- Parameters:
op
- theBufferedImageOp
inPlace
- true to apply filter in place, i.e., not create a newBufferedImage
for the result (theop
needs to support this!)- Returns:
- the
ImageProcessor
wrapper
-
getImageProcessors
public java.util.List<ImageProcessor> getImageProcessors()
This method gets allImageProcessor
s of the layer- Returns:
- list of image processors without removed one
-
applyImageProcessors
public java.awt.image.BufferedImage applyImageProcessors(java.awt.image.BufferedImage img)
Applies all the chosenImageProcessor
s to the image- Parameters:
img
- - image which should be changed- Returns:
- the new changed image
-
getChangesetSourceTag
public java.lang.String getChangesetSourceTag()
Description copied from class:Layer
Get the source for the layer- Overrides:
getChangesetSourceTag
in classLayer
- Returns:
- The string for the changeset source tag or
null
-
-