package org.geotools.wcs.bindings;
import javax.xml.namespace.QName;
import net.opengis.wcs10.AxisSubsetType;
import net.opengis.wcs10.IntervalType;
import net.opengis.wcs10.TypedLiteralType;
import net.opengis.wcs10.ValueRangeType;
import net.opengis.wcs10.Wcs10Factory;
import org.geotools.wcs.WCS;
import org.geotools.xml.AbstractComplexBinding;
import org.geotools.xml.AttributeInstance;
import org.geotools.xml.ElementInstance;
import org.geotools.xml.Node;
/**
* Binding object for the type
* http://www.opengis.net/wcs:RangeSubsetType_axisSubset.
*
* <p>
*
* <pre>
* <code>
* <complexType name="RangeSubsetType_axisSubset">
* <complexContent>
* <extension base="wcs:valueEnumBaseType">
* <attribute name="name" type="string" use="required">
* <annotation>
* <documentation>Name or identifier of one axis in this coverage. This name shall match that of an AxisDescription element in the DescribeCoverage XML response. </documentation>
* </annotation>
* </attribute>
* </extension>
* </complexContent>
* </complexType>
*
* </code>
* </pre>
*
* </p>
*
* @generated
*
*
* @source $URL$
*/
public class RangeSubsetType_axisSubsetBinding extends AbstractComplexBinding {
/**
* @generated
*/
public QName getTarget() {
return WCS.RangeSubsetType_axisSubset;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated modifiable
*/
public Class getType() {
return AxisSubsetType.class;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated modifiable
*/
public Object parse(ElementInstance instance, Node node, Object value)
throws Exception {
AxisSubsetType axis = Wcs10Factory.eINSTANCE.createAxisSubsetType();
AttributeInstance[] atts = instance.getAttributes();
for (AttributeInstance attType : atts) {
if (attType.getName().equals("name"))
axis.setName(attType.getText());
}
Node singleValue = node.getChild("singleValue");
if (singleValue != null) {
TypedLiteralType theValue = Wcs10Factory.eINSTANCE.createTypedLiteralType();
theValue.setValue((String) singleValue.getValue());
axis.getSingleValue().add(theValue);
}
Node interval = node.getChild("interval");
if (interval != null) {
IntervalType range = Wcs10Factory.eINSTANCE.createIntervalType();
if (interval.getChild("min") != null) {
TypedLiteralType theValue = Wcs10Factory.eINSTANCE.createTypedLiteralType();
theValue.setValue((String) interval.getChildValue("min"));
range.setMin(theValue);
}
if (interval.getChild("max") != null) {
TypedLiteralType theValue = Wcs10Factory.eINSTANCE.createTypedLiteralType();
theValue.setValue((String) interval.getChildValue("max"));
range.setMax(theValue);
}
if (interval.getChild("res") != null) {
TypedLiteralType theValue = Wcs10Factory.eINSTANCE.createTypedLiteralType();
theValue.setValue((String) interval.getChildValue("res"));
range.setRes(theValue);
}
if (interval.getAttribute("atomic") != null)
range.setAtomic((Boolean) interval.getAttributeValue("atomic"));
else
range.setAtomic(false);
axis.getInterval().add(range);
}
return axis;
}
}