GML3CurveSegmentReader extends GML3GeometryBaseReader { private CubicSpline parseCubicSpline( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ) throws XMLParsingException, XMLStreamException, UnknownCRSException { validateInterpolationAttribute( xmlStream, "cubicSpline" ); xmlStream.nextTag(); Points points = parseControlPoints( xmlStream, defaultCRS ); if ( points.size() < 2 ) { String msg = "Error in 'gml:CubicSpline' element. Must consist of two points at least."; throw new XMLParsingException( xmlStream, msg ); } xmlStream.require( XMLStreamConstants.START_ELEMENT, gmlNs, "vectorAtStart" ); Point vectorAtStart = parseDirectPositionType( xmlStream, defaultCRS ); xmlStream.nextTag(); xmlStream.require( XMLStreamConstants.START_ELEMENT, gmlNs, "vectorAtEnd" ); Point vectorAtEnd = parseDirectPositionType( xmlStream, defaultCRS ); xmlStream.nextTag(); xmlStream.require( XMLStreamConstants.END_ELEMENT, gmlNs, "CubicSpline" ); return geomFac.createCubicSpline( points, vectorAtStart, vectorAtEnd ); } GML3CurveSegmentReader( GML3GeometryReader geometryParser, GMLStreamReader gmlStream );   }
@Test public void parseCubicSpline() throws XMLStreamException, FactoryConfigurationError, IOException, XMLParsingException, UnknownCRSException { CubicSpline segment = (CubicSpline) getParser().parseCurveSegment( getReader( "CubicSpline.gml" ), CRSManager.getCRSRef( "EPSG:4326" ) ); Assert.assertEquals( 3, segment.getControlPoints().size() ); Assert.assertEquals( -2.0, segment.getControlPoints().get( 0 ).get0() ); Assert.assertEquals( 0.0, segment.getControlPoints().get( 0 ).get1() ); Assert.assertEquals( -4.0, segment.getControlPoints().get( 1 ).get0() ); Assert.assertEquals( 0.0, segment.getControlPoints().get( 1 ).get1() ); Assert.assertEquals( -6.0, segment.getControlPoints().get( 2 ).get0() ); Assert.assertEquals( 1.0, segment.getControlPoints().get( 2 ).get1() ); Assert.assertEquals( 0.0, segment.getVectorAtStart().get0() ); Assert.assertEquals( -1.0, segment.getVectorAtStart().get1() ); Assert.assertEquals( -1.0, segment.getVectorAtEnd().get0() ); Assert.assertEquals( 1.0, segment.getVectorAtEnd().get1() ); }