Package org.locationtech.udig.project.internal

Examples of org.locationtech.udig.project.internal.Map


        }
       
    handler.performDrop(data, null);
        WaitCondition c=new WaitCondition(){
      public boolean isTrue() {
        Map map = ApplicationGISInternal.getActiveMap();
        if( map==null )
          return false;
        List<ILayer> layers = map.getMapLayers();
        if (layers.size()<baseLayers[0]+1)
          return false;
        return true;
      }
    };

    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


               
                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

                MapTests.createGeoResource(UDIGTestUtil.createDefaultTestFeatures("test2", 2), true) //$NON-NLS-1$
        };
               
        int base = 0;

        final Map currentMap = ApplicationGISInternal.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, 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 static Map createNonDynamicMapAndRenderer(IGeoResource resource, Dimension displaySize, Style style) throws Exception {
        return createNonDynamicMapAndRenderer(resource, displaySize, style, true);
    }

    public static Map createNonDynamicMapAndRenderer(IGeoResource resource, Dimension displaySize, Style style, boolean createRenderManager) throws Exception {
    final Map map=ProjectFactory.eINSTANCE.createMap(ProjectPlugin.getPlugin().getProjectRegistry().getDefaultProject(),
                "testMap", new ArrayList<Layer>()); //$NON-NLS-1$

    Layer tmp=map.getLayerFactory().createLayer(resource);
        Layer layer=new TestLayer();
        layer.setID(tmp.getID());
        layer.setStyleBlackboard(tmp.getStyleBlackboard());
        layer.setDefaultColor(tmp.getDefaultColor());
        layer.setName(tmp.getName());

        if( style!=null ){
            StyleBlackboard styleBlackboard = layer.getStyleBlackboard();
            styleBlackboard.put(SLDContent.ID, style);
        }
    map.getLayersInternal().add(layer);
        if( createRenderManager){
        map.setRenderManagerInternal(new RenderManagerImpl(){
               
            @Override
            public boolean isViewer() {
                return true;
            }
               
                @Override
                public void refresh( Envelope bounds ) {
                    // do nothing
                   
                }
               
                @Override
                public void refresh( ILayer layer, Envelope bounds ) {
                    //do nothing
                }
               
                @Override
                public void refreshSelection( ILayer layer, Envelope bounds ) {
                    // do nothing
                }
               
                @Override
                public void refreshImage() {
                    //do nothing
                }
            });
        RenderManager rm=map.getRenderManagerInternal();
        rm.setMapDisplay(new TestMapDisplay(displaySize));
        rm.getRendererCreator().getLayers().add(layer);
           
            map.getViewportModelInternal().setCRS(layer.getCRS());
           
            final Runnable job = new Runnable() {
                @Override
                public void run() {
                    map.getViewportModelInternal().zoomToExtent();
                }
            };
            final Thread jobThread = new Thread(job);
            jobThread.start();
            jobThread.join();
View Full Code Here

   
    @Ignore
    @Test
    public void testMapOpeningInterceptor() throws Exception {
        assertNull(TestMapOpeningInterceptor.mapOpening);
        Map createDefaultMap = MapTests.createDefaultMap("ftn", 3, true, null); //$NON-NLS-1$
        ApplicationGIS.openMap(createDefaultMap);
        UDIGTestUtil.inDisplayThreadWait(2000, new WaitCondition(){

            public boolean isTrue() {
                return TestMapOpeningInterceptor.mapOpening!=null;
View Full Code Here

            assertTrue(executionTimes.get(i-1)-executionTimes.get(i)<FRAME_INTERVAL+100);
        }
    }

    private Map openMap() {
        Map map=(Map) ApplicationGIS.getActiveMap();
        if( map==null ){
        map = ProjectFactory.eINSTANCE.createMap(ProjectPlugin.getPlugin().getProjectRegistry().getCurrentProject(),
                "AnimationTest", new ArrayList<Layer>()); //$NON-NLS-1$
       
        ApplicationGIS.openMap(map);
View Full Code Here

            }
            @SuppressWarnings("unchecked")
            @Override
            protected IStatus run( IProgressMonitor monitor ) {
                if (parent instanceof Map) {
                    Map map = (Map) parent;
                    boolean found = false;
                    SynchronizedEList adapters = (SynchronizedEList) map.getContextModel()
                            .eAdapters();
                    adapters.lock();
                    try {
                        for( Iterator<Adapter> iter = adapters.iterator(); iter.hasNext(); ) {
                            Adapter next = iter.next();
View Full Code Here

        throw new IllegalArgumentException("Object must be a Map.  Was: " + object); //$NON-NLS-1$
    }

    @Override
    public Object getChild( Object object, int childIndex ) {
        Map map = (Map) object;
        if (childIndex >= map.getMapLayers().size()) return null;
        return map.getMapLayers().get(childIndex);
    }
View Full Code Here

     * -->
     *
     *
     */
    public String getText( Object object ) {
        Map map = ((Map) object);
        String label = map.getName();
        if (label == null) {
            Resource resource = map.eResource();
            if (resource != null) {
                String toString = resource.toString();
                int lastSlash = toString.lastIndexOf(File.pathSeparator);
                if (lastSlash == -1) lastSlash = 0;
                label = toString.substring(lastSlash);
View Full Code Here

public class LayerVisibilityTest extends AbstractProjectUITestCase {
   
    @Ignore
    @Test
  public void testNormalRenderer() throws Exception {
    Map map = ProjectFactory.eINSTANCE.createMap();
    URL url1 = FileLocator.toFileURL(CatalogTestsUIPlugin.getDefault().getBundle().getEntry("data/streams.shp")); //$NON-NLS-1$
    String fragment1=url1.getFile();
    fragment1=fragment1.substring(0,fragment1.lastIndexOf('.'));
    fragment1="#"+fragment1.substring(fragment1.lastIndexOf("/")+1); //$NON-NLS-1$ //$NON-NLS-2$
    URL url2 = FileLocator.toFileURL(CatalogTestsUIPlugin.getDefault().getBundle().getEntry("data/lakes.shp")); //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.internal.Map

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.