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 Object
clone()
static ColorThemingStyle
get(Layer layer)
Creates a default ColorThemingStyle for this layer if none is already set.int
getAlpha()
String
getAttributeName()
Map<Object,BasicStyle>
getAttributeValueToBasicStyleMap()
Map<Object,String>
getAttributeValueToLabelMap()
BasicStyle
getDefaultStyle()
void
initialize(Layer layer)
Called before #paint is applied to each Feature.boolean
isEnabled()
boolean
isGlobalLineWidthEnabled()
boolean
isGlobalTransparencyEnabled()
boolean
isVertexStyleEnabled()
void
paint(Feature f, Graphics2D g, Viewport viewport)
void
setAlpha(int alpha)
Call this method after calling #setAttributeValueToBasicStyleMap rather than before.void
setAttributeName(String attributeName)
void
setAttributeValueToBasicStyleMap(Map<Object,BasicStyle> attributeValueToBasicStyleMap)
You can set the keys to Ranges if the Map is a Range.RangeTreeMap.void
setAttributeValueToLabelMap(Map<Object,String> attributeValueToLabelMap)
You can set the keys to Ranges if the Map is a Range.RangeTreeMap.void
setDefaultStyle(BasicStyle defaultStyle)
void
setEnabled(boolean enabled)
void
setGlobalLineWidthEnabled(boolean globalLineWidthEnabled)
void
setGlobalTransparencyEnabled(boolean globalTransparencyEnabled)
void
setLineWidth(int lineWidth)
Call this method after calling #setAttributeValueToBasicStyleMap rather than before.void
setVertexStyleEnabled(boolean vertexStyleEnabled)
static Object
trimIfString(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.null
to 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.null
to 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:
setAlpha
in 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:Style
Called before #paint is applied to each Feature.- Specified by:
initialize
in interfaceStyle
- Parameters:
layer
- the layer on which to apply this style
-
setEnabled
public void setEnabled(boolean enabled)
- Specified by:
setEnabled
in 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:
getAlpha
in interfaceAlphaSetting
-
-