GML3CurveSegmentReader extends GML3GeometryBaseReader { private GeodesicString parseGeodesicString( 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:GeodesicString' element. Must consist of two points at least."; throw new XMLParsingException( xmlStream, msg ); } xmlStream.require( XMLStreamConstants.END_ELEMENT, gmlNs, "GeodesicString" ); return geomFac.createGeodesicString( geomFac.createPoints( points ) ); } GML3CurveSegmentReader( GML3GeometryReader geometryParser, GMLStreamReader gmlStream );   }
@Test public void parseGeodesicString() throws XMLStreamException, FactoryConfigurationError, IOException, XMLParsingException, UnknownCRSException { GeodesicString segment = (GeodesicString) getParser().parseCurveSegment( getReader( "GeodesicString.gml" ), null ); 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( 0.0, segment.getControlPoints().get( 1 ).get0() ); Assert.assertEquals( 2.0, segment.getControlPoints().get( 1 ).get1() ); Assert.assertEquals( -2.0, segment.getControlPoints().get( 2 ).get0() ); Assert.assertEquals( 0.0, segment.getControlPoints().get( 2 ).get1() ); }