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

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


            }
           
        }, false);

        assertEquals(2,manager.configuration.size());
        RenderContext addedContext=null;
        for( RenderContext context : manager.configuration ) {
            assertFalse( "Layer has been removed but has managed to get re-instated... what's up?"//$NON-NLS-1$
                    context.getLayer()==removed );
            if( !(context.getLayer() instanceof SelectionLayer) ){
                assertEquals(newLayer, context.getLayer());
View Full Code Here


            final Thread jobThread = new Thread(job);
            jobThread.start();
            jobThread.join();
           
        MultiLayerRenderer renderer=(MultiLayerRenderer) RenderFactory.eINSTANCE.createCompositeRenderer();
        RenderContext context=new CompositeRenderContextImpl();
        context.setRenderManagerInternal(rm);
        context.setMapInternal(map);
            context.setGeoResourceInternal(layer.getGeoResources().get(0));
            context.setLayerInternal(layer);
        renderer.setContext(context);
        context = rm.getRendererCreator().getConfiguration().iterator().next();
        ((CompositeRenderContext) renderer.getContext()).addContexts(Collections.singleton(context));
        RenderExecutor ex=RenderFactory.eINSTANCE.createRenderExecutor(renderer);
        rm.setRenderExecutor(ex);
View Full Code Here

                break;
            }
        }

        protected void layerNotVisible(Layer layer, Notification msg) {
            RenderContext context2 = executor.getContext();
            context2.getLabelPainter().disableLayer(context2.getLayer().getID().toString());
            if (executor.getState() == RENDERING) {
                executor.stopRendering();
                context2.setStatus(ILayer.DONE);
                context2.setStatusMessage(""); //$NON-NLS-1$
                executor.setState(NEVER);
            } else {
                RenderManager renderManager = (RenderManager) layer.getMapInternal()
                        .getRenderManager();
                if (renderManager != null) {
View Full Code Here

                }
            }
        }

        protected void layerVisible(Layer layer, Notification msg) {
            RenderContext context2 = executor.getContext();
            context2.getLabelPainter().enableLayer(context2.getLayer().getID().toString());
            if (executor.getState() == IRenderer.RENDERING)
                return;
            if (executor.getState() != IRenderer.DONE || executor.dirty) {
                RenderManager renderManager = (RenderManager) layer.getMapInternal()
                        .getRenderManager();
View Full Code Here

                    configuration.put(layer, null);
                    continue LAYERS;
                } else {
                    AbstractRenderMetrics metrics = availableMetrics.get(0); //the best metric once sorted
                    if (metrics != null) {
                        RenderContext renderContext = (RenderContext) metrics.getRenderContext();
                                               
                        if (renderContext instanceof CompositeRenderContextImpl) {
                            //need to construct the composite context by going through the next layers and seeing
                            //if they can be added to the current context.
                            constructCompositeContext(layers, configuration, i, metrics,
View Full Code Here

        for( Iterator<IRenderMetricsFactory> iterator = factories.iterator(); iterator.hasNext(); ) {
            IRenderMetricsFactory renderMetricsFactory = (IRenderMetricsFactory) iterator.next();
           
            List<IGeoResource> data = layer.getGeoResources();
            for( IGeoResource resource : data ) {
                RenderContext context;
                try{
                    if (IMultiLayerRenderer.class.isAssignableFrom(renderMetricsFactory.getRendererType())){
                        context = new CompositeRenderContextImpl();
                    }else{
                        context = new RenderContextImpl(layer instanceof SelectionLayer);
                    }
                }catch (Throwable e){
                    context = new RenderContextImpl(layer instanceof SelectionLayer);
                }
               
                context.setMapInternal(manager.getMapInternal());
                context.setRenderManagerInternal(manager);
                context.setLayerInternal(layer);
                context.setGeoResourceInternal(resource);
                context.setImageSize(new Dimension(tilesize, tilesize));
                context.setImageBounds(bounds);
               
                try {
                    if (renderMetricsFactory.canRender(context)){
                        AbstractRenderMetrics metric = ((InternalRenderMetricsFactory.InternalRenderMetrics) renderMetricsFactory.createMetrics(context)).delegate;
                        // we need to assign an id here for the metrics sorting
View Full Code Here

            Map<Layer, AbstractRenderMetrics> configuration,
            CompositeRenderContext parentRenderContext,
            Layer layer, AbstractRenderMetrics parentMetrics) {

        //create a context for this layer that matches the parent layer
        RenderContext childcontext = new RenderContextImpl(layer instanceof SelectionLayer);
        childcontext.setMapInternal(parentRenderContext.getMapInternal());
        childcontext.setRenderManagerInternal(parentRenderContext.getRenderManagerInternal());
        childcontext.setLayerInternal(layer);
        childcontext.setGeoResourceInternal(layer.getGeoResource());
        childcontext.setImageSize(parentRenderContext.getImageSize());
        childcontext.setImageBounds(parentRenderContext.getImageBounds());
       
        //use the same render metrics factory to create a new render metrics
        AbstractRenderMetrics childmetric = parentMetrics.getRenderMetricsFactory().createMetrics(childcontext);
       
        //add to the parent context
View Full Code Here

        ViewportModel viewportModel = map.getViewportModelInternal();
        ReferencedEnvelope bounds = (ReferencedEnvelope) viewportModel.getBounds();
        BoundsStrategy boundsStrategy = new BoundsStrategy(scale);

        RenderContext context = null;
        if (inPreviewMode && !Float.isNaN(scaleFactor)) {
            float dpiFloat = (float) DEFAULTDPI * scaleFactor;
            context = ApplicationGIS.configureMapForRendering(map, size, (int) dpiFloat,
                    boundsStrategy, bounds);
        } else {
            context = ApplicationGIS.configureMapForRendering(map, size, DEFAULTDPI,
                    boundsStrategy, bounds);
        }

        context.setLayerInternal(layer);
        context.setGeoResourceInternal(layer.getGeoResource());

        CompositeRenderContext toUseForRendering = new CompositeRenderContextImpl();
        toUseForRendering.addContexts(Collections.singleton(context));
        toUseForRendering.setRenderManagerInternal(context.getRenderManagerInternal());
        toUseForRendering.setMapInternal(context.getMapInternal());
        return toUseForRendering;
    }
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.