本文整理汇总了Java中org.geomajas.gwt2.client.map.layer.tile.TileConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java TileConfiguration类的具体用法?Java TileConfiguration怎么用?Java TileConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TileConfiguration类属于org.geomajas.gwt2.client.map.layer.tile包,在下文中一共展示了TileConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeLayer
import org.geomajas.gwt2.client.map.layer.tile.TileConfiguration; //导入依赖的package包/类
/**
* Initialize the OSM layer by creating a new {@link org.geomajas.gwt2.client.map.layer.tile.TileBasedLayer}
* and a {@link org.geomajas.gwt2.client.map.layer.tile.TileConfiguration}.
* <p/>
* Values such as {@code {z}, {x}, {y}} are optional and will be used to substitute the tile level, X-ordinate and
* Y-ordinate.
* <p/>
* The tile based layer service can be given different URLs in which case Round-robin will be performed to
* determine the next URL to load tiles from.
*/
private void initializeLayer() {
// Set the URL to the service and the file extension:
String[] domains = new String[] { "a", "b", "c" };
List<String> urls = new ArrayList<String>();
for (String domain : domains) {
urls.add("http://" + domain + ".tile.openstreetmap.org/{z}/{x}/{y}.png");
}
// Create the configuration for the tiles:
Coordinate tileOrigin = new Coordinate(-HALF_EQUATOR_IN_METERS, -HALF_EQUATOR_IN_METERS);
initializeResolutions();
TileConfiguration tileConfig = new TileConfiguration(TILE_DIMENSION, TILE_DIMENSION, tileOrigin, resolutions);
// Create a new layer with the configurations and add it to the maps:
OsmLayer osmLayer = TileBasedLayerClient.getInstance().createOsmLayer("osmCountries", tileConfig, urls);
mapPresenter.getLayersModel().addLayer(osmLayer);
mapPresenter.getLayersModel().moveLayer(osmLayer, 0);
}
示例2: createClientWmsLayerInfo
import org.geomajas.gwt2.client.map.layer.tile.TileConfiguration; //导入依赖的package包/类
/**
* Factory method for {@link ClientWmsLayerInfo} from
* {@link org.geomajas.widget.layer.client.presenter.WmsSelectedLayerInfo} and {@link MapWidget}.
* Could be a static method in a util class.
*
* @param wmsSelectedLayerInfo
* @param mapWidget
* @return
*/
public ClientWmsLayerInfo createClientWmsLayerInfo(WmsSelectedLayerInfo wmsSelectedLayerInfo, MapWidget mapWidget) {
WmsLayerConfiguration wmsConfig = new WmsLayerConfiguration();
wmsConfig.setFormat("image/png");
wmsConfig.setLayers(wmsSelectedLayerInfo.getWmsLayerInfo().getName());
wmsConfig.setVersion(wmsSelectedLayerInfo.getWmsVersion());
wmsConfig.setBaseUrl(wmsSelectedLayerInfo.getBaseWmsUrl());
wmsConfig.setTransparent(true);
wmsConfig.setMaximumResolution(Double.MAX_VALUE);
wmsConfig.setMinimumResolution(1 / mapWidget.getMapModel().getMapInfo().getMaximumScale());
wmsConfig.setCrs(mapWidget.getMapModel().getCrs());
Bbox bounds = wmsSelectedLayerInfo.getWmsLayerInfo().getBoundingBox(mapWidget.getMapModel().getCrs());
if (bounds == null) {
bounds = mapWidget.getMapModel().getMapInfo().getInitialBounds();
}
TileConfiguration tileConfig = new TileConfiguration(256, 256, new Coordinate(bounds.getX(), bounds.getY()),
mapWidget.getMapModel().getMapView().getResolutions());
ClientWmsLayer wmsLayer = new ClientWmsLayer(wmsSelectedLayerInfo.getName(), mapWidget.getMapModel().getCrs(),
wmsConfig, tileConfig, wmsSelectedLayerInfo.getWmsLayerInfo());
ClientWmsLayerInfo wmsLayerInfo = new ClientWmsLayerInfo(wmsLayer);
return wmsLayerInfo;
}
示例3: getTiles
import org.geomajas.gwt2.client.map.layer.tile.TileConfiguration; //导入依赖的package包/类
/**
* Update showing state.
*
* @param fireEvents Should events be fired if state changes?
*/
/*protected void updateShowing(boolean fireEvents) {
//setShowing(isVisible());
// don't do anything?
} */
private List<Tile> getTiles(WmsLayer wmsLayer, double resolution, org.geomajas.geometry.Bbox worldBounds) {
TileConfiguration tileConfig = wmsLayer.getTileConfiguration();
List<org.geomajas.gwt2.client.map.render.TileCode> codes = TileService.getTileCodesForBounds(tileConfig,
worldBounds, resolution);
List<Tile> tiles = new ArrayList<Tile>();
if (!codes.isEmpty()) {
double actualResolution = tileConfig.getResolution(codes.get(0).getTileLevel());
for (org.geomajas.gwt2.client.map.render.TileCode code : codes) {
org.geomajas.geometry.Bbox bounds = TileService.getWorldBoundsForTile(tileConfig, code);
Tile tile = new Tile(getScreenBounds(actualResolution, bounds));
tile.setCode(code);
tile.setUrl(WmsClient.getInstance().getWmsService().getMapUrl(wmsLayer.getConfiguration(),
bounds, tileConfig.getTileWidth(), tileConfig.getTileHeight()));
tiles.add(tile);
}
}
return tiles;
}
示例4: createSampleWmsLayerInfo
import org.geomajas.gwt2.client.map.layer.tile.TileConfiguration; //导入依赖的package包/类
private ClientWmsLayerInfo createSampleWmsLayerInfo(String name, String url) {
WmsLayerConfiguration wmsConfig = new WmsLayerConfiguration();
wmsConfig.setFormat("image/png");
wmsConfig.setLayers(name);
wmsConfig.setVersion(WmsService.WmsVersion.V1_1_1);
wmsConfig.setBaseUrl(url);
wmsConfig.setCrs("EPSG:900913");
wmsConfig.setTransparent(true);
wmsConfig.setMaximumResolution(Double.MAX_VALUE);
wmsConfig.setMinimumResolution(1 / mapWidget.getMapModel().getMapInfo().getMaximumScale());
TileConfiguration tileConfig = new TileConfiguration(256, 256, new Coordinate(-20026376.393709917,
-20026376.393709917), mapWidget.getMapModel().getMapView().getResolutions());
ClientWmsLayer wmsLayer = new ClientWmsLayer(name, mapWidget.getMapModel().getMapInfo().getCrs(), wmsConfig,
tileConfig);
ClientWmsLayerInfo wmsLayerInfo = new ClientWmsLayerInfo(wmsLayer);
return wmsLayerInfo;
}
示例5: build
import org.geomajas.gwt2.client.map.layer.tile.TileConfiguration; //导入依赖的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;
}
示例6: getTiles
import org.geomajas.gwt2.client.map.layer.tile.TileConfiguration; //导入依赖的package包/类
private List<Tile> getTiles(WmsLayer layer, String crs, double resolution, Bbox worldBounds) {
TileConfiguration tileConfig = layer.getTileConfiguration();
Bbox maxBounds = layer.getMaxBounds();
worldBounds = BboxService.intersection(worldBounds, maxBounds);
List<Tile> tiles = new ArrayList<Tile>();
if (worldBounds != null) {
List<org.geomajas.gwt2.client.map.render.TileCode> codes = TileService.getTileCodesForBounds(tileConfig,
worldBounds, resolution);
if (!codes.isEmpty()) {
double actualResolution = tileConfig.getResolution(codes.get(0).getTileLevel());
for (org.geomajas.gwt2.client.map.render.TileCode code : codes) {
Bbox bounds = TileService.getWorldBoundsForTile(tileConfig, code);
Tile tile = new Tile(getScreenBounds(actualResolution, bounds));
tile.setCode(code);
tile.setUrl(WmsClient.getInstance().getWmsService().getMapUrl(layer.getConfiguration(),
bounds, tileConfig.getTileWidth(), tileConfig.getTileHeight()));
tiles.add(tile);
}
}
}
return tiles;
}
示例7: build
import org.geomajas.gwt2.client.map.layer.tile.TileConfiguration; //导入依赖的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;
}
示例8: getTiles
import org.geomajas.gwt2.client.map.layer.tile.TileConfiguration; //导入依赖的package包/类
private List<Tile> getTiles(AbstractTileBasedLayer layer, String crs, double resolution, Bbox worldBounds) {
TileConfiguration tileConfig = layer.getTileConfiguration();
Bbox maxBounds = layer.getMaxBounds();
worldBounds = BboxService.intersection(worldBounds, maxBounds);
List<Tile> tiles = new ArrayList<Tile>();
if (worldBounds != null) {
List<org.geomajas.gwt2.client.map.render.TileCode> codes = TileService.getTileCodesForBounds(tileConfig,
worldBounds, resolution);
if (!codes.isEmpty()) {
double actualResolution = tileConfig.getResolution(codes.get(0).getTileLevel());
for (org.geomajas.gwt2.client.map.render.TileCode code : codes) {
Bbox bounds = TileService.getWorldBoundsForTile(tileConfig, code);
Tile tile = new Tile(getScreenBounds(actualResolution, bounds));
tile.setCode(code);
TileRenderer tileRenderer = layer.getTileRenderer();
tile.setUrl(tileRenderer.getUrl(code));
tiles.add(tile);
}
}
}
return tiles;
}
示例9: onMapInitialized
import org.geomajas.gwt2.client.map.layer.tile.TileConfiguration; //导入依赖的package包/类
public void onMapInitialized(MapInitializationEvent event) {
// Set the URL to the service and the file extension:
String[] domains = new String[] { "a", "b", "c" };
List<String> urls = new ArrayList<String>();
for (String domain : domains) {
urls.add("http://" + domain + ".tile.opencyclemap.org/cycle/{z}/{x}/{y}.png");
}
// Create the configuration for the tiles:
Coordinate tileOrigin = new Coordinate(-HALF_EQUATOR_IN_METERS, -HALF_EQUATOR_IN_METERS);
List<Double> resolutions = new ArrayList<Double>();
for (int i = 0; i < MAX_ZOOM_LEVELS; i++) {
resolutions.add(EQUATOR_IN_METERS / (TILE_DIMENSION * Math.pow(2, i)));
}
TileConfiguration tileConfig = new TileConfiguration(TILE_DIMENSION, TILE_DIMENSION, tileOrigin,
resolutions);
OsmLayer osmLayer = TileBasedLayerClient.getInstance().createOsmLayer("osmLayer", tileConfig, urls);
getMapPresenter().getLayersModel().clear();
getMapPresenter().getLayersModel().addLayer(osmLayer);
}
示例10: initialize
import org.geomajas.gwt2.client.map.layer.tile.TileConfiguration; //导入依赖的package包/类
private void initialize() {
// Cleanup:
if (mapPresenter.getLayersModel().getLayerCount() > 0) {
controller.removeLayer((FeatureInfoSupported) mapPresenter.getLayersModel().getLayer(0));
}
mapPresenter.getLayersModel().clear();
featureContainer.clear();
featureInfoParent.clear();
// Now create a WMS layer and add it to the map:
TileConfiguration tileConfig = new TileConfiguration(256, 256, new Coordinate(-180, -90),
mapPresenter.getViewPort());
WmsLayerConfiguration layerConfig = new WmsLayerConfiguration();
layerConfig.setBaseUrl(WMS_BASE_URL);
layerConfig.setFormat("image/png");
layerConfig.setVersion(getWmsVersion());
layerConfig.setLayers("demo_world:simplified_country_borders");
layerConfig.setMaximumResolution(Double.MAX_VALUE);
layerConfig.setMinimumResolution(2.1457672119140625E-5);
FeatureInfoSupportedWmsServerLayer wmsLayer = WmsServerExtension.getInstance().createLayer("Countries",
mapPresenter.getViewPort().getCrs(), tileConfig, layerConfig, null);
wmsLayer.setMaxBounds(new Bbox(-180, -90, 360, 360));
mapPresenter.getLayersModel().addLayer(wmsLayer);
controller.addLayer(wmsLayer);
}
示例11: initialize
import org.geomajas.gwt2.client.map.layer.tile.TileConfiguration; //导入依赖的package包/类
private void initialize() {
// First clear the panel and the map:
mapPresenter.getLayersModel().clear();
// Now create a WMS layer and add it to the map:
TileConfiguration tileConfig = new TileConfiguration(256, 256, new Coordinate(-180, -90),
mapPresenter.getViewPort());
WmsLayerConfiguration layerConfig = new WmsLayerConfiguration();
layerConfig.setBaseUrl(WMS_BASE_URL);
layerConfig.setFormat("image/png");
layerConfig.setVersion(getWmsVersion());
layerConfig.setLayers("demo_world:simplified_country_borders");
layerConfig.setMaximumResolution(Double.MAX_VALUE);
layerConfig.setMinimumResolution(2.1457672119140625E-5);
final WmsLayer wmsLayer = WmsClient.getInstance().createLayer("Blue Marble",
mapPresenter.getViewPort().getCrs(), tileConfig, layerConfig, null);
wmsLayer.setMaxBounds(new Bbox(-180, -90, 360, 360));
mapPresenter.getLayersModel().addLayer(wmsLayer);
}
示例12: WmsLayerImpl
import org.geomajas.gwt2.client.map.layer.tile.TileConfiguration; //导入依赖的package包/类
public WmsLayerImpl(String id, String title, String crs, WmsLayerConfiguration wmsConfig,
TileConfiguration tileConfig, WmsLayerInfo layerCapabilities) {
super(id, tileConfig);
this.crs = crs;
this.title = title;
this.wmsConfig = wmsConfig;
this.tileConfig = tileConfig;
this.layerCapabilities = layerCapabilities;
if (layerCapabilities != null) {
Bbox maxBounds = layerCapabilities.getBoundingBox(crs);
// we could transform if maxBounds = null, but that probably means the WMS is not configured correctly
if (maxBounds != null) {
setMaxBounds(maxBounds);
}
}
}
示例13: createTileConfiguration
import org.geomajas.gwt2.client.map.layer.tile.TileConfiguration; //导入依赖的package包/类
/**
* Create the tile configuration
*/
private static TileConfiguration createTileConfiguration(MapConfiguration mapConfig,
ClientVectorLayerInfo layerInfo, final ViewPort viewPort) {
TileConfiguration tileConfig = new TileConfiguration();
ClientMapInfo mapInfo = mapConfig.getHintValue(GeomajasServerExtension.MAPINFO);
tileConfig.setTileWidth(mapInfo.getPreferredPixelsPerTile().getWidth());
tileConfig.setTileHeight(mapInfo.getPreferredPixelsPerTile().getHeight());
List<Double> resolutions = new ArrayList<Double>();
for (int i = 0; i < viewPort.getResolutionCount(); i++) {
resolutions.add(viewPort.getResolution(i));
}
tileConfig.setResolutions(resolutions);
if (layerInfo.getMaxExtent() != null) {
tileConfig.setTileOrigin(BboxService.getOrigin(layerInfo.getMaxExtent()));
} else {
tileConfig.setTileOrigin(new Coordinate());
}
return tileConfig;
}
示例14: createTileConfiguration
import org.geomajas.gwt2.client.map.layer.tile.TileConfiguration; //导入依赖的package包/类
/**
* Create the tile configuration
*/
private static TileConfiguration createTileConfiguration(ClientRasterLayerInfo layerInfo) {
RasterLayerInfo serverLayerInfo = (RasterLayerInfo) layerInfo.getLayerInfo();
TileConfiguration tileConfig = new TileConfiguration();
tileConfig.setTileWidth(serverLayerInfo.getTileWidth());
tileConfig.setTileHeight(serverLayerInfo.getTileHeight());
if (serverLayerInfo.getResolutions().size() > 0) {
// use resolutions of server for raster layer (as yet not reprojectable)
tileConfig.setResolutions(serverLayerInfo.getResolutions());
} else {
// if no resolutions, fall back to quad tree numbers
ArrayList<Double> resolutions = new ArrayList<Double>();
for (int i = 0; i < 50; i++) {
resolutions
.add(layerInfo.getMaxExtent().getWidth() / (serverLayerInfo.getTileWidth() * Math.pow(2, i)));
tileConfig.setResolutions(resolutions);
}
}
tileConfig.setTileOrigin(BboxService.getOrigin(layerInfo.getMaxExtent()));
return tileConfig;
}
示例15: TmsLayer
import org.geomajas.gwt2.client.map.layer.tile.TileConfiguration; //导入依赖的package包/类
/**
* Create a new layer using a TileMapInfo object.
*
* @param id The unique ID for this layer.
* @param tileMapInfo The configuration object to create a layer for. The layer title will be taken from this
* configuration object.
*/
public TmsLayer(String id, TileMapInfo tileMapInfo) {
super(tileMapInfo.getTitle(), new TileConfiguration(tileMapInfo.getTileFormat().getWidth(),
tileMapInfo.getTileFormat().getHeight(), tileMapInfo.getOrigin(), new ArrayList<Double>()));
this.layerConfiguration = new TmsLayerConfiguration();
this.layerConfiguration.setBaseUrl(tileMapInfo.getHref());
this.layerConfiguration.setFileExtension(tileMapInfo.getTileFormat().getExtension());
this.tileRenderer = new TmsTileRenderer(layerConfiguration);
List<Double> resolutions = new ArrayList<Double>();
for (TileSetInfo tileSetInfo : tileMapInfo.getTileSets()) {
resolutions.add(tileSetInfo.getUnitsPerPixel());
}
getTileConfiguration().setResolutions(resolutions);
}