GML3GeometryWriter extends AbstractGMLObjectWriter implements GMLGeometryWriter { protected void exportSurfacePatch( SurfacePatch surfacePatch ) throws XMLStreamException, UnknownCRSException, TransformationException { switch ( surfacePatch.getSurfacePatchType() ) { case GRIDDED_SURFACE_PATCH: GriddedSurfacePatch gridded = (GriddedSurfacePatch) surfacePatch; switch ( gridded.getGriddedSurfaceType() ) { case GRIDDED_SURFACE_PATCH: break; case CONE: exportCone( (Cone) surfacePatch ); break; case CYLINDER: exportCylinder( (Cylinder) surfacePatch ); break; case SPHERE: exportSphere( (Sphere) surfacePatch ); break; } break; case POLYGON_PATCH: exportPolygonPatch( (PolygonPatch) surfacePatch ); break; } } GML3GeometryWriter( GMLStreamWriter gmlStreamWriter ); @SuppressWarnings("unchecked") @Override void export( Geometry geometry ); @Override void exportReference( GeometryReference<Geometry> geometryRef ); @SuppressWarnings("unchecked") @Override void exportMultiGeometry( MultiGeometry<? extends Geometry> geometry ); @Override void exportPoint( Point point ); @Override void exportCurve( Curve curve ); @Override void exportSurface( Surface surface ); @Override void exportTriangulatedSurface( TriangulatedSurface triangSurface ); @Override void exportTin( Tin tin ); @Override void exportSolid( Solid solid ); @Override void exportRing( Ring ring ); @Override void exportCompositeCurve( CompositeCurve compositeCurve ); @Override void exportCompositeSurface( CompositeSurface compositeSurface ); @Override void exportCompositeSolid( CompositeSolid compositeSolid ); @Override void exportEnvelope( Envelope envelope ); @Override void exportCompositeGeometry( CompositeGeometry<GeometricPrimitive> geometryComplex );  }
@Test public void testValidatingExportedSurfacePatches() throws XMLStreamException, XMLParsingException, UnknownCRSException, FactoryConfigurationError, IOException, TransformationException { for ( String patchSource : patchSources ) { URL docURL = GML3GeometryWriterTest.class.getResource( PATCH_DIR + patchSource ); if ( docURL == null ) LOG.debug( "patch dir: " + GML3GeometryWriterTest.class.getResource( PATCH_DIR + patchSource ) ); GMLStreamReader parser = getGML31StreamReader( docURL ); XMLStreamReaderWrapper xmlReader = new XMLStreamReaderWrapper( parser.getXMLReader(), docURL.toString() ); SurfacePatch surfPatch = ( (GML3GeometryReader) parser.getGeometryReader() ).getSurfacePatchReader().parseSurfacePatch( xmlReader, null ); XMLMemoryStreamWriter memoryWriter = new XMLMemoryStreamWriter(); SchemaLocationXMLStreamWriter writer = new SchemaLocationXMLStreamWriter( memoryWriter.getXMLStreamWriter(), SCHEMA_LOCATION_ATTRIBUTE ); GMLStreamWriter exporter = GMLOutputFactory.createGMLStreamWriter( GML_31, writer ); ( (GML3GeometryWriter) exporter.getGeometryWriter() ).exportSurfacePatch( surfPatch ); writer.flush(); XMLAssert.assertValidity( memoryWriter.getReader(), SCHEMA_LOCATION ); } }