public GTVectorDataBinding parseXML(File file) { SimpleFeatureCollection fc = parseSimpleFeatureCollection(file); GTVectorDataBinding data = new GTVectorDataBinding(fc); return data; }
public InputStream generateStream(IData data, String mimeType, String schema) throws IOException { InputStream theStream = ((GenericFileDataWithGTBinding)data).getPayload().getDataStream(); return theStream; }
public InputStream generateStream(IData data, String mimeType, String schema) throws IOException { InputStream theStream = ((GenericFileDataBinding)data).getPayload().getDataStream(); return theStream; }
private IData unwrapSextanteResults(Output outputObject) throws Exception { Object result = outputObject.getOutputObject(); if(result instanceof IVectorLayer){ IVectorLayer vectorLayer = ((IVectorLayer)result); vectorLayer.open(); FeatureStore<?, ?> fs = (FeatureStore<?, ?>) vectorLayer.getBaseDataObject(); return new GTVectorDataBinding(fs.getFeatures()); }else if (result instanceof IRasterLayer){ IRasterLayer rasterLayer = ((IRasterLayer)result); GridCoverage coverage = (GridCoverage) rasterLayer.getBaseDataObject(); return new GTRasterDataBinding((GridCoverage2D)coverage); }else if(result instanceof ITable){ FileOutputChannel outputChannel = (FileOutputChannel) outputObject.getOutputChannel(); File output = new File(outputChannel.getFilename()); return new FileDataBinding(output); } //TODO Extend for literal output return null; }
protected int getNumberOfChunks(Map<String, List<IData>> pInputData) { // return a fixed number // return 3; // return a number depending on an input parameter // int numberOfChunks = ((LiteralIntBinding) pInputData.get("numberOfChunks").get(0)).getPayload().intValue(); // return numberOfChunks; // return a number depending on the complexity of input data FeatureCollection features = ((GTVectorDataBinding) pInputData.get("data").get(0)).getPayload(); return features.size() % 5; }
@Override public GenericFileDataWithGTBinding parse(InputStream input, String mimeType, String schema) { GenericFileDataWithGT theData = new GenericFileDataWithGT(input, mimeType); LOGGER.info("Found File Input " + mimeType); return new GenericFileDataWithGTBinding(theData); }
@Override public GenericFileDataBinding parse(InputStream input, String mimeType, String schema) { GenericFileData theData = new GenericFileData(input, mimeType); LOGGER.info("Found File Input " + mimeType); return new GenericFileDataBinding(theData); }
public File getShpFile() { return getAsGTVectorDataBinding().getPayloadAsShpFile(); }
@Override public GenericXMLDataBinding parse(InputStream input, String mimeType, String schema) { XmlObject xmlData = XmlObject.Factory.newInstance(); try { xmlData = XmlObject.Factory.parse(input); } catch (XmlException e) { LOGGER.error("Could not parse inputstream as XMLObject.", e); } catch (IOException e) { LOGGER.error("Could not parse inputstream as XMLObject.", e); } GenericXMLDataBinding xmlDataBinding = new GenericXMLDataBinding(xmlData); return xmlDataBinding; }
@Override public InputStream generateStream(IData data, String mimeType, String schema) throws IOException { if(data instanceof GenericXMLDataBinding){ XmlObject xmlData = ((GenericXMLDataBinding)data).getPayload(); XmlOptions xmlOptions = new XmlOptions(); xmlOptions.setSaveNoXmlDecl(); return xmlData.newInputStream(xmlOptions); } return XmlObject.Factory.newInstance().newInputStream(); }
private GTVectorDataBinding parseXML(File file) { SimpleFeatureCollection fc = parseFeatureCollection(file); GTVectorDataBinding data = new GTVectorDataBinding(fc); return data; }
public File writeFeatureCollectionToDirectory(IData data, File parent) throws IOException { GTVectorDataBinding binding = (GTVectorDataBinding) data; FeatureCollection originalCollection = binding.getPayload(); FeatureCollection collection = createCorrectFeatureCollection(originalCollection); return createShapefileDirectory(collection, parent); }
@Override public GenericFileDataWithGTBinding parse(InputStream input, String mimeType, String schema) { GenericFileDataWithGT theData = new GenericFileDataWithGT(input, mimeType); LOGGER.info("Found File Input " + mimeType); return new GenericFileDataWithGTBinding(theData); }
public InputStream generateStream(IData data, String mimeType, String schema) throws IOException { InputStream theStream = ((GenericFileDataWithGTBinding)data).getPayload().getDataStream(); return theStream; }
private GTVectorDataBinding parseXML(File file) { Configuration configuration = new KMLConfiguration(); SimpleFeatureCollection fc = new GML3BasicParser().parseFeatureCollection(file, configuration, true); GTVectorDataBinding data = new GTVectorDataBinding(fc); return data; }
private void writeToStream(IData coll, OutputStream os) { FeatureCollection<?, ?> fc = ((GTVectorDataBinding)coll).getPayload(); Configuration configuration = new KMLConfiguration(); Encoder encoder = new org.geotools.xml.Encoder(configuration); try{ encoder.encode(fc, KML.kml, os); }catch(IOException e){ throw new RuntimeException(e); } }
@Override public GenericFileDataWithGTBinding parse(InputStream stream, String mimeType, String schema) { GenericFileDataWithGTBinding data = new GenericFileDataWithGTBinding( new GenericFileDataWithGT(stream, "text/xml")); return data; }
public InputStream generateStream(IData data, String mimeType, String schema) throws IOException { InputStream theStream = ((GenericFileDataWithGTBinding)data).getPayload().getDataStream(); return theStream; }
private GenericFileDataWithGTBinding parseXML(File file) { SimpleFeatureCollection fc = new GML2BasicParser().parseSimpleFeatureCollection(file); GenericFileDataWithGTBinding data = null; try { data = new GenericFileDataWithGTBinding(new GenericFileDataWithGT(fc)); } catch (IOException e) { LOGGER.error("Exception while trying to wrap GenericFileData around GML2 FeatureCollection.", e); } return data; }
@Override public InputStream generateStream(IData data, String mimeType, String schema) throws IOException { // // check for correct request before returning the stream // if (!(this.isSupportedGenerate(data.getSupportedClass(), mimeType, schema))){ // throw new IOException("I don't support the incoming datatype"); // } GTVectorDataBinding vectorBindingData = ((GenericFileDataWithGTBinding)data).getPayload().getAsGTVectorDataBinding(); IGenerator assistanceGen = GeneratorFactory.getInstance().getGenerator(schema, mimeType, IOHandler.DEFAULT_ENCODING, GTVectorDataBinding.class); return assistanceGen.generateStream(vectorBindingData, mimeType, schema); }