GML3GeometryReader extends GML3GeometryBaseReader implements GMLGeometryReader { public Tin parseTin( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ) throws XMLStreamException, XMLParsingException, UnknownCRSException { QName elName = xmlStream.getName(); GMLObjectType type = getType( xmlStream ); String gid = parseGeometryId( xmlStream ); ICRS crs = determineActiveCRS( xmlStream, defaultCRS ); List<Property> props = readStandardProperties( xmlStream, type, crs ); List<Triangle> memberPatches = new LinkedList<Triangle>(); xmlStream.require( START_ELEMENT, gmlNs, "trianglePatches" ); while ( xmlStream.nextTag() == START_ELEMENT ) { memberPatches.add( surfacePatchParser.parseTriangle( xmlStream, crs ) ); } xmlStream.require( END_ELEMENT, gmlNs, "trianglePatches" ); List<List<LineStringSegment>> stopLines = new LinkedList<List<LineStringSegment>>(); if ( xmlStream.nextTag() == START_ELEMENT ) { while ( xmlStream.getLocalName().equals( "stopLines" ) ) { List<LineStringSegment> segments = new LinkedList<LineStringSegment>(); while ( xmlStream.nextTag() == START_ELEMENT ) { xmlStream.require( START_ELEMENT, gmlNs, "LineStringSegment" ); segments.add( curveSegmentParser.parseLineStringSegment( xmlStream, crs ) ); xmlStream.require( END_ELEMENT, gmlNs, "LineStringSegment" ); } xmlStream.require( END_ELEMENT, gmlNs, "stopLines" ); stopLines.add( segments ); xmlStream.nextTag(); } } List<List<LineStringSegment>> breakLines = new LinkedList<List<LineStringSegment>>(); if ( xmlStream.getEventType() == START_ELEMENT ) { while ( xmlStream.getLocalName().equals( "breakLines" ) ) { List<LineStringSegment> segments = new LinkedList<LineStringSegment>(); while ( xmlStream.nextTag() == START_ELEMENT ) { xmlStream.require( START_ELEMENT, gmlNs, "LineStringSegment" ); segments.add( curveSegmentParser.parseLineStringSegment( xmlStream, crs ) ); xmlStream.require( END_ELEMENT, gmlNs, "LineStringSegment" ); } xmlStream.require( END_ELEMENT, gmlNs, "breakLines" ); breakLines.add( segments ); xmlStream.nextTag(); } } xmlStream.require( START_ELEMENT, gmlNs, "maxLength" ); Length maxLength = parseLengthType( xmlStream ); xmlStream.nextTag(); List<Point> controlPoints = null; xmlStream.require( START_ELEMENT, gmlNs, "controlPoint" ); if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) { String name = xmlStream.getLocalName(); if ( "posList".equals( name ) ) { controlPoints = parsePosList( xmlStream, crs ); xmlStream.nextTag(); } else { controlPoints = new LinkedList<Point>(); do { if ( "pos".equals( name ) ) { double[] coords = parseDoubleList( xmlStream ); controlPoints.add( geomFac.createPoint( gid, coords, crs ) ); } else if ( "pointProperty".equals( name ) ) { controlPoints.add( parsePointProperty( xmlStream, crs ) ); } else { String msg = "Error in 'gml:Tin' element."; throw new XMLParsingException( xmlStream, msg ); } } while ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ); } } nextElement( xmlStream ); if ( controlPoints.size() < 3 ) { String msg = "Error in 'gml:Tin' element. Must specify three control points (=one triangle) at least."; throw new XMLParsingException( xmlStream, msg ); } Tin tin = geomFac.createTin( gid, crs, stopLines, breakLines, maxLength, geomFac.createPoints( controlPoints ), memberPatches ); tin.setType( type ); props.addAll( readAdditionalProperties( xmlStream, type, crs ) ); tin.setProperties( props ); idContext.addObject( tin ); xmlStream.require( END_ELEMENT, elName.getNamespaceURI(), elName.getLocalPart() ); idContext.addObject( tin ); return tin; } GML3GeometryReader( GMLStreamReader gmlStream ); @Override boolean isGeometryElement( XMLStreamReader reader ); @Override boolean isGeometryOrEnvelopeElement( XMLStreamReader reader ); boolean isGeometryElement( QName elName ); boolean isGeometryOrEnvelopeElement( QName elName ); @Override Geometry parse( XMLStreamReaderWrapper xmlStream ); @Override Geometry parse( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Geometry parseGeometryOrEnvelope( XMLStreamReaderWrapper xmlStream ); @Override Geometry parseGeometryOrEnvelope( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); GeometricPrimitive parseGeometricPrimitive( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); MultiGeometry<? extends Geometry> parseGeometricAggregate( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Geometry parseAbstractGeometricComplex( XMLStreamReaderWrapper xmlStream, CRS defaultCRS ); Geometry parseImplicitGeometry( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Curve parseAbstractCurve( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Ring parseAbstractRing( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Surface parseAbstractSurface( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Solid parseAbstractSolid( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Point parsePoint( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); LineString parseLineString( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Curve parseCurve( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); OrientableCurve parseOrientableCurve( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); LinearRing parseLinearRing( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Ring parseRing( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Polygon parsePolygon( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Surface parseSurface( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); PolyhedralSurface parsePolyhedralSurface( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); TriangulatedSurface parseTriangulatedSurface( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Tin parseTin( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); OrientableSurface parseOrientableSurface( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Solid parseSolid( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); CompositeCurve parseCompositeCurve( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); CompositeSurface parseCompositeSurface( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); CompositeSolid parseCompositeSolid( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); CompositeGeometry<GeometricPrimitive> parseGeometricComplex( XMLStreamReaderWrapper xmlStream,
                                                                        ICRS defaultCRS ); MultiPoint parseMultiPoint( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); MultiCurve<?> parseMultiCurve( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); MultiLineString parseMultiLineString( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); MultiSurface<?> parseMultiSurface( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); MultiPolygon parseMultiPolygon( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); MultiSolid parseMultiSolid( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); MultiGeometry<Geometry> parseMultiGeometry( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Envelope parseEnvelope( XMLStreamReaderWrapper xmlStream ); @Override Envelope parseEnvelope( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Point parsePointProperty( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); LineString parseLineStringProperty( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Curve parseCurveProperty( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Polygon parsePolygonProperty( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Surface parseSurfaceProperty( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Solid parseSolidProperty( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); GeometricPrimitive parseGeometricPrimitiveProperty( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS ); Geometry parseGeometryProperty( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS );  }
@Test public void parseTin() throws XMLStreamException, FactoryConfigurationError, IOException, XMLParsingException, UnknownCRSException { GMLStreamReader gmlReader = getParser( "Tin.gml" ); XMLStreamReader xmlReader = gmlReader.getXMLReader(); Assert.assertEquals( XMLStreamConstants.START_ELEMENT, xmlReader.getEventType() ); Assert.assertEquals( new QName( "http: Tin surface = (Tin) gmlReader.readGeometry(); Assert.assertEquals( XMLStreamConstants.END_ELEMENT, xmlReader.getEventType() ); Assert.assertEquals( new QName( "http: Assert.assertEquals( SurfaceType.Tin, surface.getSurfaceType() ); Assert.assertEquals( 2, surface.getStopLines().size() ); Assert.assertEquals( 1, surface.getBreakLines().size() ); Assert.assertEquals( 15.0, surface.getMaxLength( null ).getValueAsDouble(), DELTA ); Assert.assertEquals( 3, surface.getControlPoints().size() ); Assert.assertEquals( 3.0, surface.getControlPoints().get( 2 ).get0(), DELTA ); Assert.assertEquals( 4.0, surface.getControlPoints().get( 2 ).get1(), DELTA ); }