Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#203 Make it possible to use zoomOffset #204

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
<dependency>
<groupId>org.peimari</groupId>
<artifactId>g-leaflet</artifactId>
<version>1.0.15</version>
<version>1.0.15-SNAPSHOT</version>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<version>1.0.15-SNAPSHOT</version>
<version>1.0.16</version>

<!-- Only needed during widgetset compilation, so provided scope would
be great for this, but with it is left out from widgetset compilation by
vaadin plugin -->
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/vaadin/addon/leaflet/LGridLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ protected LeafletGridLayerState getState() {
return (LeafletGridLayerState) super.getState();
}

public Integer getTileSize() {
return getState().tileSize;
}

public void setTileSize(Integer tileSize) {
getState().tileSize = tileSize;
}

public String getAttributionString() {
return getState().attributionString;
}
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/vaadin/addon/leaflet/LTileLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ public void setSubDomains(String... string) {
getState().subDomains = string;
}

public Integer getZoomOffset() {
return getState().zoomOffset;
}

public void setZoomOffset(Integer zoomOffset) {
getState().zoomOffset = zoomOffset;
}

public Map<String, String> getCustomOptions() {
return getState().customOptions;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ protected GridLayerOptions createOptions() {
GridLayerOptions o = GridLayerOptions.create();
LeafletGridLayerState s = getState();

if (s.tileSize != null) {
o.setTileSize(s.tileSize);
}
if (s.attributionString != null) {
o.setAttribution(s.attributionString);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ protected TileLayerOptions createOptions() {
if (s.tms != null && s.tms) {
o.setTms(true);
}
if (s.zoomOffset != null) {
o.setZoomOffset(s.zoomOffset);
}
if (s.customOptions != null) {
for (String keyName : s.customOptions.keySet()) {
o.setCustomOption(keyName, s.customOptions.get(keyName));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

public class LeafletGridLayerState extends AbstractLeafletComponentState {

public Integer tileSize;
public Double opacity;
public Integer zIndex;
public Bounds bounds;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class LeafletTileLayerState extends LeafletGridLayerState {
public Integer minZoom;
public Integer maxZoom;
public String[] subDomains;
public Integer zoomOffset;
public Map<String, String> customOptions;

}
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ public Component getTestComponent() {

LTileLayer pk = new LTileLayer();
pk.setUrl("https://{s}.kartat.kapsi.fi/peruskartta/{z}/{x}/{y}.png");
pk.setZoomOffset(0);
pk.setTileSize(256);
pk.setAttributionString("Maanmittauslaitos, hosted by kartat.kapsi.fi");
pk.setMaxZoom(18);
pk.setSubDomains("tile2");
Expand Down