Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.SubProgressMonitor


        monitor.beginTask(Messages.RenderExecutorImpl_1, IProgressMonitor.UNKNOWN);
        if( context2.getLayer()!=null ) {
            initializeLabelPainter(context2);
        }

        executor.getRenderer().render(new SubProgressMonitor(monitor,0));
    }
View Full Code Here


                    UndoableMapCommand c=null;
                    try{
                        c=behaviour.getCommand(handler, event, eventType);
                        if( c==null )
                            continue;
                        IProgressMonitor submonitor = new SubProgressMonitor(monitor, 10);
                        c.setMap(getMap());
                        if (c instanceof PostDeterminedEffectCommand) {
                            PostDeterminedEffectCommand command = (PostDeterminedEffectCommand) c;
                            if( command.execute(submonitor) )
                                commandsRan.add(command);
                        }else{
                        c.run(submonitor);
                        commandsRan.add(c);
                        }
                        submonitor.done();
                    }catch(Exception e){
                        behaviour.handleError(handler, e, c);
                    }
                }
            }
        }else{
            monitor.beginTask(getName(), commandsRan.size()*12);
            monitor.worked(2);
            for( UndoableMapCommand command : commandsRan ) {
                command.setMap(getMap());
                IProgressMonitor submonitor = new SubProgressMonitor(monitor, 10);
                if (command instanceof PostDeterminedEffectCommand) {
                    ((PostDeterminedEffectCommand)command).execute(submonitor);
                }else{
                    command.run(submonitor);
                }
                submonitor.done();
            }
        }
        monitor.done();
        return !commandsRan.isEmpty();
    }
View Full Code Here

    public void rollback( IProgressMonitor monitor ) throws Exception {
        monitor.beginTask(getName(), commandsRan.size()*12);
        monitor.worked(2);
        for( UndoableMapCommand command : commandsRan ) {
            command.setMap(getMap());
            IProgressMonitor submonitor = new SubProgressMonitor(monitor, 10);
            command.rollback(submonitor);
            submonitor.done();
        }
    }
View Full Code Here

                    monitor.beginTask(Messages.ExportMapToImageWizard_exportMapsTaskName, maps
                            .size() * 3 + 1);
                    monitor.worked(1);
                    for( IMap map : maps ) {
                        try {
                            exportMap(map, new SubProgressMonitor(monitor, 3));
                        } catch (RenderException e) {

                            Object[] args = new Object[]{map.getName(), e.getLocalizedMessage()};
                            String pattern = Messages.ExportMapToImageWizard_renderingErrorMessage;
                            errors.add(MessageFormat.format(pattern, args));
View Full Code Here

  }

 
  private boolean runCommand( NavCommand command, IProgressMonitor monitor ) throws Exception {

        SubProgressMonitor subProgressMonitor = new SubProgressMonitor(
                monitor, 10);
        boolean changed;
        if (command instanceof PostDeterminedEffectCommand) {
            changed = ((PostDeterminedEffectCommand) command)
                    .execute(subProgressMonitor);
        } else {
            command.run(subProgressMonitor);
            changed = true;
        }
        subProgressMonitor.done();
        return changed;
    }
View Full Code Here

    }
    protected WMSResourceInfo createInfo( IProgressMonitor monitor ) throws IOException {
        if (monitor == null)
            monitor = new NullProgressMonitor();

        WMSServiceImpl wmsServer = service(new SubProgressMonitor(monitor, 50));

        wmsServer.rLock.lock();
        try {
            return new WMSResourceInfo(new SubProgressMonitor(monitor, 50));
        } finally {
            wmsServer.rLock.unlock();
        }
    }
View Full Code Here

    }
    protected WMSCGeoResourceInfo createInfo( IProgressMonitor monitor ) throws IOException {
        if (monitor == null)
            monitor = new NullProgressMonitor();

        WMSCServiceImpl tileServer = service(new SubProgressMonitor(monitor, 50));
        try {
            tileServer.rLock.lock();
            return new WMSCGeoResourceInfo(this, new SubProgressMonitor(monitor, 50));
        } finally {
            tileServer.rLock.unlock();
        }

    }
View Full Code Here

            MathTransform dataToWorld = CRS.findMathTransform(dataCRS, worldCRS, false);

            ReferencedEnvelope bounds = getRenderBounds();
            monitor.subTask("connecting");
           
            CSV csv = resource.resolve(CSV.class, new SubProgressMonitor(monitor, 10) );
            reader = csv.reader();
           
            int nameIndex = csv.getHeader("name");

            IProgressMonitor drawMonitor = new SubProgressMonitor(monitor, 90);
            Coordinate worldLocation = new Coordinate();
           
            drawMonitor.beginTask("draw "+csv.toString(), csv.getSize());           
            String [] row;
            while ((row = reader.readNext()) != null) {
                Point point = csv.getPoint(row);
                Coordinate dataLocation = point.getCoordinate();
                try {
                    JTS.transform(dataLocation, worldLocation, dataToWorld);
                } catch (TransformException e) {
                    continue;
                }               
                if (bounds != null && !bounds.contains(worldLocation)) {
                    continue; // optimize!
                }               
                java.awt.Point p = getContext().worldToPixel(worldLocation);
                g.fillOval(p.x, p.y, 10, 10);
                String name = row[nameIndex];
                g.drawString(name, p.x + 15, p.y + 15);
                drawMonitor.worked(1);

                if (drawMonitor.isCanceled())
                    break;
            }
            drawMonitor.done();           
        } catch (IOException e) {
            throw new RenderException(e); // rethrow any exceptions encountered
        } catch (FactoryException e) {
            throw new RenderException(e); // rethrow any exceptions encountered
        } finally {
View Full Code Here

            }
            if (version == null || "".equals(version)) { //$NON-NLS-1$
                WmsPlugin.log("GetCapabilities VERSION is required", new ServiceNotFoundException()); //$NON-NLS-1$
                return null;
            }
            IGeoResourceInfo info = resource.getInfo( new SubProgressMonitor(monitor, 50));
   
            String srs = CRS.toSRS(info.getCRS());
            TileSet tileset = new WMSTileSet();
   
            ReferencedEnvelope bounds = info.getBounds();
            if (bounds == null ) { //$NON-NLS-1$
                WmsPlugin.log("Bounds required for TileSet definition", new NullPointerException("Bounds required for tileset definitio")); //$NON-NLS-1$
                return null;
            }
            double minX = bounds.getMinimum(0);
            double maxX = bounds.getMaximum(0);
            double minY = bounds.getMinimum(1);
            double maxY = bounds.getMaximum(1);
   
            CRSEnvelope bbox = new CRSEnvelope(srs, minX, minY, maxX, maxY);
            tileset.setBoundingBox(bbox);
            tileset.setCoorindateReferenceSystem(srs);
   
            Map<String, Serializable> properties = resource.getPersistentProperties();
            Integer width = Integer.parseInt((String) properties.get(PreferenceConstants.P_TILESET_WIDTH));
            Integer height = Integer.parseInt((String) properties.get(PreferenceConstants.P_TILESET_HEIGHT));
   
            if (width == null) {
                width = PreferenceConstants.DEFAULT_TILE_SIZE;
            }
   
            if (height == null) {
                height = PreferenceConstants.DEFAULT_TILE_SIZE;
            }
   
            tileset.setWidth(width);
            tileset.setHeight(height);
   
            String imageType = (String) properties.get(PreferenceConstants.P_TILESET_IMAGE_TYPE);
   
            if (imageType == null || "".equals(imageType)) { //$NON-NLS-1$
                imageType = PreferenceConstants.DEFAULT_IMAGE_TYPE;
            }
   
            tileset.setFormat(imageType);
   
            /*
             * The layer ID
             */
            tileset.setLayers(info.getName());
   
            String scales = (String) properties.get(PreferenceConstants.P_TILESET_SCALES);
   
            String resolutions = workoutResolutions(scales, new ReferencedEnvelope(bbox), width);
   
            /*
             * If we have no resolutions to try - we wont.
             */
            if ("".equals(resolutions)) { //$NON-NLS-1$
                WmsPlugin.log("Resolutions are required for TileSet generation", new ServiceNotFoundException()); //$NON-NLS-1$
                return null;
            }
            tileset.setResolutions(resolutions);
   
            /*
             * The styles
             */
            String style = ""; //$NON-NLS-1$
            if (resource.canResolve(Layer.class)) {
                Layer layer = resource.resolve(Layer.class, new SubProgressMonitor(monitor, 50));
                StringBuilder sb = new StringBuilder(""); //$NON-NLS-1$
                for( StyleImpl layerStyle : layer.getStyles() ) {
                    sb.append(layerStyle.getName()+","); //$NON-NLS-1$
                }
                style = sb.toString();
View Full Code Here

    String typeName = schema.getTypeName();
    Filter selected = layer.getFilter();
    Query query = new DefaultQuery(typeName, selected, Query.ALL_NAMES );
       
        FeatureSource<SimpleFeatureType,SimpleFeature> featureSource =
          layer.getResource(FeatureSource.class, new SubProgressMonitor(monitor, 1));
        FeatureCollection<SimpleFeatureType,SimpleFeature> features = featureSource.getFeatures(query);
        FeatureIterator<SimpleFeature> featureIterator = features.features();
        try{
            SubProgressMonitor monitor2 = new SubProgressMonitor(monitor, 98);
            monitor2.beginTask("this is ignored", features.size());
            while(featureIterator.hasNext() ){
                monitor2.worked(1);
                SimpleFeature feature=featureIterator.next();
               
                // do something.
                // the features here will have no attributes or geometry but you can call getID().
                // warning you can't call getBounds() because no geometry was requested in the query.
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.SubProgressMonitor

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.