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

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


     */
  private void initRenderExecutor() {
    checkState();
    MultiLayerRenderer renderExecutor = RenderFactory.eINSTANCE
        .createCompositeRenderer();
    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();
        // // FIXME Arbonaut Oy , Vitali Diatchkov
        // System.out.println(
        // "synchronized CompositeRenderContext.clearImage()");
      }

    };
    context.setMapInternal(getMapInternal());
    context.setRenderManagerInternal(this);
   
    renderExecutor.setContext(context);

    initRenderCreator(context);

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

        org.locationtech.udig.project.internal.Layer layer = map.getLayerFactory().createLayer(members2.get(0));
        assertFalse(metrics.canAddLayer(layer));
    }

    private CompositeRenderContextImpl createCompositeRenderer() {
        CompositeRenderContextImpl comp=new CompositeRenderContextImpl();
        comp.setGeoResourceInternal(members.get(0));
        comp.setLayerInternal(map.getLayersInternal().get(0));
        comp.setMapInternal(map);
        comp.setRenderManagerInternal(map.getRenderManagerInternal());
        return comp;
    }
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

    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);
View Full Code Here

        }

        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.impl.CompositeRenderContextImpl

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.