schmitzm.geotools.styling
Class StylingUtil

java.lang.Object
  extended by schmitzm.geotools.styling.StylingUtil

public class StylingUtil
extends Object

Diese Klasse enthaelt Hilfsfunktionen zum GeoTools-Styling

Version:
1.1
Author:
Martin Schmitz (University of Bonn/Germany), Stefan Alfons Krüger

Field Summary
static SLDTransformer SLDTRANSFORMER
          Standard-Instanz eines SLDTransformer.
static StyleBuilder STYLE_BUILDER
          Standard-Instanz eines StyleBuilder.
static StyleFactory STYLE_FACTORY
          Standard-Instanz einer StyleFactory
static StyleFactory styleFactory
          Deprecated. wurde ersetzt durch STYLE_FACTORY
static Color TRANSPARENT_COLOR
          transparent color
 
Constructor Summary
StylingUtil()
           
 
Method Summary
static ColorMap addColorMapEntryAndSort(ColorMap colorMap, ColorMapEntry colorMapEntry)
          Unless ColorMap is not sorted automatically, this method calls sortColorMap(ColorMap) after inserting the color map entry.
static void applyColorMapProperties(ColorMap sourceColorMap, ColorMap destColormap)
          Applies general properties (color map type and extended colors) to a ColorMap.
static ColorMap clearColorMapLabels(ColorMap colorMap)
          Removes all label information from the ColorMapEntrys of the given ColorMap
static Graphic clone(Graphic graphic)
          Clons a Graphic element
static Style clone(Style style)
          Clones a Style by converting it to XML and reading it back in.
static Symbolizer clone(Symbolizer sym)
          Clones a Symbolizer using the DuplicatingStyleVisitor.
static ColorMap cloneColorMap(ColorMap colorMap)
          Kopiert eine ColorMap.
static ColorMapEntry cloneColorMapEntry(ColorMapEntry colorMapEntry)
          Kopiert einen ColorMapEntry.
static boolean colorMapEntriesEqual(ColorMapEntry cme1, ColorMapEntry cme2)
          Prueft, ob zwei ColorMapEntry-Instanzen gleich sind.
static ColorMapEntry ColorMapEntry(ColorMapEntry colorMapEntry)
          Kopiert einen ColorMapEntry.
static boolean colorMapsEqual(ColorMap cm1, ColorMap cm2)
          Prueft, ob zwei ColorMap-Instanzen gleich sind.
static void copyAllValues(TextSymbolizer from, TextSymbolizer to)
          Copies all Values from one TextSymbolizer to another TextSymbolizer
static Style correctPropertyNames(Style style, SimpleFeatureType schema)
          Since GT2.6, the AttributeNames are case sensitive.
static FeatureTypeStyle createBlinkFeatureTypeStyle(Object geoObject)
           
static BrewerPalette createBrewerPalette(String name, Color[] colors)
          Creates a new BrewerPalette with only one scheme (which includes all colors).
static ColorMapEntry createColorMapEntry(String label, Double quantity, Color color, double opacity)
          Erzeugt einen ColorMapEntry.
static Style createDefaultStyle(Object object)
          Erstellt einen Default-Style fuer die Klassen/Interfaces: StyledFeaturesInterface, GridCoverage2D, FeatureCollection, FeatureSource und GeometryAttributeType.
static GridSampleDimension createDiscreteGridSampleDimension(String name, ColorMap colorMap, double[] noDataValues,  unit)
          Erzeugt eine GridSampleDimension aus einer ColorMap.
static Category createNoDataCategory(double geoValue)
          Erzeugt eine Category fuer die NoData-Werte transparent dargestellt werden.
static Category createNoDataCategory(int value, double geoValue)
          Erzeugt eine Category fuer die NoData-Werte transparent dargestellt werden.
static FeatureTypeStyle createSelectionStyle(Object geoObject)
           
static Style createStyleFromColorMap(ColorMap colorMap, String name)
          Creates a Style for a Grid layer from a ColorMap Title will be set to GridUtil.UNTITLED_RASTER_STYLE_TITLE
static Style createStyleFromColorMap(ColorMap colorMap, String name, String title)
          Creates a Style for a Grid layer from a ColorMap
static Style createStyleFromSLD(Element element)
          Erzeugt einen Style aus einem JDOM-Element, des eine SLD-Definition enthaelt
static Style createStyleSimple(Object geoObject, Color color, Color color2)
           
static MemoryFeatureCollection filterSLDVisibleOnly( fc, Style style, Double scaleDenominator)
          SLD Rules können die Paramter MinScaleDenominator und MaxScaleDenominator enthalten.
static  filterSLDVisibleOnly( fc, Style style, XMapPane xMapPane)
          SLD Rules können die Paramter MinScaleDenominator und MaxScaleDenominator enthalten.
static ColorMapEntry findColorMapEntry(ColorMap colorMap, double value)
          Ermittelt fuer einen Wert den ColorMapEntry aus einer ColorMap.
static Color getColorFromColorMapEntry(ColorMapEntry entry)
          Liefert die Farbe eines Farbpaletten-Eintrag.
static Color getColorFromExpression(Expression expression)
          Liefert die Farbe eines Farbpaletten-Eintrag.
static ColorMap getColorMapFromStyle(Style style)
          Liefert die Farbpalette zu einem Style, wenn der Style aus einem RasterSymbolizer erzeugt wurde.
static List<ColorMap> getColorMapsFromStyle(Style style)
          Liefert alle Farbpaletten aus einem Style, wenn irgendo RasterSymbolizer enthalten sind.
static int getColorMapType(String typeStr)
          Returns the color map type specified by a given string.
static Color getFillColor(Fill fill)
           
static PropertyName getFirstPropertyName(SimpleFeatureType ft, TextSymbolizer textSymbolizer)
          Geopublisher allows to use one or two attributes for labelling, like ORTSRATSBE: ORB_SCHLUE Returns the first attribute found in the label expression of the given TextSymbolizer.
static Color getGraphicColor(Graphic graphic)
           
static Color getLineSymbolizerColor(LineSymbolizer ps)
           
static double getMaxScaleDenominator(Double avgNn)
          Super smart metod ;-) Needs to be extended to look at the graphic width and Geometry type.
static double getMaxScaleDenominator(Double avgNn, FeatureUtil.GeometryForm form)
          Super smart metod ;-) Needs to be extended to look at the graphic width and Geometry type.
static Double getOpacityFromColorMapEntry(ColorMapEntry entry)
          Liefert die Transparenz eines Farbpaletten-Eintrag.
static Double getOpacityFromExpression(Expression expression)
          Liefert die Transparenz eines Farbpaletten-Eintrag.
static Color getPointSymbolizerColor(PointSymbolizer ps)
           
static Color getPolygonSymbolizerColor(PolygonSymbolizer ps)
           
static Double getQuantityFromColorMapEntry(ColorMapEntry entry)
          Liefert den Wert eines Farbpaletten-Eintrag.
static Double getQuantityFromExpression(Expression expression)
          Liefert den Wert eines Farbpaletten-Eintrag.
static List<RasterSymbolizer> getRasterSymbolizers(Style style)
          Returns all RasterSymbolizer that are contained in a Style.
static PropertyName getSecondPropertyName(SimpleFeatureType ft, TextSymbolizer textSymbolizer)
          Geopublisher allows to use one or two attributes for labelling, like ORTSRATSBE: ORB_SCHLUE Returns the second attribute found in the label expression of the given TextSymbolizer or null.
static FeatureTypeStyle getSelectionFeatureTypeStyle(Style style)
          Returns null or any FeatureTypeStyle that is SELECTION related.
static Color getStrokeColor(Stroke stroke)
           
static Color getSymbolizerColor(Symbolizer symb)
           
static TextSymbolizer getTextSymbolizer(Style style, SimpleFeature f)
           
static List<TextSymbolizer> getTextSymbolizers(Style style)
           
static List<TextSymbolizer> getTextSymbolizers(Symbolizer[] symbolizers)
           
static List<TextSymbolizer> getVisibleTextSymbolizers(Style style)
           
static boolean isStyleDifferent(Style style1, File style2file)
          Compares a given Style and a File containg a Style.
static boolean isStyleDifferent(Style style1, Style style2)
          Compares a given Style and a File containg a Style.
static Style[] loadSLD(File sldFile)
          Loads Styles from a SLD File
static Style[] loadSLD(InputStream inputStream)
          Loads Styles from a SLD InputStream
static Style[] loadSLD(URL url)
          Loads Styles from a SLD InputStream
static ColorMap removeColorMapEntry(ColorMap colorMap, ColorMapEntry colorMapEntry)
          Unless ColorMap has no methods to remove an entry this method creates a new ColorMap with the identical entries except the one to remove.
static ColorMap removeColorMapEntry(ColorMap colorMap, int idx)
          Unless ColorMap has no methods to remove an entry this method creates a new ColorMap with the identical entries except the one to remove.
static Style removeSelectionFeatureTypeStyle(Style style)
          Creates a copy of the given Style, removing any FeatureTypeStyles that are only SELECTION related.
static void replaceFillColor(Fill fill, Color oldColor, Color newColor)
          Replaces the "main" color in a given Fill element
static void replaceGraphicColor(Graphic graphic, Color oldColor, Color newColor)
          Replaces the "main" color in a given Graphic element
static void replaceLineSymbolizerColor(LineSymbolizer ps, Color oldColor, Color newColor)
          Replaces the "main" color in a given LineSymbolizer element
static void replacePointSymbolizerColor(PointSymbolizer ps, Color oldColor, Color newColor)
          Replaces the "main" color in a given PointSymbolizer element
static void replacePolygonSymbolizerColor(PolygonSymbolizer ps, Color oldColor, Color newColor)
          Replaces the "main" color in a given PolygonSymbolizer element
static void replaceStrokeColor(Stroke stroke, Color oldColor, Color newColor)
          Replaces the "main" color in a given Stroke element
static void replaceSymbolizerColor(Symbolizer symb, Color oldColor, Color newColor)
          Replaces the "main" color in a given Symbolizer element
static boolean saveStyleToSLD(Style style, File exportFile)
          Saves the Style to OGC SLD using UTF-8 as charset.
static boolean saveStyleToSLD(Style origStyle, File exportFile, Charset charset)
          Saves the Style to OGC SLD.
static void setColorForColorMapEntry(ColorMapEntry entry, Color color)
          Setzt die Farbe eines Farbpaletten-Eintrag.
static void setDoublePropertyName(TextSymbolizer symbolizer, PropertyName literalLabelField1, PropertyName literalLabelField2)
          AtlasStyler has a fixed system that allows to use one or two label attributes.
static void setOpacityForColorMapEntry(ColorMapEntry entry, double opacity)
          Setzt die Transparenz eines Farbpaletten-Eintrag.
static void setQuantityForColorMapEntry(ColorMapEntry entry, double quantity)
          Setzt den Wert eines Farbpaletten-Eintrag.
static ColorMap sortColorMap(ColorMap colorMap)
          Sorts a ColorMap according to the value of its entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRANSPARENT_COLOR

public static final Color TRANSPARENT_COLOR
transparent color


STYLE_BUILDER

public static final StyleBuilder STYLE_BUILDER
Standard-Instanz eines StyleBuilder.


SLDTRANSFORMER

public static final SLDTransformer SLDTRANSFORMER
Standard-Instanz eines SLDTransformer.


STYLE_FACTORY

public static final StyleFactory STYLE_FACTORY
Standard-Instanz einer StyleFactory


styleFactory

public static final StyleFactory styleFactory
Deprecated. wurde ersetzt durch STYLE_FACTORY
Standard-Instanz einer StyleFactory

Constructor Detail

StylingUtil

public StylingUtil()
Method Detail

createDefaultStyle

public static Style createDefaultStyle(Object object)
Erstellt einen Default-Style fuer die Klassen/Interfaces: StyledFeaturesInterface, GridCoverage2D, FeatureCollection, FeatureSource und GeometryAttributeType.

Parameters:
object - GridCoverage2D, org.geotools.coverage.grid.io.AbstractGridCoverage2DReader oder FeatureCollection
Returns:
null falls kein Style generiert werden kann

createNoDataCategory

public static Category createNoDataCategory(double geoValue)
Erzeugt eine Category fuer die NoData-Werte transparent dargestellt werden.

Parameters:
geoValue - Geo-Wert, der NoData repraesentiert

createNoDataCategory

public static Category createNoDataCategory(int value,
                                            double geoValue)
Erzeugt eine Category fuer die NoData-Werte transparent dargestellt werden.

Parameters:
value - Sample-Wert der Category
geoValue - Geo-Wert, der NoData repraesentiert

createDiscreteGridSampleDimension

public static GridSampleDimension createDiscreteGridSampleDimension(String name,
                                                                    ColorMap colorMap,
                                                                    double[] noDataValues,
                                                                     unit)
Erzeugt eine GridSampleDimension aus einer ColorMap.

Parameters:
name - Name fuer die GridSampleDimension
colorMap - fuer jeden Eintrag der ColorMap wird eine Category erzeugt
noDataValues - Werte fuer die zusaetzliche Categorys erstellt werden, welche die transparent dargestellt werden (wenn null wird keine zusaetzliche Category erstellt)
unit - Einheit der Werte in der GridSampleDimension (kann null sein)

getColorMapFromStyle

public static ColorMap getColorMapFromStyle(Style style)
Liefert die Farbpalette zu einem Style, wenn der Style aus einem RasterSymbolizer erzeugt wurde.

Parameters:
style - Style Wenn null, dann wird style auf GridUtil.createDefaultStyle() gesetzt
Returns:
null wenn der Style nicht auf einem RasterSymbolizer basiert.

getColorMapsFromStyle

public static List<ColorMap> getColorMapsFromStyle(Style style)
Liefert alle Farbpaletten aus einem Style, wenn irgendo RasterSymbolizer enthalten sind.

Parameters:
style - Style Wenn null, dann wird style auf GridUtil.createDefaultStyle() gesetzt
Returns:
Leere Liste wenn keine RasterSymbolizer enthalten ist.

findColorMapEntry

public static ColorMapEntry findColorMapEntry(ColorMap colorMap,
                                              double value)
Ermittelt fuer einen Wert den ColorMapEntry aus einer ColorMap.

Parameters:
value - Wert
Returns:
null, wenn in der ColorMap kein expliziter Eintrag fuer den Wert hinterlegt ist

applyColorMapProperties

public static void applyColorMapProperties(ColorMap sourceColorMap,
                                           ColorMap destColormap)
Applies general properties (color map type and extended colors) to a ColorMap.

Parameters:
sourceColorMap - color map the properties are taken from
destColormap - color map the properties are set

removeColorMapEntry

public static ColorMap removeColorMapEntry(ColorMap colorMap,
                                           int idx)
Unless ColorMap has no methods to remove an entry this method creates a new ColorMap with the identical entries except the one to remove.

Parameters:
colorMap - the color map to remove entries from
idx - the entry index to remove

removeColorMapEntry

public static ColorMap removeColorMapEntry(ColorMap colorMap,
                                           ColorMapEntry colorMapEntry)
Unless ColorMap has no methods to remove an entry this method creates a new ColorMap with the identical entries except the one to remove.

Parameters:
colorMap - the color map to remove entries from
colorMapEntry - the entry to remove

addColorMapEntryAndSort

public static ColorMap addColorMapEntryAndSort(ColorMap colorMap,
                                               ColorMapEntry colorMapEntry)
Unless ColorMap is not sorted automatically, this method calls sortColorMap(ColorMap) after inserting the color map entry.

Parameters:
colorMap - the color map to extend
colorMapEntry - the new entry

sortColorMap

public static ColorMap sortColorMap(ColorMap colorMap)
Sorts a ColorMap according to the value of its entries.

Parameters:
colorMap - the color map to sort

getColorMapType

public static int getColorMapType(String typeStr)
Returns the color map type specified by a given string.

Parameters:
typeStr - a string
See Also:
ColorMap#getType()

cloneColorMap

public static ColorMap cloneColorMap(ColorMap colorMap)
Kopiert eine ColorMap.

Returns:
null wenn die uebergebene ColorMap null ist

cloneColorMapEntry

public static ColorMapEntry cloneColorMapEntry(ColorMapEntry colorMapEntry)
Kopiert einen ColorMapEntry.

Returns:
null wenn der uebergebene ColorMapEntry null ist

colorMapsEqual

public static boolean colorMapsEqual(ColorMap cm1,
                                     ColorMap cm2)
Prueft, ob zwei ColorMap-Instanzen gleich sind.

Parameters:
cm1 - eine Farbpalette
cm2 - eine andere Farbpalette

colorMapEntriesEqual

public static boolean colorMapEntriesEqual(ColorMapEntry cme1,
                                           ColorMapEntry cme2)
Prueft, ob zwei ColorMapEntry-Instanzen gleich sind. Dies ist der Fall, wenn ihnen der gleiche Wert, die gleiche Farbe, die gleiche Transparenz und das gleiche Label zugeordnet ist.

Parameters:
cme1 - ein Farbpaletten-Eintrag
cme2 - ein anderer Farbpaletten-Eintrag

createColorMapEntry

public static ColorMapEntry createColorMapEntry(String label,
                                                Double quantity,
                                                Color color,
                                                double opacity)
Erzeugt einen ColorMapEntry.

Parameters:
label - Label fuer den Farbpaletten-Eintrag
quantity - Wert fuer den Farbpaletten-Eintrag
color - Farbe fuer den Farbpaletten-Eintrag
opacity - Transparenz fuer die Farbe des Farbpaletten-Eintrag

ColorMapEntry

public static ColorMapEntry ColorMapEntry(ColorMapEntry colorMapEntry)
Kopiert einen ColorMapEntry.

Returns:
null wenn der uebergebene ColorMapEntry null ist

getQuantityFromExpression

public static Double getQuantityFromExpression(Expression expression)
Liefert den Wert eines Farbpaletten-Eintrag.

Parameters:
expression - Expression, die einen String oder einen Double liefert
Returns:
null, wenn null uebergeben wird

getQuantityFromColorMapEntry

public static Double getQuantityFromColorMapEntry(ColorMapEntry entry)
Liefert den Wert eines Farbpaletten-Eintrag.

Parameters:
entry - Farbpaletten-Eintrag
Returns:
null, wenn null uebergeben wird

setQuantityForColorMapEntry

public static void setQuantityForColorMapEntry(ColorMapEntry entry,
                                               double quantity)
Setzt den Wert eines Farbpaletten-Eintrag.

Parameters:
entry - Farbpaletten-Eintrag
quantity - neuer Wert

getOpacityFromExpression

public static Double getOpacityFromExpression(Expression expression)
Liefert die Transparenz eines Farbpaletten-Eintrag.

Parameters:
expression - Expression, die einen String oder einen Double liefert
Returns:
1.0, wenn null uebergeben wird

getOpacityFromColorMapEntry

public static Double getOpacityFromColorMapEntry(ColorMapEntry entry)
Liefert die Transparenz eines Farbpaletten-Eintrag.

Parameters:
entry - Farbpaletten-Eintrag
Returns:
1.0, wenn null uebergeben wird

setOpacityForColorMapEntry

public static void setOpacityForColorMapEntry(ColorMapEntry entry,
                                              double opacity)
Setzt die Transparenz eines Farbpaletten-Eintrag.

Parameters:
entry - Farbpaletten-Eintrag
opacity - Transparenzwert

getColorFromExpression

public static Color getColorFromExpression(Expression expression)
Liefert die Farbe eines Farbpaletten-Eintrag.

Parameters:
expression - Expression, die einen String liefert

getColorFromColorMapEntry

public static Color getColorFromColorMapEntry(ColorMapEntry entry)
Liefert die Farbe eines Farbpaletten-Eintrag.

Parameters:
entry - Farbpaletten-Eintrag

setColorForColorMapEntry

public static void setColorForColorMapEntry(ColorMapEntry entry,
                                            Color color)
Setzt die Farbe eines Farbpaletten-Eintrag.

Parameters:
entry - Farbpaletten-Eintrag
color - eine Farbe

createStyleFromSLD

public static Style createStyleFromSLD(Element element)
Erzeugt einen Style aus einem JDOM-Element, des eine SLD-Definition enthaelt

Parameters:
element - Element mit SLD-Definition

createStyleFromColorMap

public static Style createStyleFromColorMap(ColorMap colorMap,
                                            String name,
                                            String title)
Creates a Style for a Grid layer from a ColorMap

Parameters:
colorMap - If null, then defaultStyle for Grid will be used
name - The name to give to the Style. null will result in name= GridUtil.UNNAMED_RASTER_STYLE_NAME or GridUtil#DEFAULT_RASTER_STYLE_NAME} (if no colorMap is given).
title - The Title to give to the Style. null will result in title= GridUtil.UNTITLED_RASTER_STYLE_TITLE or GridUtil.DEFAULT_RASTER_STYLE_TITLE (if no colorMap is given)
Returns:
Always a Style that you can be applyed to a GridCoverage.

clearColorMapLabels

public static ColorMap clearColorMapLabels(ColorMap colorMap)
Removes all label information from the ColorMapEntrys of the given ColorMap


createStyleFromColorMap

public static Style createStyleFromColorMap(ColorMap colorMap,
                                            String name)
Creates a Style for a Grid layer from a ColorMap Title will be set to GridUtil.UNTITLED_RASTER_STYLE_TITLE

Parameters:
colorMap - If null, then defaultStyle for Grid will be used
name - The name to give to the Style. null will result in name GridUtil.UNTITLED_RASTER_STYLE_TITLE
Returns:
Always a Style that you can apply to a GridCoverage. Style has name GridUtil.DEFAULT_RASTER_STYLE_NAME if no colormap was provided.

loadSLD

public static Style[] loadSLD(URL url)
Loads Styles from a SLD InputStream

Parameters:
url - URL to read the SLD from
Returns:
An Array of Styles, can be length==0 if no UserStyles in SLD file. null if file not exists

loadSLD

public static Style[] loadSLD(InputStream inputStream)
Loads Styles from a SLD InputStream

Parameters:
inputStream - InputStream to read the SLD from
Returns:
An Array of Styles, can be length==0. null if file not exists

loadSLD

public static Style[] loadSLD(File sldFile)
                       throws FileNotFoundException
Loads Styles from a SLD File

Parameters:
sldFile - File to read the SLD from
Returns:
An Array of Styles, can be length==0
Throws:
FileNotFoundException

saveStyleToSLD

public static final boolean saveStyleToSLD(Style origStyle,
                                           File exportFile,
                                           Charset charset)
                                    throws TransformerException,
                                           IOException
Saves the Style to OGC SLD. Overwrites any existing file. If a FeatureTypeStyle for selection is used, it is automatically removed. This method also checks, whether the style is actually differing from any existing style in the File.

Parameters:
origStyle - Style to save. Any selectino related FeatureTypeStyle will be removed.
charset - The charset to use for the XML, e.g. . If null, non is set and the system default is used.
Throws:
TransformerException
IOException

removeSelectionFeatureTypeStyle

public static Style removeSelectionFeatureTypeStyle(Style style)
Creates a copy of the given Style, removing any FeatureTypeStyles that are only SELECTION related.

See Also:
FeatureMapLayerSelectionSynchronizer#SELECTION_STYLING_FTS_NAME}

getSelectionFeatureTypeStyle

public static FeatureTypeStyle getSelectionFeatureTypeStyle(Style style)
Returns null or any FeatureTypeStyle that is SELECTION related.

See Also:
FeatureMapLayerSelectionSynchronizer#SELECTION_STYLING_FTS_NAME}

isStyleDifferent

public static boolean isStyleDifferent(Style style1,
                                       File style2file)
Compares a given Style and a File containg a Style.

Parameters:
style1 - The first Style
style2file - A File pointing to the second Style
Returns:
true is they are different, ignoring any XML fomatting.

isStyleDifferent

public static boolean isStyleDifferent(Style style1,
                                       Style style2)
Compares a given Style and a File containg a Style.

Parameters:
style1 - The first Style
style2 - The second Style to compare to
Returns:
true is they are different, ignoring any XML fomatting.

saveStyleToSLD

public static final boolean saveStyleToSLD(Style style,
                                           File exportFile)
                                    throws TransformerException,
                                           IOException
Saves the Style to OGC SLD using UTF-8 as charset. Overwrites any existing file.

Parameters:
style - Style to save
Throws:
TransformerException
IOException

filterSLDVisibleOnly

public static MemoryFeatureCollection filterSLDVisibleOnly( fc,
                                                           Style style,
                                                           Double scaleDenominator)
SLD Rules können die Paramter MinScaleDenominator und MaxScaleDenominator enthalten. Dadurch können Elemente für manche Zoom-Stufen deaktiviert werden. Kommentar: "Sichtbarkeit" bezieht es nicht darauf, ob die Elemente auf dem Kartenausschnitt sichtbar sind, sondern um die SLD Regeln, welche das SimpleFeature evt. nur Scalenabhängig zeichnen.
SK 19.6.2009:Bei einem PolygonSymbolizer zählt nicht der Rand, sondern nur ob eine Füllung vorhanden ist! Man kann dann zwar leider nicht auf ein Rand eines Polygons ohne Fill klicken, aber dafür kann man durch die ungefüllte Fläche klicken.

Parameters:
fc - Die zu filternde FeatureCollection. Diese wird nicht verändert.
style - Der Style, mit dem die Features gerendert werden (z.b. layer.getStyle() )
scaleDenominator - Der aktuelle ScaleDenomitor für den die Sichtbarkeit ermittelt wird.
Returns:
Eine FeatureCollection in welcher nur die Features enthalten sind, welche bei aktuellen Scale mit dem übergebenen Style gerendert werden. TODO Was ist mit raster?! TODO Das sollte man besser machen: Zuerst die FIlter der sichtbaren regeln raussuchen, und dann direkt am anfang damitmit mitfiltern...
See Also:
RendererUtilities.calculateOGCScale

getTextSymbolizer

public static TextSymbolizer getTextSymbolizer(Style style,
                                               SimpleFeature f)
Parameters:
style - A Style to search for the first TextSymbolizer that will be used for the given SimpleFeature.
Returns:
null or the first TextSymbolizer found in the style that applies to the SimpleFeature.

getVisibleTextSymbolizers

public static List<TextSymbolizer> getVisibleTextSymbolizers(Style style)
Parameters:
style - A Style to search for all TextSymbolizers . No guarantee, that any one of them will ever be used for any feature (think about filters).
Returns:
List or all TextSymbolizers found in the Style.

getTextSymbolizers

public static List<TextSymbolizer> getTextSymbolizers(Style style)
Parameters:
style - A Style to search for all TextSymbolizers . No guarantee, that any one of them will ever be used for any feature (think about filters).
Returns:
List or all TextSymbolizers found in the Style.

getTextSymbolizers

public static List<TextSymbolizer> getTextSymbolizers(Symbolizer[] symbolizers)
Parameters:
symbolizers - List of Symbolizers to search for all TextSymbolizers . No guarantee, that any one of them will ever be used for any feature (think about filters).
Returns:
List or all TextSymbolizers found in the given symbolizers.

clone

public static Style clone(Style style)
Clones a Style by converting it to XML and reading it back in.

Parameters:
style - the Style to be copied.

clone

public static Symbolizer clone(Symbolizer sym)
Clones a Symbolizer using the DuplicatingStyleVisitor.


clone

public static Graphic clone(Graphic graphic)
Clons a Graphic element

Parameters:
graphicFill -
Returns:

createBrewerPalette

public static BrewerPalette createBrewerPalette(String name,
                                                Color[] colors)
Creates a new BrewerPalette with only one scheme (which includes all colors). The suitablity of the palette is set to "unknown" for all viewer types.

Parameters:
name - name for the palette (also the description is set to this value)
colors - colors for the palette

createSelectionStyle

public static FeatureTypeStyle createSelectionStyle(Object geoObject)
Parameters:
geoObject - GridCoverage2D, AbstractGridCoverage2DReader, FeatureCollection, GeometryAttributeType or FeatureSource
Returns:
a Style that is suitable to identify features of the given type as selected items.

createStyleSimple

public static Style createStyleSimple(Object geoObject,
                                      Color color,
                                      Color color2)

replaceSymbolizerColor

public static void replaceSymbolizerColor(Symbolizer symb,
                                          Color oldColor,
                                          Color newColor)
Replaces the "main" color in a given Symbolizer element


replaceLineSymbolizerColor

public static void replaceLineSymbolizerColor(LineSymbolizer ps,
                                              Color oldColor,
                                              Color newColor)
Replaces the "main" color in a given LineSymbolizer element


replacePointSymbolizerColor

public static void replacePointSymbolizerColor(PointSymbolizer ps,
                                               Color oldColor,
                                               Color newColor)
Replaces the "main" color in a given PointSymbolizer element


replacePolygonSymbolizerColor

public static void replacePolygonSymbolizerColor(PolygonSymbolizer ps,
                                                 Color oldColor,
                                                 Color newColor)
Replaces the "main" color in a given PolygonSymbolizer element

Parameters:
oldColor -
newColor -
ps -

replaceStrokeColor

public static void replaceStrokeColor(Stroke stroke,
                                      Color oldColor,
                                      Color newColor)
Replaces the "main" color in a given Stroke element

Parameters:
stroke -
oldColor -
newColor -

replaceFillColor

public static void replaceFillColor(Fill fill,
                                    Color oldColor,
                                    Color newColor)
Replaces the "main" color in a given Fill element

Parameters:
fill -
oldColor -
newColor -

replaceGraphicColor

public static void replaceGraphicColor(Graphic graphic,
                                       Color oldColor,
                                       Color newColor)
Replaces the "main" color in a given Graphic element


getGraphicColor

public static Color getGraphicColor(Graphic graphic)
Parameters:
graphic - If null returns null
Returns:
the Color used in the Graphic or null, if an ExternalGraphic is used.

getStrokeColor

public static Color getStrokeColor(Stroke stroke)
Returns:
the first Color used in a Stroke.

getFillColor

public static Color getFillColor(Fill fill)
Returns:
the first Color used in a Fill.

getSymbolizerColor

public static Color getSymbolizerColor(Symbolizer symb)
Returns:
the first Color used in a Symbolizer.

getLineSymbolizerColor

public static Color getLineSymbolizerColor(LineSymbolizer ps)
Returns:
the first Color used in a LineSymbolizer.

getPolygonSymbolizerColor

public static Color getPolygonSymbolizerColor(PolygonSymbolizer ps)
Returns:
the first Color used in a PolygonSymbolizer.

getPointSymbolizerColor

public static Color getPointSymbolizerColor(PointSymbolizer ps)
Returns:
the first Color used in a PointSymbolizer.

copyAllValues

public static void copyAllValues(TextSymbolizer from,
                                 TextSymbolizer to)
Copies all Values from one TextSymbolizer to another TextSymbolizer

Parameters:
from - TextSymbolizer source
to - TextSymbolizer target. May not be null.

getRasterSymbolizers

public static List<RasterSymbolizer> getRasterSymbolizers(Style style)
Returns all RasterSymbolizer that are contained in a Style. RasterSymbolizer from FeatureTypeStyles that are selection related are ignored.


getMaxScaleDenominator

public static double getMaxScaleDenominator(Double avgNn)
Super smart metod ;-) Needs to be extended to look at the graphic width and Geometry type.

Parameters:
geometryDescriptor -
avgNn -

getMaxScaleDenominator

public static double getMaxScaleDenominator(Double avgNn,
                                            FeatureUtil.GeometryForm form)
Super smart metod ;-) Needs to be extended to look at the graphic width and Geometry type.

Parameters:
geometryDescriptor -
avgNn -

filterSLDVisibleOnly

public static  filterSLDVisibleOnly( fc,
                                         Style style,
                                         XMapPane xMapPane)
SLD Rules können die Paramter MinScaleDenominator und MaxScaleDenominator enthalten. Dadurch können Elemente für manche Zoom-Stufen deaktiviert werden.

Parameters:
fc - Die zu filternde FeatureCollection. Diese wird nicht verändert.
style - Der Style, mit dem die Features gerendert werden (z.b. layer.getStyle() )
Returns:
Eine FeatureCollection in welcher nur die Features enthalten sind, welche bei aktuellen Scale mit dem übergebenen Style gerendert werden.

correctPropertyNames

public static Style correctPropertyNames(Style style,
                                         SimpleFeatureType schema)
Since GT2.6, the AttributeNames are case sensitive. Also the raster Styles need GeometryProperty set to "geom" to work. This method checks all referenced AttributeNames and checks them against the schema.


getSecondPropertyName

public static PropertyName getSecondPropertyName(SimpleFeatureType ft,
                                                 TextSymbolizer textSymbolizer)
Geopublisher allows to use one or two attributes for labelling, like ORTSRATSBE: ORB_SCHLUE Returns the second attribute found in the label expression of the given TextSymbolizer or null.


getFirstPropertyName

public static PropertyName getFirstPropertyName(SimpleFeatureType ft,
                                                TextSymbolizer textSymbolizer)
Geopublisher allows to use one or two attributes for labelling, like ORTSRATSBE: ORB_SCHLUE Returns the first attribute found in the label expression of the given TextSymbolizer. If non is found for some reason, the method tries to return the first attribute from the schema. We expect the layer to have some attributes, because otherwise AS shouldn't even create the LabellingTab.


setDoublePropertyName

public static void setDoublePropertyName(TextSymbolizer symbolizer,
                                         PropertyName literalLabelField1,
                                         PropertyName literalLabelField2)
AtlasStyler has a fixed system that allows to use one or two label attributes. If two are used, the are seperated by ": ". This mehtod stes one or two ProperybaName fields.

Parameters:
symbolizer - the TextSymbolizer to call setLabel(Expression) on.
literalLabelField1 - may not be null!
literalLabelField2 - may be null

createBlinkFeatureTypeStyle

public static FeatureTypeStyle createBlinkFeatureTypeStyle(Object geoObject)
Returns:
A FeatureTypeStyle that can be used style the given geoObject during a blink or highlight process.