本文整理汇总了Java中org.geomajas.layer.tile.RasterTile类的典型用法代码示例。如果您正苦于以下问题:Java RasterTile类的具体用法?Java RasterTile怎么用?Java RasterTile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RasterTile类属于org.geomajas.layer.tile包,在下文中一共展示了RasterTile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import org.geomajas.layer.tile.RasterTile; //导入依赖的package包/类
@Override
public ClientLayerInfo build(MapPresenter mapPresenter, Layer layer, Bbox worldBounds, double resolution) {
WmsLayer tileBasedLayer = (WmsLayer) layer;
TileConfiguration tileConfig = tileBasedLayer.getTileConfiguration();
WmsClientLayerInfo info = new WmsClientLayerInfo();
List<RasterTile> tiles = new ArrayList<RasterTile>();
for (Tile tile : getTiles(tileBasedLayer, mapPresenter.getViewPort().getCrs(), resolution, worldBounds)) {
tiles.add(toRasterTile(tile));
}
info.setTiles(tiles);
info.setTileHeight(tileBasedLayer.getTileConfiguration().getTileHeight());
info.setTileWidth(tileBasedLayer.getTileConfiguration().getTileWidth());
info.setScale(1 / getActualResolution(tileConfig, resolution));
info.setId(tileBasedLayer.getId());
RasterLayerRasterizingInfo rasterInfo = new RasterLayerRasterizingInfo();
rasterInfo.setShowing(tileBasedLayer.isShowing());
rasterInfo.setCssStyle(tileBasedLayer.getOpacity() + "");
info.getWidgetInfo().put(RasterLayerRasterizingInfo.WIDGET_KEY, rasterInfo);
return info;
}
示例2: build
import org.geomajas.layer.tile.RasterTile; //导入依赖的package包/类
@Override
public ClientLayerInfo build(MapPresenter mapPresenter, Layer layer, Bbox worldBounds, double resolution) {
AbstractTileBasedLayer tileBasedLayer = (AbstractTileBasedLayer) layer;
TileConfiguration tileConfig = tileBasedLayer.getTileConfiguration();
TilebasedClientLayerInfo info = new TilebasedClientLayerInfo();
List<RasterTile> tiles = new ArrayList<RasterTile>();
for (Tile tile : getTiles(tileBasedLayer, mapPresenter.getViewPort().getCrs(), resolution, worldBounds)) {
tiles.add(toRasterTile(tile));
}
info.setTiles(tiles);
info.setTileHeight(tileBasedLayer.getTileConfiguration().getTileHeight());
info.setTileWidth(tileBasedLayer.getTileConfiguration().getTileWidth());
info.setScale(1 / getActualResolution(tileConfig, resolution));
info.setCrs(mapPresenter.getViewPort().getCrs());
info.setId(tileBasedLayer.getId());
RasterLayerRasterizingInfo rasterInfo = new RasterLayerRasterizingInfo();
rasterInfo.setShowing(tileBasedLayer.isShowing());
rasterInfo.setCssStyle(tileBasedLayer.getOpacity() + "");
info.getWidgetInfo().put(RasterLayerRasterizingInfo.WIDGET_KEY, rasterInfo);
return info;
}
示例3: createLayer
import org.geomajas.layer.tile.RasterTile; //导入依赖的package包/类
public Layer createLayer(MapContext mapContext, ClientLayerInfo clientLayerInfo) throws GeomajasException {
if (!(clientLayerInfo instanceof TilebasedClientLayerInfo)) {
throw new IllegalArgumentException(
"TileBasedClientLayerFactory.createLayer() should only be called with TilebasedClientLayerInfo");
}
TilebasedClientLayerInfo rasterInfo = (TilebasedClientLayerInfo) clientLayerInfo;
RasterLayerRasterizingInfo extraInfo = (RasterLayerRasterizingInfo) rasterInfo
.getWidgetInfo(RasterLayerRasterizingInfo.WIDGET_KEY);
List<RasterTile> tiles = rasterInfo.getTiles();
for (RasterTile rasterTile : tiles) {
if (null != rasterTile.getUrl() && !rasterTile.getUrl().isEmpty()) {
rasterTile.setUrl(calculateUrl(rasterTile.getUrl()));
}
}
final RasterLayer layer = configurationService.getRasterLayer(clientLayerInfo.getServerLayerId());
RasterDirectLayer rasterLayer = new RasterDirectLayer(imageThreadPool, getHttpDownloader(layer), tiles,
rasterInfo.getTileHeight(), rasterInfo.getTileWidth(), rasterInfo.getScale(), extraInfo.getCssStyle());
rasterLayer.setTitle(clientLayerInfo.getLabel());
rasterLayer.getUserData().put(USERDATA_KEY_LAYER_ID, rasterInfo.getId());
rasterLayer.getUserData().put(USERDATA_KEY_SHOWING, extraInfo.isShowing());
return rasterLayer;
}
示例4: testNormalSeveral
import org.geomajas.layer.tile.RasterTile; //导入依赖的package包/类
@Test
public void testNormalSeveral() throws Exception {
Envelope envelope = new Envelope(10000, 13000, 5000, 8000);
List<RasterTile> tiles = osm.paint(osm.getCrs(), envelope, MAX_LEVEL_SCALE);
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);
}
示例5: testReprojectOne
import org.geomajas.layer.tile.RasterTile; //导入依赖的package包/类
@Test
public void testReprojectOne() throws Exception {
Envelope googleEnvelope = new Envelope(10000, 10010, 5000, 5010);
// back-transform envelope to latlon
Crs google = geoService.getCrs2("EPSG:900913");
Crs latlon = geoService.getCrs2("EPSG:4326");
Envelope latlonEnvelope = geoService.transform(JTS.toGeometry(googleEnvelope), google, latlon)
.getEnvelopeInternal();
// 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);
}
示例6: testPaintLevel1
import org.geomajas.layer.tile.RasterTile; //导入依赖的package包/类
@Test
@SuppressWarnings("deprecation")
public void testPaintLevel1() throws LayerException, GeomajasException {
double resolution = 512.0;
Envelope maxBounds = new Envelope(18000.0, 259500.250, 152999.75, 244500.0);
List<RasterTile> tiles = layer.paint(geoService.getCrs("EPSG:31370"), maxBounds, 1.0 / resolution);
Assert.assertEquals(2, tiles.size());
Assert.assertEquals(1, tiles.get(0).getCode().getTileLevel());
Assert.assertEquals(0, tiles.get(0).getCode().getX());
Assert.assertEquals(0, tiles.get(0).getCode().getY());
Assert.assertEquals("http://tms.osgeo.org/1.0.0/landsat2000/" + (int) resolution + "/0/0.png", tiles.get(0)
.getUrl());
Assert.assertEquals(1, tiles.get(1).getCode().getTileLevel());
Assert.assertEquals(1, tiles.get(1).getCode().getX());
Assert.assertEquals(0, tiles.get(1).getCode().getY());
Assert.assertEquals("http://tms.osgeo.org/1.0.0/landsat2000/" + (int) resolution + "/1/0.png", tiles.get(1)
.getUrl());
}
示例7: testProxy
import org.geomajas.layer.tile.RasterTile; //导入依赖的package包/类
@Test
@SuppressWarnings("deprecation")
public void testProxy() throws LayerException, GeomajasException {
double resolution = 512.0;
Envelope maxBounds = new Envelope(18000.0, 259500.250, 152999.75, 244500.0);
List<RasterTile> tiles = proxyLayer.paint(geoService.getCrs("EPSG:31370"), maxBounds, 1.0 / resolution);
Assert.assertEquals(2, tiles.size());
Assert.assertEquals(1, tiles.get(0).getCode().getTileLevel());
Assert.assertEquals(0, tiles.get(0).getCode().getX());
Assert.assertEquals(0, tiles.get(0).getCode().getY());
Assert.assertEquals("./d/tms-proxy/tmsLayerProxy/1/0/0.png", tiles.get(0)
.getUrl());
Assert.assertEquals(1, tiles.get(1).getCode().getTileLevel());
Assert.assertEquals(1, tiles.get(1).getCode().getX());
Assert.assertEquals(0, tiles.get(1).getCode().getY());
Assert.assertEquals("./d/tms-proxy/tmsLayerProxy/1/1/0.png", tiles.get(1)
.getUrl());
}
示例8: createLayer
import org.geomajas.layer.tile.RasterTile; //导入依赖的package包/类
public Layer createLayer(MapContext mapContext, ClientLayerInfo clientLayerInfo) throws GeomajasException {
if (!(clientLayerInfo instanceof ClientRasterLayerInfo)) {
throw new IllegalArgumentException(
"RasterLayerFactory.createLayer() should only be called using ClientRasterLayerInfo");
}
ClientRasterLayerInfo rasterInfo = (ClientRasterLayerInfo) clientLayerInfo;
RasterLayerRasterizingInfo extraInfo = (RasterLayerRasterizingInfo) rasterInfo
.getWidgetInfo(RasterLayerRasterizingInfo.WIDGET_KEY);
ReferencedEnvelope areaOfInterest = mapContext.getAreaOfInterest();
final RasterLayer layer = configurationService.getRasterLayer(clientLayerInfo.getServerLayerId());
MapViewport port = mapContext.getViewport();
double rasterScale = port.getScreenArea().getWidth() / port.getBounds().getWidth();
List<RasterTile> tiles = rasterLayerService.getTiles(clientLayerInfo.getServerLayerId(),
areaOfInterest.getCoordinateReferenceSystem(), areaOfInterest, rasterScale);
RasterDirectLayer rasterLayer = new RasterDirectLayer(imageThreadPool, new UrlDownLoader() {
@Override
public InputStream getStream(String url) throws IOException {
return httpService.getStream(url, layer);
}
}, tiles, layer.getLayerInfo().getTileWidth(), layer.getLayerInfo().getTileHeight(), extraInfo.getCssStyle());
rasterLayer.setTitle(clientLayerInfo.getLabel());
rasterLayer.getUserData().put(USERDATA_KEY_LAYER_ID, layer.getId());
rasterLayer.getUserData().put(USERDATA_KEY_SHOWING, extraInfo.isShowing());
return rasterLayer;
}
示例9: RasterDirectLayer
import org.geomajas.layer.tile.RasterTile; //导入依赖的package包/类
/**
* Create a layer with the specified thread pool.
*
* @param imageThreadPool thread pool
* @param urlDownLoader helper class for downloading images
* @param tiles the tiles to be rendered
* @param tileWidth the tile width
* @param tileHeight the tile height
* @param tileScale the scale at which to render
* @param style the image style
*
*/
public RasterDirectLayer(ExecutorService imageThreadPool, UrlDownLoader urlDownLoader, List<RasterTile> tiles,
int tileWidth, int tileHeight, double tileScale, String style) {
this.imageThreadPool = imageThreadPool;
this.urlDownLoader = urlDownLoader;
this.tileScale = tileScale;
this.tiles = tiles;
if (tileWidth < 1) {
tileWidth = 1;
}
this.tileWidth = tileWidth;
if (tileHeight < 1) {
tileHeight = 1;
}
this.tileHeight = tileHeight;
this.style = style;
}
示例10: testLevels
import org.geomajas.layer.tile.RasterTile; //导入依赖的package包/类
@Test
public void testLevels() throws Exception {
// this test failed before http://jira.geomajas.org/browse/WMS-18
Crs latlon = geoService.getCrs2(LONLAT);
Envelope latlonEnvelope = null;
for (int level = 0; level < 32; level++) {
double latlonScale = Math.pow(2, level);
// must reduce envelope as we zoom
latlonEnvelope = new Envelope(-180, -180 + 1.0 / latlonScale, -412, -412 + 1.0 / latlonScale);
List<RasterTile> tiles = wms.paint(latlon, latlonEnvelope, latlonScale);
Assert.assertEquals(1, tiles.size());
Assert.assertEquals(level, tiles.get(0).getCode().getTileLevel());
Assert.assertEquals(512, tiles.get(0).getBounds().getHeight(), DELTA);
Assert.assertEquals(512, tiles.get(0).getBounds().getWidth(), DELTA);
}
}
示例11: testNormalEncoded
import org.geomajas.layer.tile.RasterTile; //导入依赖的package包/类
@Test
public void testNormalEncoded() throws Exception {
Envelope googleEnvelope = new Envelope(10000, 10010, 5000, 5010);
// back-transform envelope to latlon
Crs google = geoService.getCrs2(MERCATOR);
Crs latlon = geoService.getCrs2(LONLAT);
Envelope latlonEnvelope = geoService.transform(JTS.toGeometry(googleEnvelope), google, latlon)
.getEnvelopeInternal();
// back-transform scale to latlon
double latlonScale = ZOOMED_IN_SCALE * googleEnvelope.getWidth() / latlonEnvelope.getWidth();
// paint with re-projection (affine is fine for now...:-)
List<RasterTile> tiles = escapeBlue.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 !!!!
assertThat(tile.getUrl()).isEqualTo("http://apps.geomajas.org/geoserver/wms?SERVICE=WMS&" +
"layers=geomajas%3Abluemarble&WIDTH=512&HEIGHT=512&bbox=0,0,45,45&format=image/png&version=1.1.1&" +
"srs=EPSG%3A4326&styles=&what%3F=value%2Bmore%21&request=GetMap");
}
示例12: testLowestTileLevel
import org.geomajas.layer.tile.RasterTile; //导入依赖的package包/类
@Test
public void testLowestTileLevel() throws Exception {
Crs lambert = geoService.getCrs2(LAMBERT);
double x = wms.getLayerInfo().getMaxExtent().getX();
double y = wms.getLayerInfo().getMaxExtent().getY();
ScaleInfo scaleInfo = wms.getLayerInfo().getZoomLevels().get(wms.getLayerInfo().getZoomLevels().size()- 1);
Envelope bounds = new Envelope(x - 1, x + 1, y - 1, y + 1);
double scale = scaleInfo.getPixelPerUnit();
List<RasterTile> tiles = wms.paint(lambert, bounds, scale);
Assert.assertEquals(1, tiles.size());
RasterTile tile = tiles.get(0);
double resultX = tile.getBounds().getX() / scale;
double resultY = -tile.getBounds().getY() / scale - tile.getBounds().getHeight() / scale;
Assert.assertEquals(x, resultX, 0.1);
Assert.assertEquals(y, resultY, 0.1);
}
示例13: testNormalSeveral
import org.geomajas.layer.tile.RasterTile; //导入依赖的package包/类
@Test
public void testNormalSeveral() throws Exception {
Envelope envelope = new Envelope(10000, 13000, 5000, 8000);
List<RasterTile> tiles = google.paint(google.getCrs(), envelope, MAX_LEVEL_SCALE);
Assert.assertEquals(4, tiles.size());
Assert.assertEquals("http://maps.googleapis.com/maps/api/staticmap?center=0.034082031132611657,0.07802734564300369&zoom=14&size=512x512", tiles.get(0).getUrl());
Assert.assertEquals("http://maps.googleapis.com/maps/api/staticmap?center=0.07802732152486058,0.07802734564300369&zoom=14&size=512x512", tiles.get(1).getUrl());
Assert.assertEquals("http://maps.googleapis.com/maps/api/staticmap?center=0.034082031132611657,0.12197265814346592&zoom=14&size=512x512", tiles.get(2).getUrl());
Assert.assertEquals("http://maps.googleapis.com/maps/api/staticmap?center=0.07802732152486058,0.12197265814346592&zoom=14&size=512x512", tiles.get(3).getUrl());
RasterTile tile = tiles.get(3);
Assert.assertEquals("http://maps.googleapis.com/maps/api/staticmap?center=0.07802732152486058,0.12197265814346592&zoom=14&size=512x512", tile.getUrl());
Assert.assertEquals(14, tile.getCode().getTileLevel());
Assert.assertEquals(4096, tile.getCode().getX());
Assert.assertEquals(4095, tile.getCode().getY());
Assert.assertEquals(1113.0, tile.getBounds().getX(), DELTA);
Assert.assertEquals(-1113.0, tile.getBounds().getY(), DELTA);
Assert.assertEquals(489.0, tile.getBounds().getHeight(), DELTA);
Assert.assertEquals(489.0, tile.getBounds().getWidth(), DELTA);
}
示例14: testNormalDs
import org.geomajas.layer.tile.RasterTile; //导入依赖的package包/类
@Test
public void testNormalDs() throws Exception {
List<RasterTile> tiles = googleDs.paint(googleDs.getCrs(),
new Envelope(10000, 10010, 4000, 4010), ZOOMED_IN_SCALE);
Assert.assertEquals(1, tiles.size());
RasterTile tile = tiles.get(0);
if (System.getProperty("java.version").startsWith("1.6")) {
Assert.assertEquals("http://maps.googleapis.com/maps/api/staticmap?center=16.731982094003893,16.975000002070733&zoom=4&sensor=false&maptype=roadmap&size=640x640", tile.getUrl());
} else {
Assert.assertEquals("http://maps.googleapis.com/maps/api/staticmap?center=16.731982094003904,16.975000002070733&zoom=4&sensor=false&maptype=roadmap&size=640x640", tile.getUrl());
}
Assert.assertEquals(4, tile.getCode().getTileLevel());
Assert.assertEquals(3, tile.getCode().getX());
Assert.assertEquals(3, tile.getCode().getY());
Assert.assertEquals(-124.0, tile.getBounds().getX(), DELTA);
Assert.assertEquals(-502.0, tile.getBounds().getY(), DELTA);
Assert.assertEquals(626.0, tile.getBounds().getHeight(), DELTA);
Assert.assertEquals(626.0, tile.getBounds().getWidth(), DELTA);
}
示例15: testSatelliteDs
import org.geomajas.layer.tile.RasterTile; //导入依赖的package包/类
@Test
public void testSatelliteDs() throws Exception {
List<RasterTile> tiles = satelliteDs.paint(satelliteDs.getCrs(),
new Envelope(10000, 10010, 4000, 4010), ZOOMED_IN_SCALE);
Assert.assertEquals(1, tiles.size());
RasterTile tile = tiles.get(0);
if (System.getProperty("java.version").startsWith("1.6")) {
Assert.assertEquals("http://maps.googleapis.com/maps/api/staticmap?center=16.731982094003893,16.975000002070733&zoom=4&sensor=false&maptype=satellite&size=640x640", tile.getUrl());
} else {
Assert.assertEquals("http://maps.googleapis.com/maps/api/staticmap?center=16.731982094003904,16.975000002070733&zoom=4&sensor=false&maptype=satellite&size=640x640", tile.getUrl());
}
Assert.assertEquals(4, tile.getCode().getTileLevel());
Assert.assertEquals(3, tile.getCode().getX());
Assert.assertEquals(3, tile.getCode().getY());
Assert.assertEquals(-124.0, tile.getBounds().getX(), DELTA);
Assert.assertEquals(-502.0, tile.getBounds().getY(), DELTA);
Assert.assertEquals(626.0, tile.getBounds().getHeight(), DELTA);
Assert.assertEquals(626.0, tile.getBounds().getWidth(), DELTA);
}