Package org.locationtech.udig.project

Examples of org.locationtech.udig.project.IMap


        setDataValue();
    }

    private void removeMapMouseListener() {
        if (currentMapMouseListener != null) {
            final IMap activeMap = ApplicationGIS.getActiveMap();
            final IRenderManager renderManager = activeMap.getRenderManager();
            final ViewportPane viewportPane = (ViewportPane) renderManager.getMapDisplay();
            viewportPane.removeMouseListener(currentMapMouseListener);
        }
    }
View Full Code Here


            viewportPane.removeMouseListener(currentMapMouseListener);
        }
    }

    private void addMapMouseListener() {
        final IMap activeMap = ApplicationGIS.getActiveMap();
        if (activeMap == null) {
            return;
        }
        final IRenderManager renderManager = activeMap.getRenderManager();
        if (renderManager == null) {
            return;
        }
        final ViewportPane viewportPane = (ViewportPane) renderManager.getMapDisplay();
        if (viewportPane == null) {
            return;
        }

        currentMapMouseListener = new MapMouseListener(){
            public void mouseReleased( MapMouseEvent event ) {
                Point point = event.getPoint();
                Coordinate worldClick = activeMap.getViewportModel().pixelToWorld(point.x, point.y);
                if (isEastingNorthing) {
                    text.setText(String.valueOf(worldClick.x) + "," + String.valueOf(worldClick.y));
                }
                if (isNorthing) {
                    text.setText(String.valueOf(worldClick.y));
View Full Code Here

                                            return;
                                        }

                                        if (newMapName != null && newMapName.length() > 0) {
                                            // remove map from layer view
                                            IMap activeMap = ApplicationGIS.getActiveMap();
                                            List<ILayer> mapLayers = activeMap.getMapLayers();
                                            List<ILayer> toRemove = new ArrayList<ILayer>();
                                            for( int i = 0; i < mapLayers.size(); i++ ) {
                                                String layerName = mapLayers.get(i).getName();
                                                if (layerName.equals(oldMapName)) {
                                                    // remove it from layer list
                                                    toRemove.add(mapLayers.get(i));
                                                }

                                            }
                                            if (toRemove.size() > 0)
                                                activeMap.sendCommandSync(new DeleteLayersCommand((ILayer[]) toRemove
                                                        .toArray(new ILayer[toRemove.size()])));

                                            // rename the map
                                            renameGrassRasterMap(mapsetName, oldMapName, newMapName);
                                            // remove old map
View Full Code Here

  @Override
  public void setContext(IToolContext newContext) {

    // ######### THIS IS NEW STUFF - Before editing the setContext
    // method was EMPTY
    IMap map;
    if (newContext == null) {
      // initialize or reinitialize the Presenter
      map = getCurrentMap();
      if (map != null) {
        removeListenerFrom(map);
View Full Code Here

    assert mergedFeature != null;

    // creates the command to delete selected features

    final EditCommandFactory cmdFactory = EditCommandFactory.getInstance();
    final IMap map = layer.getMap();

    List<UndoableMapCommand> cmdList = new LinkedList<UndoableMapCommand>();

    final FeatureIterator<SimpleFeature> iter = sourceFeatures.features();
    while (iter.hasNext()) {
View Full Code Here

                Coordinate c2 = context.getMap().getViewportModel().pixelToWorld(end.x, end.y);

                Envelope bounds = new Envelope(c1, c2);

                ILayer activeRegionLayer = JGrassPlugin.getDefault().getActiveRegionMapGraphic();
                IMap activeMap = ApplicationGIS.getActiveMap();
                IBlackboard blackboard = activeMap.getBlackboard();
                ActiveRegionStyle style = (ActiveRegionStyle) blackboard.get(ActiveregionStyleContent.ID);
                if (style != null) {
                    try {
                        JGrassRegion activeRegion = new JGrassRegion(style.windPath);
                        JGrassRegion newActiveRegion = JGrassRegion.adaptActiveRegionToEnvelope(bounds, activeRegion);
View Full Code Here

        super.dispose(); // run super

        // remove ourselves as a selection listener
        getSite().getPage().removeSelectionListener(workbenchListener);
        if (currentPart != null) {
            IMap map = (IMap) currentPart.getAdapter(IMap.class);
            if (map != null) {
                map.getEditManager().removeListener(editListener);
            }
            currentPart = null;
        }
        if (currentMap != null) {
            currentMap.getEditManager().removeListener(editListener);
View Full Code Here

        }
        return getSchema(currentPart);
    }

    private SimpleFeatureType getSchema(IWorkbenchPart part) {
        IMap map = (IMap) part.getAdapter(IMap.class);
        if (map == null) {
            return null;
        }
        IEditManager editManager = map.getEditManager();
        if (editManager == null) {
            return null;
        }
        ILayer selectedLayer = editManager.getSelectedLayer();
        if (selectedLayer == null) {
View Full Code Here

        return page;
    }

    @Override
    protected PageRec doCreatePage(IWorkbenchPart part) {
        IMap map = (IMap) part.getAdapter(IMap.class);
        if (map == null) {
            MessagePage page = new MessagePage();
            page.setMessage("Please select a Map");
            initPage(page);
            page.createControl(getPageBook());
View Full Code Here

        IEditorPart editor = page.getActiveEditor();
        if (editor == null)
            return null;

        IMap map = (IMap) editor.getAdapter(IMap.class);
        if (map == null)
            return null;

        return editor;
    }
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.