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.geotools.filter.Expression;
023: import org.geotools.styling.AnchorPoint;
024: import org.geotools.styling.StyleFactory;
025: import org.geotools.xml.*;
026:
027: /**
028: * Binding object for the element http://www.opengis.net/sld:AnchorPoint.
029: *
030: * <p>
031: * <pre>
032: * <code>
033: * <xsd:element name="AnchorPoint">
034: * <xsd:annotation>
035: * <xsd:documentation> An "AnchorPoint"
036: * identifies the location inside of a text label to
037: * use an an 'anchor' for positioning it relative to
038: * a point geometry. </xsd:documentation>
039: * </xsd:annotation>
040: * <xsd:complexType>
041: * <xsd:sequence>
042: * <xsd:element ref="sld:AnchorPointX"/>
043: * <xsd:element ref="sld:AnchorPointY"/>
044: * </xsd:sequence>
045: * </xsd:complexType>
046: * </xsd:element>
047: *
048: * </code>
049: * </pre>
050: * </p>
051: *
052: * @generated
053: */
054: public class SLDAnchorPointBinding extends AbstractComplexBinding {
055: StyleFactory styleFactory;
056:
057: public SLDAnchorPointBinding(StyleFactory styleFactory) {
058: this .styleFactory = styleFactory;
059: }
060:
061: /**
062: * @generated
063: */
064: public QName getTarget() {
065: return SLD.ANCHORPOINT;
066: }
067:
068: /**
069: * <!-- begin-user-doc -->
070: * <!-- end-user-doc -->
071: *
072: * @generated modifiable
073: */
074: public int getExecutionMode() {
075: return AFTER;
076: }
077:
078: /**
079: * <!-- begin-user-doc -->
080: * <!-- end-user-doc -->
081: *
082: * @generated modifiable
083: */
084: public Class getType() {
085: return AnchorPoint.class;
086: }
087:
088: /**
089: * <!-- begin-user-doc -->
090: * <!-- end-user-doc -->
091: *
092: * @generated modifiable
093: */
094: public void initialize(ElementInstance instance, Node node,
095: MutablePicoContainer context) {
096: }
097:
098: /**
099: * <!-- begin-user-doc -->
100: * <!-- end-user-doc -->
101: *
102: * @generated modifiable
103: */
104: public Object parse(ElementInstance instance, Node node,
105: Object value) throws Exception {
106: Expression x = (Expression) node.getChildValue("AnchorPointX");
107: Expression y = (Expression) node.getChildValue("AnchorPointY");
108:
109: return styleFactory.createAnchorPoint(x, y);
110: }
111: }
|