Package org.locationtech.udig.project.render

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


                if (drawMonitor.isCanceled())
                    break;
            }
            drawMonitor.done();           
        } catch (IOException e) {
            throw new RenderException(e); // rethrow any exceptions encountered
        } catch (FactoryException e) {
            throw new RenderException(e); // rethrow any exceptions encountered
        } finally {
            if (reader != null)
                try {
                    reader.close();
                } catch (IOException e) {
                    throw new RenderException(e);
                }
            monitor.done();
        }
    }
View Full Code Here


                if (monitor.isCanceled())
                    break;
            }
        } catch (IOException e) {
            throw new RenderException(e); // rethrow any exceptions encountered
        } finally {
            if (reader != null)
                try {
                    reader.close();
                } catch (IOException e) {
                    throw new RenderException(e); // rethrow any exceptions encountered
                }
            monitor.done();
        }
    }
View Full Code Here

            }
            setState(RENDERING);
        }
        if (!exceptions.isEmpty()) {
            // XXX: externalize this message
            RenderException exception = new RenderException(exceptions.size()
                    + " exceptions we raised while drawing map graphics", exceptions.get(0)); //$NON-NLS-1$
            exception.fillInStackTrace();
        }
        setState(DONE);
       
    }
View Full Code Here

        Graphics2D denstination = getContext().getImage().createGraphics();
        denstination.drawImage(cache, transform, null);
       
        if (!exceptions.isEmpty()) {
            //XXX: externalize this message
            RenderException exception = new RenderException(exceptions.size()
                    + " exceptions we raised while drawing map graphics", exceptions.get(0)); //$NON-NLS-1$
            exception.fillInStackTrace();
        }
        setState(DONE);
    }
View Full Code Here

                RendererPlugin.log("Viewable area available in the layer CRS", te); //$NON-NLS-1$
                endMessage = Messages.BasicFeatureRenderer_warning1;
                endStatus = ILayer.WARNING;
                return;
            } catch (FactoryException e) {
                throw (RenderException) new RenderException().initCause(e);
            }
           
            listener.init( new SubProgressMonitor( monitor,90) );
            setQueries();
           
            monitor.worked(5);
           
            Point min = getContext().worldToPixel(
                    new Coordinate(validBounds.getMinX(), validBounds
                            .getMinY()));
            Point max = getContext().worldToPixel(
                    new Coordinate(validBounds.getMaxX(), validBounds
                            .getMaxY()));
  
            int width = Math.abs(max.x - min.x);
            int height = Math.abs(max.y - min.y);

            Rectangle paintArea = new Rectangle(Math.min(min.x, max.x), Math.min(min.y, max.y), width, height);

            int expandPaintAreaBy = 0;
            if (expandSizePaintArea > 0) {
                expandPaintAreaBy = expandSizePaintArea;
            }
            // expand the painArea by 30 pixels each direction to get symbols
            // rendered right (up to a size of 60 pix)
            // upper left
            paintArea.addMath.min(min.x, max.x) - expandPaintAreaBy,
                            Math.min(min.y, max.y) - expandPaintAreaBy);
            // lower right
            paintArea.addMath.max(min.x, max.x) + expandPaintAreaBy,
                            Math.max(min.y, max.y) + expandPaintAreaBy);
           
            if( clear ){ // if partial update on live screen
                graphics.setBackground(new Color(0,0,0,0));
                graphics.clearRect(paintArea.x, paintArea.y, paintArea.width, paintArea.height);
            }
           
            validBounds=getContext().worldBounds(paintArea);

            MapViewport mapViewport = new MapViewport( validBounds );
            map.setViewport( mapViewport);

            GTRenderer geotToolsRenderer = getRenderer();

            if (bounds != null && !bounds.isNull()) {
                graphics.setClip(paintArea);
            }
            java.util.Map<Object, Object> rendererHints = geotToolsRenderer.getRendererHints();

            rendererHints.put(StreamingRenderer.DECLARED_SCALE_DENOM_KEY, getContext()
                    .getViewportModel().getScaleDenominator());
            rendererHints.put(StreamingRenderer.SCALE_COMPUTATION_METHOD_KEY,
                    StreamingRenderer.SCALE_ACCURATE);
            ILabelPainter labelPainter = getContext().getLabelPainter();
            Point origin = new Point(paintArea.x, paintArea.y);
            String layerId = getContext().getLayer().getID().toString();
            if (getContext().getLayer() instanceof SelectionLayer)
                layerId = layerId + "-Selection"; //$NON-NLS-1$
            rendererHints.put(StreamingRenderer.LABEL_CACHE_KEY, new LabelCacheDecorator(
                    labelPainter, origin, layerId));

            geotToolsRenderer.setRendererHints(rendererHints);

            RenderingHints hints = new RenderingHints(Collections.EMPTY_MAP);
            hints.add(new RenderingHints(RenderingHints.KEY_RENDERING,
                    RenderingHints.VALUE_RENDER_SPEED));
            hints.add(new RenderingHints(RenderingHints.KEY_DITHERING,
                    RenderingHints.VALUE_DITHER_DISABLE));
            hints.add(new RenderingHints(RenderingHints.KEY_ALPHA_INTERPOLATION,
                    RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED));
            hints.add(new RenderingHints(RenderingHints.KEY_COLOR_RENDERING,
                    RenderingHints.VALUE_COLOR_RENDER_SPEED));
            hints.add(new RenderingHints(RenderingHints.KEY_INTERPOLATION,
                    RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR));
            hints.add(new RenderingHints(RenderingHints.KEY_STROKE_CONTROL,
                    RenderingHints.VALUE_STROKE_PURE));
            hints.add(new RenderingHints(RenderingHints.KEY_FRACTIONALMETRICS,
                    RenderingHints.VALUE_FRACTIONALMETRICS_OFF));

            IPreferenceStore store = ProjectPlugin.getPlugin().getPreferenceStore();
            boolean antiAliasing = store.getBoolean(PreferenceConstants.P_ANTI_ALIASING);
            hints.add(new RenderingHints(RenderingHints.KEY_ANTIALIASING, antiAliasing
                    ? RenderingHints.VALUE_ANTIALIAS_ON
                    : RenderingHints.VALUE_ANTIALIAS_OFF));

            graphics.addRenderingHints(hints);
            geotToolsRenderer.setJava2DHints(hints);

            if (monitor.isCanceled()){
                return;
            }
            if( paintArea == null || paintArea.isEmpty() || validBounds == null || validBounds.isEmpty() || validBounds.isNull() || validBounds.getWidth() <=0 || validBounds.getHeight()<=0 ){
                System.out.println("nothing to draw");
                // nothing to draw yet
            }
            else {
                geotToolsRenderer.paint(graphics, paintArea, validBounds);
            }

        } catch (Throwable renderingProblem) {
            if (renderingProblem instanceof InterruptedException){
                // ignore the rendering process being interrupted this is expected
                // if the user pans while we are drawing
                return;
            }
            RenderException e2 = new RenderException( renderingProblem.getClass()+" occured during rendering: " //$NON-NLS-1$
                    + renderingProblem.getLocalizedMessage(), renderingProblem );
            throw e2;
        } finally {
            /*
             * vitalus: Clear MapContext to remove <code>FeatureListener</code>s from FeatureStore
             * implementation, otherwises listeners hell takes place (example is a
             * ShapefileDataStore and its FeatureListenerManager).
             */
            if (map != null) {
                map.layers().clear();
            }

            getContext().setStatus(endStatus);
            getContext().setStatusMessage(endMessage);
            Exception renderingProblem = listener.exception;
            if (renderingProblem != null) {
                if (renderingProblem instanceof InterruptedException)
                    return;
                if (!(renderingProblem instanceof TopologyException)) {
                    RenderException e2 = new RenderException(
                            Messages.BasicFeatureRenderer_renderingProblem
                                    + renderingProblem.getLocalizedMessage(), renderingProblem);
                    throw e2;
                }
            }
View Full Code Here

            g.drawString(name, p.x + 15, p.y + 15);
            monitor.worked(1);
            if (monitor.isCanceled()) break;
        }
    } catch (IOException e) {
        throw new RenderException(e); // rethrow any exceptions encountered
    } catch (FactoryException e) {
        throw new RenderException(e); // rethrow any exceptions encountered
    } finally {
        if (reader != null)
            try {
                reader.close();
            } catch (IOException e) {
                throw new RenderException(e); // rethrow any exceptions encountered
            }
        monitor.done();
    }
}
View Full Code Here

                    setState( DONE );
              }
              //tempCache.flush();
      }
        } catch (Exception e1) {
            throw new RenderException(e1);
        }
        finally {
            getContext().setStatus(ILayer.DONE);
            getContext().setStatusMessage(null);
        }
View Full Code Here

            throws RenderException {
        GridCoverageRenderState state = null;
        try {
            state = prepareRender(monitor);
        } catch (IOException e1) {
            throw new RenderException(e1);
        }

        doRender(renderer, graphics, state);
    }
View Full Code Here

            renderGridCoverage(destination, backprojectedBBox, imageDimensions, requestBBox, image);

        } catch (Exception e) {
          if( e instanceof RenderException )
            throw (RenderException) e;
            throw new RenderException(e);
        } finally {
            getContext().setStatus(endLayerStatus);
            if (endLayerStatus == ILayer.DONE) {
                // clear the status message (rendering was successful)
                getContext().setStatusMessage(null);
View Full Code Here

                } catch (ServiceException e) {
                    exception[0]=wrapException(e);
                } catch( Throwable t){
                  String message = Messages.BasicWMSRenderer2_errorObtainingImage;
          image[0] = getContext().getImage();
          exception[0]=new RenderException(message, t);
                } finally {
                    synchronized (condition) {
                        condition.notify();
                    }
                    if (inputStream != null)
View Full Code Here

TOP

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

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.