Package org.locationtech.udig.project.render

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


    }

    protected void startRendering( Envelope bounds2, IProgressMonitor monitor ) throws Throwable {
        Envelope bounds=bounds2;
        //validate bounds
        IRenderContext context2 = getExecutor().getContext();
       
        //TODO: should this use getImageBounds from the context instead of the viewport model?
        if (bounds == null
                || bounds.contains(context2.getViewportModel().getBounds())) {
            bounds=null;
        }
       
        clearBounds(bounds);

        // If the start of the renderer is a render request then
        if( executor.getRenderer().getState()!=IRenderer.RENDER_REQUEST)
            executor.getRenderer().setRenderBounds(bounds);
       
        monitor.beginTask(Messages.RenderExecutorImpl_1, IProgressMonitor.UNKNOWN);
        if( context2.getLayer()!=null ) {
            initializeLabelPainter(context2);
        }

        executor.getRenderer().render(new SubProgressMonitor(monitor,0));
    }
View Full Code Here


        if (layer == contained)
            return true;

        //for each renderer check the contexts
        for (Iterator<IRenderer> iterator = getRenderers().iterator(); iterator.hasNext();) {
            IRenderContext context = ((IRenderer) iterator.next()).getContext();
            if (context instanceof CompositeRenderContext) {
                if (((CompositeRenderContext) context).getLayers().contains(layer)) {
                    if (((CompositeRenderContext) context).getLayers().contains(contained)) {
                        //composite context and contains layer + contained
                        //these layers are related through a composite context
                        return true;
                    } else {
                        //composite context that contains layer but not contained
                        //cannot be related
                        return false;
                    }
                }
            } else {
                if (context.getLayer() == layer) {
                    //layer is not part of a composite context and cannot be related in
                    //any way to contained
                    return false;
                }
            }
View Full Code Here

    private static final String THE_MAP_IS_OUTSIDE_OF_THE_VISIBLE_REGION = "The map is outside of the visible region.";

    public void render( Graphics2D g2d, IProgressMonitor monitor ) throws RenderException {
        try {
            final IRenderContext currentContext = getContext();
            currentContext.setStatus(ILayer.WAIT);
            CoordinateReferenceSystem destinationCRS = currentContext.getCRS();

            // the bounds of the visible area in world coordinates
            // get the envelope and the screen extent
            Envelope envelope = getRenderBounds();
            if (envelope == null || envelope.isNull()) {
                envelope = context.getImageBounds();
            }

            Point upperLeft = currentContext.worldToPixel(new Coordinate(envelope.getMinX(), envelope.getMinY()));
            Point bottomRight = currentContext.worldToPixel(new Coordinate(envelope.getMaxX(), envelope.getMaxY()));
            Rectangle screenSize = new Rectangle(upperLeft);
            screenSize.add(bottomRight);

            final IGeoResource resource = getContext().getGeoResource();
            if (resource == null || !resource.canResolve(JGrassMapGeoResource.class)) {
View Full Code Here

      if (availableRenderers == null) {
        return Collections.emptyList();
      }
        }
        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

    public boolean isVisible() {
        if (getLayer() != null && getLayer().isVisible())
            return true;
        for( Iterator iter = getContexts().iterator(); iter.hasNext(); ) {
            IRenderContext context = (IRenderContext) iter.next();
            if (context == this)
                continue;
            if (context.isVisible())
                return true;
        }
        return false;
    }
View Full Code Here

            return false;
       
        Iterator<IRenderContext> iter1=getContexts().iterator();
        Iterator<IRenderContext> iter2=o.getContexts().iterator();
        while ( iter1.hasNext() ){
            IRenderContext o1 = iter1.next();
            IRenderContext o2 = iter2.next();
           
            if( o1==this ){
                if ( o2==o )
                    continue;
                else
View Full Code Here

    getRendererCreator().reset();
    validateRendererConfiguration();

    getRenderExecutor().visit(new ExecutorVisitor() {
      public void visit(RenderExecutor executor) {
        IRenderContext context = executor.getContext();
        if (selectionLayer == context.getLayer()) {
          executor.getRenderer().setRenderBounds(bounds);
          if (bounds != null) {
            Rectangle bounds2 = context.toShape(
                new ReferencedEnvelope(bounds,
                    getViewportModelInternal().getCRS()))
                .getBounds();
            context.clearImage(bounds2);
          } else {
            context.clearImage();
          }
          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

        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();
        assertEquals(layer3, next.getLayer());
       
        next = children.next();
        assertEquals(layer2, next.getLayer());
       
        next = children.next();
        assertEquals(layer4, next.getLayer());
    }
View Full Code Here

        try {
            RenderExecutor renderExecutor = renderManager.getRenderExecutor();
            Renderer renderer = renderExecutor.getRenderer();
            if (renderer.getState() == IRenderer.DISPOSED)
                return null;
            IRenderContext context = renderer.getContext();
            return context.getImage();
        } catch (Throwable e) {
            ProjectUIPlugin.log(null, e);
            return null;
        }
    }
View Full Code Here

            //set render requests for the selection layer
            re.visit(new ExecutorVisitor(){

                public void visit( RenderExecutor executor ) {
                    IRenderContext context = executor.getContext();
                    if (selectionLayer == context.getLayer()) {
                        executor.getRenderer().setRenderBounds(bbox);
                        // only clear the part of the image in the bounds??
                        context.clearImage();
                        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

TOP

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

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.