Package org.locationtech.udig.project

Examples of org.locationtech.udig.project.IMap


        ApplicationGIS.createAndOpenMap(Collections.<IGeoResource>emptyList());

        UDIGTestUtil.inDisplayThreadWait(4000, new WaitCondition(){

            public boolean isTrue()  {
                IMap map = ApplicationGIS.getActiveMap();
                if( map==null || currentMap==map )
                    return false;
               
                return true;
            }
           
        }, true);
        Map activeMap = ApplicationGISInternal.getActiveMap();


        final int[] numberLayerAdds=new int[1];
        numberLayerAdds[0]=0;
        activeMap.addMapCompositionListener(new IMapCompositionListener(){

            public void changed( MapCompositionEvent event ) {
                numberLayerAdds[0]++;
            }
           
        });

        IMap map = ApplicationGIS.getActiveMap();
        if (map != null) {
            List<ILayer> layers = map.getMapLayers();
            base = layers.size();
        }
       
        final int[] numberActionsRan=new int[1];
        numberActionsRan[0]=0;
       
        handler.setTarget(map);
        handler.addListener(new IDropHandlerListener(){

            public void done( IDropAction action, Throwable error ) {
                numberActionsRan[0]++;
            }

            public void noAction( Object data ) {
            }

            public void starting( IDropAction action ) {
            }
           
        });
       
        handler.performDrop(data, null);
       
        final int base2=base;
        WaitCondition c=new WaitCondition(){
            public boolean isTrue() {
                Map map = ApplicationGISInternal.getActiveMap();
                if( map==null )
                    return false;
                List<ILayer> layers = map.getMapLayers();
                if (layers.size()<base2 + 2 || numberActionsRan[0]<1 || numberLayerAdds[0]<1)
                    return false;
                return true;
            }
        };

        UDIGTestUtil.inDisplayThreadWait(8000,c, true);
       
        map = ApplicationGIS.getActiveMap();
        assertNotNull(map);
       
        List<ILayer> layers = map.getMapLayers();
        assertEquals(layers.size(),base+2);
       
        assertEquals(1, numberLayerAdds[0]);
        assertEquals(1, numberActionsRan[0]);
       
View Full Code Here


    public void partActivated( IWorkbenchPart part ) {
        if (part == currentPart)
            return;
       
        IMap map = null;
        if (part instanceof BookmarksView){
            //get the current active map
            map = ApplicationGIS.getActiveMap();
        }
        if (map == null && part instanceof IAdaptable){
View Full Code Here

        //add the error to our list of failed features + failure messages
      if (message == null) message = ""; //$NON-NLS-1$
      failedFeatures.add(feature);
        failureMessages.add(feature.getID() + ": " + message); //$NON-NLS-1$
        //find the layer of the current feature
        IMap activeMap = ApplicationGIS.getActiveMap();
        List<ILayer> layers = new ArrayList<ILayer>();
        if (activeMap != ApplicationGIS.NO_MAP) {
            layers.addAll(activeMap.getMapLayers());
        }
        Layer layer = null;
        for (Iterator i = layers.listIterator(); i.hasNext();) {
          Layer thisLayer = (Layer) i.next();
          if (feature.getName().getLocalPart().equals(thisLayer.getName())) {
View Full Code Here

public class TestGetRenderers extends ActionDelegate implements IWorkbenchWindowActionDelegate {


    @Override
    public void run( IAction action ) {
        IMap map = ApplicationGIS.getActiveMap();
        List<IRenderer> renderers = map.getRenderManager().getRenderers();
        List<ILayer> layers = map.getMapLayers();
        if( renderers.size()!=layers.size() ){
            System.out.println("Renderers.size()="+renderers.size()+" layers.size()="+layers.size()); //$NON-NLS-1$ //$NON-NLS-2$
        }
       
        for( IRenderer renderer : renderers ) {
View Full Code Here

@Ignore
public class TestSelectFirstLayer extends ActionDelegate implements IWorkbenchWindowActionDelegate {

    @Override
    public void run( IAction action ) {
        IMap map = ApplicationGIS.getActiveMap();
       
        List<ILayer> layers = map.getMapLayers();
        IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        activePage.activate(activePage.findView(LayersView.ID));
        ((EditManager)map.getEditManager()).setSelectedLayer((Layer) layers.get(layers.size()-1));
    }
View Full Code Here

        action.init(null, null, ViewerDropLocation.ON, map.getProject(), resource);
        action.perform(new NullProgressMonitor());
       
        assertEquals(2, map.getProject().getElements().size());
        IMap newMap = (IMap) map.getProject().getElements().get(1);
       
        assertEquals( 1, newMap.getMapLayers().size());
        assertNotSame( layer, newMap.getMapLayers().get(0));
    }
View Full Code Here

       
        action.init(null, null, ViewerDropLocation.ON, map.getProject(), list);
        action.perform(new NullProgressMonitor());
       
        assertEquals(2, map.getProject().getElements().size());
        IMap newMap = (IMap) map.getProject().getElements().get(1);
       
        assertEquals( 2, newMap.getMapLayers().size());
        assertNotSame( layer, newMap.getMapLayers().get(0));
        assertNotSame( layer, newMap.getMapLayers().get(1));
    }
View Full Code Here

  public void execute(BufferedReader reader, Socket socket) throws Exception {
   
    Pair<URL, Map<String, Serializable>> params = createParams(reader);

    IMap activeMap = ApplicationGIS.getActiveMap();
    if (activeMap != ApplicationGIS.NO_MAP) {
      for (ILayer layer : activeMap.getMapLayers()) {
        if (URLUtils.urlEquals(layer.getID(), params.getLeft(), false)) {
          layer.refresh(null);
          return;
        }
      }
View Full Code Here

        }
        if (resources.size() == 0) {
            return;
        }

        IMap map = ApplicationGIS.getActiveMap();

        LayerFactory layerFactory = map.getLayerFactory();
        for( IGeoResource resource : resources ) {
            if (resource instanceof JGrassMapGeoResource) {
                JGrassMapGeoResource grassMGR = (JGrassMapGeoResource) resource;
                File locationFile = grassMGR.getLocationFile();
                File mapsetFile = grassMGR.getMapsetFile();
                File mapFile = grassMGR.getMapFile();
                IGeoResource addedMapToCatalog = JGrassCatalogUtilities.addMapToCatalog(locationFile.getAbsolutePath(),
                        mapsetFile.getName(), mapFile.getName(), JGrassConstants.GRASSBINARYRASTERMAP);
                int index = map.getMapLayers().size();
                ApplicationGIS.addLayersToMap(map, Arrays.asList(addedMapToCatalog), index);
            } else {
                Layer layer = layerFactory.createLayer(resource);
                AddLayerCommand cmd = new AddLayerCommand(layer);
                map.sendCommandASync(cmd);
            }
        }
    }
View Full Code Here

                    dialog.open();
                }
            });

            // initially set to map's crs
            IMap activeMap = ApplicationGIS.getActiveMap();
            if (activeMap != null) {
                try {
                    CoordinateReferenceSystem crs = activeMap.getViewportModel().getCRS();
                    String codeFromCrs = OmsBoxUtils.getCodeFromCrs(crs);
                    text.setText(codeFromCrs);
                    setDataValue();
                } catch (Exception e) {
                    e.printStackTrace();
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.