Skip to content

Commit

Permalink
Merge pull request #221 from dve/220-tileSize
Browse files Browse the repository at this point in the history
#220 - add tileSize option to gridLayer
  • Loading branch information
mstahv authored Aug 13, 2021
2 parents 211cdb4 + 3ff8dbb commit 238d7f4
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
13 changes: 12 additions & 1 deletion src/main/java/org/vaadin/addon/leaflet/LGridLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public void onLoading() {
});
}

protected LeafletGridLayerState getState() {
@Override
protected LeafletGridLayerState getState() {
return (LeafletGridLayerState) super.getState();
}

Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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<GridLayerOptions> {

protected Layer layer;
protected LeafletGridLayerServerRpc gridLayerServerRpc = RpcProxy.create(LeafletGridLayerServerRpc.class, this);

public LeafletGridLayerState getState() {
@Override
public LeafletGridLayerState getState() {
return (LeafletGridLayerState) super.getState();
}

Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ public class LeafletGridLayerState extends AbstractLeafletComponentState {
public Integer minNativeZoom;
public Boolean noWrap;
public String attributionString;
public Integer tileSize;
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void onLoading(LeafletLoadingEvent event)
layerWmsAbiesAlbaGermanyMV.setStyles("polygon");
layerWmsAbiesAlbaGermanyMV.setCQLFilter("taxon=54870");

leafletMap.addOverlay(groupAreas,"Populated Areas & Water");
leafletMap.addOverlay(groupAreas,"Populated Areas & Water");
leafletMap.addOverlay(layerWmsStreets, "Streets");
leafletMap.addOverlay(layerWmsAbiesAlbaGermany, "Distribution of Abies Alba in Germany");
leafletMap.addOverlay(layerWmsAbiesAlbaGermanyMV,
Expand Down

0 comments on commit 238d7f4

Please sign in to comment.