GML3CurveSegmentReader extends GML3GeometryBaseReader { private ArcByCenterPoint parseArcByCenterPoint( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ) throws XMLParsingException, XMLStreamException, UnknownCRSException { validateInterpolationAttribute( xmlStream, "circularArcCenterPointWithRadius" ); xmlStream.nextTag(); Points points = parseControlPoints( xmlStream, defaultCRS ); if ( points.size() != 1 ) { String msg = "Error in 'gml:ArcByCenterPoint' element. Must contain one control point (the center point), but contains " + points.size() + "."; throw new XMLParsingException( xmlStream, msg ); } xmlStream.require( XMLStreamConstants.START_ELEMENT, gmlNs, "radius" ); Length radius = parseLengthType( xmlStream ); xmlStream.nextTag(); Angle startAngle = null; if ( xmlStream.getEventType() == START_ELEMENT ) { String localName = xmlStream.getName().getLocalPart(); if ( "startAngle".equals( localName ) ) { startAngle = parseAngleType( xmlStream ); xmlStream.nextTag(); } } Angle endAngle = null; if ( xmlStream.getEventType() == START_ELEMENT ) { String localName = xmlStream.getName().getLocalPart(); if ( "endAngle".equals( localName ) ) { endAngle = parseAngleType( xmlStream ); xmlStream.nextTag(); } } xmlStream.require( XMLStreamConstants.END_ELEMENT, gmlNs, "ArcByCenterPoint" ); return geomFac.createArcByCenterPoint( points.get( 0 ), radius, startAngle, endAngle ); } GML3CurveSegmentReader( GML3GeometryReader geometryParser, GMLStreamReader gmlStream );   }
@Test public void parseArcByCenterPoint() throws XMLStreamException, FactoryConfigurationError, IOException, XMLParsingException, UnknownCRSException { ArcByCenterPoint arc = (ArcByCenterPoint) getParser().parseCurveSegment( getReader( "ArcByCenterPoint.gml" ), CRSManager.getCRSRef( "EPSG:4326" ) ); Assert.assertEquals( 2, arc.getMidPoint().getCoordinateDimension() ); Assert.assertEquals( 47.0, arc.getMidPoint().get0() ); Assert.assertEquals( 11.0, arc.getMidPoint().get1() ); Assert.assertEquals( 1.0, arc.getRadius( null ).getValueAsDouble() ); Assert.assertEquals( "whatever#metres", arc.getRadius( null ).getUomUri() ); Assert.assertEquals( 180.0, arc.getStartAngle().getValueAsDouble() ); Assert.assertEquals( "whatever#degrees", arc.getStartAngle().getUomUri() ); Assert.assertEquals( 360.0, arc.getEndAngle().getValueAsDouble() ); Assert.assertEquals( "whatever#degrees", arc.getEndAngle().getUomUri() ); }