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.Graphic;
024: import org.geotools.styling.PointSymbolizer;
025: import org.geotools.styling.StyleFactory;
026: import org.geotools.xml.*;
027:
028: /**
029: * Binding object for the element http://www.opengis.net/sld:PointSymbolizer.
030: *
031: * <p>
032: * <pre>
033: * <code>
034: * <xsd:element name="PointSymbolizer" substitutionGroup="sld:Symbolizer">
035: * <xsd:annotation>
036: * <xsd:documentation> A "PointSymbolizer"
037: * specifies the rendering of a "graphic symbol"
038: * at a point. </xsd:documentation>
039: * </xsd:annotation>
040: * <xsd:complexType>
041: * <xsd:complexContent>
042: * <xsd:extension base="sld:SymbolizerType">
043: * <xsd:sequence>
044: * <xsd:element ref="sld:Geometry" minOccurs="0"/>
045: * <xsd:element ref="sld:Graphic" minOccurs="0"/>
046: * </xsd:sequence>
047: * </xsd:extension>
048: * </xsd:complexContent>
049: * </xsd:complexType>
050: * </xsd:element>
051: *
052: * </code>
053: * </pre>
054: * </p>
055: *
056: * @generated
057: */
058: public class SLDPointSymbolizerBinding extends AbstractComplexBinding {
059: StyleFactory styleFactory;
060:
061: public SLDPointSymbolizerBinding(StyleFactory styleFactory) {
062: this .styleFactory = styleFactory;
063: }
064:
065: /**
066: * @generated
067: */
068: public QName getTarget() {
069: return SLD.POINTSYMBOLIZER;
070: }
071:
072: /**
073: * <!-- begin-user-doc -->
074: * <!-- end-user-doc -->
075: *
076: * @generated modifiable
077: */
078: public int getExecutionMode() {
079: return AFTER;
080: }
081:
082: /**
083: * <!-- begin-user-doc -->
084: * <!-- end-user-doc -->
085: *
086: * @generated modifiable
087: */
088: public Class getType() {
089: return PointSymbolizer.class;
090: }
091:
092: /**
093: * <!-- begin-user-doc -->
094: * <!-- end-user-doc -->
095: *
096: * @generated modifiable
097: */
098: public void initialize(ElementInstance instance, Node node,
099: MutablePicoContainer context) {
100: }
101:
102: /**
103: * <!-- begin-user-doc -->
104: * <!-- end-user-doc -->
105: *
106: * @generated modifiable
107: */
108: public Object parse(ElementInstance instance, Node node,
109: Object value) throws Exception {
110: PointSymbolizer ps = styleFactory.createPointSymbolizer();
111:
112: //<xsd:element ref="sld:Geometry" minOccurs="0"/>
113: if (node.hasChild("Geometry")) {
114: PropertyName propertyName = (PropertyName) node
115: .getChildValue("Geometry");
116: ps.setGeometryPropertyName(propertyName.getPropertyName());
117: }
118:
119: //<xsd:element ref="sld:Graphic" minOccurs="0"/>
120: if (node.hasChild("Graphic")) {
121: ps.setGraphic((Graphic) node.getChildValue("Graphic"));
122: }
123:
124: return ps;
125: }
126: }
|