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

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


       
        if( object==null || !((Boolean)object).booleanValue() )
            return true;
       
        if( executor.getContext() instanceof CompositeRenderContext ){
            CompositeRenderContext context=(CompositeRenderContext) executor.getContext();
            if (context.getLayers().contains(getContext().getSelectedLayer()) )
                return true;
           
            return false;
        }
       
View Full Code Here


       
        if( object==null || !((Boolean)object).booleanValue() )
      return true;
   
    if( executor.getContext() instanceof CompositeRenderContext ){
      CompositeRenderContext context=(CompositeRenderContext) executor.getContext();
      if (context.getLayers().contains(getContext().getSelectedLayer()) )
        return true;
     
      return false;
    }
   
View Full Code Here

    public void setContext( IRenderContext newContext ) {
        if (context != null) {
            ((CompositeRenderContext) context).removeListener(contextListener);
        }
        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));
                }
            }
View Full Code Here

          executor.getRenderer().setState(IRenderer.RENDER_REQUEST);
        }
      }

      public void visit(RenderExecutorMultiLayer executor) {
        CompositeRenderContext contexts = executor.getContext();
        for (IRenderContext context : contexts.getContexts()) {
          if (context.getLayer() == selectionLayer) {
            executor.getRenderer().setState(
                IRenderer.RENDER_REQUEST);
            return;
          }
View Full Code Here

        if (configuration.contains(context))
          continue;

        addList.add(context);
      }
      CompositeRenderContext compositecontext = (CompositeRenderContext) getRenderExecutor()
          .getContext();
      compositecontext.removeContexts(removeList);
      if (!addList.isEmpty())
        compositecontext.removeContexts(addList);
      compositecontext.addContexts(addList);

    } else {
      initRenderExecutor();
      configuration2 = getRendererCreator().getConfiguration();

      CompositeRenderContext compositecontext = (CompositeRenderContext) getRenderExecutor()
          .getContext();
      // need this because this is taking place in a non-synchronized
      // block so it is possible for
      // this code to be executed twice. I want the second run to be
      // accurate.
      // might need to be thought about more.
      compositecontext.clear();
      compositecontext.addContexts(configuration2);
    }
    synchronized (this) {
      this.configuration = configuration2;
    }
    logRendererTypes();
View Full Code Here

     */
  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

                            ((layer instanceof SelectionLayer) && params.selectionStyle.getShowLabels()) ){
                        labelPainter.startLayer(layerId);
                    }
                    try {
                        if (context instanceof CompositeRenderContext) {
                            CompositeRenderContext compositeContext = (CompositeRenderContext) context;
                            List<ILayer> layers = compositeContext.getLayers();
                            boolean visible = false;
                            for (ILayer tmpLayer : layers) {
                                visible = visible || tmpLayer.isVisible();
                            }
                            if (!visible)
View Full Code Here

        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$
       
        layer=MapTests.createLayer(new URL( "http://othername"), new RendererCreatorTestObjForMulitRenderer(), layer.getMapInternal()); //$NON-NLS-1$
        creator.changed(listener.lastNotification);

        assertEquals(3, creator.getLayers().size());
        assertEquals(2, creator.getConfiguration().size());
        for( RenderContext context2 : creator.getConfiguration() ) {       
            renderer = creator.getRenderer(context2);
            assertTrue("Expected SingleRenderer but was "+renderer, renderer instanceof MultiLayerRenderer); //$NON-NLS-1$
        }
       
        map.lowerLayer(layer);
       
        int indexOfOtherName=map.getMapLayers().indexOf(layer);
       
        creator.changed(listener.lastNotification);

        assertEquals(3, creator.getLayers().size());
        assertEquals(3, creator.getConfiguration().size());
        for( RenderContext context2 : creator.getConfiguration() ) {       
            renderer = creator.getRenderer(context2);
            assertTrue("Expected SingleRenderer but was "+renderer, renderer instanceof MultiLayerRenderer); //$NON-NLS-1$
        }

        layer=MapTests.createLayer(new URL( "http://dummy"), new RendererCreatorTestObjForMulitRenderer(), null); //$NON-NLS-1$
        map.getLayersInternal().set(indexOfOtherName, layer);
        creator.changed(listener.lastNotification);
       
        assertEquals(3, creator.getLayers().size());
        assertEquals(1, creator.getConfiguration().size());
        renderer = creator.getRenderer(creator.getConfiguration().iterator().next());
        compositeRenderContext = ((CompositeRenderContext)creator.getConfiguration().iterator().next());
        assertEquals(3, compositeRenderContext.getContexts().size());
       
        map.getLayersInternal().remove(0);
        creator.changed(listener.lastNotification);
        assertEquals(2, creator.getLayers().size());
        assertEquals(1, creator.getConfiguration().size());
        renderer = creator.getRenderer(creator.getConfiguration().iterator().next());
        compositeRenderContext = ((CompositeRenderContext)creator.getConfiguration().iterator().next());
        assertEquals(2, compositeRenderContext.getContexts().size());
       
    }
View Full Code Here

        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

       
        map.getLayersInternal().addAll(Arrays.asList(new Layer[]{layer, layer2, layer3, layer4}));
        UDIGTestUtil.inDisplayThreadWait(2000, new WaitCondition(){

            public boolean isTrue() {
                CompositeRenderContext context = (CompositeRenderContext) map.getRenderManagerInternal().getRenderExecutor().getContext();
                return layer4==context.getContexts().get(0).getLayer();
            }
           
        }, false);
        manager.refresh(null);
        CompositeRenderContext context = (CompositeRenderContext) map.getRenderManagerInternal().getRenderExecutor().getContext();
       
        context = (CompositeRenderContext) context.getContexts().get(0);
        assertEquals(layer, context.getLayer());
       
        Iterator<IRenderContext> children = context.getContexts().iterator();
       
        IRenderContext next = children.next();
        assertEquals(layer, next.getLayer());
       
        next = children.next();
        assertEquals(layer2, next.getLayer());
       
        next = children.next();
        assertEquals(layer3, next.getLayer());
       
        next = children.next();
        assertEquals(layer4, next.getLayer());
       
        map.lowerLayer(layer3);
       
        UDIGTestUtil.inDisplayThreadWait(2000, new WaitCondition(){

            public boolean isTrue() {
                CompositeRenderContext context = (CompositeRenderContext) map.getRenderManagerInternal().getRenderExecutor().getContext();
                context = (CompositeRenderContext) context.getContexts().get(0);
                return layer3==context.getContexts().get(1).getLayer();
            }
           
        }, false);
        manager.refresh(null);
        context = (CompositeRenderContext) map.getRenderManagerInternal().getRenderExecutor().getContext();
       
        context = (CompositeRenderContext) context.getContexts().get(0);
        assertEquals(layer, context.getLayer());
       
        children = context.getContexts().iterator();
       
        next = children.next();
        assertEquals(layer, next.getLayer());
       
        next = children.next();
View Full Code Here

TOP

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

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.