001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/graphics/sld/LineSymbolizer.java $
002 /*---------------- FILE HEADER ------------------------------------------
003
004 This file is part of deegree.
005 Copyright (C) 2001-2008 by:
006 EXSE, Department of Geography, University of Bonn
007 http://www.giub.uni-bonn.de/deegree/
008 lat/lon GmbH
009 http://www.lat-lon.de
010
011 This library is free software; you can redistribute it and/or
012 modify it under the terms of the GNU Lesser General Public
013 License as published by the Free Software Foundation; either
014 version 2.1 of the License, or (at your option) any later version.
015
016 This library is distributed in the hope that it will be useful,
017 but WITHOUT ANY WARRANTY; without even the implied warranty of
018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019 Lesser General Public License for more details.
020
021 You should have received a copy of the GNU Lesser General Public
022 License along with this library; if not, write to the Free Software
023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024
025 Contact:
026
027 Andreas Poth
028 lat/lon GmbH
029 Aennchenstr. 19
030 53115 Bonn
031 Germany
032 E-Mail: poth@lat-lon.de
033
034 Prof. Dr. Klaus Greve
035 Department of Geography
036 University of Bonn
037 Meckenheimer Allee 166
038 53115 Bonn
039 Germany
040 E-Mail: greve@giub.uni-bonn.de
041
042
043 ---------------------------------------------------------------------------*/
044 package org.deegree.graphics.sld;
045
046 import org.deegree.framework.xml.Marshallable;
047
048 /**
049 * Used to render a "stroke" along a linear geometry. If a point geometry is used, it should be
050 * interpreted as a line of zero length and two end caps. If a polygon is used, then its closed
051 * outline is used as the line string (with no end caps). A missing Geometry element selects the
052 * default geometry. A missing Stroke element means that nothing will be plotted.
053 * <p>
054 * ----------------------------------------------------------------------
055 * </p>
056 *
057 * @author <a href="mailto:k.lupp@web.de">Katharina Lupp</a>
058 * @version $Revision: 9340 $ $Date: 2007-12-27 13:32:12 +0100 (Do, 27 Dez 2007) $
059 */
060
061 public class LineSymbolizer extends AbstractSymbolizer implements Marshallable {
062
063 private Stroke stroke = null;
064
065 /**
066 * Creates a new LineSymbolizer object.
067 */
068 public LineSymbolizer() {
069 super( null, "org.deegree.graphics.displayelements.LineStringDisplayElement" );
070
071 Stroke stroke = new Stroke();
072 setStroke( stroke );
073 }
074
075 /**
076 * constructor initializing the class with the <LineSymbolizer>
077 */
078 LineSymbolizer( Stroke stroke, Geometry geometry, double min, double max ) {
079 super( geometry, "org.deegree.graphics.displayelements.LineStringDisplayElement" );
080 setStroke( stroke );
081 setMinScaleDenominator( min );
082 setMaxScaleDenominator( max );
083 }
084
085 /**
086 * constructor initializing the class with the <LineSymbolizer>
087 */
088 LineSymbolizer( Stroke stroke, Geometry geometry, String responsibleClass, double min, double max ) {
089 super( geometry, responsibleClass );
090 // super( geometry, "org.deegree.graphics.displayelements.LineStringDisplayElement" );
091 setStroke( stroke );
092 setMinScaleDenominator( min );
093 setMaxScaleDenominator( max );
094 }
095
096 /**
097 * A Stroke allows a string of line segments (or any linear geometry) to be rendered. There are
098 * three basic types of strokes: solid Color, GraphicFill (stipple), and repeated GraphicStroke.
099 * A repeated graphic is plotted linearly and has its graphic symbol bended around the curves of
100 * the line string. The default is a solid black line (Color "#000000").
101 *
102 * @return the Stroke
103 */
104 public Stroke getStroke() {
105 return stroke;
106 }
107
108 /**
109 * sets the <Stroke>
110 *
111 * @param stroke
112 * the Stroke
113 *
114 */
115 public void setStroke( Stroke stroke ) {
116 this.stroke = stroke;
117 }
118
119 /**
120 * exports the content of the LineSymbolizer as XML formated String
121 *
122 * @return xml representation of the LineSymbolizer
123 */
124 public String exportAsXML() {
125
126 StringBuffer sb = new StringBuffer( 1000 );
127 sb.append( "<LineSymbolizer>" );
128 if ( geometry != null ) {
129 sb.append( ( (Marshallable) geometry ).exportAsXML() );
130 }
131 if ( stroke != null ) {
132 sb.append( ( (Marshallable) stroke ).exportAsXML() );
133 }
134 sb.append( "</LineSymbolizer>" );
135
136 return sb.toString();
137 }
138 }