public class RasterImageLayer extends AbstractLayerable implements ObjectContainingMetaInformation
Modifier and Type | Field and Description |
---|---|
protected static long |
availRAM |
protected static Blackboard |
blackboard |
protected static java.lang.String |
BLACKBOARD_KEY_PLUGINCONTEXT |
protected static java.lang.String |
BLACKBOARD_KEY_WORKBENCHCONTEXT |
protected com.vividsolutions.jts.geom.Envelope |
envelope |
protected boolean |
firingAppearanceEvents
Flag to decide, if events are fired automatically, if the appearance (envelope, etc.) changes.
|
protected static double |
freeRamFactor |
protected javax.media.jai.PlanarImage |
image |
protected java.lang.String |
imageFileName |
protected java.awt.Rectangle |
imagePart |
protected javax.media.jai.PlanarImage |
imageProcessingStep1 |
protected javax.media.jai.PlanarImage |
imageProcessingStep2 |
protected boolean |
imageSet |
protected int |
lastImgProcessingMode |
protected static int |
maxPixelsForFastDisplayMode |
protected MetaDataMap |
metaInformation |
protected static double |
minRamToKeepFree |
protected static int |
MODE_CLIPPINGFIRST |
protected static int |
MODE_FASTDISPLAY |
protected static int |
MODE_NONE |
protected static int |
MODE_SCALINGFIRST |
protected boolean |
needToKeepImage
Flag to control if the image should be deleted from RAM as soon as possible to save RAM or if it should be keeped e.g. because it was generated
dynamically and can not be loaded from a file again, once it was deleted.
|
protected static double |
noDataValue |
protected static java.awt.Point |
nullpunkt |
protected java.awt.Rectangle |
oldImagePart |
protected double |
oldScaleXImg2Canvas |
protected int |
origImageHeight |
protected int |
origImageWidth |
protected java.awt.image.Raster |
rasterData |
protected boolean |
rasterDataChanged |
protected double |
scaleXImg2Canvas |
protected double |
scaleYImg2Canvas |
protected boolean |
transparencyColorNeedsToBeApplied |
protected double |
transparencyLevel |
protected java.awt.Color |
transparentColor |
protected com.vividsolutions.jts.geom.Envelope |
visibleEnv |
protected java.awt.Rectangle |
visibleRect |
protected boolean |
wasScaledForDisplay |
protected int |
xOffset |
protected int |
yOffset |
Constructor and Description |
---|
RasterImageLayer()
for java2xml
|
RasterImageLayer(java.lang.String name,
LayerManager layerManager,
java.awt.image.RenderedImage imageToDisplay,
java.awt.image.Raster newRaster,
com.vividsolutions.jts.geom.Envelope envelope)
Constructor to be used in case the image was not loaded from a file, so there is
no file name, but an image
|
RasterImageLayer(java.lang.String name,
LayerManager layerManager,
java.lang.String imageFileName,
java.awt.image.RenderedImage imageToDisplay,
java.awt.image.Raster newRaster,
com.vividsolutions.jts.geom.Envelope envelope) |
Modifier and Type | Method and Description |
---|---|
boolean |
clearImageAndRaster(boolean garbageCollect)
deletes image from RAM (if it is not to be kept and if the RAM consumption is high)
and calls the garbage collector, if the
garbageCollect is true. |
java.lang.Object |
clone() |
java.awt.image.BufferedImage |
createImage(LayerViewPanel layerViewPanel)
Creates the image to draw
|
protected javax.media.jai.PlanarImage |
createOneColorImage() |
void |
dispose() |
protected void |
finalize() |
void |
flushImages(boolean garbageCollect)
flushes all images from the RAM.
|
protected void |
forceTotalRepaint()
After this method was invoked, the image will be
completely re-rendered (not using caches) the next time.
|
static long |
getAvailRAM() |
Blackboard |
getBlackboard() |
java.awt.Rectangle |
getDrawingRectangle(double imgWidth,
double imgHeight,
com.vividsolutions.jts.geom.Envelope imageEnv,
Viewport viewport) |
com.vividsolutions.jts.geom.Envelope |
getEnvelope() |
com.vividsolutions.jts.geom.Polygon |
getEnvelopeAsGeometry()
Method to change the coordinates of the image and later apply the
changes to the RasterImageLayer by using
setGeometryAsEnvelope(Geometry) . |
static double |
getFreeRamFactor() |
static java.awt.Point |
getImageDimensions(WorkbenchContext context,
java.lang.String filenameOrURL)
Returns the dimensions (width and height in px) of the image as a
Point object. |
java.lang.String |
getImageFileName() |
javax.media.jai.PlanarImage |
getImageForDisplay()
returns the image, this can be modified - i.e. is just a representation.
|
static int |
getMaxPixelsForFastDisplayMode() |
MetaDataMap |
getMetaInformation() |
static double |
getMinRamToKeepFree() |
double |
getNoDataValue()
Default value is NaN.
|
int |
getNumBands()
TODO: sstein test - 25.Sept.2013
|
int |
getOrigImageHeight() |
int |
getOrigImageWidth() |
java.awt.image.Raster |
getRasterData()
the original raster data values.
|
protected javax.media.jai.PlanarImage |
getScaledImageMatchingVisible(javax.media.jai.PlanarImage toBeScaled,
double XscaleImg2Canvas,
double YscaleImg2Canvas) |
java.awt.image.BufferedImage |
getTileAsImage(com.vividsolutions.jts.geom.Envelope wantedEnvelope) |
java.awt.image.Raster |
getTileAsRaster(com.vividsolutions.jts.geom.Envelope wantedEnvelope) |
double |
getTransparencyLevel()
Returns the transparency level of the image.
|
java.awt.Color |
getTransparentColor()
Gets the color which will be drawn with a zero opacity in the Jump map
|
java.lang.String |
getTransparentColorAsString()
for java2xml
|
protected java.awt.Rectangle |
getVisibleImageCoordinatesOfImage(double imgWidth,
double imgHeight,
com.vividsolutions.jts.geom.Envelope visible,
com.vividsolutions.jts.geom.Envelope imageEnv) |
protected java.awt.Rectangle |
getVisibleImageCoordinatesOfImage(javax.media.jai.PlanarImage img,
com.vividsolutions.jts.geom.Envelope visible,
com.vividsolutions.jts.geom.Envelope imageEnv) |
protected javax.media.jai.PlanarImage |
getVisiblePartOfTheImage(javax.media.jai.PlanarImage img,
java.awt.Rectangle desiredImageArea) |
protected WorkbenchContext |
getWorkbenchContext() |
java.lang.String |
getXmlEnvelope()
for java2xml
|
int |
getXOffset() |
int |
getYOffset() |
boolean |
isFiringAppearanceEvents() |
boolean |
isImageNull() |
boolean |
isImageSet() |
boolean |
isNeedToKeepImage()
check, if image will be keeped in RAM or if it will be reloaded from a file
if needed
|
boolean |
isRasterDataChanged() |
javax.media.jai.PlanarImage |
loadImage(WorkbenchContext context,
java.lang.String filenameOrURL) |
static java.awt.image.BufferedImage |
makeBufferedImage(java.awt.Image im)
creates a BufferedImage out of an Image
|
void |
reLoadImage() |
void |
reLoadImageButKeepImageForDisplay()
use this to assign the raster data again
the method is called from getRasterData();
|
protected javax.media.jai.PlanarImage |
scaleImage(javax.media.jai.PlanarImage im,
float xScale,
float yScale)
apply a scale operation to the image and return the
new image.
|
void |
setEnvelope(com.vividsolutions.jts.geom.Envelope envelope)
Sets the Envelope object containing the real world coordinates (e.g.
|
void |
setFiringAppearanceEvents(boolean firingAppearanceEvents) |
static void |
setFreeRamFactor(double freeRamFactor) |
void |
setGeometryAsEnvelope(com.vividsolutions.jts.geom.Geometry geometry)
Method to set the coordinates of the image, e.g. after changing them after using
getEnvelopeAsGeometry() . |
void |
setImage(javax.media.jai.PlanarImage image)
Sets the image that will be shown in the map (also sets some interally used flags)
|
void |
setImageFileName(java.lang.String imageFileName)
Sets the image's files name (if image is not to be keeped) - this needs to be set!
|
void |
setImageSet(boolean imageSet) |
void |
setMetaInformation(MetaDataMap metaInformation) |
void |
setNeedToKeepImage(boolean needToKeepImage)
toogle, if image will be keeped in RAM or if it will be reloaded from a file
if needed
|
void |
setOrigImageHeight(int origImageHeight)
for java2xml
|
void |
setOrigImageWidth(int origImageWidth)
for java2xml
|
void |
setRasterData(java.awt.image.Raster newRaster)
to set the Raster data, use also setImage()
|
void |
setRasterDataChanged(boolean rasterDataChanged) |
void |
setTransparencyLevel(double transparencyLevel)
Sets the transparency level of the image.
|
void |
setTransparencyLevelInPercent(int transparencyInPercent)
Sets the transparency level of the image.
|
void |
setTransparentColor(java.awt.Color transparentColor)
Sets the color which will be drawn with a zero opacity in the Jump map
|
void |
setTransparentColorAsString(java.lang.String hexColorString)
for java2xml
|
void |
setVisible(boolean visible)
shows or hides the image in the Jump map
|
static void |
setWorkbenchContext(WorkbenchContext wContext) |
void |
setXmlEnvelope(java.lang.String envStr)
for java2xml
|
fireAppearanceChanged, fireLayerChanged, getLayerManager, getMaxScale, getMinScale, getName, getTask, isScaleDependentRenderingEnabled, isVisible, setLayerManager, setMaxScale, setMinScale, setName, setScaleDependentRenderingEnabled, toString
protected static Blackboard blackboard
protected static final java.lang.String BLACKBOARD_KEY_PLUGINCONTEXT
protected static final java.lang.String BLACKBOARD_KEY_WORKBENCHCONTEXT
protected int lastImgProcessingMode
protected static final int MODE_NONE
protected static final int MODE_SCALINGFIRST
protected static final int MODE_CLIPPINGFIRST
protected static final int MODE_FASTDISPLAY
protected java.awt.Rectangle imagePart
protected java.awt.Rectangle oldImagePart
protected java.awt.Rectangle visibleRect
protected double scaleXImg2Canvas
protected double oldScaleXImg2Canvas
protected double scaleYImg2Canvas
protected int xOffset
protected int yOffset
protected double transparencyLevel
protected static long availRAM
protected static double freeRamFactor
protected static double minRamToKeepFree
protected static int maxPixelsForFastDisplayMode
protected java.lang.String imageFileName
protected int origImageWidth
protected int origImageHeight
protected boolean imageSet
protected javax.media.jai.PlanarImage image
protected java.awt.image.Raster rasterData
protected boolean rasterDataChanged
protected boolean wasScaledForDisplay
protected javax.media.jai.PlanarImage imageProcessingStep1
protected javax.media.jai.PlanarImage imageProcessingStep2
protected com.vividsolutions.jts.geom.Envelope envelope
protected com.vividsolutions.jts.geom.Envelope visibleEnv
protected boolean firingAppearanceEvents
protected boolean needToKeepImage
protected static final java.awt.Point nullpunkt
protected java.awt.Color transparentColor
protected boolean transparencyColorNeedsToBeApplied
protected static double noDataValue
protected MetaDataMap metaInformation
public RasterImageLayer()
public RasterImageLayer(java.lang.String name, LayerManager layerManager, java.lang.String imageFileName, java.awt.image.RenderedImage imageToDisplay, java.awt.image.Raster newRaster, com.vividsolutions.jts.geom.Envelope envelope)
name
- name of the layerlayerManager
- imageToDisplay
- the image (if already loaded) or nullnewRaster
- the raster (if already loaded) or nullenvelope
- real-world coordinates of the imagepublic RasterImageLayer(java.lang.String name, LayerManager layerManager, java.awt.image.RenderedImage imageToDisplay, java.awt.image.Raster newRaster, com.vividsolutions.jts.geom.Envelope envelope)
name
- name of the layerlayerManager
- imageToDisplay
- the image (if already loaded) or nullnewRaster
- the raster (if already loaded) or nullenvelope
- real-world coordinates of the imagepublic Blackboard getBlackboard()
getBlackboard
in interface Layerable
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
protected javax.media.jai.PlanarImage scaleImage(javax.media.jai.PlanarImage im, float xScale, float yScale)
protected javax.media.jai.PlanarImage createOneColorImage()
public java.awt.image.BufferedImage createImage(LayerViewPanel layerViewPanel)
public boolean clearImageAndRaster(boolean garbageCollect)
garbageCollect
is true.garbageCollect
- if true the garbage collector will be called (this parameter may be overridden, if there is not enough RAM available...)public void flushImages(boolean garbageCollect)
garbageCollect
- if true the garbage collector will be called (this parameter may be overridden, if there is not enough RAM available...)public void reLoadImage()
public void reLoadImageButKeepImageForDisplay()
public static java.awt.Point getImageDimensions(WorkbenchContext context, java.lang.String filenameOrURL)
Point
object.
The clue is that only the image file's header is read to get this information, so it's quite
fast, because the image was not entirely read.context
- the WorkbenchContextfilenameOrURL
- the image file's name or URLpublic final javax.media.jai.PlanarImage loadImage(WorkbenchContext context, java.lang.String filenameOrURL)
public com.vividsolutions.jts.geom.Envelope getEnvelope()
public void setEnvelope(com.vividsolutions.jts.geom.Envelope envelope)
envelope
- the Envelopepublic java.lang.String getXmlEnvelope()
public void setXmlEnvelope(java.lang.String envStr)
envStr
- the Envelope as stringpublic com.vividsolutions.jts.geom.Polygon getEnvelopeAsGeometry()
setGeometryAsEnvelope(Geometry)
.public void setGeometryAsEnvelope(com.vividsolutions.jts.geom.Geometry geometry)
getEnvelopeAsGeometry()
.public static final java.awt.image.BufferedImage makeBufferedImage(java.awt.Image im)
im
- the Imageprotected javax.media.jai.PlanarImage getScaledImageMatchingVisible(javax.media.jai.PlanarImage toBeScaled, double XscaleImg2Canvas, double YscaleImg2Canvas)
public java.awt.image.BufferedImage getTileAsImage(com.vividsolutions.jts.geom.Envelope wantedEnvelope)
public java.awt.image.Raster getTileAsRaster(com.vividsolutions.jts.geom.Envelope wantedEnvelope)
protected WorkbenchContext getWorkbenchContext()
public static void setWorkbenchContext(WorkbenchContext wContext)
public java.awt.Rectangle getDrawingRectangle(double imgWidth, double imgHeight, com.vividsolutions.jts.geom.Envelope imageEnv, Viewport viewport) throws java.awt.geom.NoninvertibleTransformException
java.awt.geom.NoninvertibleTransformException
protected java.awt.Rectangle getVisibleImageCoordinatesOfImage(double imgWidth, double imgHeight, com.vividsolutions.jts.geom.Envelope visible, com.vividsolutions.jts.geom.Envelope imageEnv)
protected java.awt.Rectangle getVisibleImageCoordinatesOfImage(javax.media.jai.PlanarImage img, com.vividsolutions.jts.geom.Envelope visible, com.vividsolutions.jts.geom.Envelope imageEnv)
protected javax.media.jai.PlanarImage getVisiblePartOfTheImage(javax.media.jai.PlanarImage img, java.awt.Rectangle desiredImageArea)
public void setImage(javax.media.jai.PlanarImage image)
image
- image that will be shown in the mappublic void setImageSet(boolean imageSet)
public boolean isImageNull()
public javax.media.jai.PlanarImage getImageForDisplay()
public boolean isImageSet()
public double getTransparencyLevel()
public void setTransparencyLevel(double transparencyLevel)
transparencyLevel
- the transparency level of the imagepublic void setTransparencyLevelInPercent(int transparencyInPercent)
transparencyInPercent
- the transparency level of the imagepublic java.awt.Color getTransparentColor()
public java.lang.String getTransparentColorAsString()
public void setTransparentColorAsString(java.lang.String hexColorString)
public void setTransparentColor(java.awt.Color transparentColor)
transparentColor
- the color for transparencyprotected void forceTotalRepaint()
public int getXOffset()
(0,0)
) in x directionpublic int getYOffset()
(0,0)
) in y directionpublic static double getFreeRamFactor()
public static void setFreeRamFactor(double freeRamFactor)
public static long getAvailRAM()
public static int getMaxPixelsForFastDisplayMode()
public static double getMinRamToKeepFree()
public void setImageFileName(java.lang.String imageFileName)
imageFileName
- the file name of the imagepublic java.lang.String getImageFileName()
RasterImageLayer
public boolean isNeedToKeepImage()
public void setNeedToKeepImage(boolean needToKeepImage)
needToKeepImage
- true if image is supposed be keeped in RAM, else falseprotected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public int getOrigImageHeight()
public int getOrigImageWidth()
public void setOrigImageHeight(int origImageHeight)
origImageHeight
- public void setOrigImageWidth(int origImageWidth)
origImageWidth
- public void setVisible(boolean visible)
setVisible
in interface Layerable
setVisible
in class AbstractLayerable
visible
- public boolean isFiringAppearanceEvents()
firingAppearanceEvents
public void setFiringAppearanceEvents(boolean firingAppearanceEvents)
firingAppearanceEvents
- true if appearance events are to be fired automatically, false if notfiringAppearanceEvents
public MetaDataMap getMetaInformation()
getMetaInformation
in interface ObjectContainingMetaInformation
public void setMetaInformation(MetaDataMap metaInformation)
setMetaInformation
in interface ObjectContainingMetaInformation
public java.awt.image.Raster getRasterData()
public void setRasterData(java.awt.image.Raster newRaster)
newRaster
- public boolean isRasterDataChanged()
public void setRasterDataChanged(boolean rasterDataChanged)
rasterDataChanged
- the rasterDataChanged to setpublic double getNoDataValue()
public int getNumBands()
public void dispose()