Package org.geotools.styling
Class ContrastEnhancementImpl
- Object
-
- ContrastEnhancementImpl
-
- All Implemented Interfaces:
ContrastEnhancement
public class ContrastEnhancementImpl extends Object implements ContrastEnhancement
The ContrastEnhancement object defines contrast enhancement for a channel of a false-color image or for a color image. Its format is:<xs:element name="ContrastEnhancement"> <xs:complexType> <xs:sequence> <xs:choice minOccurs="0"> <xs:element ref="sld:Normalize"/> <xs:element ref="sld:Histogram"/> </xs:choice> <xs:element ref="sld:GammaValue" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Normalize"> <xs:complexType/> </xs:element> <xs:element name="Histogram"> <xs:complexType/> </xs:element> <xs:element name="GammaValue" type="xs:double"/>In the case of a color image, the relative grayscale brightness of a pixel color is used. ?Normalize? means to stretch the contrast so that the dimmest color is stretched to black and the brightest color is stretched to white, with all colors in between stretched out linearly. ?Histogram? means to stretch the contrast based on a histogram of how many colors are at each brightness level on input, with the goal of producing equal number of pixels in the image at each brightness level on output. This has the effect of revealing many subtle ground features. A ?GammaValue? tells how much to brighten (value greater than 1.0) or dim (value less than 1.0) an image. The default GammaValue is 1.0 (no change). If none of Normalize, Histogram, or GammaValue are selected in a ContrastEnhancement, then no enhancement is performed.- Author:
- iant
-
-
Constructor Summary
Constructors Constructor Description ContrastEnhancementImpl()ContrastEnhancementImpl(FilterFactory factory)ContrastEnhancementImpl(FilterFactory factory, Expression gamma, ContrastMethod method)ContrastEnhancementImpl(FilterFactory factory, ContrastMethod method)ContrastEnhancementImpl(ContrastEnhancement contrastEnhancement)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(StyleVisitor visitor)Traversal of the style data structure.Objectaccept(TraversingStyleVisitor visitor, Object extraData)calls the visit method of a StyleVisitorvoidaddOption(String key, Expression value)Store a vendor optionbooleanequals(Object obj)ExpressiongetGammaValue()How much to brighten (values greater than 1.0) or dim (values less than 1.0) an image.ContrastMethodgetMethod()We use a codeList to enable more enchancement type possibilities.ExpressiongetOption(String key)Map<String,Expression>getOptions()Return vendor options relating to the enhancement methodinthashCode()booleanhasOption(String key)check if vendor option key is availablevoidsetFilterFactory(FilterFactory factory)voidsetGammaValue(Expression gamma)voidsetMethod(ContrastMethod method)Used to set the contrast enhancement method used.voidsetMethod(ContrastMethodStrategy method)Convenience method to allow users to pass in aContrastMethodStrategyto updateContrastEnhancement.setMethod(org.geotools.api.style.ContrastMethod)andContrastEnhancement.setOptions(java.util.Map<java.lang.String, org.geotools.api.filter.expression.Expression>)in one go.voidsetOptions(Map<String,Expression> options)
-
-
-
Constructor Detail
-
ContrastEnhancementImpl
public ContrastEnhancementImpl()
-
ContrastEnhancementImpl
public ContrastEnhancementImpl(FilterFactory factory)
-
ContrastEnhancementImpl
public ContrastEnhancementImpl(FilterFactory factory, ContrastMethod method)
-
ContrastEnhancementImpl
public ContrastEnhancementImpl(ContrastEnhancement contrastEnhancement)
-
ContrastEnhancementImpl
public ContrastEnhancementImpl(FilterFactory factory, Expression gamma, ContrastMethod method)
-
-
Method Detail
-
setFilterFactory
public void setFilterFactory(FilterFactory factory)
-
getGammaValue
public Expression getGammaValue()
Description copied from interface:ContrastEnhancementHow much to brighten (values greater than 1.0) or dim (values less than 1.0) an image. The default GammaValue is 1.0 (no change).- Specified by:
getGammaValuein interfaceContrastEnhancement- Returns:
- Expression, if
nulla value of 1.0 is assumed indicating no change
-
setGammaValue
public void setGammaValue(Expression gamma)
- Specified by:
setGammaValuein interfaceContrastEnhancement- Parameters:
gamma- How much to brighten (greater than 1) or dim (less than 1) this channel; use 1.0 to indicate no change.
-
getMethod
public ContrastMethod getMethod()
Description copied from interface:ContrastEnhancementWe use a codeList to enable more enchancement type possibilities.- Specified by:
getMethodin interfaceContrastEnhancement
-
accept
public Object accept(TraversingStyleVisitor visitor, Object extraData)
Description copied from interface:ContrastEnhancementcalls the visit method of a StyleVisitor- Specified by:
acceptin interfaceContrastEnhancement- Parameters:
visitor- the style visitor
-
accept
public void accept(StyleVisitor visitor)
Description copied from interface:ContrastEnhancementTraversal of the style data structure.- Specified by:
acceptin interfaceContrastEnhancement
-
setMethod
public void setMethod(ContrastMethod method)
Description copied from interface:ContrastEnhancementUsed to set the contrast enhancement method used.- Specified by:
setMethodin interfaceContrastEnhancement
-
getOptions
public Map<String,Expression> getOptions()
Description copied from interface:ContrastEnhancementReturn vendor options relating to the enhancement method- Specified by:
getOptionsin interfaceContrastEnhancement- Returns:
- a Map containing expressions with string keys.
-
hasOption
public boolean hasOption(String key)
Description copied from interface:ContrastEnhancementcheck if vendor option key is available- Specified by:
hasOptionin interfaceContrastEnhancement- Parameters:
key- - the name of the option to check- Returns:
- true if present
-
getOption
public Expression getOption(String key)
- Specified by:
getOptionin interfaceContrastEnhancement- Returns:
- An expression for the matching VendorOption
-
addOption
public void addOption(String key, Expression value)
Description copied from interface:ContrastEnhancementStore a vendor option- Specified by:
addOptionin interfaceContrastEnhancement- Parameters:
key- - the name of the optionvalue- an expression that evaluates to it's value
-
setOptions
public void setOptions(Map<String,Expression> options)
- Specified by:
setOptionsin interfaceContrastEnhancement- Parameters:
options- a Map of VendorOptions
-
setMethod
public void setMethod(ContrastMethodStrategy method)
Description copied from interface:ContrastEnhancementConvenience method to allow users to pass in aContrastMethodStrategyto updateContrastEnhancement.setMethod(org.geotools.api.style.ContrastMethod)andContrastEnhancement.setOptions(java.util.Map<java.lang.String, org.geotools.api.filter.expression.Expression>)in one go.- Specified by:
setMethodin interfaceContrastEnhancement- Parameters:
method- theContrastMethodStrategythat underlies this enhancement
-
-