use of org.vaadin.addon.leaflet.LImageOverlay in project v-leaflet by mstahv.
the class PlainImage method getTestComponent.
@Override
public Component getTestComponent() {
leafletMap.setCrs(Crs.Simple);
ExternalResource url = new ExternalResource("https://www.dropbox.com/s/oajfgu8onqxfo0g/photo.jpg?dl=1");
// The size of this image is 3264 * 2448, scale it here to suite better
// for default zoomlevels
final Bounds bounds = new Bounds(new Point(0, 0), new Point(244.8, 326.4));
LImageOverlay imageOverlay = new LImageOverlay(url, bounds);
leafletMap.addLayer(imageOverlay);
// You can fit it directly or to another extend like here, you could also
// use multiple images on the background
leafletMap.setMaxBounds(new Bounds(new Point(0, 0), new Point(300, 500)));
// draw line from corner to corner
leafletMap.addLayer(new LPolyline(new Point(0, 0), new Point(244.8, 326.4)));
leafletMap.setMaxZoom(5);
return leafletMap;
}
use of org.vaadin.addon.leaflet.LImageOverlay in project v-leaflet by mstahv.
the class AddOverlayBugTest method getTestComponent.
@Override
public Component getTestComponent() {
VerticalLayout lmapContainer = new VerticalLayout();
lmapContainer.setMargin(true);
// create leaflet map
lmap = new LMap();
lmap.setCenter(40.712216, -74.22655);
lmap.setWidth("500px");
lmap.setHeight("400px");
lmapContainer.addComponent(lmap);
// base laser 1 & 2 (dummy base layers)
LOpenStreetMapLayer osm1 = new LOpenStreetMapLayer();
osm1.setActive(false);
lmap.addBaseLayer(osm1, "Base Layer 1");
LTileLayer osm2 = new LTileLayer("https://a.tile.thunderforest.com/cycle/{z}/{x}/{y}.png");
osm2.setAttributionString("© OpenStreetMap contributors. Tiles courtesy of Andy Allan");
osm2.setActive(true);
lmap.addBaseLayer(osm2, "Base Layer 2");
// BUG: after removing/adding the base layer and also existing wms layers are duplicated
Button wmsLayerRemoveAddButton = new Button("Add");
wmsLayerRemoveAddButton.addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
ExternalResource url = new ExternalResource("https://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg");
LImageOverlay imageOverlay = new LImageOverlay(url, new Bounds(new Point(40.712216, -74.22655), new Point(40.773941, -74.12544)));
imageOverlay.setOpacity(0.5);
imageOverlay.setAttribution("University of Texas");
lmap.addOverlay(imageOverlay, "imagelayer-" + System.currentTimeMillis());
// dummy wms layer
LWmsLayer result = new LWmsLayer();
result.setFormat("image/png");
result.setUrl("not/working/url/to/your/geoserver");
result.setLayers("layerselection");
// add new wms layer
lmap.addOverlay(result, "layer-" + System.currentTimeMillis());
}
});
lmapContainer.addComponent(wmsLayerRemoveAddButton);
return lmapContainer;
}
use of org.vaadin.addon.leaflet.LImageOverlay in project v-leaflet by mstahv.
the class ImageLayerOnOSM method getTestComponent.
@Override
public Component getTestComponent() {
leafletMap.addLayer(new LOpenStreetMapLayer());
// Old map overlayed approximately over OSM map
ExternalResource url = new ExternalResource("https://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg");
LImageOverlay imageOverlay = new LImageOverlay(url, new Bounds(new Point(40.712216, -74.22655), new Point(40.773941, -74.12544)));
imageOverlay.setOpacity(0.5);
imageOverlay.setAttribution("University of Texas");
leafletMap.addLayer(imageOverlay);
leafletMap.zoomToContent();
return leafletMap;
}
Aggregations