org.deegree_impl.graphics.sld
Class Mark_Impl

java.lang.Object
  extended byorg.deegree_impl.graphics.sld.Mark_Impl
All Implemented Interfaces:
Mark, Marshallable

public class Mark_Impl
extends java.lang.Object
implements Mark, Marshallable

A Mark takes a "shape" and applies coloring to it. The shape can be derived either from a well-known name (such as "square"), an external URL in various formats (such as, perhaps GIF), or from a glyph of a font. Multiple external formats may be used with the semantic that they all contain the equivalent shape in different formats. If an image format is used that has inherent coloring, the coloring is discarded and only the opacity channel (or equivalent) is used. A Halo, Fill, and/or Stroke is applied as appropriate for the shape's source format.

Version:
$Revision: 1.13 $ $Date: 2004/03/05 16:46:49 $
Author:
Katharina Lupp, Markus Schneider

Field Summary
private  Fill fill
           
private  java.awt.image.BufferedImage image
           
private  Stroke stroke
           
private  java.lang.String wellKnownName
           
 
Constructor Summary
(package private) Mark_Impl()
          Constructor for the default Mark.
(package private) Mark_Impl(java.lang.String wellKnownName, Stroke stroke, Fill fill)
          constructor initializing the class with the
 
Method Summary
 java.awt.image.BufferedImage drawCircle(int size, double fillOpacity, java.awt.Color fillColor, double strokeOpacity, java.awt.Color strokeColor)
          Draws a scaled instance of a circle mark according to the given parameters.
 java.awt.image.BufferedImage drawCross1(int size, double strokeOpacity, java.awt.Color strokeColor)
          Draws a scaled instance of a cross mark (a "+") according to the given parameters.
 java.awt.image.BufferedImage drawCross2(int size, double strokeOpacity, java.awt.Color strokeColor)
          Draws a scaled instance of a cross mark (an "X") according to the given parameters.
 java.awt.image.BufferedImage drawSquare(int size, double fillOpacity, java.awt.Color fillColor, double strokeOpacity, java.awt.Color strokeColor)
          Draws a scaled instance of a square mark according to the given parameters.
 java.awt.image.BufferedImage drawTriangle(int size, double fillOpacity, java.awt.Color fillColor, double strokeOpacity, java.awt.Color strokeColor)
          Draws a scaled instance of a triangle mark according to the given parameters.
 java.lang.String exportAsXML()
          exports the content of the Mark as XML formated String
 java.awt.image.BufferedImage getAsImage(Feature feature, int size)
          DOCUMENT ME!
 Fill getFill()
          A Fill allows area geometries to be filled.
 Stroke getStroke()
          A Stroke allows a string of line segments (or any linear geometry) to be rendered.
 java.lang.String getWellKnownName()
          Gives the well known name of a Mark's shape.
 void setAsImage(java.awt.image.BufferedImage bufferedImage)
          Sets the mark as an image.
private  void setColor(java.awt.Graphics2D g2D, java.awt.Color color, double opacity)
           
 void setFill(Fill fill)
          sets the
 void setStroke(Stroke stroke)
          sets
 void setWellKnownName(java.lang.String wellKnownName)
          Sets the well known name of a Mark's shape.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

image

private java.awt.image.BufferedImage image

fill

private Fill fill

wellKnownName

private java.lang.String wellKnownName

stroke

private Stroke stroke
Constructor Detail

Mark_Impl

Mark_Impl()
Constructor for the default Mark.


Mark_Impl

Mark_Impl(java.lang.String wellKnownName,
          Stroke stroke,
          Fill fill)
constructor initializing the class with the

Method Detail

getWellKnownName

public java.lang.String getWellKnownName()
Gives the well known name of a Mark's shape. Allowed values include at least "square", "circle", "triangle", "star", "cross", and "x", though map servers may draw a different symbol instead if they don't have a shape for all of these. Renderings of these marks may be made solid or hollow depending on Fill and Stroke parameters. The default value is "square".

Specified by:
getWellKnownName in interface Mark
Returns:
the WK-Name of the mark

setWellKnownName

public void setWellKnownName(java.lang.String wellKnownName)
Sets the well known name of a Mark's shape. Allowed values include at least "square", "circle", "triangle", "star", "cross", and "x", though map servers may draw a different symbol instead if they don't have a shape for all of these. Renderings of these marks may be made solid or hollow depending on Fill and Stroke parameters. The default value is "square".

Specified by:
setWellKnownName in interface Mark
Parameters:
wellKnownName - the WK-Name of the mark

getFill

public Fill getFill()
A Fill allows area geometries to be filled. There are two types of fills: solid-color and repeated GraphicFill. In general, if a Fill element is omitted in its containing element, no fill will be rendered. The default is a solid 50%-gray (color "#808080") opaque fill.

Specified by:
getFill in interface Mark
Returns:
the fill of the mark

setFill

public void setFill(Fill fill)
sets the

Specified by:
setFill in interface Mark
Parameters:
fill - the fill of the mark

getStroke

public Stroke getStroke()
A Stroke allows a string of line segments (or any linear geometry) to be rendered. There are three basic types of strokes: solid Color, GraphicFill (stipple), and repeated GraphicStroke. A repeated graphic is plotted linearly and has its graphic symbol bended around the curves of the line string. The default is a solid black line (Color "#000000").

Specified by:
getStroke in interface Mark
Returns:
the stroke of the mark

setStroke

public void setStroke(Stroke stroke)
sets

Specified by:
setStroke in interface Mark
Parameters:
stroke - the stroke of the mark

getAsImage

public java.awt.image.BufferedImage getAsImage(Feature feature,
                                               int size)
                                        throws FilterEvaluationException
DOCUMENT ME!

Specified by:
getAsImage in interface Mark
Parameters:
size - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
FilterEvaluationException

setAsImage

public void setAsImage(java.awt.image.BufferedImage bufferedImage)
Sets the mark as an image. Rhis method is not part of the sld specifications but it is added to speed up applications.

Specified by:
setAsImage in interface Mark
Parameters:
bufferedImage - the bufferedImage to be set for the mark

drawTriangle

public java.awt.image.BufferedImage drawTriangle(int size,
                                                 double fillOpacity,
                                                 java.awt.Color fillColor,
                                                 double strokeOpacity,
                                                 java.awt.Color strokeColor)
Draws a scaled instance of a triangle mark according to the given parameters.

Parameters:
size - resulting image's height and widthh
fillOpacity - opacity value for the filled parts of the image
fillColor - Colorto be used for the fill
strokeOpacity - opacity value for the stroked parts of the image
strokeColor - Colorto be used for the strokes
Returns:
image displaying a triangle

drawCircle

public java.awt.image.BufferedImage drawCircle(int size,
                                               double fillOpacity,
                                               java.awt.Color fillColor,
                                               double strokeOpacity,
                                               java.awt.Color strokeColor)
Draws a scaled instance of a circle mark according to the given parameters.

Parameters:
size - resulting image's height and widthh
fillOpacity - opacity value for the filled parts of the image
fillColor - Colorto be used for the fill
strokeOpacity - opacity value for the stroked parts of the image
strokeColor - Colorto be used for the strokes
Returns:
image displaying a circle

drawSquare

public java.awt.image.BufferedImage drawSquare(int size,
                                               double fillOpacity,
                                               java.awt.Color fillColor,
                                               double strokeOpacity,
                                               java.awt.Color strokeColor)
Draws a scaled instance of a square mark according to the given parameters.

Parameters:
size - resulting image's height and widthh
fillOpacity - opacity value for the filled parts of the image
fillColor - Colorto be used for the fill
strokeOpacity - opacity value for the stroked parts of the image
strokeColor - Colorto be used for the strokes
Returns:
image displaying a square

drawCross1

public java.awt.image.BufferedImage drawCross1(int size,
                                               double strokeOpacity,
                                               java.awt.Color strokeColor)
Draws a scaled instance of a cross mark (a "+") according to the given parameters.

Parameters:
size - resulting image's height and widthh
strokeOpacity - opacity value for the stroked parts of the image
strokeColor - Colorto be used for the strokes
Returns:
image displaying a cross (a "+")

drawCross2

public java.awt.image.BufferedImage drawCross2(int size,
                                               double strokeOpacity,
                                               java.awt.Color strokeColor)
Draws a scaled instance of a cross mark (an "X") according to the given parameters.

Parameters:
size - resulting image's height and widthh
strokeOpacity - opacity value for the stroked parts of the image
strokeColor - Colorto be used for the strokes
Returns:
image displaying a cross (a "X")

setColor

private void setColor(java.awt.Graphics2D g2D,
                      java.awt.Color color,
                      double opacity)
Parameters:
g2D -
color -
opacity -

exportAsXML

public java.lang.String exportAsXML()
exports the content of the Mark as XML formated String

Specified by:
exportAsXML in interface Marshallable
Returns:
xml representation of the Mark