/*
* GeoTools - The Open Source Java GIS Toolkit
* http://geotools.org
*
* (C) 2002-2010, Open Source Geospatial Foundation (OSGeo)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
package org.geotools.geopkg.wps.xml;
import java.math.BigDecimal;
import java.math.BigInteger;
import org.geotools.geopkg.TileMatrix;
import org.geotools.xml.*;
import javax.xml.namespace.QName;
/**
* Binding object for the type http://www.opengis.net/gpkg:gridtype.
*
* <p>
* <pre>
* <code>
* <?xml version="1.0" encoding="UTF-8"?><xs:complexType name="gridtype" xmlns:xs="http://www.w3.org/2001/XMLSchema">
* <xs:sequence>
* <xs:element name="zoomlevel" type="xs:nonNegativeInteger"/>
* <xs:element name="tilewidth" type="xs:positiveInteger"/>
* <xs:element name="tileheight" type="xs:positiveInteger"/>
* <xs:element name="matrixwidth" type="xs:positiveInteger"/>
* <xs:element name="matrixheight" type="xs:positiveInteger"/>
* <xs:element name="pixelxsize" type="xs:decimal"/>
* <xs:element name="pixelysize" type="xs:decimal"/>
* </xs:sequence>
* </xs:complexType>
*
* </code>
* </pre>
* </p>
*
* @generated
*/
public class GridtypeBinding extends AbstractComplexBinding {
/**
* @generated
*/
public QName getTarget() {
return GPKG.gridtype;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated modifiable
*/
public Class getType() {
return TileMatrix.class;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated modifiable
*/
public Object parse(ElementInstance instance, Node node, Object value)
throws Exception {
int zoomlevel = (Integer) node.getChildValue("zoomlevel");
int tilewidth = ((BigInteger) node.getChildValue("tilewidth")).intValue();
int tilheight = ((BigInteger) node.getChildValue("tileheight")).intValue();
int matrixwidth = ((BigInteger) node.getChildValue("matrixwidth")).intValue();
int matrixheight = ((BigInteger) node.getChildValue("matrixheight")).intValue();
double xpixelsize = ((BigDecimal) node.getChildValue("pixelxsize")).doubleValue();
double ypixelsize = ((BigDecimal) node.getChildValue("pixelysize")).doubleValue();
return new TileMatrix(zoomlevel, matrixwidth, matrixheight, tilewidth, tilheight, xpixelsize, ypixelsize);
}
}