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 classImageryLayer.ApplyOffsetActionclassImageryLayer.OffsetActionCreate an offset for an imagery layerstatic interfaceImageryLayer.OffsetMenuEntryAn 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 ImageryFilterSettingsfilterSettingsprotected javax.swing.Iconiconprivate java.util.List<ImageProcessor>imageProcessorsprotected ImageryInfoinfostatic IntegerPropertyPROP_SHARPEN_LEVELThe 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 protectedImageryLayer(ImageryInfo info)Constructs a newImageryLayer.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanaddImageProcessor(ImageProcessor processor)This method adds theImageProcessorto this Layer if it is notnull.java.awt.image.BufferedImageapplyImageProcessors(java.awt.image.BufferedImage img)Applies all the chosenImageProcessors to the imagestatic ImageryLayercreate(ImageryInfo info)Create a new imagery layerstatic ImageProcessorcreateImageProcessor(java.awt.image.BufferedImageOp op, boolean inPlace)Wraps aBufferedImageOpto be used asImageProcessor.protected javax.swing.JComponentcreateTextField(java.lang.String text)protected abstract javax.swing.ActiongetAdjustAction()java.lang.StringgetChangesetSourceTag()Get the source for the layerImageryFilterSettingsgetFilterSettings()Gets the settings for the filter that is applied to this layer.javax.swing.IcongetIcon()Return a representative small image for this layer.java.util.List<ImageProcessor>getImageProcessors()This method gets allImageProcessors of the layerImageryInfogetInfo()Returns imagery info.java.lang.ObjectgetInfoComponent()Gets the layer information to display to the user.protected abstract java.util.List<ImageryLayer.OffsetMenuEntry>getOffsetMenuEntries()javax.swing.JMenuItemgetOffsetMenuItem()Create the menu item that should be added to the offset menu.javax.swing.JComponentgetOffsetMenuItem(javax.swing.JComponent subMenu)Create the submenu or the menu item to set the offset of the layer.doublegetPPD()booleanisMergable(Layer other)Determines if the other layer can be merged into this layer.voidmergeFrom(Layer from)Merges the given layer into this layer.booleanremoveImageProcessor(ImageProcessor processor)This method removes givenImageProcessorfrom this layerjava.lang.StringtoString()-
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:LayerReturn 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: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
public void mergeFrom(Layer from)
Description copied from class:LayerMerges the given layer into this layer. Throws if the layer types are incompatible.
-
getInfoComponent
public java.lang.Object 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.
-
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 theImageProcessorto 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 givenImageProcessorfrom 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 aBufferedImageOpto be used asImageProcessor.- Parameters:
op- theBufferedImageOpinPlace- true to apply filter in place, i.e., not create a newBufferedImagefor the result (theopneeds to support this!)- Returns:
- the
ImageProcessorwrapper
-
getImageProcessors
public java.util.List<ImageProcessor> getImageProcessors()
This method gets allImageProcessors 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 chosenImageProcessors 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:LayerGet the source for the layer- Overrides:
getChangesetSourceTagin classLayer- Returns:
- The string for the changeset source tag or
null
-
-