Package org.locationtech.udig.project

Examples of org.locationtech.udig.project.IMap


     ViewportGraphics g = context.getGraphics();
     g.setColor(Color.RED);
     g.setStroke(ViewportGraphics.LINE_SOLID, 2);
    
     //get the map blackboard
     IMap map = context.getLayer().getMap();
     IBlackboard blackboard = context.getLayer().getMap().getBlackboard();
    
     List<Coordinate> coordinates =
         (List<Coordinate>) blackboard.get("locations");
    
View Full Code Here


        return list;
    }
   
   
    public static FeatureIssue createFeatureIssue(String id) throws Exception {
        IMap map=MapTests.createDefaultMap("testMap", 1, true, new java.awt.Dimension(10,10)); //$NON-NLS-1$
        ILayer layer=map.getMapLayers().get(0);
        FeatureCollection<SimpleFeatureType, SimpleFeature> collection = layer.getResource(FeatureSource.class, null).getFeatures();
        SimpleFeature feature=collection.features().next();
        FeatureIssue issue=new FeatureIssue(Priority.WARNING, "test description", layer, feature, "groupID"); //$NON-NLS-1$ //$NON-NLS-2$
        issue.setId(id);
        return issue;
View Full Code Here

    }

     @Override
    protected void runImpl( IProgressMonitor monitor ) throws Exception {
         URI mapID = target.getMap().getMapID();
         IMap map = (IMap) (ProjectPlugin.getPlugin().getProjectRegistry().eResource()
                 .getResourceSet().getResource(mapID, true).getContents().get(0));
         ApplicationGIS.openMap(map);
         IViewportModel v = map.getViewportModel();
        
         final ReferencedEnvelope bookmarkEnvelope = target.getEnvelope();
         final Envelope viewportBounds = v.getBounds();

         final CoordinateReferenceSystem viewportCrs = v.getCRS();
View Full Code Here

       
        composite.addDisposeListener(new DisposeListener() {

            public void widgetDisposed(DisposeEvent e) {
                // find the Map
                IMap map = ApplicationGIS.getActiveMap();
                saveDialogState(processor, map);
            }
           
        });
       
View Full Code Here

        members = catalog.members(new DummyMonitor());
        assertTrue(members.isEmpty());

        runMapImport(context);
       
        IMap map = ApplicationGIS.getActiveMap();
        assertNotNull(map);
       
        List<ILayer> layers = map.getMapLayers();
        assertFalse(layers.isEmpty());
       
        for (ILayer layer : layers) {
            assertGeoResourceType(layer, DummyService.class);
        }

        mapImport=new MapImport();
        runMapImport(context);
       
        assertEquals(2, map.getMapLayers().size());
        assertEquals(map, ApplicationGIS.getActiveMap());
        IEditorReference[] editors = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
        assertEquals(1, editors.length);
       
    }
View Full Code Here

        mapImport.run(new DummyMonitor(),context);

        WaitCondition object = new WaitCondition(){

      public boolean isTrue() {
                IMap map = ApplicationGIS.getActiveMap();
                if (map == ApplicationGIS.NO_MAP)
                    return false;
               
                List<ILayer> layers = map.getMapLayers();
                if (layers.isEmpty())
                  return false;
                return true;
      }
         
View Full Code Here

        DialogDriver.pushButton(mapImport.getDialog(), IDialogConstants.FINISH_ID);
      
        UDIGTestUtil.inDisplayThreadWait(4000, new WaitCondition(){

      public boolean isTrue()  {
          IMap map = ApplicationGIS.getActiveMap();
          if( map==ApplicationGIS.NO_MAP )
            return false;
         
          return true;
      }
         
        }, true);
       
        IMap map = ApplicationGIS.getActiveMap();
        assertNotSame(ApplicationGIS.NO_MAP, map);
       
        List<ILayer> layers = map.getMapLayers();
        assertEquals(2, layers.size());
       
        for (ILayer layer : layers) {
            assertGeoResourceType(layer, DummyMultiResourceService.class);
        }
View Full Code Here

      }
    };

    UDIGTestUtil.inDisplayThreadWait(15000,c, true);
   
    IMap map = ApplicationGIS.getActiveMap();
    assertNotNull(map);
   
    List<ILayer> layers = map.getMapLayers();
    assertFalse(layers.isEmpty());
   
    List<String> typeNames=Arrays.asList(new String[]{"streams"})//$NON-NLS-1$
   
    for (ILayer layer : layers) {
      assertLayerType(layer,typeNames, ShapefileDataStore.class);
    }
       

        MapEditorPart activeEditor = ApplicationGISInternal.getActiveEditor();
        UDIGDropHandler dropHandler = activeEditor.getDropHandler();
        dropHandler.setTarget(activeEditor);
        dropHandler.setViewerLocation(ViewerDropLocation.NONE);
        dropHandler.performDrop(data, null);

        expectedLayers[0]=2;
       
        UDIGTestUtil.inDisplayThreadWait(4000,c, true);
   
        map = ApplicationGIS.getActiveMap();
        assertNotNull(map);
       
        layers = map.getMapLayers();
        assertEquals(2,layers.size());
       
        for (ILayer layer : layers) {
            assertLayerType(layer, typeNames, ShapefileDataStore.class);
        }
View Full Code Here

      }
    };

    UDIGTestUtil.inDisplayThreadWait(8000,c, false);
//    UDIGTestUtil.inDisplayThreadWait(800000,c, false);
    IMap map = ApplicationGIS.getActiveMap();
    System.out.println("current maps="+map.getProject().getElements()); //$NON-NLS-1$
    assertNotNull(map);
    List<ILayer> layers = map.getMapLayers();
    assertEquals(map.getName()+" should have "+(baseLayers[0]+1)+" number of layers but instead layers="+layers,  //$NON-NLS-1$ //$NON-NLS-2$
                baseLayers[0]+1, layers.size());
       

        List<String> typeNames=Arrays.asList(new String[]{"lakes"})//$NON-NLS-1$
       
View Full Code Here

          FileLocator.toFileURL(CatalogTestsUIPlugin.getDefault().getBundle().getEntry("data/lakes.shp")) //$NON-NLS-1$
        };
        Object data = urls;
               
        int base = 0;
        final IMap currentMap = ApplicationGIS.getActiveMap();
       
        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, false);
//        UDIGTestUtil.inDisplayThreadWait(800000,c, false);
       
        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

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.