Search in sources :

Example 1 with TileLayer

use of org.discotools.gwt.leaflet.client.layers.raster.TileLayer in project opennms by OpenNMS.

the class NodeMapWidget method addTileLayer.

private void addTileLayer(String tileUrl, List<Option> optionsList) {
    LOG.info("NodeMapWidget.setTileLayer(String, Option...) start");
    LOG.info("NodeMapWidget.setTileLayer tileServerUrl: " + tileUrl + "," + optionsList);
    final Options tileOptions = new Options();
    for (Option eachOption : optionsList) {
        tileOptions.setProperty(eachOption.getKey(), eachOption.getValue());
    }
    m_layer = new TileLayer(tileUrl, tileOptions);
    m_map.addLayer(m_layer, true);
    LOG.info("NodeMapWidget.setTileLayer(String, Option...) end");
}
Also used : MapOptions(org.discotools.gwt.leaflet.client.map.MapOptions) Options(org.discotools.gwt.leaflet.client.Options) ZoomOptions(org.discotools.gwt.leaflet.client.controls.zoom.ZoomOptions) TileLayer(org.discotools.gwt.leaflet.client.layers.raster.TileLayer) Option(org.opennms.features.vaadin.nodemaps.internal.gwt.client.Option)

Example 2 with TileLayer

use of org.discotools.gwt.leaflet.client.layers.raster.TileLayer in project activityinfo by bedatadriven.

the class LocationMap method afterRender.

@Override
protected void afterRender() {
    super.afterRender();
    Extents countryBounds = searchPresenter.getCountryBounds();
    MapOptions mapOptions = new MapOptions();
    mapOptions.setCenter(new LatLng(countryBounds.getCenterY(), countryBounds.getCenterX()));
    mapOptions.setZoom(6);
    mapOptions.setProperty("crs", new EPSG3857());
    TileLayer baseLayer = new TileLayer(MapboxLayers.MAPBOX_STREETS, new Options());
    markerLayer = new LayerGroup(new ILayer[0]);
    map = new Map(getElement().getElementsByTagName("div").getItem(0), mapOptions);
    map.addLayer(baseLayer);
    map.addLayer(markerLayer);
    bindEvents();
}
Also used : EPSG3857(org.discotools.gwt.leaflet.client.crs.epsg.EPSG3857) MapOptions(org.discotools.gwt.leaflet.client.map.MapOptions) Options(org.discotools.gwt.leaflet.client.Options) TileLayer(org.discotools.gwt.leaflet.client.layers.raster.TileLayer) MapOptions(org.discotools.gwt.leaflet.client.map.MapOptions) ILayer(org.discotools.gwt.leaflet.client.layers.ILayer) AiLatLng(org.activityinfo.model.type.geo.AiLatLng) LayerGroup(org.discotools.gwt.leaflet.client.layers.others.LayerGroup) Extents(org.activityinfo.model.type.geo.Extents) Map(org.discotools.gwt.leaflet.client.map.Map)

Example 3 with TileLayer

use of org.discotools.gwt.leaflet.client.layers.raster.TileLayer in project activityinfo by bedatadriven.

the class LeafletReportOverlays method setBaseMap.

public void setBaseMap(BaseMap baseMap) {
    TileBaseMap tileBaseMap = MapboxLayers.toTileBaseMap(baseMap);
    if (!Objects.equal(currentBaseMap, tileBaseMap)) {
        if (baseLayer != null) {
            mapWidget.removeLayer(baseLayer);
        }
        Options options = new Options();
        options.setProperty("minZoom", tileBaseMap.getMinZoom());
        options.setProperty("maxZoom", tileBaseMap.getMaxZoom());
        baseLayer = new TileLayer(tileBaseMap.getTileUrlPattern(), options);
        mapWidget.addLayer(baseLayer, true);
        if (mapWidget.getZoom() > tileBaseMap.getMaxZoom()) {
            mapWidget.setZoom(tileBaseMap.getMaxZoom());
        }
        if (mapWidget.getZoom() < tileBaseMap.getMinZoom()) {
            mapWidget.setZoom(tileBaseMap.getMinZoom());
        }
    }
}
Also used : Options(org.discotools.gwt.leaflet.client.Options) GeoJSONOptions(org.discotools.gwt.leaflet.client.layers.others.GeoJSONOptions) TileLayer(org.discotools.gwt.leaflet.client.layers.raster.TileLayer) TileBaseMap(org.activityinfo.legacy.shared.model.TileBaseMap)

Aggregations

Options (org.discotools.gwt.leaflet.client.Options)3 TileLayer (org.discotools.gwt.leaflet.client.layers.raster.TileLayer)3 MapOptions (org.discotools.gwt.leaflet.client.map.MapOptions)2 TileBaseMap (org.activityinfo.legacy.shared.model.TileBaseMap)1 AiLatLng (org.activityinfo.model.type.geo.AiLatLng)1 Extents (org.activityinfo.model.type.geo.Extents)1 ZoomOptions (org.discotools.gwt.leaflet.client.controls.zoom.ZoomOptions)1 EPSG3857 (org.discotools.gwt.leaflet.client.crs.epsg.EPSG3857)1 ILayer (org.discotools.gwt.leaflet.client.layers.ILayer)1 GeoJSONOptions (org.discotools.gwt.leaflet.client.layers.others.GeoJSONOptions)1 LayerGroup (org.discotools.gwt.leaflet.client.layers.others.LayerGroup)1 Map (org.discotools.gwt.leaflet.client.map.Map)1 Option (org.opennms.features.vaadin.nodemaps.internal.gwt.client.Option)1