use of org.vaadin.addon.leaflet.LTileLayer in project v-leaflet by mstahv.
the class ExternalLayerControlTest method createOverlay.
private LayerWrapper createOverlay(String url, String desc) {
Double opacity = 0.6;
LTileLayer l = new LTileLayer();
l.setUrl(url);
l.setAttributionString(attrUSGS);
l.setOpacity(opacity);
l.setActive(true);
return new LayerWrapper(desc, l);
}
use of org.vaadin.addon.leaflet.LTileLayer in project v-leaflet by mstahv.
the class ExternalLayerControlTest method getBaseLayers.
private List<LayerWrapper> getBaseLayers() {
LTileLayer aer = new LTileLayer();
aer.setUrl("https://basemap.nationalmap.gov/ArcGIS/rest/services/USGSImageryOnly/MapServer/tile/{z}/{y}/{x}");
aer.setAttributionString(attrUSGS);
aer.setActive(false);
LTileLayer tf = new LTileLayer();
tf.setUrl("https://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png");
tf.setAttributionString("Tiles Courtesy of <a href=\"https://www.thunderforest.com/\" target=\"_blank\">Thunderforest</a>" + " and OpenStreetMap contributors");
tf.setSubDomains("a", "b", "c");
tf.setActive(true);
return Arrays.asList(new LayerWrapper("ThunderForest Transport ", tf), new LayerWrapper("USGS Aerial", aer));
}
use of org.vaadin.addon.leaflet.LTileLayer in project v-leaflet by mstahv.
the class HasControlTest method createOverlay.
private LayerWrapper createOverlay(String url, String desc) {
Double opacity = 0.6;
LTileLayer l = new LTileLayer();
l.setUrl(url);
l.setAttributionString(attrUSGS);
l.setOpacity(opacity);
l.setActive(false);
l.setZindex(overlayZindex++);
return new LayerWrapper(desc, l);
}
use of org.vaadin.addon.leaflet.LTileLayer in project v-leaflet by mstahv.
the class LayerGroupTest method setup.
@Override
protected void setup() {
super.setup();
addMarkers = new CheckBox("Add markers");
content.addComponentAsFirst(addMarkers);
delete = new CheckBox("Delete on click");
content.addComponentAsFirst(delete);
showLayerGroupCB = new CheckBox("Show first layer (switch on/off from server side)");
showLayerGroupCB.setValue(true);
content.addComponentAsFirst(showLayerGroupCB);
showLayerGroupCB.addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() {
@Override
public void valueChange(ValueChangeEvent<Boolean> event) {
if (event.getValue()) {
if (!leafletMap.hasComponent(llg)) {
leafletMap.addComponent(llg);
}
} else {
leafletMap.removeComponent(llg);
}
}
});
Button button = new Button("Delete first component from map (may also be a layer containing many components)");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
for (Component c : leafletMap) {
if (!(c instanceof LTileLayer)) {
leafletMap.removeComponent(c);
break;
}
}
}
});
content.addComponentAsFirst(button);
button = new Button("Delete first component from first layer group (may also be a layer containing many components)");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
LLayerGroup group = null;
for (Component c : leafletMap) {
if (c instanceof LLayerGroup) {
group = (LLayerGroup) c;
break;
}
}
if (group.getComponentCount() > 0) {
Component next = group.iterator().next();
group.removeComponent(next);
} else {
Notification.show("No component in first component group");
}
}
});
content.addComponentAsFirst(button);
button = new Button("Add polyline to first group on map (creates if does not exist)");
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
LLayerGroup group = null;
for (Component c : leafletMap) {
if (c instanceof LLayerGroup) {
group = (LLayerGroup) c;
break;
}
}
if (group == null) {
group = new LLayerGroup();
leafletMap.addOverlay(group, "new group");
}
LPolyline lPolyline = new LPolyline(new Point(60.44, 22.30), new Point(60.456, 22.304));
lPolyline.addClickListener(listener);
group.addComponent(lPolyline);
}
});
content.addComponentAsFirst(button);
}
use of org.vaadin.addon.leaflet.LTileLayer in project v-leaflet by mstahv.
the class LayersTest method getTestComponent.
@Override
public Component getTestComponent() {
leafletMap = new LMap();
leafletMap.setCenter(40.525282, -3.81603);
leafletMap.setZoomLevel(11);
leafletMap.setControls(new ArrayList<Control>(Arrays.asList(Control.values())));
LWmsLayer baseLayerIgn = new LWmsLayer();
baseLayerIgn.setUrl("https://componentes.ign.es/wms-inspire/ign-base");
baseLayerIgn.setLayers("SombreadoPenBal");
baseLayerIgn.setTransparent(false);
baseLayerIgn.setFormat("image/jpeg");
baseLayerIgn.setOpacity(0.5);
leafletMap.addBaseLayer(baseLayerIgn, "IGN");
LTileLayer baseLayerOsm = new LTileLayer();
baseLayerOsm.setUrl("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png");
leafletMap.addBaseLayer(baseLayerOsm, "OSM");
LLayerGroup groupAreas = new LLayerGroup();
LWmsLayer layerWmsAreas = new LWmsLayer();
layerWmsAreas.setUrl("https://componentes.ign.es/wms-inspire/ign-base");
layerWmsAreas.setLayers("NucleosPob_mayores,LugarInteres");
layerWmsAreas.setTransparent(true);
layerWmsAreas.setFormat("image/png");
layerWmsAreas.setOpacity(0.5);
groupAreas.addComponent(layerWmsAreas);
LWmsLayer layerWmsWater = new LWmsLayer();
layerWmsWater.setUrl("https://componentes.ign.es/wms-inspire/ign-base");
layerWmsWater.setLayers("HY.PhysicalWaters.Waterbodies");
layerWmsWater.setTransparent(true);
layerWmsWater.setFormat("image/png");
groupAreas.addComponent(layerWmsWater);
LWmsLayer layerWmsStreets = new LWmsLayer();
layerWmsStreets.setUrl("https://componentes.ign.es/wms-inspire/ign-base");
layerWmsStreets.setLayers("Autopista,Autopista_Autovia,VialUrbano,CarreteraAutonomica," + "CarreteraConvencional,CarreteraNacional");
layerWmsStreets.setTransparent(true);
layerWmsStreets.setFormat("image/png");
layerWmsStreets.setActive(false);
LWmsLayer layerWmsAbiesAlbaGermany = new LWmsLayer();
layerWmsAbiesAlbaGermany.setUrl("http://botanik4.botanik.uni-greifswald.de/geoserver/wms");
layerWmsAbiesAlbaGermany.setLayers("indicia:indiciaGroup");
layerWmsAbiesAlbaGermany.setTransparent(true);
layerWmsAbiesAlbaGermany.setOpacity(.6);
layerWmsAbiesAlbaGermany.setFormat("image/png");
layerWmsAbiesAlbaGermany.setActive(true);
// BOUNDS should be set to current view port, because of server side cluster at some scale level - but this is just for try viewparams
layerWmsAbiesAlbaGermany.setViewparams("TAXONMEANINGID:274;BOUNDS:POLYGON(( 9.44617309618379 54.84370034122247\\,9.44617309618379 50.86696466779405\\,18.301153563701007 50.86696466779405\\,18.301153563701007 54.84370034122247\\,9.44617309618379 54.84370034122247))");
layerWmsAbiesAlbaGermany.addLoadListener(new LeafletLoadListener() {
@Override
public void onLoad(LeafletLoadEvent event) {
Notification.show("onLoad", Type.TRAY_NOTIFICATION);
}
});
layerWmsAbiesAlbaGermany.addLoadingListener(new LeafletLoadingListener() {
@Override
public void onLoading(LeafletLoadingEvent event) {
Notification.show("onLoanding", Type.TRAY_NOTIFICATION);
}
});
LWmsLayer layerWmsAbiesAlbaGermanyMV = new LWmsLayer();
layerWmsAbiesAlbaGermanyMV.setUrl("https://wms.test.infinitenature.org/geoserver/werbeo/wms?");
layerWmsAbiesAlbaGermanyMV.setLayers("mv-occ");
layerWmsAbiesAlbaGermanyMV.setTransparent(true);
layerWmsAbiesAlbaGermanyMV.setOpacity(.6);
layerWmsAbiesAlbaGermanyMV.setFormat("image/png");
layerWmsAbiesAlbaGermanyMV.setActive(true);
layerWmsAbiesAlbaGermanyMV.setStyles("polygon");
layerWmsAbiesAlbaGermanyMV.setCQLFilter("taxon=54870");
leafletMap.addOverlay(groupAreas, "Populated Areas & Water");
leafletMap.addOverlay(layerWmsStreets, "Streets");
leafletMap.addOverlay(layerWmsAbiesAlbaGermany, "Distribution of Abies Alba in Germany");
leafletMap.addOverlay(layerWmsAbiesAlbaGermanyMV, "Distribution of Abies Alba in Mecklenburg-Vorpommern");
return leafletMap;
}
Aggregations