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

Examples of org.locationtech.udig.project.internal.render.Renderer


        if (newContext != null) {
            CompositeRenderContext compositeRenderContext = (CompositeRenderContext) newContext;
            compositeRenderContext.addListener(contextListener);
            for( IRenderContext context : compositeRenderContext.getContexts() ) {
                if (findExecutor(context) == null) {
                    Renderer renderer = getRendererCreator(context).getRenderer((RenderContext) context);
                    getRenderExecutors().add(createRenderExecutor(renderer));
                }
            }
            super.setContext(newContext);
        }
View Full Code Here


        final List<IRenderer> renderers = new ArrayList<IRenderer>();
        getRenderExecutor().visit(new ExecutorVisitor() {

            public void visit(RenderExecutor executor) {
                if (!(executor.getContext().getLayer() instanceof SelectionLayer)) {
                    Renderer renderer = executor.getRenderer();
                    renderers.add(renderer);
                }
            }

            public void visit(RenderExecutorMultiLayer executor) {
View Full Code Here

            internalRenderMetrics = iter.next();
            boolean canRender;
            try {
                canRender = internalRenderMetrics.getRenderMetricsFactory().canRender(context);
                if( canRender ) {
                    Renderer createRenderer = internalRenderMetrics.createRenderer();
                    createRenderer.setContext(context);
                    return createRenderer;
                }
            } catch (Throwable e) {
                internalRenderMetrics=null;
            }
View Full Code Here

     *
     * @param metrics
     */
    public void addChild(AbstractRenderMetrics metrics){
        synchronized (childrenRenderers) {
            Renderer render = metrics.createRenderer();
            render.setContext(metrics.getRenderContext());
            RenderExecutor executor = createRenderExecutor(render);
            RenderInfo ri = new RenderInfo(executor, metrics);
            childrenRenderers.add(ri);
        }
    }
View Full Code Here

            if (result == null)
                result = defaultCase(theEObject);
            return result;
        }
        case RenderPackage.RENDERER: {
            Renderer renderer = (Renderer) theEObject;
            T result = caseRenderer(renderer);
            if (result == null)
                result = caseIRenderer(renderer);
            if (result == null)
                result = defaultCase(theEObject);
View Full Code Here

                            }
                            if (!visible)
                                continue;
                        } else if (!layer.isVisible())
                            continue;
                        Renderer renderer = decisive.getRenderer(context);
                        ProjectUIPlugin
                                .trace(
                                        ApplicationGIS.class,
                                        "Issuing render call to " + renderer.getName(), null); //$NON-NLS-1$
                        try {
                            Graphics2D graphics = (Graphics2D) params.graphics.create();
                            if (params.doBufferedImageForGrids && isLayerFromGrid) {
                                Rectangle clipBounds = graphics.getClipBounds();
                                BufferedImage bi = new BufferedImage(clipBounds.width,
                                        clipBounds.height, BufferedImage.TYPE_INT_ARGB);
                                Graphics2D biG2D = (Graphics2D) bi.getGraphics();
                                renderer.render(biG2D, monitor);
                                graphics.drawImage(bi, null, 0, 0);
                                biG2D.dispose();
                            }else{
                                renderer.render(graphics, monitor);
                            }
                           
                        } catch (RenderException e) {
                            throw new InvocationTargetException(e);
                        }
View Full Code Here

        RendererCreatorImpl creator = MapTests.createRendererCreator(layer.getMapInternal());
        creator.getLayers().add(layer);
       
        creator.reset();
        RenderContext context = creator.getConfiguration().iterator().next();
        Renderer renderer = creator.getRenderer(context);
        assertTrue( renderer instanceof SingleRenderer );
       
        // now test case where there is no good renderer
        layer = MapTests.createLayer(null, "HELLO", null); //$NON-NLS-1$
       
        creator = MapTests.createRendererCreator(layer.getMapInternal());
        creator.getLayers().add(layer);
       
        creator.reset();
       
        context = creator.getConfiguration().iterator().next();
        renderer = creator.getRenderer(context);
        assertTrue( renderer instanceof PlaceHolder );
        assertEquals(context, renderer.getContext());
       
       
    }
View Full Code Here

                ProjectPackage.CONTEXT_MODEL__LAYERS, null, layer);
        creator.changed(notificationImpl);
        RenderContext context = creator.getConfiguration().iterator().next();

        assertEquals(1, creator.getLayers().size());
        Renderer renderer = creator.getRenderer(context);
        assertTrue("Expected SingleRenderer but was "+renderer, renderer instanceof SingleRenderer); //$NON-NLS-1$
        assertEquals(1, creator.getConfiguration().size());

        layer=MapTests.createLayer(null, new RendererCreatorTestObjForSingleRenderer(), layer.getMapInternal());
        notificationImpl = new ENotificationImpl((InternalEObject) layer.getContextModel(), Notification.ADD,
View Full Code Here

                ProjectPackage.CONTEXT_MODEL__LAYERS, null, layer);
        creator.changed(notificationImpl);
        RenderContext context = creator.getConfiguration().iterator().next();
       
        assertEquals(1, creator.getLayers().size());
        Renderer renderer = creator.getRenderer(context);
        assertSame( context, renderer.getContext() );
        assertTrue("Expected MultiLayerRenderer but was "+renderer, renderer instanceof MultiLayerRenderer); //$NON-NLS-1$
        assertEquals(1, creator.getConfiguration().size());

        layer=MapTests.createLayer(new URL( "http://multi_dummy"), new RendererCreatorTestObjForMulitRenderer(), layer.getMapInternal()); //$NON-NLS-1$
        creator.changed(listener.lastNotification);
       
        assertEquals(2, creator.getLayers().size());
        assertEquals(1, creator.getConfiguration().size());
        context=creator.getConfiguration().iterator().next();
        renderer = creator.getRenderer(context);
        assertSame( context, renderer.getContext() );
        CompositeRenderContext compositeRenderContext = ((CompositeRenderContext)creator.getConfiguration().iterator().next());
        assertEquals(2, compositeRenderContext.getContexts().size());
       
        assertTrue("Expected MultiRenderer but was "+renderer, renderer instanceof MultiLayerRenderer); //$NON-NLS-1$
       
View Full Code Here

        firstLayerR2SecondR1(creator);
    }
   
    private void sameRenderer( RendererCreatorImpl creator, Class<? extends IRenderer> rendererClass, int expectedContexts) {
        Collection<RenderContext> configuration;
        Renderer renderer;
        creator.reset();
        configuration = creator.getConfiguration();

        assertEquals(expectedContexts, configuration.size());
       
        // map has it but layer2 doesn't yet since map has the renderer2 both should still use renderer2.
        for( RenderContext context : configuration ) {
            renderer = creator.getRenderer(context);
            assertTrue("Expected SingleRenderer but was "+renderer, rendererClass.isAssignableFrom(renderer.getClass()) ); //$NON-NLS-1$
        }
    }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.internal.render.Renderer

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.