001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016: package org.geotools.sld.bindings;
017:
018: import org.picocontainer.MutablePicoContainer;
019: import org.w3c.dom.Document;
020: import org.w3c.dom.Element;
021: import javax.xml.namespace.QName;
022: import org.opengis.filter.expression.PropertyName;
023: import org.geotools.styling.LineSymbolizer;
024: import org.geotools.styling.Stroke;
025: import org.geotools.styling.StyleFactory;
026: import org.geotools.xml.*;
027:
028: /**
029: * Binding object for the element http://www.opengis.net/sld:LineSymbolizer.
030: *
031: * <p>
032: * <pre>
033: * <code>
034: * <xsd:element name="LineSymbolizer" substitutionGroup="sld:Symbolizer">
035: * <xsd:annotation>
036: * <xsd:documentation> A LineSymbolizer is used to render a
037: * "stroke" along a linear geometry. </xsd:documentation>
038: * </xsd:annotation>
039: * <xsd:complexType>
040: * <xsd:complexContent>
041: * <xsd:extension base="sld:SymbolizerType">
042: * <xsd:sequence>
043: * <xsd:element ref="sld:Geometry" minOccurs="0"/>
044: * <xsd:element ref="sld:Stroke" minOccurs="0"/>
045: * </xsd:sequence>
046: * </xsd:extension>
047: * </xsd:complexContent>
048: * </xsd:complexType>
049: * </xsd:element>
050: *
051: * </code>
052: * </pre>
053: * </p>
054: *
055: * @generated
056: */
057: public class SLDLineSymbolizerBinding extends AbstractComplexBinding {
058: StyleFactory styleFactory;
059:
060: public SLDLineSymbolizerBinding(StyleFactory styleFactory) {
061: this .styleFactory = styleFactory;
062: }
063:
064: /**
065: * @generated
066: */
067: public QName getTarget() {
068: return SLD.LINESYMBOLIZER;
069: }
070:
071: /**
072: * <!-- begin-user-doc -->
073: * <!-- end-user-doc -->
074: *
075: * @generated modifiable
076: */
077: public int getExecutionMode() {
078: return AFTER;
079: }
080:
081: /**
082: * <!-- begin-user-doc -->
083: * <!-- end-user-doc -->
084: *
085: * @generated modifiable
086: */
087: public Class getType() {
088: return LineSymbolizer.class;
089: }
090:
091: /**
092: * <!-- begin-user-doc -->
093: * <!-- end-user-doc -->
094: *
095: * @generated modifiable
096: */
097: public void initialize(ElementInstance instance, Node node,
098: MutablePicoContainer context) {
099: }
100:
101: /**
102: * <!-- begin-user-doc -->
103: * <!-- end-user-doc -->
104: *
105: * @generated modifiable
106: */
107: public Object parse(ElementInstance instance, Node node,
108: Object value) throws Exception {
109: LineSymbolizer ls = styleFactory.createLineSymbolizer();
110:
111: //<xsd:element ref="sld:Geometry" minOccurs="0"/>
112: if (node.hasChild(PropertyName.class)) {
113: PropertyName propertyName = (PropertyName) node
114: .getChildValue(PropertyName.class);
115: ls.setGeometryPropertyName(propertyName.getPropertyName());
116: }
117:
118: //<xsd:element ref="sld:Stroke" minOccurs="0"/>
119: if (node.hasChild(Stroke.class)) {
120: ls.setStroke((Stroke) node.getChildValue(Stroke.class));
121: }
122:
123: return ls;
124: }
125: }
|