GML3CurveSegmentReader extends GML3GeometryBaseReader { private ArcStringByBulge parseArcStringByBulge( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ) throws XMLParsingException, XMLStreamException, UnknownCRSException { validateInterpolationAttribute( xmlStream, "circularArc2PointWithBulge" ); xmlStream.nextTag(); Points points = parseControlPoints( xmlStream, defaultCRS ); if ( points.size() < 2 ) { String msg = "Error in 'gml:ArcStringByBulge' element. Must contain at least two points."; throw new XMLParsingException( xmlStream, msg ); } double[] bulges = new double[points.size() - 1]; for ( int i = 0; i < bulges.length; i++ ) { bulges[i] = xmlStream.getElementTextAsDouble( gmlNs, "bulge" ); xmlStream.nextTag(); } List<Point> normals = new ArrayList<Point>( points.size() - 1 ); for ( int i = 0; i < bulges.length; i++ ) { xmlStream.require( XMLStreamConstants.START_ELEMENT, gmlNs, "normal" ); ICRS normalCRS = determineActiveCRS( xmlStream, defaultCRS ); double[] coords = parseDoubleList( xmlStream ); normals.add( geomFac.createPoint( null, coords, normalCRS ) ); xmlStream.nextTag(); } xmlStream.require( XMLStreamConstants.END_ELEMENT, gmlNs, "ArcStringByBulge" ); return geomFac.createArcStringByBulge( points, bulges, geomFac.createPoints( normals ) ); } GML3CurveSegmentReader( GML3GeometryReader geometryParser, GMLStreamReader gmlStream );   }
@Test public void parseArcStringByBulge() throws XMLStreamException, FactoryConfigurationError, IOException, XMLParsingException, UnknownCRSException { ArcStringByBulge arc = (ArcStringByBulge) getParser().parseCurveSegment( getReader( "ArcStringByBulge.gml" ), CRSManager.getCRSRef( "EPSG:4326" ) ); Assert.assertEquals( 3, arc.getNumArcs() ); Assert.assertEquals( 4, arc.getControlPoints().size() ); Assert.assertEquals( 2.0, arc.getControlPoints().get( 0 ).get0() ); Assert.assertEquals( 0.0, arc.getControlPoints().get( 0 ).get1() ); Assert.assertEquals( -2.0, arc.getControlPoints().get( 1 ).get0() ); Assert.assertEquals( 0.0, arc.getControlPoints().get( 1 ).get1() ); Assert.assertEquals( -4.0, arc.getControlPoints().get( 2 ).get0() ); Assert.assertEquals( 0.0, arc.getControlPoints().get( 2 ).get1() ); Assert.assertEquals( -6.0, arc.getControlPoints().get( 3 ).get0() ); Assert.assertEquals( 0.0, arc.getControlPoints().get( 3 ).get1() ); }