GML3CurveSegmentReader extends GML3GeometryBaseReader { LineStringSegment parseLineStringSegment( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ) throws XMLParsingException, XMLStreamException, UnknownCRSException { validateInterpolationAttribute( xmlStream, "linear" ); xmlStream.nextTag(); Points points = parseControlPoints( xmlStream, defaultCRS ); if ( points.size() < 2 ) { String msg = "Error in 'gml:LineStringSegment' element. Must consist of two points at least."; throw new XMLParsingException( xmlStream, msg ); } xmlStream.require( XMLStreamConstants.END_ELEMENT, gmlNs, "LineStringSegment" ); return geomFac.createLineStringSegment( points ); } GML3CurveSegmentReader( GML3GeometryReader geometryParser, GMLStreamReader gmlStream );   }
@Test public void parseLineStringSegment() throws XMLStreamException, FactoryConfigurationError, IOException, XMLParsingException, UnknownCRSException { LineStringSegment arc = (LineStringSegment) getParser().parseCurveSegment( getReader( "LineStringSegment.gml" ), null ); Assert.assertEquals( 3, arc.getControlPoints().size() ); Assert.assertEquals( 2.0, arc.getControlPoints().get( 0 ).get0() ); Assert.assertEquals( 0.0, arc.getControlPoints().get( 0 ).get1() ); Assert.assertEquals( 0.0, arc.getControlPoints().get( 1 ).get0() ); Assert.assertEquals( 2.0, arc.getControlPoints().get( 1 ).get1() ); Assert.assertEquals( -2.0, arc.getControlPoints().get( 2 ).get0() ); Assert.assertEquals( 0.0, arc.getControlPoints().get( 2 ).get1() ); }