Skip to content

Commit

Permalink
Tine enhancements & preparing for 1.0.0 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
mstahv committed Apr 3, 2024
1 parent c9e1a2c commit 3fefc8f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.parttio</groupId>
<artifactId>maplibre</artifactId>
<version>0.0.7-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<name>MapLibreGL }&gt; add-on</name>
<description>An extension to Vaadin that provides a Java API for MapLibreGL slippy map component with modern vector layer support.</description>
<url>https://github.com/parttio/maplibre</url>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/vaadin/addons/maplibre/DrawControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public class DrawControl {
private DrawMode mode = DrawMode.SIMPLE_SELECT;
private ArrayList<DrawEventListener<GeometryChangeEvent>> changeListeners;

public DrawControl(MapLibre map) {
this(map, null);
}

public DrawControl(MapLibre map, String stylesJson) {
this.map = map;
this.stylesJson = stylesJson;
Expand Down
17 changes: 8 additions & 9 deletions src/main/java/org/vaadin/addons/maplibre/MapLibre.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,14 @@ public MapLibre() {
} else if (o instanceof URI uri) {
styleUrl = uri.toString();
}
setMinWidth("100px");
setMinHeight("100px");
}

public MapLibre(URI styleUrl) {
this.styleUrl = styleUrl.toString();
setMinWidth("100px");
setMinHeight("100px");
}

public MapLibre(String styleUrl) {
this.styleUrl = styleUrl;
setMinWidth("100px");
setMinHeight("100px");

}

public MapLibre(InputStream styleJson) {
Expand All @@ -105,12 +98,18 @@ public MapLibre(InputStream styleJson) {
} catch (IOException e) {
throw new RuntimeException(e);
}
setMinWidth("100px");
setMinHeight("100px");
}

private void init() {
if (!initialized) {
if(getWidth() == null && getMinWidth() == null) {
setWidth("100%");
setMinWidth("100px");
}
if(getHeight() == null && getMinHeight() == null) {
setHeight("100%");
setMinHeight("100px");
}
loadMapLibreJs();
jsTemplate("org/vaadin/addons/maplibre/mapinit.js", Map.of(
"style", styleJson == null ? "null" : styleJson, // Map.of is not nullsafe :-(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public FinnishPropertyAreaMap() throws IOException, URISyntaxException {

setCenter(22.2462, 60.1755);
setZoomLevel(15);
setHeight("50vh");

// add Finnish estate data as name source
addSource("kiinteisto-avoin", "{'type':'vector', 'url':\"https://avoin-karttakuva.maanmittauslaitos.fi/kiinteisto-avoin/v3/kiinteistojaotus/WGS84_Pseudo-Mercator/tilejson.json?api-key=95065def-f53b-44d6-b429-769c3d504e13\"}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public OsmViaMapTiler() {
.withPopup("Hello from Vaadin!")
.openPopup();


Polygon polygon = (Polygon) new WKTReader().read("POLYGON((22.290 60.428, 22.310 60.429, 22.31 60.47, 22.28 60.47, 22.290 60.428))");

map.addFillLayer(polygon, new FillPaint("red", 0.2));
Expand Down

0 comments on commit 3fefc8f

Please sign in to comment.