public DelegateProgressListener( org.opengis.util.ProgressListener progress ){ if( progress == null ) progress = new NullProgressListener(); this.delegate = progress; }
public ExecuteResponseType build() { return build(new NullProgressListener()); }
/** * {@code SwingWorker} method to visit each feature and retrieve * its attributes */ public List<Object[]> doInBackground() { List<Object[]> list = new ArrayList<Object[]>(); final NullProgressListener listener = new NullProgressListener(); try { features.accepts( new FeatureVisitor() { public void visit(Feature feature) { SimpleFeature simple = (SimpleFeature) feature; Object[] values = simple.getAttributes().toArray(); ArrayList<Object> row = new ArrayList<Object>( Arrays.asList( values )); row.add(0, simple.getID() ); publish( row.toArray() ); if( isCancelled() ) listener.setCanceled(true); } } , listener ); } catch (IOException e) { exception = e; } return list; }
@Override public int getCoveragesNumber(ProgressListener listener) { if (listener == null) listener = new NullProgressListener(); listener.started(); try { return names.size(); } finally { listener.complete(); } }
@Override public List<Name> getNames(ProgressListener listener) { if (listener == null) { listener = new NullProgressListener(); } listener.started(); try { return Collections.unmodifiableList(names); } finally { listener.complete(); } }
/** * Returns the Coverages available with this coverage response. * * @param listener * @return a collection of coverages. */ public Collection<? extends Coverage> getResults(ProgressListener listener) { if (listener == null) listener = new NullProgressListener(); listener.started(); try { synchronized (this.results) { return new ArrayList<GridCoverage>(this.results); } } finally { listener.complete(); } }
/** * Calculates the bounds of the features without caching. */ @Override public ReferencedEnvelope getBounds() { BoundsVisitor bounds = new BoundsVisitor(); accepts(bounds, new NullProgressListener()); return bounds.getBounds(); }
/** * Calculates the bounds of the features without caching. * * TODO Have some pro look at this code. * author by Stefan Krueger */ @Override public ReferencedEnvelope getBounds() { BoundsVisitor bounds = new BoundsVisitor(); accepts( bounds, new NullProgressListener() ); return bounds.getBounds(); }
final public Map<String,Object> execute( Map<String,Object> input, ProgressListener monitor ) { if (started) throw new IllegalStateException("Process can only be run once"); started = true; if( monitor == null ) monitor = new NullProgressListener(); try { if( monitor.isCanceled() ) return null; // respect isCanceled this.input = input; result = new HashMap<String,Object>(); process(); return result; } catch( Throwable eek){ monitor.exceptionOccurred( eek ); return null; } finally { monitor.complete(); } }
public CoverageSource access( Name name, Map<String, Serializable> params, AccessType accessType, Hints hints, ProgressListener listener) throws IOException { if (listener == null) { listener = new NullProgressListener(); } listener.started(); try { return new NetCDFSource((NetCDFImageReader) reader, name); } catch (Throwable e) { LOGGER.log(Level.SEVERE, "Failed to access the NetCDF source", e); listener.exceptionOccurred(e); return null; } finally { listener.complete(); } }
@Override public ServiceInfo getInfo(ProgressListener listener) { if (listener == null) { listener = new NullProgressListener(); } listener.started(); final DefaultServiceInfo info = new DefaultServiceInfo(); // Fix that Collection<Name> coverageNames = getNames(listener); Iterator<Name> namesIterator = coverageNames.iterator(); if (namesIterator.hasNext()) { info.setTitle(namesIterator.next().toString()); } try { info.setSource(source.toURI()); } catch (URISyntaxException e1) { } finally { listener.complete(); } return info; }
/** * Returns the GML version used in the feature type's definition. * * <p>The method recursively climbs up the type hierarchy of the provided feature type, until it * finds AbstractFeatureType. Then, the GML version is determined by looking at the namespace * URI. * * <p>Please note that this method does not differentiate between GML 2 and GML 3.1.1, but * assumes that "http://www.opengis.net/gml" namespace always refers to GML 3.1.1. * * @param ftInfo the feature type info * @return the GML version used in the feature type definition * @throws IOException if the underlying datastore instance cannot be retrieved */ String findGmlVersion(FeatureTypeInfo ftInfo) throws IOException { ProgressListener listener = new NullProgressListener(); Name qName = ftInfo.getQualifiedName(); FeatureType fType = ftInfo.getStore().getDataStore(listener).getSchema(qName); return findFeatureTypeGmlVersion(fType); }
public void accepts(final FeatureVisitor visitor, ProgressListener listener) throws IOException { Envelope everything = new Envelope(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY); final ProgressListener progress = listener != null ? listener : new NullProgressListener(); progress.started(); final float size = (float) size(); index.query(everything, new ItemVisitor() { float count = 0f; public void visitItem(Object item) { try { SimpleFeature feature = (SimpleFeature) item; visitor.visit(feature); } catch (Throwable t) { progress.exceptionOccurred(t); } finally { progress.progress(count / size); } } }); progress.complete(); }
public void accepts(org.opengis.feature.FeatureVisitor visitor, org.opengis.util.ProgressListener progress) { Iterator iterator = null; if (progress == null) progress = new NullProgressListener(); try{ float size = size(); float position = 0; progress.started(); for( iterator = iterator(); !progress.isCanceled() && iterator.hasNext(); progress.progress( 100.0f * position++ / size )){ try { SimpleFeature feature = (SimpleFeature) iterator.next(); visitor.visit(feature); } catch( Exception erp ){ progress.exceptionOccurred( erp ); } } } finally { progress.complete(); close( iterator ); } }
public void accepts(org.opengis.feature.FeatureVisitor visitor, org.opengis.util.ProgressListener progress) { Iterator iterator = null; if (progress == null) progress = new NullProgressListener(); try{ float size = size(); float position = 0; progress.started(); for( iterator = iterator(); !progress.isCanceled() && iterator.hasNext(); progress.progress( position++/size )){ try { SimpleFeature feature = (SimpleFeature) iterator.next(); visitor.visit(feature); } catch( Exception erp ){ progress.exceptionOccurred( erp ); } } } finally { progress.complete(); close( iterator ); } }
public void accepts(FeatureVisitor visitor, ProgressListener progress) throws IOException { Iterator iterator = null; if (progress == null) progress = new NullProgressListener(); try { float size = size(); float position = 0; progress.started(); for (iterator = iterator(); !progress.isCanceled() && iterator.hasNext(); progress .progress(position++ / size)) { try { SimpleFeature feature = (SimpleFeature) iterator.next(); visitor.visit(feature); } catch (Exception erp) { progress.exceptionOccurred(erp); } } } finally { progress.complete(); close(iterator); } }
public void accepts(org.opengis.feature.FeatureVisitor visitor, org.opengis.util.ProgressListener progress) { Iterator iterator = null; if (progress == null) progress = new NullProgressListener(); try { float size = size(); float position = 0; progress.started(); for (iterator = iterator(); !progress.isCanceled() && iterator.hasNext(); progress .progress(position++ / size)) { try { SimpleFeature feature = (SimpleFeature) iterator.next(); visitor.visit(feature); } catch (Exception erp) { progress.exceptionOccurred(erp); } } } finally { progress.complete(); close(iterator); } }
public void accepts(org.opengis.feature.FeatureVisitor visitor, org.opengis.util.ProgressListener progress) { Iterator<SimpleFeature> iterator = null; if( progress == null ) progress = new NullProgressListener(); try{ float size = size(); float position = 0; progress.started(); for( iterator = iterator(); !progress.isCanceled() && iterator.hasNext();){ if (size > 0) progress.progress( position++/size ); try { SimpleFeature feature = (SimpleFeature) iterator.next(); visitor.visit(feature); } catch( Exception erp ){ progress.exceptionOccurred( erp ); } } } finally { progress.complete(); close( iterator ); } }
public void accepts( org.opengis.feature.FeatureVisitor visitor, org.opengis.util.ProgressListener progress) { Iterator<F> iterator = null; if (progress == null) progress = new NullProgressListener(); try { float size = size(); float position = 0; progress.started(); for (iterator = iterator(); !progress.isCanceled() && iterator.hasNext(); ) { if (size > 0) progress.progress(position++ / size); try { Feature feature = (Feature) iterator.next(); visitor.visit(feature); } catch (Exception erp) { progress.exceptionOccurred(erp); } } } finally { progress.complete(); close(iterator); } }
/** * Test basic capabilities for the contour process. It works on the DEM tiff * and produces a shapefile. Nothing more nothing less. * * @throws Exception */ public void testProcessStandaloneBasicInterval() throws Exception { final GridCoverage2D gc = extractCoverageSubset(); final double step = 100; final ContourProcess process = new ContourProcess(); final SimpleFeatureCollection fc = process.execute(gc, 0, null, Double.valueOf(step), false, false, null, new NullProgressListener()); assertNotNull(fc); assertTrue(fc.size() > 0); SimpleFeatureIterator fi = fc.features(); while (fi.hasNext()) { SimpleFeature sf = fi.next(); Double value = (Double) sf.getAttribute("value"); assertTrue(value > 0); } fi.close(); }