Package org.opengis.util

Examples of org.opengis.util.ProgressListener


        Dimension gridDim = new Dimension(
                (int)bounds.getWidth(),
                (int)bounds.getHeight());

        ProgressListener monitor = null;

        Map<String, Object> map = new HashMap<String, Object>();
        map.put(AbstractFeatureCollectionProcessFactory.FEATURES.key, features);
        map.put("attribute", "value");
        map.put("rasterWidth", gridDim.width);
View Full Code Here


        return file.getName();
      }
      public void run(TestResult result) {
        result.startTest(this);
        try {
          ProgressListener watch;

          StringBuffer buffer = new StringBuffer();

          buffer.append(file.getAbsolutePath()).append("\n");
          final URL source = file.toURI().toURL();
          if (factory.canProcess(DriverOperation.CONNECT, source, null)) {
            buffer.append("ACCEPTED").append("\n");

            // getting access to the file
            watch = new TestProgress();
            final CoverageAccess access = factory.process(DriverOperation.CONNECT,source,null, null, watch);
            assertEquals("Connect progress", 1.0f, watch
                .getProgress());

            if (access == null)
              throw new IOException("Could not access " + file);

            // get the names
            watch = new TestProgress();
            final List<Name> names = access.getNames(watch);
            assertEquals("names progress", 1.0f, watch
                .getProgress());

            for (Name name : names) {
              // get a source
              watch = new TestProgress();
              final CoverageSource gridSource = access.access(
                  name, null, AccessType.READ_ONLY, null,
                  watch);
              assertEquals("access progress", 1.0f, watch
                  .getProgress());

              if (gridSource == null)
                throw new IOException("");
              // create a request
              // reading the coverage
              watch = new TestProgress();
              CoverageResponse response = gridSource.read(
                  new DefaultCoverageReadRequest(), watch);
              assertEquals("read progress", 1.0f, watch
                  .getProgress());

              assertNotNull("response is null", response);
              assertEquals("response success", Status.SUCCESS,
                  response.getStatus());
              assertTrue("response has no errors", response
                  .getExceptions().isEmpty());

              watch = new TestProgress();
              final Collection<? extends Coverage> results = response
                  .getResults(watch);
              assertEquals("request results progress", 1.0f,
                  watch.getProgress());

              for (Coverage c : results) {
                GridCoverage2D coverage = (GridCoverage2D) c;
                // Crs and envelope
                if (TestData.isInteractiveTest()) {
View Full Code Here

     */
    private final static Logger LOGGER = Logging.getLogger(GridCoverageProgressAdapterTest.class);
    @Test
    public void testInReadingCanceled() throws Exception{
        final DefaultProgressListener adaptee= new DefaultProgressListener();
        final ProgressListener myListener= new ProgressListener() {
          

            @Override
            public void warningOccurred(String source, String location, String warning) {
                adaptee.warningOccurred(source, location, warning);
View Full Code Here

    }
   
    @Test
    public void testInReading() throws Exception{
        final DefaultProgressListener adaptee= new DefaultProgressListener();
        final ProgressListener myListener= new ProgressListener() {
          

            @Override
            public void warningOccurred(String source, String location, String warning) {
                adaptee.warningOccurred(source, location, warning);
View Full Code Here

   

    @Test
    public void testInWriting() throws Exception {
        final DefaultProgressListener adaptee= new DefaultProgressListener();
        final ProgressListener myListener= new ProgressListener() {
   
            @Override
            public void warningOccurred(String source, String location, String warning) {
                adaptee.warningOccurred(source, location, warning);
               
View Full Code Here

    }
   
    @Test
    public void testInWritingCanceled() throws Exception {
        final DefaultProgressListener adaptee= new DefaultProgressListener();
        final ProgressListener myListener= new ProgressListener() {
   
            @Override
            public void warningOccurred(String source, String location, String warning) {
                adaptee.warningOccurred(source, location, warning);
               
View Full Code Here

        page.removeAll();
        page.setLayout(new GridLayout(0, 2));

        Process process = this.factory.create(name);

        final ProgressListener progress = new JProgressWindow(this.getJWizard());
        Map<String, Object> resultMap = process.execute(paramMap, progress);

        // when we get here, the processing is over so show the result
        JLabel title = new JLabel(factory.getTitle().toString());
        page.add(title);
View Full Code Here

    }

    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();
        final IOException problem[] = new IOException[1];
        index.query(everything, new ItemVisitor() {
            float count = 0f;

            public void visitItem(Object item) {
                SimpleFeature feature = null;
                try {
                    feature = (SimpleFeature) item;
                    visitor.visit(feature);
                } catch (Throwable t) {
                    progress.exceptionOccurred(t);
                    String fid = feature == null ? "feature" : feature.getIdentifier().toString();
                    problem[0] = new IOException("Problem visiting " + fid + ":" + t, t);
                } finally {
                    progress.progress(count / size);
                }
            }
        });
        if( problem[0] != null ){
            throw problem[0];
        }
        progress.complete();
    }
View Full Code Here

        Map inputs = new HashMap();
        inputs.put("geom", g);
        inputs.put("distance", 1);

        ProgressListener listener = new DefaultProgressListener();
        Map outputs = p.execute(inputs, listener);
        Geometry h = (Geometry) outputs.get("result");
        assertTrue(h.equals(g.buffer(1)));
        assertEquals("The task", listener.getTask().toString());
        assertEquals(10f, listener.getProgress());
    }
View Full Code Here

        Map inputs = new HashMap();
        inputs.put("geom", g);
        inputs.put("distance", -11);

        try {
            ProgressListener listener = new DefaultProgressListener();
            p.execute(inputs, listener);
            fail("Should have thrown a WPSException");
        } catch (ProcessException processException) {
            PyException pyException = (PyException) processException.getCause();
            WPSException e = (WPSException) pyException.getCause();
View Full Code Here

TOP

Related Classes of org.opengis.util.ProgressListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.