GML3CurveSegmentReader extends GML3GeometryBaseReader { private Geodesic parseGeodesic( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ) throws XMLParsingException, XMLStreamException, UnknownCRSException { validateInterpolationAttribute( xmlStream, "geodesic" ); List<Point> points = null; if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) { String name = xmlStream.getLocalName(); if ( "posList".equals( name ) ) { points = parsePosList( xmlStream, defaultCRS ); xmlStream.nextTag(); } else { points = new LinkedList<Point>(); do { name = xmlStream.getLocalName(); if ( "pos".equals( name ) ) { points.add( parseDirectPositionType( xmlStream, defaultCRS ) ); } else if ( "pointProperty".equals( name ) ) { points.add( geometryParser.parsePointProperty( xmlStream, defaultCRS ) ); } else { break; } } while ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ); } } if ( points.size() != 2 ) { String msg = "Error in 'gml:Geodesic' element. Must consist of exactly two points."; throw new XMLParsingException( xmlStream, msg ); } xmlStream.require( XMLStreamConstants.END_ELEMENT, gmlNs, "Geodesic" ); return geomFac.createGeodesic( points.get( 0 ), points.get( 1 ) ); } GML3CurveSegmentReader( GML3GeometryReader geometryParser, GMLStreamReader gmlStream );   }
@Test public void parseGeodesic() throws XMLStreamException, FactoryConfigurationError, IOException, XMLParsingException, UnknownCRSException { Geodesic segment = (Geodesic) getParser().parseCurveSegment( getReader( "Geodesic.gml" ), null ); Assert.assertEquals( 2, segment.getControlPoints().size() ); Assert.assertEquals( 2.0, segment.getControlPoints().get( 0 ).get0() ); Assert.assertEquals( 0.0, segment.getControlPoints().get( 0 ).get1() ); Assert.assertEquals( 0.0, segment.getControlPoints().get( 1 ).get0() ); Assert.assertEquals( 2.0, segment.getControlPoints().get( 1 ).get1() ); }