Class LayerSettingImage
- java.lang.Object
-
- com.supermap.mapping.LayerSetting
-
- com.supermap.mapping.LayerSettingImage
-
public class LayerSettingImage extends LayerSetting
Rhithers. Decision Rhitherges Rhithers. Rhitherite Rhithers. Rhitherite Rhitherd Rhithers. Rhither Rh.This class is mainly used to set the display style of the image layer, to obtain and set the image layer transparent background color, transparent color tolerance and whether to allow transparent features. Image layer corresponds to normal layer. It is style setting instance can be acquired from
Layer.getAdditionalSetting()
. You can also create a new object and set through theLayer.setAdditionalSetting(LayerSetting)
method. After modifying the layer display, you need to call the methodMap.refresh()
to refresh the map.
-
-
Constructor Summary
Constructors Constructor and Description LayerSettingImage()
Initializes a new instance of this LayerSettingImage class.LayerSettingImage(LayerSettingImage layerSettingImage)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
add(Datasource datasource, java.lang.String strSLDFilePath)
Add a layer to the layer collection through the SLD filejava.lang.String[]
getAllSubLayers()
Gets the collection of all layers and return the string array.int
getCacheMaxSize()
Gets the maximum number of buffers for the layerint[]
getDisplayBandIndexes()
Gets the band index of the current image layerColorSpaceType
getDisplayColorSpace()
Gets the color display mode of the image layerImageDisplayMode
getDisplayMode()
Returns the image display modeImageStretchOption
getImageStretchOption()
Get image stretch parameters If there is a color table, and the number of color table is not 0, will use the color table to display the image, then the drawing method does not work, If there is no color table or the number is 0, support the stretch display.java.lang.String
getMapLayersID()
Gets layer collection specified by map (for REST services).Color
getTransparentColor()
Gets the transparent background color.int
getTransparentColorTolerance()
Gets the tolerance for transparent background color.LayerSettingType
getType()
Gets the type of the layer, inherited and overwritten based onLayerSetting.getType()
method.java.lang.String[]
getVisibleSubLayers()
Gets the collection of all visible layers and return the string array.boolean
isTransparent()
Whether the background color of the image layer is transparently displayed or not.void
setCacheMaxSize(int nMaxSize)
Sets the maximum number of buffers for the layervoid
setDisplayBandIndexes(int[] bandIndexes)
Sets the band index displayed by current image layer.void
setDisplayColorSpace(ColorSpaceType colorSpace)
Sets the color display mode for the image layer.void
setDisplayMode(ImageDisplayMode displayMode)
Set the image display modevoid
setImageStretchOption(ImageStretchOption imageStretchOption)
Set stretching way for the multi-band image of the layervoid
setMapLayersID(java.lang.String layersID)
Sets layer collection specified by map (for REST services).void
setTransparent(boolean transparentEnable)
Sets whether the background color of the image layer is transparently displayed or not.void
setTransparentColor(Color color)
Sets whether the image layer needs to transparently display the background color or not.void
setTransparentColorTolerance(int value)
Sets the tolerance of transparent background color.void
setVisibleSubLayers(java.lang.String[] subLayers)
Sets the collection of all visible layers.
-
-
-
Constructor Detail
-
LayerSettingImage
public LayerSettingImage()
Initializes a new instance of this LayerSettingImage class.
-
LayerSettingImage
public LayerSettingImage(LayerSettingImage layerSettingImage)
Constructor. Constructs a new instance according to the specified LayerSettingImage object.- Parameters:
layerSettingImage
- Specifies the LayerSettingImage object
-
-
Method Detail
-
getType
public LayerSettingType getType()
Gets the type of the layer, inherited and overwritten based onLayerSetting.getType()
method.- Specified by:
getType
in classLayerSetting
- Returns:
- Returns the layer type
LayerSettingType
. If there is no associated layer, returns null.
-
isTransparent
public boolean isTransparent()
Whether the background color of the image layer is transparently displayed or not. True indicates the color specified bysetTransparentColor(Color)
will transparently display. Default is false, indicating not transparent.- Returns:
- Returns an opolean indicating whether the image layer background is transparent
-
setTransparent
public void setTransparent(boolean transparentEnable)
Sets whether the background color of the image layer is transparently displayed or not.- Parameters:
transparentEnable
- boolean type, indicating whether the image layer background color is transparent. True indicates the color specified bysetTransparentColor(Color)
will transparently display.
-
getTransparentColor
public Color getTransparentColor()
Gets the transparent background color.- Returns:
Color
Type, returns the specified transparent background color. If the object is a new one, returns null.
-
setTransparentColor
public void setTransparentColor(Color color)
Sets whether the image layer needs to transparently display the background color or not.In addition to the need to transparently display the color, but also need the
setTransparent(boolean)
to allow transparent display of the color- Parameters:
color
-Color
Type, background color that needs to be displayed transparently
-
getTransparentColorTolerance
public int getTransparentColorTolerance()
Gets the tolerance for transparent background color.Transparent tolerance range is [0,255]. When this value is 0, only the specified color can be transparently displayed; when the value is 255, all colors will be displayed transparently. The default value is 0.
- Returns:
- int type, returns the tolerance value of the current transparent background color
-
setTransparentColorTolerance
public void setTransparentColorTolerance(int value)
Sets the tolerance of transparent background color.Transparent tolerance range is [0,255]. When this value is 0, only the specified color can be transparently displayed; when the value is 255, all colors will be displayed transparently.
This setting is valid if and only if the
isTransparent()
value is true.- Parameters:
value
- int type, you need to set the transparent background color and color limits. If value<0, the real setting would be 0; if value >255, the real value is 255.
-
getAllSubLayers
public java.lang.String[] getAllSubLayers()
Gets the collection of all layers and return the string array.- Returns:
- Layer name collection.
-
getVisibleSubLayers
public java.lang.String[] getVisibleSubLayers()
Gets the collection of all visible layers and return the string array.- Returns:
- Layer name collection
-
setVisibleSubLayers
public void setVisibleSubLayers(java.lang.String[] subLayers)
Sets the collection of all visible layers.- Parameters:
subLayers
- Layer name collection.
-
setMapLayersID
public void setMapLayersID(java.lang.String layersID)
Sets layer collection specified by map (for REST services).- Parameters:
layersID
- Specifies the ID of the layer collection.
-
getMapLayersID
public java.lang.String getMapLayersID()
Gets layer collection specified by map (for REST services).- Returns:
- Map Specifies the collection of layers.
-
getDisplayBandIndexes
public int[] getDisplayBandIndexes()
Gets the band index of the current image layer- Returns:
- Returns the band index displayed by the current image layer
-
setDisplayBandIndexes
public void setDisplayBandIndexes(int[] bandIndexes)
Sets the band index displayed by current image layer. Supposes it has several bands, when you need to set the display band according to the set color mode (such as RGB) Specify the color (such as red, green, blue) in the corresponding band index (such as 0,2,1) can be.- Parameters:
bandIndexes
- The current image layer shows the band index
-
getDisplayMode
public ImageDisplayMode getDisplayMode()
Returns the image display mode- Returns:
- image display mode Defaults: The default value is consistent with the number of bands in the data set. If the data set is multi-band, the default is the combined mode. Otherwise, the default is the stretching mode.
-
setDisplayMode
public void setDisplayMode(ImageDisplayMode displayMode)
Set the image display mode- Parameters:
displayMode
- image display mode, multi-band support two display modes, single band only supports stretch display mode
-
getDisplayColorSpace
public ColorSpaceType getDisplayColorSpace()
Gets the color display mode of the image layer- Returns:
- image layer color display mode, the default is RGB
-
setDisplayColorSpace
public void setDisplayColorSpace(ColorSpaceType colorSpace)
Sets the color display mode for the image layer. It displays the image layer in the color mode according to the current color format of the image layer and the displayed band. Currently only support RGB / RGBA two- Parameters:
colorSpace
- The color display mode of the image layer
-
getImageStretchOption
public ImageStretchOption getImageStretchOption()
Get image stretch parameters If there is a color table, and the number of color table is not 0, will use the color table to display the image, then the drawing method does not work, If there is no color table or the number is 0, support the stretch display.- Returns:
- ImageStretchOption Image stretch parameters
-
setImageStretchOption
public void setImageStretchOption(ImageStretchOption imageStretchOption)
Set stretching way for the multi-band image of the layer- Parameters:
imageStretchOption
- Stretch parameters
-
add
public void add(Datasource datasource, java.lang.String strSLDFilePath)
Add a layer to the layer collection through the SLD file- Parameters:
datasource
- The data source where the data is locatedstrSLDFilePath
- SLD file path
-
setCacheMaxSize
public void setCacheMaxSize(int nMaxSize)
Sets the maximum number of buffers for the layer- Parameters:
nMaxSize
- Maximum number of buffers
-
getCacheMaxSize
public int getCacheMaxSize()
Gets the maximum number of buffers for the layer- Returns:
- maximum number of buffers
-
-