Class ColorThemingStyle
- java.lang.Object
-
- com.vividsolutions.jump.workbench.ui.renderer.style.ColorThemingStyle
-
- All Implemented Interfaces:
AlphaSetting,Style,Cloneable
public class ColorThemingStyle extends Object implements Style, AlphaSetting
A Style mapping different basic styles for different attribute values.
-
-
Constructor Summary
Constructors Constructor Description ColorThemingStyle()ColorThemingStyle(String attributeName, Map<Object,BasicStyle> attributeValueToBasicStyleMap, BasicStyle defaultStyle)ColorThemingStyle(String attributeName, Map<Object,BasicStyle> attributeValueToBasicStyleMap, Map<Object,String> attributeValueToLabelMap, BasicStyle defaultStyle)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()static ColorThemingStyleget(Layer layer)Creates a default ColorThemingStyle for this layer if none is already set.intgetAlpha()StringgetAttributeName()Map<Object,BasicStyle>getAttributeValueToBasicStyleMap()Map<Object,String>getAttributeValueToLabelMap()BasicStylegetDefaultStyle()voidinitialize(Layer layer)Called before #paint is applied to each Feature.booleanisEnabled()booleanisGlobalLineWidthEnabled()booleanisGlobalTransparencyEnabled()booleanisVertexStyleEnabled()voidpaint(Feature f, Graphics2D g, Viewport viewport)voidsetAlpha(int alpha)Call this method after calling #setAttributeValueToBasicStyleMap rather than before.voidsetAttributeName(String attributeName)voidsetAttributeValueToBasicStyleMap(Map<Object,BasicStyle> attributeValueToBasicStyleMap)You can set the keys to Ranges if the Map is a Range.RangeTreeMap.voidsetAttributeValueToLabelMap(Map<Object,String> attributeValueToLabelMap)You can set the keys to Ranges if the Map is a Range.RangeTreeMap.voidsetDefaultStyle(BasicStyle defaultStyle)voidsetEnabled(boolean enabled)voidsetGlobalLineWidthEnabled(boolean globalLineWidthEnabled)voidsetGlobalTransparencyEnabled(boolean globalTransparencyEnabled)voidsetLineWidth(int lineWidth)Call this method after calling #setAttributeValueToBasicStyleMap rather than before.voidsetVertexStyleEnabled(boolean vertexStyleEnabled)static ObjecttrimIfString(Object object)
-
-
-
Constructor Detail
-
ColorThemingStyle
public ColorThemingStyle()
-
ColorThemingStyle
public ColorThemingStyle(String attributeName, Map<Object,BasicStyle> attributeValueToBasicStyleMap, BasicStyle defaultStyle)
- Parameters:
attributeName- name of the attribute used to choose the feature StyleattributeValueToBasicStyleMap- map attribute values (or range) to stylesdefaultStyle- style used for features with a null attribute value.nullto prevent drawing features with a null attribute value.
-
ColorThemingStyle
public ColorThemingStyle(String attributeName, Map<Object,BasicStyle> attributeValueToBasicStyleMap, Map<Object,String> attributeValueToLabelMap, BasicStyle defaultStyle)
- Parameters:
attributeName- name of the attribute used to choose the feature StyleattributeValueToBasicStyleMap- map attribute values (or range) to stylesattributeValueToLabelMap- map attribute values (or range) to labelsdefaultStyle- style used for features with a null attribute value.nullto prevent drawing features with a null attribute value.
-
-
Method Detail
-
setAlpha
public void setAlpha(int alpha)
Call this method after calling #setAttributeValueToBasicStyleMap rather than before.- Specified by:
setAlphain interfaceAlphaSetting
-
setLineWidth
public void setLineWidth(int lineWidth)
Call this method after calling #setAttributeValueToBasicStyleMap rather than before.
-
paint
public void paint(Feature f, Graphics2D g, Viewport viewport) throws Exception
-
getAttributeName
public String getAttributeName()
- Returns:
- null if the layer has no non-spatial attributes
-
setAttributeValueToBasicStyleMap
public void setAttributeValueToBasicStyleMap(Map<Object,BasicStyle> attributeValueToBasicStyleMap)
You can set the keys to Ranges if the Map is a Range.RangeTreeMap. But don't mix Ranges and non-Ranges -- the UI expects homogeneity in this regard (i.e. to test whether or not there are ranges, only the first attribute value is tested).
-
setAttributeValueToLabelMap
public void setAttributeValueToLabelMap(Map<Object,String> attributeValueToLabelMap)
You can set the keys to Ranges if the Map is a Range.RangeTreeMap. But don't mix Ranges and non-Ranges -- the UI expects homogeneity in this regard (i.e. to test whether or not there are ranges, only the first attribute value is tested).
-
setAttributeName
public void setAttributeName(String attributeName)
-
getAttributeValueToBasicStyleMap
public Map<Object,BasicStyle> getAttributeValueToBasicStyleMap()
-
initialize
public void initialize(Layer layer)
Description copied from interface:StyleCalled before #paint is applied to each Feature.- Specified by:
initializein interfaceStyle- Parameters:
layer- the layer on which to apply this style
-
setEnabled
public void setEnabled(boolean enabled)
- Specified by:
setEnabledin interfaceStyle
-
isEnabled
public boolean isEnabled()
-
get
public static ColorThemingStyle get(Layer layer)
Creates a default ColorThemingStyle for this layer if none is already set.
-
getDefaultStyle
public BasicStyle getDefaultStyle()
-
setDefaultStyle
public void setDefaultStyle(BasicStyle defaultStyle)
-
isGlobalTransparencyEnabled
public boolean isGlobalTransparencyEnabled()
-
setGlobalTransparencyEnabled
public void setGlobalTransparencyEnabled(boolean globalTransparencyEnabled)
-
isGlobalLineWidthEnabled
public boolean isGlobalLineWidthEnabled()
-
setGlobalLineWidthEnabled
public void setGlobalLineWidthEnabled(boolean globalLineWidthEnabled)
-
isVertexStyleEnabled
public boolean isVertexStyleEnabled()
-
setVertexStyleEnabled
public void setVertexStyleEnabled(boolean vertexStyleEnabled)
-
getAlpha
public int getAlpha()
- Specified by:
getAlphain interfaceAlphaSetting
-
-