org.deegree_impl.tools
Class LegendElementCreator
java.lang.Object
org.deegree_impl.tools.LegendElementCreator
- public class LegendElementCreator
- extends java.lang.Object
This executable class is an application, which reads out an sld-document,
creates the corresponding legend-elements and saves them as an image.
The class can be executed from the console. Details of use can be requested
with java LegendElementCreator --help
usage: java LegendConsole [-f sld-file -d directory
-g format -c color -w width -h height -t title]
[--version] [--help]
mandatory arguments:
-f file reads the SLD inputfile.
-d outdir name of the directory to save the results in.
optional arguments:
-g format graphics format of the output (default=png).
possible values are: bmp, gif, jpg, png, tif
-c color background-color (default=white)
possible values are: TRANSPARENT (if supported by the
graphics-format '-g'), black, blue, cyan, dark_gray, gray,
green, light_gray, magenta, orange, pink, red, white, yellow
or the hexadecimal codes (i.e. #ffffff for white).
-w width width (in pixel) of the legendsymbol (default=40).
-h height height (in pixel) of the legendsymbol (default=40).
-t title optional title for the legend-element. (no default).
If more than one word, put the title in "quotation marks".
information options:
--help shows this help.
--version shows the version and exits.
- Version:
- Author:
- Axel Schaefer
Constructor Summary |
LegendElementCreator(java.lang.String sldfile,
java.lang.String directory,
java.lang.String format,
java.awt.Color color,
int width,
int height,
java.lang.String title,
LecGUI lec)
|
Method Summary |
java.lang.String |
getVerboseOutput()
|
private static java.util.HashMap |
loadSLD(java.lang.String sldFile)
loads the sld-document, parses it an returns a HashMap containing the
different styles. |
static void |
main(java.lang.String[] args)
main-method for testing purposes |
private void |
saveImage(java.awt.image.BufferedImage bi,
java.lang.String outdir,
java.lang.String filename,
java.lang.String graphicsformat,
java.awt.Color color)
saves the resulting buffered Image from org.deegree.graphics.legend as
an image. |
void |
setVerboseOutput(java.lang.String vo)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
verbose_output
java.lang.String verbose_output
lecgui
LecGUI lecgui
LegendElementCreator
public LegendElementCreator(java.lang.String sldfile,
java.lang.String directory,
java.lang.String format,
java.awt.Color color,
int width,
int height,
java.lang.String title,
LecGUI lec)
throws LegendException
getVerboseOutput
public java.lang.String getVerboseOutput()
- Returns:
setVerboseOutput
public void setVerboseOutput(java.lang.String vo)
loadSLD
private static java.util.HashMap loadSLD(java.lang.String sldFile)
throws java.io.IOException,
XMLParsingException
- loads the sld-document, parses it an returns a HashMap containing the
different styles.
- Parameters:
sldFile
- the file containing the StyledLayerDescriptor
- Returns:
- HashMap containing the styles of the SLD.
- Throws:
java.io.IOException
- if the SLD-document cant be read/found in the filesystem
XMLParsingException
- if an error occurs during the parsing of the sld-document
saveImage
private void saveImage(java.awt.image.BufferedImage bi,
java.lang.String outdir,
java.lang.String filename,
java.lang.String graphicsformat,
java.awt.Color color)
throws LegendException,
java.io.IOException,
java.lang.Exception
- saves the resulting buffered Image from org.deegree.graphics.legend as
an image.
- Parameters:
bi
- the BufferedImage from org.deegree.graphics.legend.*outdir
- the output-directory (application-parameter)filename
- the output-filename (from the styles of the SLD)graphicsformat
- the output-graphicsformat (application-parameter)
- Throws:
java.io.IOException
- if saving fails.
java.lang.Exception
- if the graphic-encoder can't be found.
LegendException
main
public static void main(java.lang.String[] args)
- main-method for testing purposes