Search in sources :

Example 1 with LZoom

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;
}
Also used : LMap(org.vaadin.addon.leaflet.LMap) LOpenStreetMapLayer(org.vaadin.addon.leaflet.LOpenStreetMapLayer) Button(com.vaadin.ui.Button) LZoom(org.vaadin.addon.leaflet.control.LZoom) ClickEvent(com.vaadin.ui.Button.ClickEvent) VerticalLayout(com.vaadin.ui.VerticalLayout) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 2 with LZoom

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;
}
Also used : Extension(com.vaadin.server.Extension) LZoom(org.vaadin.addon.leaflet.control.LZoom)

Example 3 with 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;
}
Also used : LMap(org.vaadin.addon.leaflet.LMap) LOpenStreetMapLayer(org.vaadin.addon.leaflet.LOpenStreetMapLayer) LZoom(org.vaadin.addon.leaflet.control.LZoom) LAttribution(org.vaadin.addon.leaflet.control.LAttribution)

Example 4 with LZoom

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;
}
Also used : LMap(org.vaadin.addon.leaflet.LMap) LZoom(org.vaadin.addon.leaflet.control.LZoom) AbstractLeafletLayer(org.vaadin.addon.leaflet.AbstractLeafletLayer) LScale(org.vaadin.addon.leaflet.control.LScale)

Aggregations

LZoom (org.vaadin.addon.leaflet.control.LZoom)4 LMap (org.vaadin.addon.leaflet.LMap)3 LOpenStreetMapLayer (org.vaadin.addon.leaflet.LOpenStreetMapLayer)2 Extension (com.vaadin.server.Extension)1 Button (com.vaadin.ui.Button)1 ClickEvent (com.vaadin.ui.Button.ClickEvent)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 AbstractLeafletLayer (org.vaadin.addon.leaflet.AbstractLeafletLayer)1 LAttribution (org.vaadin.addon.leaflet.control.LAttribution)1 LScale (org.vaadin.addon.leaflet.control.LScale)1