use of org.vaadin.addon.leaflet.control.LZoom in project v-leaflet by mstahv.
the class ReadOnlyTest method getTestComponent.
@Override
public Component getTestComponent() {
leafletMap = new LMap();
leafletMap.setCenter(60.4525, 22.301);
leafletMap.setZoomLevel(10);
LOpenStreetMapLayer layer = new LOpenStreetMapLayer();
leafletMap.addBaseLayer(layer, "OSM");
leafletMap.addControl(new LZoom());
leafletMap.setReadOnly(true);
Button getStates = new Button("getStates", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
StringBuilder sb = new StringBuilder("\nisDraggingEnabled() = ").append(leafletMap.isDraggingEnabled()).append("\nisBooxZoomEnabled() = ").append(leafletMap.isBoxZoomEnabled());
Notification.show("States", sb.toString(), Type.HUMANIZED_MESSAGE);
}
});
Button toggleReadOnly = new Button("toggle readonly", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
leafletMap.setReadOnly(!leafletMap.isReadOnly());
}
});
VerticalLayout verticalLayout = new VerticalLayout(leafletMap, new HorizontalLayout(getStates, toggleReadOnly));
verticalLayout.setSizeFull();
verticalLayout.setExpandRatio(leafletMap, 1);
return verticalLayout;
}
use of org.vaadin.addon.leaflet.control.LZoom in project v-leaflet by mstahv.
the class LMap method getZoomControl.
public LZoom getZoomControl() {
for (Extension e : getExtensions()) {
if (e instanceof LZoom) {
return (LZoom) e;
}
}
LZoom lZoom = new LZoom();
addExtension(lZoom);
return lZoom;
}
use of org.vaadin.addon.leaflet.control.LZoom in project v-leaflet by mstahv.
the class ControlTest method getTestComponent.
@Override
public Component getTestComponent() {
leafletMap = new LMap();
leafletMap.setCenter(60.4525, 22.301);
leafletMap.setZoomLevel(15);
leafletMap.addBaseLayer(new LOpenStreetMapLayer(), "OSM");
/*
* Using nameless api, doesn't add layers control
*/
// leafletMap.addLayer(baselayer);
/*
* Layers control can also be removed manually
*/
// leafletMap.getLayersControl().remove();
scale.setPosition(ControlPosition.topright);
scale.setImperial(false);
scale.setMetric(true);
leafletMap.addControl(scale);
/*
* DEFAULT CONTROLS These are on there by default, but can be customized
* and disabled if needed.
*/
LAttribution attribution = new LAttribution();
attribution.setPrefix("Leaflet with Java in JVM");
attribution.setPosition(ControlPosition.bottomleft);
// attribution.setEnabled(false);
leafletMap.addControl(attribution);
LZoom zoom = new LZoom();
zoom.setPosition(ControlPosition.bottomright);
// zoom.setEnabled(false);
leafletMap.addControl(zoom);
return leafletMap;
}
use of org.vaadin.addon.leaflet.control.LZoom in project v-leaflet by mstahv.
the class MapInWindowIssue19 method createMap.
private LMap createMap() {
final LMap map = new LMap();
map.setCenter(41.920833176630296, 1.853337480434182);
map.setZoomLevel(5);
map.addControl(new LScale());
map.addControl(new LZoom());
AbstractLeafletLayer[] layers = new AbstractLeafletLayer[] { createTileLayer("OSM", "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", "a", "b", "c") };
addLayers(map, layers);
return map;
}
Aggregations