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

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


           
            List<IGeoResource> data = layer.getGeoResources();
            for( IGeoResource resource : data ) {

                RenderContext context;

                try{
                    if (IMultiLayerRenderer.class
                            .isAssignableFrom(metricsFactory.getRendererType())) {
                        context = new CompositeRenderContextImpl();
                    } else {
                        context = new RenderContextImpl(layer instanceof SelectionLayer);
                    }
                }catch(Throwable e){
                    context = new RenderContextImpl(layer instanceof SelectionLayer);                   
                }
               
                context.setMapInternal(map);
                context.setRenderManagerInternal(rm);
                context.setLayerInternal(layer);
                context.setGeoResourceInternal(resource);
                               
                InternalRenderMetrics metrics = metricsFactory.createMetrics(context);
                metrics.delegate.setId(element.getNamespaceIdentifier()+"."+element.getAttribute("id")); //$NON-NLS-1$ //$NON-NLS-2$)
                rFactories.add(metrics);
            }
View Full Code Here


     */
    protected RenderManagerImpl() {
        super();

        rendererCreator = new RendererCreatorImpl();
        RenderContext context = new RenderContextImpl() {
            @Override
            public Map getMapInternal() {
                return RenderManagerImpl.this.getMapInternal();
            }

View Full Code Here

                    continue LAYERS;
                } else {
                    AbstractRenderMetrics metrics = layerfactories.get(0); // sorted in order of preference
                 
                    if( metrics!=null ){
                        RenderContext renderContext = (RenderContext) metrics.getRenderContext();
                        if (renderContext instanceof CompositeRenderContext) {
                            constructCompositeContext(configured, layers, configuration, i, metrics,
                                    (CompositeRenderContext) renderContext);
                        }
                        configuration.put(layer, renderContext);
View Full Code Here

                                ApplicationGIS.class,
                                "ApplicationGIS.drawMap() beginning rendering of map '" + map.getName() + "'", null); //$NON-NLS-1$ //$NON-NLS-2$

                ReferencedEnvelope bounds = (ReferencedEnvelope) params.toDraw.getViewportModel().getBounds();
                ReferencedEnvelope boundsCopy = new ReferencedEnvelope(bounds);
                RenderContext tools = configureMapForRendering(map, params.destinationSize, params.dpi, params.boundsStrategy, boundsCopy);
               
                RendererCreator decisive = new RendererCreatorImpl();
                decisive.setContext(tools);

                decisive.getLayers().addAll(layersToRender);

                SortedSet<RenderContext> sortedContexts = new TreeSet<RenderContext>(
                        decisive.getConfiguration());

                render(params, monitor, decisive, sortedContexts);

            }

            private void render(final DrawMapParameter params,
                    IProgressMonitor monitor, RendererCreator decisive,
                    SortedSet<RenderContext> sortedContexts)
                    throws InvocationTargetException {
               
                monitor.beginTask("Rendering map", sortedContexts.size());
                RenderContext mainContext = decisive.getContext();

                ILabelPainter labelPainter = mainContext.getLabelPainter();
                labelPainter.clear();
                labelPainter.start();
               
                Dimension displaySize = params.destinationSize;
                Iterator<RenderContext> iter = sortedContexts.iterator();
                while (iter.hasNext()) {
                    RenderContext context = (RenderContext) iter.next();

                    ILayer layer = context.getLayer();
                    boolean isLayerFromGrid = layer.getGeoResource().canResolve(GridCoverage.class);
                    String layerId = getLayerId(layer);

                    if( !(layer instanceof SelectionLayer) ||
                            ((layer instanceof SelectionLayer) && params.selectionStyle.getShowLabels()) ){
View Full Code Here

    public static RenderContext configureMapForRendering(Map map, final Dimension destinationSize, final int dpi, BoundsStrategy boundsStrategy, ReferencedEnvelope baseMapBounds) {
        RenderManager manager = RenderFactory.eINSTANCE.createRenderManagerViewer();

        map.setRenderManagerInternal(manager);

        RenderContext tools = new RenderContextImpl();
        tools.setMapInternal(map);
        tools.setRenderManagerInternal(manager);

        ProjectUIPlugin
                .trace(
                        ApplicationGIS.class,
                        "Firing size changed event. Changing to size: " + destinationSize.width + " by " + destinationSize.height, null); //$NON-NLS-1$ //$NON-NLS-2$
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$
View Full Code Here

        RendererCreatorImpl creator = MapTests.createRendererCreator(layer.getMapInternal());

        NotificationImpl notificationImpl = new ENotificationImpl((InternalEObject) layer.getContextModel(), Notification.ADD,
                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());
View Full Code Here

        // Listener added after first layer was added so make notification by hand
        NotificationImpl notificationImpl = new ENotificationImpl((InternalEObject) layer.getContextModel(), Notification.ADD,
                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$
View Full Code Here

       
        assertEquals( 1, config.size() );
       
        Iterator<RenderContext> iter = config.iterator();
       
        RenderContext context = iter.next();
        assertEquals(layer, context.getLayer());
       
        notificationImpl = new ENotificationImpl((InternalEObject) layer.getContextModel(), Notification.ADD_MANY,
                ProjectPackage.CONTEXT_MODEL__LAYERS, null, Arrays.asList(new Layer[]{layer2, layer3, layer4}));
        creator.changed(notificationImpl);
        creator.reset();
        config = creator.getConfiguration();

        iter = config.iterator();
       
        context = iter.next();
        assertEquals(layer, context.getLayer());
       
        assertEquals( 3, config.size() );
       
       
        CompositeRenderContext compContext = (CompositeRenderContext) iter.next();
        assertEquals(layer2, compContext.getContexts().get(0).getLayer());
        assertEquals(layer3, compContext.getContexts().get(1).getLayer());
        context = iter.next();
        assertEquals(layer4, context.getLayer());
    }
View Full Code Here

        CompositeRenderContextImpl comp=new CompositeRenderContextImpl();
        comp.addContexts(creator.getConfiguration());
       
        Iterator iter = comp.getContexts().iterator()
       
        RenderContext executor = (RenderContext) iter.next();
        assertEquals( map.getLayersInternal().get(0),executor.getLayer() );
        executor = (RenderContext) iter.next();
        assertEquals( map.getLayersInternal().get(1),executor.getLayer() );
        executor = (RenderContext) iter.next();
        SelectionLayer sl = (SelectionLayer) executor.getLayer();
        assertEquals( map.getLayersInternal().get(0),sl.getWrappedLayer() );
        executor = (RenderContext) iter.next();
        sl = (SelectionLayer) executor.getLayer();
        assertEquals( map.getLayersInternal().get(1),sl.getWrappedLayer() );
    }
View Full Code Here

TOP

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

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.