GML3GeometryReader extends GML3GeometryBaseReader implements GMLGeometryReader { private GMLObjectType getType( XMLStreamReader xmlStream ) { GMLObjectType type = null; if ( schema != null && schema.getGMLSchema() != null ) { QName name = xmlStream.getName(); type = schema.getGeometryType( name ); if ( type == null ) { LOG.debug( "GML geometry element '" + name + "' is not defined in application schema!?" ); } } return type; } 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 parseStandardPropsGML311() throws XMLStreamException, FactoryConfigurationError, IOException, UnknownCRSException, ClassCastException, ClassNotFoundException, InstantiationException, IllegalAccessException { String schemaUrl = "http: GMLAppSchemaReader adapter = new GMLAppSchemaReader( GML_31, null, schemaUrl ); AppSchema schema = adapter.extractAppSchema(); GMLStreamReader gmlReader = getParser( "StandardPropsGML311.gml" ); gmlReader.setApplicationSchema( schema ); XMLStreamReader xmlReader = gmlReader.getXMLReader(); assertEquals( XMLStreamConstants.START_ELEMENT, xmlReader.getEventType() ); assertEquals( new QName( "http: Point point = (Point) gmlReader.readGeometry(); assertEquals( XMLStreamConstants.END_ELEMENT, xmlReader.getEventType() ); assertEquals( new QName( "http: assertEquals( 7.12, point.get0(), DELTA ); assertEquals( 50.72, point.get1(), DELTA ); assertEquals( 2, point.getCoordinateDimension() ); assertEquals( CRSManager.lookup( "EPSG:4326" ), point.getCoordinateSystem() ); assertEquals( 6, point.getProperties().size() ); assertEquals( QName.valueOf( "{http: point.getProperties().get( 0 ).getName() ); GenericXMLElement mdProp1 = (GenericXMLElement) point.getProperties().get( 0 ).getValue(); assertNotNull( mdProp1.getXSType() ); assertEquals( 1, mdProp1.getChildren().size() ); GenericXMLElement genericMetadata = (GenericXMLElement) mdProp1.getChildren().get( 0 ); Assert.assertNull( genericMetadata.getXSType() ); assertEquals( QName.valueOf( "{http: assertEquals( 1, genericMetadata.getChildren().size() ); PrimitiveValue pv = (PrimitiveValue) genericMetadata.getChildren().get( 0 ); assertEquals( BaseType.STRING, pv.getType().getBaseType() ); assertEquals( "Example for metadata: Ce point ne pas une point.", pv.getValue() ); assertEquals( QName.valueOf( "{http: point.getProperties().get( 1 ).getName() ); GenericXMLElement mdProp2 = (GenericXMLElement) point.getProperties().get( 1 ).getValue(); assertNotNull( mdProp2.getXSType() ); assertEquals( 1, mdProp2.getChildren().size() ); GenericXMLElement myMetadata = (GenericXMLElement) mdProp2.getChildren().get( 0 ); Assert.assertNull( myMetadata.getXSType() ); assertEquals( QName.valueOf( "{http: assertEquals( 1, myMetadata.getChildren().size() ); pv = (PrimitiveValue) myMetadata.getChildren().get( 0 ); assertEquals( STRING, pv.getType().getBaseType() ); assertEquals( "Actually, in GML 3.1.1, anything may appear here, content is not constrained.", pv.getValue() ); assertEquals( QName.valueOf( "{http: point.getProperties().get( 2 ).getName() ); GenericXMLElement descriptionProp = (GenericXMLElement) point.getProperties().get( 2 ).getValue(); assertNotNull( descriptionProp.getXSType() ); assertEquals( 1, descriptionProp.getChildren().size() ); pv = (PrimitiveValue) descriptionProp.getChildren().get( 0 ); assertEquals( STRING, pv.getType().getBaseType() ); assertEquals( "This is just for testing the parsing of standard GML properties.", pv.getValue() ); assertEquals( QName.valueOf( "{http: GenericXMLElement nameProp1 = (GenericXMLElement) point.getProperties().get( 3 ).getValue(); assertNotNull( nameProp1.getXSType() ); assertEquals( 1, nameProp1.getChildren().size() ); pv = (PrimitiveValue) nameProp1.getChildren().get( 0 ); assertEquals( STRING, pv.getType().getBaseType() ); assertEquals( "Point P1", pv.getValue() ); assertEquals( QName.valueOf( "{http: GenericXMLElement nameProp2 = (GenericXMLElement) point.getProperties().get( 4 ).getValue(); assertNotNull( nameProp2.getXSType() ); assertEquals( 1, nameProp2.getChildren().size() ); pv = (PrimitiveValue) nameProp2.getChildren().get( 0 ); assertEquals( STRING, pv.getType().getBaseType() ); assertEquals( "P1", pv.getValue() ); assertEquals( QName.valueOf( "{http: GenericXMLElement nameProp3 = (GenericXMLElement) point.getProperties().get( 5 ).getValue(); assertNotNull( nameProp3.getXSType() ); assertEquals( 1, nameProp3.getChildren().size() ); pv = (PrimitiveValue) nameProp3.getChildren().get( 0 ); assertEquals( STRING, pv.getType().getBaseType() ); assertEquals( "Point_P1", pv.getValue() ); }