Package org.openstreetmap.gui.jmapviewer

Examples of org.openstreetmap.gui.jmapviewer.Tile


        }
        for (int j = 0; j < x; j++) {
          if (x_min <= posx && posx <= x_max && y_min <= posy
              && posy <= y_max) {
            // tile is visible
            Tile tile = getTile(tilex, tiley, zoom);
            if (tile != null) {
              painted = true;
              tile.paint(g, posx, posy);
              if (tileGridVisible) {
                g.drawString(tile.getXtile() + ", "
                    + tile.getYtile(), posx, posy + 12);
                g.drawRect(posx, posy, Tile.SIZE, Tile.SIZE);
              }
            }
          }
          Point p = move[iMove];
View Full Code Here


  protected Tile getTile(int tilex, int tiley, int zoom) {
    int max = (1 << zoom);
    if (tilex < 0 || tilex >= max || tiley < 0 || tiley >= max) {
      return null;
    }
    Tile tile = tileCache.getTile(tileSource, tilex, tiley, zoom);
    if (tile == null) {
      tile = new Tile(tileSource, tilex, tiley, zoom);
      tileCache.addTile(tile);
      tile.loadPlaceholderFromCache(tileCache);
    }
    if (LOG.isTraceEnabled()) {
      LOG.trace("Numero de intentos para " + tile.getKey() + ": "
          + tile.getNumIntentos());
    }
    if (!tile.isLoaded() && tile.getNumIntentos() < Tile.MAX_NUM_INTENTOS) {
      jobDispatcher.addJob(tileLoader.createTileLoaderJob(tileSource,
          tilex, tiley, zoom));
    }
    return tile;
  }
View Full Code Here

          x++;
        for (int j = 0; j < x; j++) {
          if (x_min <= posx && posx <= x_max && y_min <= posy
              && posy <= y_max) {
            // tile is visible
            Tile tile = getTile(tilex, tiley, zoom);
            if (tile != null) {
              painted = true;
              tile.paint(g, posx, posy);
              if (tileGridVisible) {
                g.drawString(tile.getXtile() + ", "
                    + tile.getYtile(), posx, posy + 12);
                g.drawRect(posx, posy, Tile.SIZE, Tile.SIZE);
              }
            }
            ntiles++;
          }
View Full Code Here

     */
    synchronized Tile tempCornerTile(Tile t) {
        int x = t.getXtile() + 1;
        int y = t.getYtile() + 1;
        int zoom = t.getZoom();
        Tile tile = getTile(x, y, zoom);
        if (tile != null)
            return tile;
        return new Tile(tileSource, x, y, zoom);
    }
View Full Code Here

            return tile;
        return new Tile(tileSource, x, y, zoom);
    }

    synchronized Tile getOrCreateTile(int x, int y, int zoom) {
        Tile tile = getTile(x, y, zoom);
        if (tile == null) {
            tile = new Tile(tileSource, x, y, zoom);
            tileCache.addTile(tile);
            tile.loadPlaceholderFromCache(tileCache);
        }
        return tile;
    }
View Full Code Here

        /*
         * We need to get a box in which to draw, so advance by one tile in
         * each direction to find the other corner of the box.
         * Note: this somewhat pollutes the tile cache
         */
        Tile t2 = tempCornerTile(t1);
        Rectangle rect = new Rectangle(pixelPos(t1));
        rect.add(pixelPos(t2));
        return rect;
    }
View Full Code Here

                if ("no-tile".equals(missed.getValue("tile-info")) && zoomOffset > 0) {
                    // Don't try to paint from higher zoom levels when tile is overzoomed
                    newlyMissedTiles.add(missed);
                    continue;
                }
                Tile t2 = tempCornerTile(missed);
                LatLon topLeft2  = tileLatLon(missed);
                LatLon botRight2 = tileLatLon(t2);
                TileSet ts2 = new TileSet(topLeft2, botRight2, newzoom);
                // Instantiating large TileSets is expensive.  If there
                // are no loaded tiles, don't bother even trying.
View Full Code Here

        TileSet ts = new TileSet(topLeft, botRight, z);

        if (!ts.tooLarge()) {
            ts.loadAllTiles(false); // make sure there are tile objects for all tiles
        }
        Tile clickedTile = null;
        for (Tile t1 : ts.allExistingTiles()) {
            Tile t2 = tempCornerTile(t1);
            Rectangle r = new Rectangle(pixelPos(t1));
            r.add(pixelPos(t2));
            if (Main.isDebugEnabled()) {
                Main.debug("r: " + r + " clicked: " + clicked);
            }
View Full Code Here

            if (zoom == 0 || this.insane())
                return Collections.emptyList();
            List<Tile> ret = new ArrayList<>();
            for (int x = x0; x <= x1; x++) {
                for (int y = y0; y <= y1; y++) {
                    Tile t;
                    if (create) {
                        t = getOrCreateTile(x % tileMax, y % tileMax, zoom);
                    } else {
                        t = getTile(x % tileMax, y % tileMax, zoom);
                    }
View Full Code Here

TOP

Related Classes of org.openstreetmap.gui.jmapviewer.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.