Search in sources :

Example 1 with LTileLayer

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);
}
Also used : LTileLayer(org.vaadin.addon.leaflet.LTileLayer)

Example 2 with LTileLayer

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>" + "&nbspand OpenStreetMap contributors");
    tf.setSubDomains("a", "b", "c");
    tf.setActive(true);
    return Arrays.asList(new LayerWrapper("ThunderForest Transport ", tf), new LayerWrapper("USGS Aerial", aer));
}
Also used : LTileLayer(org.vaadin.addon.leaflet.LTileLayer)

Example 3 with LTileLayer

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);
}
Also used : LTileLayer(org.vaadin.addon.leaflet.LTileLayer)

Example 4 with LTileLayer

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);
}
Also used : LTileLayer(org.vaadin.addon.leaflet.LTileLayer) LPolyline(org.vaadin.addon.leaflet.LPolyline) ClickEvent(com.vaadin.ui.Button.ClickEvent) LeafletClickEvent(org.vaadin.addon.leaflet.LeafletClickEvent) Point(org.vaadin.addon.leaflet.shared.Point) HasValue(com.vaadin.data.HasValue) LLayerGroup(org.vaadin.addon.leaflet.LLayerGroup) Button(com.vaadin.ui.Button) CheckBox(com.vaadin.ui.CheckBox) Component(com.vaadin.ui.Component) ClickListener(com.vaadin.ui.Button.ClickListener) LeafletClickListener(org.vaadin.addon.leaflet.LeafletClickListener)

Example 5 with LTileLayer

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;
}
Also used : LLayerGroup(org.vaadin.addon.leaflet.LLayerGroup) Control(org.vaadin.addon.leaflet.shared.Control) LMap(org.vaadin.addon.leaflet.LMap) LTileLayer(org.vaadin.addon.leaflet.LTileLayer) LWmsLayer(org.vaadin.addon.leaflet.LWmsLayer) LeafletLoadListener(org.vaadin.addon.leaflet.LeafletLoadListener) LeafletLoadingListener(org.vaadin.addon.leaflet.LeafletLoadingListener) LeafletLoadEvent(org.vaadin.addon.leaflet.LeafletLoadEvent) LeafletLoadingEvent(org.vaadin.addon.leaflet.LeafletLoadingEvent)

Aggregations

LTileLayer (org.vaadin.addon.leaflet.LTileLayer)13 LMap (org.vaadin.addon.leaflet.LMap)7 Point (org.vaadin.addon.leaflet.shared.Point)3 ExternalResource (com.vaadin.server.ExternalResource)2 Button (com.vaadin.ui.Button)2 ClickEvent (com.vaadin.ui.Button.ClickEvent)2 Component (com.vaadin.ui.Component)2 VerticalLayout (com.vaadin.ui.VerticalLayout)2 LLayerGroup (org.vaadin.addon.leaflet.LLayerGroup)2 LMarker (org.vaadin.addon.leaflet.LMarker)2 LWmsLayer (org.vaadin.addon.leaflet.LWmsLayer)2 LeafletClickEvent (org.vaadin.addon.leaflet.LeafletClickEvent)2 LeafletClickListener (org.vaadin.addon.leaflet.LeafletClickListener)2 Bounds (org.vaadin.addon.leaflet.shared.Bounds)2 HasValue (com.vaadin.data.HasValue)1 ClickListener (com.vaadin.ui.Button.ClickListener)1 CheckBox (com.vaadin.ui.CheckBox)1 Grid (com.vaadin.ui.Grid)1 HorizontalSplitPanel (com.vaadin.ui.HorizontalSplitPanel)1 Label (com.vaadin.ui.Label)1