GML3SurfacePatchReader extends GML3GeometryBaseReader { private Rectangle parseRectangle( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ) throws XMLStreamException, XMLParsingException, UnknownCRSException { validateAttribute( xmlStream, "interpolation", "planar" ); xmlStream.nextTag(); xmlStream.require( START_ELEMENT, gmlNs, "exterior" ); if ( xmlStream.nextTag() != START_ELEMENT ) { String msg = "Error in 'gml:Rectangle' element. Expected a 'gml:LinearRing' element."; throw new XMLParsingException( xmlStream, msg ); } LinearRing exteriorRing = geometryParser.parseLinearRing( xmlStream, defaultCRS ); if ( exteriorRing.getControlPoints().size() != 5 ) { String msg = "Error in 'gml:Rectangle' element. Exterior ring must contain exactly five points, but contains " + exteriorRing.getControlPoints().size(); throw new XMLParsingException( xmlStream, msg ); } xmlStream.nextTag(); xmlStream.require( END_ELEMENT, gmlNs, "exterior" ); xmlStream.nextTag(); xmlStream.require( END_ELEMENT, gmlNs, "Rectangle" ); return geomFac.createRectangle( exteriorRing ); } GML3SurfacePatchReader( GML3GeometryReader geometryParser, GMLStreamReader gmlStream );   }
@Test public void parseRectangle() throws XMLStreamException, FactoryConfigurationError, IOException, XMLParsingException, UnknownCRSException { XMLStreamReaderWrapper parser = getParser( "Rectangle.gml" ); Rectangle patch = (Rectangle) getPatchParser().parseSurfacePatch( parser, CRSManager.getCRSRef( "EPSG:4326" ) ); Assert.assertEquals( 5, patch.getExteriorRing().getControlPoints().size() ); }