Examples of RasterTile


Examples of org.geomajas.layer.tile.RasterTile

  @Test
  public void testTerrainDs() throws Exception {
    List<RasterTile> tiles = physicalDs.paint(physicalDs.getCrs(),
        new Envelope(10000, 10010, 4000, 4010), ZOOMED_IN_SCALE);
    Assert.assertEquals(1, tiles.size());
    RasterTile tile = tiles.get(0);
    Assert.assertEquals("http://mt0.google.com/vt?lyrs=t@127,r@156000000&x=8&y=7&z=4", tile.getUrl());
    Assert.assertEquals(4, tile.getCode().getTileLevel());
    Assert.assertEquals(8, tile.getCode().getX());
    Assert.assertEquals(7, tile.getCode().getY());
    Assert.assertEquals(0.0, tile.getBounds().getX(), DELTA);
    Assert.assertEquals(-250.0, tile.getBounds().getY(), DELTA);
    Assert.assertEquals(250.0, tile.getBounds().getHeight(), DELTA);
    Assert.assertEquals(250.0, tile.getBounds().getWidth(), DELTA);
  }
View Full Code Here

Examples of org.geomajas.layer.tile.RasterTile

  }

  @Test
  public void testMaxLevel() throws Exception {
    Envelope envelope = new Envelope(10000, 10002, 5000, 5002);
    RasterTile tile;
    List<RasterTile> tiles;
    tiles = osm.paint(osm.getCrs(), envelope, MAX_LEVEL_SCALE);
    Assert.assertEquals(1, tiles.size());
    tile = tiles.get(0);
    Assert.assertEquals("http://a.tile.openstreetmap.org/14/8196/8189.png", tile.getUrl());
    tiles = osmMaxLevel.paint(osmMaxLevel.getCrs(), envelope, MAX_LEVEL_SCALE);
    Assert.assertEquals(1, tiles.size());
    tile = tiles.get(0);
    Assert.assertEquals("http://a.tile.openstreetmap.org/12/2049/2047.png", tile.getUrl());
  }
View Full Code Here

Examples of org.geomajas.layer.tile.RasterTile

  }

  @Test
  public void testConfigUrlStrategy() throws Exception {
    Envelope envelope = new Envelope(10000, 10002, 5000, 5002);
    RasterTile tile;
    List<RasterTile> tiles;
    tiles = osmCycleMap.paint(osmCycleMap.getCrs(), envelope, MAX_LEVEL_SCALE);
    Assert.assertEquals(1, tiles.size());
    tile = tiles.get(0);
    Assert.assertEquals("http://c.tile.opencyclemap.org/14/8196/8189.png", tile.getUrl());
    tiles = osmCycleMap.paint(osmCycleMap.getCrs(), envelope, MAX_LEVEL_SCALE);
    Assert.assertEquals(1, tiles.size());
    tile = tiles.get(0);
    Assert.assertEquals("http://c.tile.opencyclemap.org/14/8196/8189.png", tile.getUrl());
  }
View Full Code Here

Examples of org.geomajas.layer.tile.RasterTile

  @Test
  public void testNormalOne() throws Exception {
    List<RasterTile> tiles = osm.paint(osm.getCrs(), new Envelope(10000, 10010, 5000, 5010), ZOOMED_IN_SCALE);
    Assert.assertEquals(1, tiles.size());
    RasterTile tile = tiles.get(0);
    Assert.assertEquals("http://a.tile.openstreetmap.org/4/8/7.png", tile.getUrl());
    Assert.assertEquals(4, tile.getCode().getTileLevel());
    Assert.assertEquals(8, tile.getCode().getX());
    Assert.assertEquals(7, tile.getCode().getY());
    Assert.assertEquals(0.0, tile.getBounds().getX(), DELTA);
    Assert.assertEquals(-250.0, tile.getBounds().getY(), DELTA);
    Assert.assertEquals(250.0, tile.getBounds().getHeight(), DELTA);
    Assert.assertEquals(250.0, tile.getBounds().getWidth(), DELTA);
  }
View Full Code Here

Examples of org.geomajas.layer.tile.RasterTile

    Assert.assertEquals(4, tiles.size());
    Assert.assertEquals("http://a.tile.openstreetmap.org/14/8196/8188.png", tiles.get(0).getUrl());
    Assert.assertEquals("http://a.tile.openstreetmap.org/14/8196/8189.png", tiles.get(1).getUrl());
    Assert.assertEquals("http://a.tile.openstreetmap.org/14/8197/8188.png", tiles.get(2).getUrl());
    Assert.assertEquals("http://a.tile.openstreetmap.org/14/8197/8189.png", tiles.get(3).getUrl());
    RasterTile tile = tiles.get(3);
    Assert.assertEquals("http://a.tile.openstreetmap.org/14/8197/8189.png", tile.getUrl());
    Assert.assertEquals(14, tile.getCode().getTileLevel());
    Assert.assertEquals(8197, tile.getCode().getX());
    Assert.assertEquals(8189, tile.getCode().getY());
    Assert.assertEquals(1223, tile.getBounds().getX(), DELTA);
    Assert.assertEquals(-733.0, tile.getBounds().getY(), DELTA);
    Assert.assertEquals(245.0, tile.getBounds().getHeight(), DELTA);
    Assert.assertEquals(245.0, tile.getBounds().getWidth(), DELTA);
  }
View Full Code Here

Examples of org.geomajas.layer.tile.RasterTile

    // back-transform scale to latlon
    double latlonScale = ZOOMED_IN_SCALE * googleEnvelope.getWidth() / latlonEnvelope.getWidth();
    // paint with reprojection (affine is fine for now...:-)
    List<RasterTile> tiles = osm.paint(latlon, latlonEnvelope, latlonScale);
    Assert.assertEquals(1, tiles.size());
    RasterTile tile = tiles.get(0);
    Assert.assertEquals("http://a.tile.openstreetmap.org/4/8/7.png", tile.getUrl());
    Assert.assertEquals(4, tile.getCode().getTileLevel());
    Assert.assertEquals(8, tile.getCode().getX());
    Assert.assertEquals(7, tile.getCode().getY());
    Assert.assertEquals(0.0, tile.getBounds().getX(), DELTA);
    Assert.assertEquals(-244.0, tile.getBounds().getY(), DELTA);
    Assert.assertEquals(244.0, tile.getBounds().getHeight(), DELTA);
    Assert.assertEquals(250.0, tile.getBounds().getWidth(), DELTA);
  }
View Full Code Here

Examples of org.geomajas.layer.tile.RasterTile

        for (int j = jMin; j < jMax; j++) {
          // Using screen coordinates:
          int x = xScreenUpperLeft + (i - iMin) * screenWidth;
          int y = yScreenUpperLeft - (j - jMin) * screenHeight;

          RasterTile image = new RasterTile(new Bbox(x, -y, screenWidth, screenHeight),
              tileServiceState.getId() + "." + zoomLevel + "." + i + "," + j);
          image.setCode(new TileCode(zoomLevel, i, j));
          String url = tileServiceState.getUrlSelectionStrategy().next();
          url = url.replace("${level}", Integer.toString(zoomLevel));
          url = url.replace("${x}", Integer.toString(i));
          url = url.replace("${y}", Integer.toString(j));
          image.setUrl(url);
          log.debug("adding image {}", image);
          result.add(image);
        }
      }
      return result;
View Full Code Here

Examples of org.geomajas.layer.tile.RasterTile

            try {
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              log.debug("rendering to buffer...");
              ImageIO.write(mosaic, "png", baos);
              log.debug("rendering done, size = " + baos.toByteArray().length);
              RasterTile mosaicTile = new RasterTile();
              mosaicTile.setBounds(getWorldBounds(tiles));
              ImageResult mosaicResult = new ImageResult(mosaicTile);
              mosaicResult.setImage(baos.toByteArray());
              addImage(context, mosaicResult);
            } catch (IOException e) {
              log.warn("could not write mosaic image " + e.getMessage());
View Full Code Here

Examples of org.geomajas.layer.tile.RasterTile

      }
    }
  }

  private boolean isYIndexUp(List<RasterTile> tiles) {
    RasterTile first = tiles.iterator().next();
    for (RasterTile tile : tiles) {
      if (tile.getCode().getY() > first.getCode().getY()) {
        return tile.getBounds().getY() > first.getBounds().getY();
      } else if (tile.getCode().getY() < first.getCode().getY()) {
        return tile.getBounds().getY() < first.getBounds().getY();
      }
    }
    return false;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.