Package org.geomajas.layer.tile

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(graphics, mosaicResult, viewport);
          } catch (IOException e) {
            log.warn("could not write mosaic image " + e.getMessage());
View Full Code Here


  public ReferencedEnvelope getBounds() {
    return null;
  }

  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

    // 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 = wms.paint(latlon, latlonEnvelope, latlonScale);
    Assert.assertEquals(1, tiles.size());
    RasterTile tile = tiles.get(0);
    // ZOOMED_IN_SCALE 1E-4 corresponds to level 4 with current algorithm !!!!
    Assert.assertEquals("http://apps.geomajas.org/geoserver/wms?SERVICE=WMS&"
        + "layers=bluemarble&WIDTH=512&HEIGHT=512&"
        + "bbox=-20.032430835865227,-28.207099921352835,11.947593278789554,3.7729241933019466&"
        + "format=image/jpeg&version=1.1.1&srs=EPSG:4326&styles=&request=GetMap", tile.getUrl());
    Assert.assertEquals(4, tile.getCode().getTileLevel());
    Assert.assertEquals(5, tile.getCode().getX());
    Assert.assertEquals(12, tile.getCode().getY());
    Assert.assertEquals(-223.0, tile.getBounds().getX(), DELTA);
    Assert.assertEquals(-42.0, tile.getBounds().getY(), DELTA);
    Assert.assertEquals(356.0, tile.getBounds().getHeight(), DELTA);
    Assert.assertEquals(356.0, tile.getBounds().getWidth(), DELTA);

  }
View Full Code Here

        .get(2).getUrl());
    Assert.assertEquals("http://apps.geomajas.org/geoserver/wms?SERVICE=WMS&layers=bluemarble&"
        + "WIDTH=512&HEIGHT=512&bbox=0.09677101398176689,47.38586174271936,0.10458635695360671,"
        + "47.393677085691195&format=image/jpeg&version=1.1.1&srs=EPSG:4326&styles=&request=GetMap",
        tiles.get(3).getUrl());
    RasterTile tile = tiles.get(3);
    // MAX_LEVEL_SCALE 0.4 corresponds to level 16 with current algorithm  !!!!
    Assert.assertEquals(16, tile.getCode().getTileLevel());
    Assert.assertEquals(23044, tile.getCode().getX());
    Assert.assertEquals(58780, tile.getCode().getY());
    Assert.assertEquals(4309.0, tile.getBounds().getX(), DELTA);
    Assert.assertEquals(-2110336.0, tile.getBounds().getY(), DELTA);
    Assert.assertEquals(348.0, tile.getBounds().getHeight(), DELTA);
    Assert.assertEquals(348.0, tile.getBounds().getWidth(), DELTA);
  }
View Full Code Here

    // back-transform envelope to latlon
    Crs google = geoService.getCrs2(MERCATOR);
    // paint with reprojection (affine is fine for now...:-)
    List<RasterTile> tiles = wms.paint(google, googleEnvelope, ZOOMED_IN_SCALE);
    Assert.assertEquals(1, tiles.size());
    RasterTile tile = tiles.get(0);
    Assert.assertEquals("http://apps.geomajas.org/geoserver/wms?SERVICE=WMS&"
        + "layers=bluemarble&WIDTH=512&HEIGHT=512&"
        + "bbox=-20.032430835865227,-28.207099921352835,11.947593278789554,3.7729241933019466&"
        + "format=image/jpeg&version=1.1.1&srs=EPSG:4326&styles=&request=GetMap", tile.getUrl());
    Assert.assertEquals(4, tile.getCode().getTileLevel());
    Assert.assertEquals(5, tile.getCode().getX());
    Assert.assertEquals(12, tile.getCode().getY());
    Assert.assertEquals(-223.0, tile.getBounds().getX(), DELTA);
    Assert.assertEquals(-42.0, tile.getBounds().getY(), DELTA);
    Assert.assertEquals(370.0, tile.getBounds().getHeight(), DELTA);
    Assert.assertEquals(356.0, tile.getBounds().getWidth(), DELTA);
  }
View Full Code Here

        .get(2).getUrl());
    Assert.assertEquals("http://apps.geomajas.org/geoserver/wms?SERVICE=WMS&layers=bluemarble&"
        + "WIDTH=512&HEIGHT=512&bbox=0.09677101398176689,47.38586174271936,0.10458635695360671,"
        + "47.393677085691195&format=image/jpeg&version=1.1.1&srs=EPSG:4326&styles=&request=GetMap",
        tiles.get(3).getUrl());
    RasterTile tile = tiles.get(3);
    // MAX_LEVEL_SCALE 0.4 corresponds to level 16 !!!!
    Assert.assertEquals(16, tile.getCode().getTileLevel());
    Assert.assertEquals(23044, tile.getCode().getX());
    Assert.assertEquals(58780, tile.getCode().getY());
    Assert.assertEquals(4309.0, tile.getBounds().getX(), DELTA);
    Assert.assertEquals(-2402628.0, tile.getBounds().getY(), DELTA);
    Assert.assertEquals(514.0, tile.getBounds().getHeight(), DELTA);
    Assert.assertEquals(348.0, tile.getBounds().getWidth(), DELTA);
    // test alignment on grid
    double x = tiles.get(0).getBounds().getX();
    double y = tiles.get(0).getBounds().getY();
    double width = tiles.get(0).getBounds().getWidth();
    double height = tiles.get(0).getBounds().getHeight();
View Full Code Here

    // 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 = proxyWms.paint(latlon, latlonEnvelope, latlonScale);
    Assert.assertEquals(1, tiles.size());
    RasterTile tile = tiles.get(0);
    Assert.assertEquals("./d/wms/proxyBlue/?SERVICE=WMS&layers=bluemarble&WIDTH=512&HEIGHT=512&"
        + "bbox=-20.032430835865227,-28.207099921352835,11.947593278789554,3.7729241933019466&"
        + "format=image/jpeg&version=1.3.0&crs=EPSG:4326&styles=&request=GetMap", tile.getUrl());
    Assert.assertEquals(4, tile.getCode().getTileLevel());
    Assert.assertEquals(5, tile.getCode().getX());
    Assert.assertEquals(12, tile.getCode().getY());
    Assert.assertEquals(-223.0, tile.getBounds().getX(), DELTA);
    Assert.assertEquals(-42.0, tile.getBounds().getY(), DELTA);
    Assert.assertEquals(356.0, tile.getBounds().getHeight(), DELTA);
    Assert.assertEquals(356.0, tile.getBounds().getWidth(), DELTA);
  }
View Full Code Here

    // 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 = defaultWms.paint(latlon, latlonEnvelope, latlonScale);
    Assert.assertEquals(1, tiles.size());
    RasterTile tile = tiles.get(0);
    Assert.assertEquals("http://apps.geomajas.org/geoserver/wms?SERVICE=WMS&layers=bluemarble&"
        + "WIDTH=512&HEIGHT=512&bbox=-20.032430835865227,-28.207099921352835,11.947593278789554,"
        + "3.7729241933019466&format=image/png&version=1.1.1&srs=EPSG:4326&styles=&request=GetMap",
        tile.getUrl());
    Assert.assertEquals(4, tile.getCode().getTileLevel());
    Assert.assertEquals(5, tile.getCode().getX());
    Assert.assertEquals(12, tile.getCode().getY());
    Assert.assertEquals(-223.0, tile.getBounds().getX(), DELTA);
    Assert.assertEquals(-42.0, tile.getBounds().getY(), DELTA);
    Assert.assertEquals(356.0, tile.getBounds().getHeight(), DELTA);
    Assert.assertEquals(356.0, tile.getBounds().getWidth(), DELTA);
  }
View Full Code Here

  }

  @Test
  public void testMaxLevel() throws Exception {
    Envelope envelope = new Envelope(10000, 10002, 5000, 5002);
    RasterTile tile;
    List<RasterTile> tiles;
    tiles = google.paint(google.getCrs(), envelope, MAX_LEVEL_SCALE);
    Assert.assertEquals(1, tiles.size());
    tile = tiles.get(0);
    Assert.assertEquals("http://mt0.google.com/vt?v=w2.95&x=8196&y=8189&z=14", tile.getUrl());
    tiles = googleMaxLevel.paint(googleMaxLevel.getCrs(), envelope, MAX_LEVEL_SCALE);
    Assert.assertEquals(1, tiles.size());
    tile = tiles.get(0);
    Assert.assertEquals("http://mt0.google.com/vt?v=w2.95&x=2049&y=2047&z=12", tile.getUrl());
  }
View Full Code Here

  }

  @Test
  public void testConfigUrlStrategy() throws Exception {
    Envelope envelope = new Envelope(10000, 10002, 5000, 5002);
    RasterTile tile;
    List<RasterTile> tiles;
    tiles = googleStrategy.paint(googleStrategy.getCrs(), envelope, MAX_LEVEL_SCALE);
    Assert.assertEquals(1, tiles.size());
    tile = tiles.get(0);
    Assert.assertEquals("http://mt3.google.com/vt?v=w2.95&x=8196&y=8189&z=14", tile.getUrl());
    tiles = googleStrategy.paint(googleStrategy.getCrs(), envelope, MAX_LEVEL_SCALE);
    Assert.assertEquals(1, tiles.size());
    tile = tiles.get(0);
    Assert.assertEquals("http://mt3.google.com/vt?v=w2.95&x=8196&y=8189&z=14", tile.getUrl());
  }
View Full Code Here

TOP

Related Classes of org.geomajas.layer.tile.RasterTile

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.