GML3CurveSegmentReader extends GML3GeometryBaseReader { private ArcByBulge parseArcByBulge( 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:ArcByBulge' element. Must contain exactly two control points."; throw new XMLParsingException( xmlStream, msg ); } double bulge = xmlStream.getElementTextAsDouble( gmlNs, "bulge" ); xmlStream.nextTag(); xmlStream.require( XMLStreamConstants.START_ELEMENT, gmlNs, "normal" ); ICRS normalCRS = determineActiveCRS( xmlStream, defaultCRS ); double[] coords = parseDoubleList( xmlStream ); Point normal = geomFac.createPoint( null, coords, normalCRS ); xmlStream.nextTag(); xmlStream.require( XMLStreamConstants.END_ELEMENT, gmlNs, "ArcByBulge" ); return geomFac.createArcByBulge( points.get( 0 ), points.get( 1 ), bulge, normal ); } GML3CurveSegmentReader( GML3GeometryReader geometryParser, GMLStreamReader gmlStream );   }
@Test public void parseArcByBulge() throws XMLStreamException, FactoryConfigurationError, IOException, XMLParsingException, UnknownCRSException { ArcByBulge arc = (ArcByBulge) getParser().parseCurveSegment( getReader( "ArcByBulge.gml" ), CRSManager.getCRSRef( "EPSG:4326" ) ); Assert.assertEquals( 1, arc.getNumArcs() ); Assert.assertEquals( 2, arc.getControlPoints().size() ); Assert.assertEquals( 2.0, arc.getPoint1().get0() ); Assert.assertEquals( 0.0, arc.getPoint1().get1() ); Assert.assertEquals( -2.0, arc.getPoint2().get0() ); Assert.assertEquals( 0.0, arc.getPoint2().get1() ); Assert.assertEquals( 1, arc.getBulges().length ); Assert.assertEquals( 2.0, arc.getBulge() ); Assert.assertEquals( 1, arc.getNormals().size() ); Assert.assertEquals( -1.0, arc.getNormal().get0() ); }