Package org.locationtech.udig.project.render

Examples of org.locationtech.udig.project.render.AbstractRenderMetrics


      }
        }
        for( InternalRenderMetrics internalRenderMetrics : availableRenderers ) {
            IRenderContext renderContext = internalRenderMetrics.getRenderContext();
            IRenderMetricsFactory renderMetricsFactory = internalRenderMetrics.getRenderMetricsFactory();
            AbstractRenderMetrics createMetrics = renderMetricsFactory.createMetrics(renderContext);
            metrics.add(createMetrics);
        }
        return metrics;
    }
View Full Code Here


                if (layerfactories.isEmpty()) {
                    // nobody loves this layer
                    // layer.setStatus( Layer.UNCONFIGURED );
                    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

    }

    private void addChildContextToComposite( Set<Layer> configured, Map<Layer, RenderContext> configuration,
            CompositeRenderContext renderContext, Layer layer ) {
        List<InternalRenderMetrics> layerfactories2 = layerToMetricsFactoryMap.get(layer);
        AbstractRenderMetrics metrics2 = layerfactories2.get(0);
        Set<RenderContext> child = Collections.singleton((RenderContext) metrics2.getRenderContext());
        renderContext.addContexts(child);
        // add to configurated to indicate that it has been configured.
        configured.add(layer);

        configuration.put(layer, renderContext);
View Full Code Here

    @Test
    public void testCanAddLayer() throws Throwable {
        BasicWMSMetricsFactory2 fac=new BasicWMSMetricsFactory2();
        CompositeRenderContextImpl comp = createCompositeRenderer();
        AbstractRenderMetrics metrics = fac.createMetrics(comp);
        assertTrue(metrics.canAddLayer(map.getLayersInternal().get(1)));
        org.locationtech.udig.project.internal.Layer layer = map.getLayerFactory().createLayer(members2.get(0));
        assertFalse(metrics.canAddLayer(layer));
    }
View Full Code Here

                    // no render metrics for this layer
                    //clear our render metrics cache
                    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

                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
                        metric.setId(  ((RenderMetricsFactoryExtensionPointProcessor.IdRenderMetricsFactory)renderMetricsFactory).getId() );
                        metrics.add(metric);
                       
                    }
                } catch (IOException e) {
                    ProjectPlugin.log("Cannot determine if context is renderable.", e); //$NON-NLS-1$
View Full Code Here

        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
      Set<RenderContext> child = Collections.singleton((RenderContext) childmetric.getRenderContext());
        parentRenderContext.addContexts(child);
      
        //this layer has the parent render context associated with it
        configuration.put(layer, parentMetrics);
    }
View Full Code Here

            // might need to be thought about more.
            renderer.removeAllChildren();
            renderer.addChildren(newconfig);
            newcontexts = null;
            for( Iterator<AbstractRenderMetrics> iterator = newconfig.iterator(); iterator.hasNext(); ) {
                AbstractRenderMetrics abstractRenderMetrics = (AbstractRenderMetrics) iterator.next();
                //setup label painter
                ((RenderContextImpl)abstractRenderMetrics.getRenderContext()).setLabelPainterLocal(tilelabelpainter);
            }
        }else{
            //we have an existing configuration; lets recycle as many of the contexts as possible
            //lets get the new configuration
            Collection <AbstractRenderMetrics> newconfig = ((TiledRendererCreatorImpl) getRendererCreator()).getConfiguration(t.getReferencedEnvelope());
           
            //items to add/remove from the existing configuration
            List<AbstractRenderMetrics> removeList = new ArrayList<AbstractRenderMetrics>();
            List<AbstractRenderMetrics> addList = new ArrayList<AbstractRenderMetrics>();
           
            for(AbstractRenderMetrics metric: currentconfiguration){
                if (!newconfig.contains(metric)){
                    //this is an existing context the doesn't exist in the new set
                    removeList.add(metric);
                }
            }
            for (AbstractRenderMetrics metric: newconfig){
                if (!currentconfiguration.contains(metric)){
                    //this is in the new configuration but not the only one therefore we need to add it
                    addList.add(metric);
                    //setup label painter
                    ((RenderContextImpl)metric.getRenderContext()).setLabelPainterLocal(tilelabelpainter);
                }
            }
           
            newcontexts.addAll(addList);
           
            renderer.removeChildren(removeList);
           
            if (!addList.isEmpty()){
                renderer.removeChildren(addList);
            }
            renderer.addChildren(addList);
           
            //let's properly dispose of anything in the remove List
            for( Iterator<AbstractRenderMetrics> iterator = removeList.iterator(); iterator.hasNext(); ) {
                AbstractRenderMetrics metric = (AbstractRenderMetrics) iterator.next();
                ((RenderContextImpl)metric.getRenderContext()).dispose();
            }
       }
       return newcontexts;
    }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.render.AbstractRenderMetrics

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.