/* * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2002-2008, 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.gml3.bindings.ext; import javax.xml.namespace.QName; import org.geotools.gml3.GML; import org.geotools.gml3.bindings.LineStringTypeBinding; import org.geotools.xml.AbstractComplexBinding; import org.geotools.xml.ElementInstance; import org.geotools.xml.Node; import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.LineString; import com.vividsolutions.jts.geom.MultiLineString; /** * Binding object for the type http://www.opengis.net/gml:CurveType. * * <p> * <pre> * <code> * <complexType name="CurveType"> * <annotation> * <documentation>Curve is a 1-dimensional primitive. Curves are continuous, connected, and have a measurable length in terms of the coordinate system. * A curve is composed of one or more curve segments. Each curve segment within a curve may be defined using a different interpolation method. The curve segments are connected to one another, with the end point of each segment except the last being the start point of the next segment in the segment list. * The orientation of the curve is positive.</documentation> * </annotation> * <complexContent> * <extension base="gml:AbstractCurveType"> * <sequence> * <element ref="gml:segments"> * <annotation> * <documentation>This element encapsulates the segments of the curve.</documentation> * </annotation> * </element> * </sequence> * </extension> * </complexContent> * </complexType> * * </code> * </pre> * </p> * * @generated * * * @source $URL$ */ public class CurveTypeBinding extends org.geotools.gml3.bindings.CurveTypeBinding implements Comparable { public CurveTypeBinding(GeometryFactory gf) { super(gf); } public Object getProperty(Object object, QName name) throws Exception { if (GML.segments.equals(name)) { //Curve curve = (Curve) object; MultiLineString curve = (MultiLineString) object; LineString[] segments = new LineString[curve.getNumGeometries()]; for (int i = 0; i < segments.length; i++) { segments[i] = (LineString) curve.getGeometryN(i); } return segments; } return null; } public int compareTo(Object o) { if (o instanceof LineStringTypeBinding) { return 1; } else { return 0; } } }