|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectskrueger.geotools.StyledLayerUtil
public class StyledLayerUtil
This class provides static helper methods for dealing with
StyledLayerInterface
stuff.
Field Summary | |
---|---|
static String |
AMLURI
URL for Atlas XML schema |
static String |
ELEM_NAME_AMD
Name of the XML Element for the attribute meta data map |
static String |
ELEM_NAME_ATTRIBUTE
Name of the XML Element for an attribute meta data map entry |
static String |
ELEM_NAME_RASTERLEGEND
Name of the XML Element for an raster legend data entry |
static String |
ELEM_NAME_RLD
Name of the XML Element for the raster legend data |
static String |
ELEM_NAME_TRANSLATION
Name of the XML Element for a translation |
Constructor Summary | |
---|---|
StyledLayerUtil()
|
Method Summary | ||
---|---|---|
static Element |
createAttributeMetaDataElement(AttributeMetaData amd)
Creates an JDOM Element for the given AttributeMetaData
object. |
|
static Element |
createAttributeMetaDataMapElement(Map<Integer,AttributeMetaData> amdMap)
Creates an JDOM Element for the given AttributeMetaData
map. |
|
static MapLayer |
createMapLayer(Object object)
Creates a Geotools MapLayer from an object. |
|
static MapLayer |
createMapLayer(Object object,
Style forcedStyle)
Creates a Geotools MapLayer from an object. |
|
static Element |
createRasterLegendDataElement(RasterLegendData rld)
Creates an JDOM Element for the given RasterLegendData
map. |
|
static StyledLayerInterface<?> |
createStyledLayer(Object object,
String title)
Creates an default instance of StyledLayerInterface for a Geotools
object (GridCoverage2D , FeatureCollection ) with a default
style. |
|
static StyledLayerInterface<?> |
createStyledLayer(Object object,
String title,
StyledLayerStyle style)
Creates an default instance of StyledLayerInterface for a Geotools
object (GridCoverage2D , FeatureCollection ) with a given
style. |
|
static Element |
createTranslationElement(String tagname,
Translation translation)
Creates an JDOM Element for the given Translation . |
|
static RasterLegendData |
generateRasterLegendData(ColorMap colorMap,
boolean paintGaps,
Integer digits)
Creates RasterLegendData from a ColorMap . |
|
static RasterLegendData |
generateRasterLegendData(Style style,
boolean paintGaps,
Integer digits)
Creates RasterLegendData from the ColorMap of a style. |
|
static StyledLayerStyle<Map<Integer,AttributeMetaData>> |
getStyledLayerStyle(StyledFeatureCollectionInterface styledFC)
Returns the style and attribute meta data of a StyledFeatureCollectionInterface
as a StyledLayerStyle . |
|
static StyledLayerStyle<RasterLegendData> |
getStyledLayerStyle(StyledGridCoverageInterface styledGC)
Returns the style and raster meta data of a StyledGridCoverageInterface
as a StyledLayerStyle . |
|
static StyledLayerStyle<?> |
getStyledLayerStyle(StyledLayerInterface styledObject)
Returns the style a StyledLayerInterface as a StyledLayerStyle . |
|
static SortedMap<Integer,AttributeMetaData> |
getVisibleAttributeMetaData(Map<Integer,AttributeMetaData> amdMap,
boolean visible)
Return only the visible or invisible entries of an AttributeMetaData-Map. |
|
static Map<Integer,AttributeMetaData> |
loadAttributeMetaDataMap(URL documentUrl)
Loads a AttributeMetaData object from an URL. |
|
static RasterLegendData |
loadRasterLegendData(URL documentUrl)
Loads a RasterLegendData object from an URL. |
|
static StyledLayerStyle<Map<Integer,AttributeMetaData>> |
loadStyledFeatureStyle(URL geoObjectURL)
Loads a SLD-Style from a .sld file and
AttributeMetaData-Map from a .amd file
for a given geo-object (feature) source. |
|
static StyledLayerStyle<Map<Integer,AttributeMetaData>> |
loadStyledFeatureStyle(URL geoObjectURL,
String sldExt,
String rldExt)
Loads a SLD-Style and a AttributeMetaData-Map for a given geo-object (feature) source. |
|
static StyledLayerStyle<RasterLegendData> |
loadStyledRasterStyle(URL geoObjectURL)
Loads a SLD-Style from a .sld file and
Raster-LegendData from a .rld file
for a given geo-object (raster) source. |
|
static StyledLayerStyle<RasterLegendData> |
loadStyledRasterStyle(URL geoObjectURL,
String sldExt,
String rldExt)
Loads a SLD-Style and Raster-LegendData for a given geo-object (raster) source. |
|
static AttributeMetaData |
parseAttributeMetaData(Element element)
Parses a AttributeMetaData object from an JDOM-Element . |
|
static Map<Integer,AttributeMetaData> |
parseAttributeMetaDataMap(Element element)
Parses a AttributeMetaData map from an JDOM-Element
with <attribute> -childs. |
|
static RasterLegendData |
parseRasterLegendData(Element element)
Parses a RasterLegendData object from an JDOM-Element . |
|
static Translation |
parseTranslation(Element element)
Parses a Translation object from an JDOM-Element . |
|
static void |
saveAttributeMetaDataMap(Map<Integer,AttributeMetaData> amdMap,
URL documentUrl)
Saves a AttributeMetaData-Map to an URL. |
|
static void |
saveRasterLegendData(RasterLegendData rld,
URL documentUrl)
Saves a RasterLegendData to an URL. |
|
static void |
saveStyledLayerStyle(StyledLayerStyle<?> style,
URL geoObjectURL)
Stores the SLD-Style to a .sld file and
the meta data (RasterLegendData or AttributeMetaData )
to a .rld or .amd file. |
|
static
|
saveStyledLayerStyle(StyledLayerStyle<T> style,
URL geoObjectURL,
String sldExt,
String mdExt)
Stores a SLD-Style and Raster-LegendData for a given geo-object (raster) source. |
|
static void |
setStyledLayerStyle(StyledLayerInterface styledObject,
StyledLayerStyle<?> style)
Sets a style to StyledLayerInterface . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String AMLURI
public static final String ELEM_NAME_AMD
public static final String ELEM_NAME_RLD
public static final String ELEM_NAME_ATTRIBUTE
public static final String ELEM_NAME_RASTERLEGEND
public static final String ELEM_NAME_TRANSLATION
Constructor Detail |
---|
public StyledLayerUtil()
Method Detail |
---|
public static MapLayer createMapLayer(Object object) throws Exception
MapLayer
from an object. If the object is a
StyledLayerInterface
then its sytle is used. In case of direct
Geotools objects (GridCoverage2D
, AbstractGridCoverage2DReader
,
FeatureCollection
) a default style is generated.
object
- an Object
Exception
- if null
is given as object or an error occurs during layer creationpublic static MapLayer createMapLayer(Object object, Style forcedStyle) throws Exception
MapLayer
from an object. If the object is a
StyledLayerInterface
then its sytle is used. In case of direct
Geotools objects (GridCoverage2D
, AbstractGridCoverage2DReader
,
FeatureCollection
) a default style is generated.
object
- an ObjectforcedStyle
- (SLD-)Style to force for the object
Exception
- if null
is given as object or an error occurs during layer creationpublic static StyledLayerInterface<?> createStyledLayer(Object object, String title)
StyledLayerInterface
for a Geotools
object (GridCoverage2D
, FeatureCollection
) with a default
style.
object
- an Objecttitle
- title for the object
UnsupportedOperationException
- if null
is given as object or an error occurs during creationpublic static StyledLayerInterface<?> createStyledLayer(Object object, String title, StyledLayerStyle style)
StyledLayerInterface
for a Geotools
object (GridCoverage2D
, FeatureCollection
) with a given
style.
object
- an Objecttitle
- title for the objectstyle
- style and meta data for the object
UnsupportedOperationException
- if null
is given as object or an error occurs during creationpublic static SortedMap<Integer,AttributeMetaData> getVisibleAttributeMetaData(Map<Integer,AttributeMetaData> amdMap, boolean visible)
amdMap
- AttributeMetaData-Mapvisible
- indicated whether the visible or invisible entries are
returnedpublic static AttributeMetaData parseAttributeMetaData(Element element)
AttributeMetaData
object from an JDOM-Element
.
This method works like AMLImport#parseDataAttribute(org.w3c.dom.Node
,
but for JDOM.
element
- Element
to parsepublic static Map<Integer,AttributeMetaData> parseAttributeMetaDataMap(Element element)
AttributeMetaData
map from an JDOM-Element
with <attribute>
-childs.
element
- Element
to parsepublic static Map<Integer,AttributeMetaData> loadAttributeMetaDataMap(URL documentUrl) throws Exception
AttributeMetaData
object from an URL.
documentUrl
- URL
to parse
Exception
parseAttributeMetaData(Element)
public static Element createAttributeMetaDataElement(AttributeMetaData amd)
Element
for the given AttributeMetaData
object.
amd
- meta data for one attributepublic static Element createAttributeMetaDataMapElement(Map<Integer,AttributeMetaData> amdMap)
Element
for the given AttributeMetaData
map.
amdMap
- map of attribute meta datapublic static void saveAttributeMetaDataMap(Map<Integer,AttributeMetaData> amdMap, URL documentUrl) throws Exception
AttributeMetaData-Map
to an URL.
amdMap
- map of AttributeMetaData
documentUrl
- URL
to store the XML
Exception
public static RasterLegendData parseRasterLegendData(Element element)
RasterLegendData
object from an JDOM-Element
.
This method works like AMLImport#parseRasterLegendData(org.w3c.dom.Node
,
but for JDOM.
element
- Element
to parsepublic static RasterLegendData loadRasterLegendData(URL documentUrl) throws Exception
RasterLegendData
object from an URL.
documentUrl
- URL
to parse
Exception
parseAttributeMetaData(Element)
public static Element createRasterLegendDataElement(RasterLegendData rld)
Element
for the given RasterLegendData
map.
rld
- raster legend datapublic static RasterLegendData generateRasterLegendData(ColorMap colorMap, boolean paintGaps, Integer digits)
RasterLegendData
from a ColorMap
.
colorMap
- a color mappaintGaps
- indicated whether gaps are painted between the legend itemsdigits
- number of digits the grid value classes (and legend) are
rounded to (null means no round; >= 0 means digits after comma;
< 0 means digits before comma)public static RasterLegendData generateRasterLegendData(Style style, boolean paintGaps, Integer digits)
RasterLegendData
from the ColorMap
of a style.
style
- a raster style (must contain a RasterSymbolizer
)paintGaps
- indicated whether gaps are painted between the legend itemsdigits
- number of digits the grid value classes (and legend) are
rounded to (null means no round; >= 0 means digits after comma;
< 0 means digits before comma)public static void saveRasterLegendData(RasterLegendData rld, URL documentUrl) throws Exception
RasterLegendData
to an URL.
rld
- raster legend datadocumentUrl
- URL
to store the XML
Exception
public static final Translation parseTranslation(Element element)
Translation
object from an JDOM-Element
.
This method works like AMLImport#parseTranslation(org.w3c.dom.Node
,
but for JDOM.
element
- Element
to parsepublic static final Element createTranslationElement(String tagname, Translation translation)
Element
for the given Translation
.
tagname
- Name of the Elementtranslation
- Translation to store in the Elementpublic static void setStyledLayerStyle(StyledLayerInterface styledObject, StyledLayerStyle<?> style)
StyledLayerInterface
.
styledObject
- a styled objectstyle
- a Stylepublic static StyledLayerStyle<?> getStyledLayerStyle(StyledLayerInterface styledObject)
StyledLayerInterface
as a StyledLayerStyle
.
styledObject
- a styled object
StyledLayerStyle<RasterLegendData>
for StyledGridCoverageInterface
or StyledLayerStyle<Map<Integer,AttributeMetaData>>
for
StyledFeatureCollectionInterface
public static StyledLayerStyle<RasterLegendData> getStyledLayerStyle(StyledGridCoverageInterface styledGC)
StyledGridCoverageInterface
as a StyledLayerStyle
.
styledGC
- a styled grid coveragepublic static StyledLayerStyle<Map<Integer,AttributeMetaData>> getStyledLayerStyle(StyledFeatureCollectionInterface styledFC)
StyledFeatureCollectionInterface
as a StyledLayerStyle
.
styledFC
- a styled feature collectionpublic static StyledLayerStyle<RasterLegendData> loadStyledRasterStyle(URL geoObjectURL, String sldExt, String rldExt)
geoObjectURL
- URL of the (already read) raster objectsldExt
- file extention for the SLD filerldExt
- file extention for the raster legend-data file
null
in case of any errorpublic static StyledLayerStyle<RasterLegendData> loadStyledRasterStyle(URL geoObjectURL)
.sld
file and
Raster-LegendData from a .rld
file
for a given geo-object (raster) source. The SLD file must be present. A missing
raster legend-data file is tolerated.
geoObjectURL
- URL of the (already read) raster objectsldExt
- file extention for the SLD filerldExt
- file extention for the raster legend-data file
null
in case of any errorpublic static StyledLayerStyle<Map<Integer,AttributeMetaData>> loadStyledFeatureStyle(URL geoObjectURL, String sldExt, String rldExt)
geoObjectURL
- URL of the (already read) feature objectsldExt
- file extention for the SLD filerldExt
- file extention for the raster legend-data file
null
in case of any errorpublic static StyledLayerStyle<Map<Integer,AttributeMetaData>> loadStyledFeatureStyle(URL geoObjectURL)
.sld
file and
AttributeMetaData-Map from a .amd
file
for a given geo-object (feature) source. The SLD file must be present. A missing
attribute meta-data file is tolerated.
geoObjectURL
- URL of the (already read) feature objectsldExt
- file extention for the SLD filerldExt
- file extention for the raster legend-data file
null
in case of any errorpublic static <T> void saveStyledLayerStyle(StyledLayerStyle<T> style, URL geoObjectURL, String sldExt, String mdExt) throws Exception
style
- style to savegeoObjectURL
- URL of the raster objectsldExt
- file extention for the SLD filemdExt
- file extention for the meta-data file
Exception
public static void saveStyledLayerStyle(StyledLayerStyle<?> style, URL geoObjectURL) throws Exception
.sld
file and
the meta data (RasterLegendData
or AttributeMetaData
)
to a .rld
or .amd
file.
for a given geo-object source.
style
- style to savegeoObjectURL
- URL of the (already read) raster object
Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |