Package org.locationtech.udig.project.internal.render.impl

Examples of org.locationtech.udig.project.internal.render.impl.CompositeRendererImpl


    if (selectionLayer == null)
      return;

    try {
      CompositeRendererImpl compositeRendererImpl = (CompositeRendererImpl) getRenderExecutor()
          .getRenderer();
      compositeRendererImpl.refreshImage();
      compositeRendererImpl.setState(IRenderer.DONE);

    } catch (RenderException e) {
      ProjectUIPlugin.log("", e); //$NON-NLS-1$
    }
  }
View Full Code Here


    @Ignore
    @Test
    public void testRefreshLayer() throws Exception {
        final RenderExecutor renderExecutor = map.getRenderManagerInternal().getRenderExecutor();
        renderExecutor.setState(IRenderer.NEVER);
        final CompositeRendererImpl impl=(CompositeRendererImpl) renderExecutor.getRenderer();
        impl.setState(IRenderer.NEVER);
        for( Renderer renderer: impl.children() ) {
            renderer.setState(IRenderer.NEVER);
        }
        for( Renderer renderer: impl.children() ) {
            renderer.setState(IRenderer.NEVER);
            assertEquals(IRenderer.NEVER, renderer.getState());
        }
       
        final ILayer refreshLayer = map.getMapLayers().get(0);
        map.getRenderManagerInternal().refresh(refreshLayer, null);
        UDIGTestUtil.inDisplayThreadWait(3000000, new WaitCondition(){

            public boolean isTrue() {
                for( Renderer renderer: impl.children() ) {
                    ILayer currentLayer = renderer.getContext().getLayer();
                    if( currentLayer==refreshLayer ){
                        if( IRenderer.DONE!=renderer.getState() )
                        return false;
                    } else if( currentLayer instanceof SelectionLayer
                            && ((SelectionLayer)currentLayer).getWrappedLayer()==refreshLayer ){
                        if( IRenderer.DONE!=renderer.getState() )
                            return false;
                    } else {
                        assertEquals(currentLayer+" is supposed to be NEVER", IRenderer.NEVER, renderer.getState()); //$NON-NLS-1$
                    }
                }
                return true;
            }
           
        }, false);
       
        for( Renderer renderer: impl.children() ) {
            ILayer currentLayer = renderer.getContext().getLayer();
            if( currentLayer==refreshLayer)
                assertEquals(IRenderer.DONE, renderer.getState());
            else if( currentLayer instanceof SelectionLayer && ((SelectionLayer)currentLayer).getWrappedLayer()==refreshLayer){
                    assertEquals(IRenderer.DONE, renderer.getState());
View Full Code Here

                        }
                    }
                }
                };
        map.getRenderManagerInternal().eAdapters().add( adapterImpl);
        CompositeRendererImpl compRenderer = (CompositeRendererImpl)map.getRenderManagerInternal().getRenderExecutor().getRenderer();
        compRenderer.eAdapters().add(adapterImpl);
        List<Renderer> renderers = compRenderer.children();
        for( Renderer renderer : renderers ) {
            renderer.eAdapters().add(listener);
        }
        CompositeRenderContext compContext = ((CompositeRenderContext)map.getRenderManagerInternal().getRenderExecutor().getContext());
        compContext.addListener(contextListener);
View Full Code Here

     * This creates a render executor composite.
     */
    private RenderExecutorComposite createRenderExecutor(ReferencedEnvelope bounds) {
        checkState();
       
        CompositeRendererImpl renderer = (CompositeRendererImpl)RenderFactory.eINSTANCE.createTiledCompositeRenderer();

        CompositeRenderContext context = new CompositeRenderContextImpl() {
            @Override
            public synchronized BufferedImage getImage(int width, int height) {
                if (image == null || image.getWidth() < width
                        || image.getHeight() < height) {
                    image = new BufferedImage(width, height,
                            BufferedImage.TYPE_3BYTE_BGR);
                    Graphics2D g = image.createGraphics();
                    g.setBackground(Color.WHITE);
                    g.clearRect(0, 0, width, height);
                    g.dispose();
                }

                return image;
            }

            @Override
            public synchronized void clearImage(Rectangle paintArea) {
                if (image == null)
                    return;
                Graphics2D g = image.createGraphics();
                g.setBackground(Color.WHITE);
                g.clearRect(paintArea.x, paintArea.y, paintArea.width,
                        paintArea.height);
                g.dispose();
            }

        };
       
        context.setMapInternal(getMapInternal());
        context.setRenderManagerInternal(this);
        context.setImageBounds(bounds);
        context.setImageSize(new Dimension(getTileSize(), getTileSize()));
       
        ((CompositeRenderContextImpl)context).setLabelPainterLocal(new UDIGLabelCache(new LabelCacheImpl()));
        renderer.setContext(context);
       
        renderer.setName(Messages.RenderManagerDynamic_allLayers);
       
        RenderExecutorComposite renderExecutor = (RenderExecutorComposite)RenderFactory.eINSTANCE.createRenderExecutor(renderer);
        renderExecutor.setName("Tiled (" + bounds.hashCode() + "): " + bounds.toString()); //$NON-NLS-1$ //$NON-NLS-2$
        renderExecutor.eAdapters().add(renderExecutorListener);
       
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.internal.render.impl.CompositeRendererImpl

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.