001: //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/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 04:32:12 -0800 (Thu, 27 Dec 2007) $
059: */
060:
061: public class LineSymbolizer extends AbstractSymbolizer implements
062: Marshallable {
063:
064: private Stroke stroke = null;
065:
066: /**
067: * Creates a new LineSymbolizer object.
068: */
069: public LineSymbolizer() {
070: super (null,
071: "org.deegree.graphics.displayelements.LineStringDisplayElement");
072:
073: Stroke stroke = new Stroke();
074: setStroke(stroke);
075: }
076:
077: /**
078: * constructor initializing the class with the <LineSymbolizer>
079: */
080: LineSymbolizer(Stroke stroke, Geometry geometry, double min,
081: double max) {
082: super (geometry,
083: "org.deegree.graphics.displayelements.LineStringDisplayElement");
084: setStroke(stroke);
085: setMinScaleDenominator(min);
086: setMaxScaleDenominator(max);
087: }
088:
089: /**
090: * constructor initializing the class with the <LineSymbolizer>
091: */
092: LineSymbolizer(Stroke stroke, Geometry geometry,
093: String responsibleClass, double min, double max) {
094: super (geometry, responsibleClass);
095: // super( geometry, "org.deegree.graphics.displayelements.LineStringDisplayElement" );
096: setStroke(stroke);
097: setMinScaleDenominator(min);
098: setMaxScaleDenominator(max);
099: }
100:
101: /**
102: * A Stroke allows a string of line segments (or any linear geometry) to be rendered. There are
103: * three basic types of strokes: solid Color, GraphicFill (stipple), and repeated GraphicStroke.
104: * A repeated graphic is plotted linearly and has its graphic symbol bended around the curves of
105: * the line string. The default is a solid black line (Color "#000000").
106: *
107: * @return the Stroke
108: */
109: public Stroke getStroke() {
110: return stroke;
111: }
112:
113: /**
114: * sets the <Stroke>
115: *
116: * @param stroke
117: * the Stroke
118: *
119: */
120: public void setStroke(Stroke stroke) {
121: this .stroke = stroke;
122: }
123:
124: /**
125: * exports the content of the LineSymbolizer as XML formated String
126: *
127: * @return xml representation of the LineSymbolizer
128: */
129: public String exportAsXML() {
130:
131: StringBuffer sb = new StringBuffer(1000);
132: sb.append("<LineSymbolizer>");
133: if (geometry != null) {
134: sb.append(((Marshallable) geometry).exportAsXML());
135: }
136: if (stroke != null) {
137: sb.append(((Marshallable) stroke).exportAsXML());
138: }
139: sb.append("</LineSymbolizer>");
140:
141: return sb.toString();
142: }
143: }
|