Package org.locationtech.udig.project.render

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


        Collection<ReferencedEnvelope> tileBounds = computeTileBounds(areaOfInterest, resolution);

        for( Iterator<ReferencedEnvelope> iterator = tileBounds.iterator(); iterator.hasNext(); ) {
            ReferencedEnvelope referencedEnvelope = (ReferencedEnvelope) iterator.next();

            Tile tile = getOrCreateTile(referencedEnvelope);

            RenderExecutorComposite re = tile.getRenderExecutor();
            if (tile.getRenderState() == Tile.RenderState.INVALID) {
                re.setRenderBounds(tile.getReferencedEnvelope());
                re.getRenderer().setState(IRenderer.RENDER_REQUEST);
                re.render();
            } else {
                //kick the renderer to refresh the image
               re.getRenderer().setState(IRenderer.DONE);
            }
            tile.setRenderState(Tile.RenderState.RENDERED);
        }
    }
View Full Code Here


     * Disposes all tiles
     */
    private void disposeAllTiles(){
        for( Iterator<Object> iterator = tileCache.getKeys().iterator(); iterator.hasNext(); ) {
            ReferencedEnvelope key = (ReferencedEnvelope) iterator.next();
            Tile t = (Tile)tileCache.get(key);
            if (t != null){
                removeAdapters(t.getRenderExecutor());
                t.dispose();
            }
        }   
    }
View Full Code Here

        //they are the same; so they are related
        if (layer == contained) return true;
       
       
        Tile t = null;
        Iterator<Object> keys = tileCache.getKeys().iterator();
        while( t == null && keys.hasNext()){
            t = (Tile)tileCache.get((ReferencedEnvelope)keys.next());
        }
        if (t == null){
            //no tile found
            return false;
        }

        RenderExecutorComposite parent  = t.getRenderExecutor();
        Collection<TiledCompositeRendererImpl.RenderInfo>  kids = ((TiledCompositeRendererImpl)parent.getRenderer()).getChildren();
       
        for( Iterator<TiledCompositeRendererImpl.RenderInfo> iterator = kids.iterator(); iterator.hasNext(); ) {
            TiledCompositeRendererImpl.RenderInfo kid = iterator.next();
            IRenderContext childcontext = kid.getRenderer().getContext()
View Full Code Here

        try {
            for( Iterator<ReferencedEnvelope> iterator = bounds.iterator(); iterator.hasNext(); ) {
                ReferencedEnvelope env = (ReferencedEnvelope) iterator.next();

                // get the tile
                Tile tile = getOrCreateTile(env);
                tile.setScreenState(Tile.ScreenState.ONSCREEN);
                if (tile.getRenderState() == Tile.RenderState.INVALID){
                    tile.getRenderExecutor().setRenderBounds(tile.getReferencedEnvelope());
                    tile.getRenderExecutor().setState(IRenderer.RENDER_REQUEST);
                }
                newTiles.put(env, tile);
            }
           
            //update the other tiles to an offscreen state
            for( Iterator<Object> iterator = tileCache.getKeys().iterator(); iterator.hasNext(); ) {
                ReferencedEnvelope referencedEnvelope = (ReferencedEnvelope) iterator.next();
                Tile t = (Tile)tileCache.get(referencedEnvelope);
                if (t != null && !newTiles.containsKey(referencedEnvelope)){
                    t.setScreenState(Tile.ScreenState.OFFSCREEN);
                }
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
View Full Code Here

     *
     */
    private void invalidateAllTilesRenderState(){
        for( Iterator<Object> iterator = tileCache.getKeys().iterator(); iterator.hasNext(); ) {
            ReferencedEnvelope key = (ReferencedEnvelope)iterator.next();
            Tile t = (Tile)tileCache.get(key);
            if (t != null){
                t.setRenderState(Tile.RenderState.INVALID);
            }
        }
    }
View Full Code Here

     * and modifications made as necessary.
     */
    private void invalidateAllTileContext(){
        for( Iterator<Object> iterator = tileCache.getKeys().iterator(); iterator.hasNext(); ) {
            ReferencedEnvelope key = (ReferencedEnvelope)iterator.next();
            Tile t = (Tile)tileCache.get(key);
            if (t != null){
                t.setContextState(Tile.ContextState.INVALID);
            }
        }
    }
View Full Code Here

        g.clearRect(0,0, getMapDisplay().getWidth(), getMapDisplay().getHeight());
       
        //update screen tile states
        for( Iterator<Object> iterator = tileCache.getKeys().iterator(); iterator.hasNext(); ) {
            ReferencedEnvelope referencedEnvelope = (ReferencedEnvelope) iterator.next();
            Tile t = (Tile)tileCache.get(referencedEnvelope);
            if (t != null && !tileBounds.contains(referencedEnvelope)){
                t.setScreenState(Tile.ScreenState.OFFSCREEN);
            }
        }
       
        try {
            for( Iterator<ReferencedEnvelope> iterator = tileBounds.iterator(); iterator.hasNext(); ) {
                ReferencedEnvelope env = (ReferencedEnvelope) iterator.next();

                // get the tile image
                Tile tile = getOrCreateTile(env);
                tile.setScreenState(Tile.ScreenState.ONSCREEN);
               
                BufferedImage tileimage = tile.getBufferedImage();

                //write the image to the screen image
                Point a = getViewportModelInternal().worldToPixel(new Coordinate(env.getMinX(), env.getMinY()));
                Point b = getViewportModelInternal().worldToPixel(new Coordinate(env.getMaxX(), env.getMaxY()));
               
View Full Code Here

        double resolution = viewportbounds.getWidth() / getMapDisplay().getWidth();
        Collection<ReferencedEnvelope> tileBounds = computeTileBounds(areaOfInterest, resolution);
       
        for( Iterator<Object> iterator = tileCache.getKeys().iterator(); iterator.hasNext(); ) {
            ReferencedEnvelope key = (ReferencedEnvelope)iterator.next();
            Tile t = (Tile)tileCache.get(key);
            if (!tileBounds.contains(key)){
                //we can't assume that all layers have been rendered outside of the current tile bounds
                //really we only need to do this when tiles are made visible...
                t.setRenderState(Tile.RenderState.INVALID);
            }
        }
    }
View Full Code Here

         * Renders each tile in the list; until the list is empty
         */
        @Override
        protected IStatus run( IProgressMonitor monitor ) {
            if (tilestorender.size() == 0) return Status.OK_STATUS;
            Tile t = tilestorender.remove(0);
            manager.renderTile(t);
            if (tilestorender.size() > 0){
                schedule();
            }
            return Status.OK_STATUS;
View Full Code Here

    public void clearCachedTiles() {
      //Collection<Tile> values = cachedTiles.values();
      //for (Tile tile : values) {
        Set<Entry<ReferencedEnvelope, Tile>> entrySet = cachedTiles.entrySet();
        for( Entry<ReferencedEnvelope, Tile> set : entrySet ) {
          Tile tile = set.getValue();
        // only dispose the image if this tile is not in the ready tiles
        if (!readyTiles.containsValue(tile)) {
          tile.disposeSWTImage();
        }
      }
      cachedTiles.clear();
    }
View Full Code Here

TOP

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

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.