diff --git a/src/main/java/org/vaadin/addon/leaflet/LGridLayer.java b/src/main/java/org/vaadin/addon/leaflet/LGridLayer.java index c06faf7c..be58314d 100644 --- a/src/main/java/org/vaadin/addon/leaflet/LGridLayer.java +++ b/src/main/java/org/vaadin/addon/leaflet/LGridLayer.java @@ -23,7 +23,8 @@ public void onLoading() { }); } - protected LeafletGridLayerState getState() { + @Override + protected LeafletGridLayerState getState() { return (LeafletGridLayerState) super.getState(); } @@ -83,6 +84,16 @@ public Bounds getBounds() { return getState().bounds; } + public void setTileSize(int tileSize) + { + getState().tileSize = tileSize; + } + + public int getTileSize() + { + return getState().tileSize; + } + @Override public Geometry getGeometry() { return null; diff --git a/src/main/java/org/vaadin/addon/leaflet/client/LeafletGridLayerConnector.java b/src/main/java/org/vaadin/addon/leaflet/client/LeafletGridLayerConnector.java index b12e2e2a..6c7a14e0 100644 --- a/src/main/java/org/vaadin/addon/leaflet/client/LeafletGridLayerConnector.java +++ b/src/main/java/org/vaadin/addon/leaflet/client/LeafletGridLayerConnector.java @@ -1,19 +1,28 @@ package org.vaadin.addon.leaflet.client; -import com.vaadin.client.communication.RpcProxy; -import com.vaadin.shared.ui.Connect; -import org.peimari.gleaflet.client.*; +import org.peimari.gleaflet.client.Event; +import org.peimari.gleaflet.client.GridLayer; +import org.peimari.gleaflet.client.GridLayerOptions; +import org.peimari.gleaflet.client.LatLng; +import org.peimari.gleaflet.client.LatLngBounds; +import org.peimari.gleaflet.client.Layer; +import org.peimari.gleaflet.client.LoadListener; +import org.peimari.gleaflet.client.LoadingListener; import org.vaadin.addon.leaflet.shared.EventId; import org.vaadin.addon.leaflet.shared.LeafletGridLayerServerRpc; import org.vaadin.addon.leaflet.shared.LeafletGridLayerState; +import com.vaadin.client.communication.RpcProxy; +import com.vaadin.shared.ui.Connect; + @Connect(org.vaadin.addon.leaflet.LGridLayer.class) public class LeafletGridLayerConnector extends AbstractLeafletLayerConnector { protected Layer layer; protected LeafletGridLayerServerRpc gridLayerServerRpc = RpcProxy.create(LeafletGridLayerServerRpc.class, this); - public LeafletGridLayerState getState() { + @Override + public LeafletGridLayerState getState() { return (LeafletGridLayerState) super.getState(); } @@ -44,6 +53,10 @@ protected GridLayerOptions createOptions() { o.setBounds(LatLngBounds.create(LatLng.create(s.bounds.getSouthWestLat(), s.bounds.getSouthWestLon()), LatLng.create(s.bounds.getNorthEastLat(), s.bounds.getNorthEastLon()))); } + if (s.tileSize != null) + { + o.setTileSize(s.tileSize); + } return o; } diff --git a/src/main/java/org/vaadin/addon/leaflet/shared/LeafletGridLayerState.java b/src/main/java/org/vaadin/addon/leaflet/shared/LeafletGridLayerState.java index 66966eb5..8a7353ce 100644 --- a/src/main/java/org/vaadin/addon/leaflet/shared/LeafletGridLayerState.java +++ b/src/main/java/org/vaadin/addon/leaflet/shared/LeafletGridLayerState.java @@ -9,4 +9,5 @@ public class LeafletGridLayerState extends AbstractLeafletComponentState { public Integer minNativeZoom; public Boolean noWrap; public String attributionString; + public Integer tileSize; } diff --git a/src/test/java/org/vaadin/addon/leaflet/demoandtestapp/LayersTest.java b/src/test/java/org/vaadin/addon/leaflet/demoandtestapp/LayersTest.java index 74858659..955ad700 100644 --- a/src/test/java/org/vaadin/addon/leaflet/demoandtestapp/LayersTest.java +++ b/src/test/java/org/vaadin/addon/leaflet/demoandtestapp/LayersTest.java @@ -3,12 +3,20 @@ import java.util.ArrayList; import java.util.Arrays; -import org.vaadin.addon.leaflet.*; +import org.vaadin.addon.leaflet.LLayerGroup; +import org.vaadin.addon.leaflet.LMap; +import org.vaadin.addon.leaflet.LTileLayer; +import org.vaadin.addon.leaflet.LWmsLayer; +import org.vaadin.addon.leaflet.LeafletLoadEvent; +import org.vaadin.addon.leaflet.LeafletLoadListener; +import org.vaadin.addon.leaflet.LeafletLoadingEvent; +import org.vaadin.addon.leaflet.LeafletLoadingListener; import org.vaadin.addon.leaflet.shared.Control; +import org.vaadin.addonhelpers.AbstractTest; -import com.vaadin.ui.*; +import com.vaadin.ui.Component; +import com.vaadin.ui.Notification; import com.vaadin.ui.Notification.Type; -import org.vaadin.addonhelpers.AbstractTest; public class LayersTest extends AbstractTest { @@ -93,7 +101,7 @@ public void onLoading(LeafletLoadingEvent event) Notification.show("onLoanding", Type.TRAY_NOTIFICATION); } }); - + leafletMap.addOverlay(groupAreas,"Populated Areas & Water"); leafletMap.addOverlay(layerWmsStreets, "Streets"); leafletMap.addOverlay(layerWmsAbiesAlbaGermany, "Distribution of Abies Alba in Germany");