Package org.locationtech.udig.project

Examples of org.locationtech.udig.project.IMap


     */
    private LayerAction downAction() {
        downAction = new LayerAction(){
            public void run() {
                if( selection.isEmpty() ) return;
                IMap map = getCurrentMap();
                // map.sendCommandSync( new LayerMoveDownCommand( selection ));
                map.sendCommandASync( new LayerMoveDownCommand( selection ));
            }
        };
        downAction.setEnabled(false);
        downAction.setToolTipText(Messages.LayersView_down_tooltip);
        downAction.setImageDescriptor(ProjectUIPlugin.getDefault().getImageDescriptor(ISharedImages.DOWN_CO));
View Full Code Here


            /**
             * @see org.eclipse.jface.action.Action#run()
             */
            public void run() {
                if( selection.isEmpty() ) return;
                IMap map = getCurrentMap();
                //map.sendCommandSync( new LayerMoveUpCommand( selection ));
                map.sendCommandASync( new LayerMoveUpCommand( selection ));
            }
        };
        upAction.setEnabled(false);
        upAction.setToolTipText(Messages.LayersView_up_tooltip);
        upAction.setImageDescriptor(ProjectUIPlugin.getDefault().getImageDescriptor(ISharedImages.UP_CO));
View Full Code Here

                                JGrassRegion newActiveRegion = JGrassRegion.adaptActiveRegionToEnvelope(bounds, currentRegion);
                                File windFile = grassMapEnvironment.getWIND();
                                JGrassRegion.writeWINDToMapset(windFile.getParent(), newActiveRegion);

                                IMap activeMap = ApplicationGIS.getActiveMap();
                                IBlackboard blackboard = activeMap.getBlackboard();
                                ActiveRegionStyle style = (ActiveRegionStyle) blackboard.get(ActiveregionStyleContent.ID);
                                if (style == null) {
                                    style = ActiveregionStyleContent.createDefault();
                                }
                                style.north = (float) newActiveRegion.getNorth();
View Full Code Here

        // fine for all formats.
        BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // .TYPE_INT_ARGB);

        Graphics2D g = image.createGraphics();

        IMap renderedMap;
        try {
            monitor.worked(2);
            pattern = Messages.ExportMapToImageWizard_renderingTaskname;
            args = new Object[]{map.getName()};
            monitor.setTaskName(MessageFormat.format(pattern, args));
View Full Code Here

      if (this.preview != null) {

        // TODO do we need to validate?

        IMap map = ApplicationGIS.getActiveMap();
        Coordinate newCoord = map.getViewportModel().pixelToWorld(point.x, point.y);

        this.preview.getMarkModel().updateCoordinatePosition(newCoord);
        this.preview.delete();
        this.preview = null;
      }
View Full Code Here

                public void commandChanged( CommandEvent commandEvent ) {
                    if (commandEvent.isHandledChanged()) {
                        commandEvent.getCommand().removeCommandListener(this);
                        clearEditBlackboardCommandListener = null;
                       
                        IMap map = ApplicationGIS.getActiveMap();
                        resetBlackboards(map);
                    }
                }

            };
View Full Code Here

     *
     * @return
     */
    public static ILayer findEditLayer( IToolContext context ) {
        ILayer layer = null;
        IMap map = context.getMap();
        // The selected layer will become the edit layer! If it's a featureStore and editable of
        // course.
        ILayer selectedLayer = ((EditManagerImpl) map.getEditManager()).getSelectedLayer();
        if (isEditable(selectedLayer)) {
            return selectedLayer;
        }
        // Otherwise we'll fall back to the current editLayer
        if (isEditable(map.getEditManager().getEditLayer()))
            return map.getEditManager().getEditLayer();
        // If all else fails we'll iterate through the layer and find the first layer eligable for
        // editing.
        // We should really never get here though.
        for( Iterator<ILayer> iter = map.getMapLayers().iterator(); iter.hasNext(); ) {
            layer = iter.next();
            if (isEditable(layer))
                break;
        }
        return layer;
View Full Code Here

    }

    @Override
    public void perform( IProgressMonitor monitor ) {
        Layer destinationLayer;
        IMap destinationMap;
       
        if( getDestination() instanceof IMap ){
            destinationMap=(IMap) getDestination();
            destinationLayer=(Layer) destinationMap.getEditManager().getSelectedLayer();
        }else if( getDestination() instanceof Layer ){
            destinationLayer=(Layer)getDestination();
            destinationMap=destinationLayer.getMap();
        }else {
            return;
        }
       
        if( getData() instanceof IAdaptable ){
            ILayer layer=(ILayer) ((IAdaptable)getData()).getAdapter(ILayer.class);
            Filter filter=(Filter) ((IAdaptable)getData()).getAdapter(Filter.class);
           
            if (filter == null) {
              SimpleFeature feature = (SimpleFeature) ((IAdaptable) getData()).getAdapter(SimpleFeature.class);
              FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
        if (feature != null) {
          filter = filterFactory.id(FeatureUtils.stringToId(
              filterFactory, feature.getID()));
        } else {
          return;
        }
            }
           
            if( layer==null){
                setSelection(filter==null?(Filter)getData():filter, destinationLayer, monitor);
            }else{
                MapCommand c=EditCommandFactory.getInstance().createCopyFeaturesCommand( layer, filter, destinationLayer);
                destinationMap.sendCommandASync(c);
            }
        }else{
            setSelection((Filter)getData(), destinationLayer, monitor);
        }
    }
View Full Code Here

    }

    @Override
    public void perform( IProgressMonitor monitor ) {
        Object data2 = getData();
        IMap map;
        if (getDestination() instanceof LayersView || getDestination() instanceof MapEditorPart) {
            map=ApplicationGIS.getActiveMap();
        }else{
            map=(Map) getDestination();
        }

        Collection<Layer> layers = toCollection(data2);
        map.sendCommandASync( new AddLayersCommand(layers) );
        layers.iterator().next().getMap().sendCommandASync(new DeleteLayersCommand(layers.toArray(new Layer[0])));
    }
View Full Code Here

    this.toolContext = newContext;

    if (toolContext != null) {

      // display the map
      IMap map = toolContext.getMap();
      mapLabel.setText("Map: " + map.getName()); //$NON-NLS-1$
      // display the CRS.
      CoordinateReferenceSystem crs = getCurrentMapCrs(map);
      crsLabel.setText("CRS: " + crs.getName().toString()); //$NON-NLS-1$
    }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.IMap

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.