Skip to content

Commit 4a85e02

Browse files
authored
Merge pull request #337 from xdev-software/develop
Release 4.2.0
2 parents 4490300 + 1511689 commit 4a85e02

File tree

32 files changed

+422
-62
lines changed

32 files changed

+422
-62
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66

77
env:
88
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}
9-
DEMO_MAVEN_MODULE: ${{ github.event.repository.name }}-demo
109

1110
permissions:
1211
contents: write
@@ -58,17 +57,16 @@ jobs:
5857
run: |
5958
git config --global user.email "[email protected]"
6059
git config --global user.name "GitHub Actions"
61-
62-
- name: Un-SNAP root
63-
run: mvn -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false
64-
65-
- name: Un-SNAP demo
66-
run: mvn -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false
67-
working-directory: ${{ env.DEMO_MAVEN_MODULE }}
6860
6961
- name: Un-SNAP
70-
run: mvn -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false
71-
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
62+
run: |
63+
modules=("") # root
64+
modules+=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0'))
65+
for i in "${modules[@]}"
66+
do
67+
echo "Processing $i/pom.xml"
68+
(cd "$i" && mvn -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false)
69+
done
7270
7371
- name: Get version
7472
id: version
@@ -207,17 +205,16 @@ jobs:
207205
git config --global user.email "[email protected]"
208206
git config --global user.name "GitHub Actions"
209207
git pull
210-
211-
- name: Inc Version and SNAP root
212-
run: mvn -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true
213-
214-
- name: Inc Version and SNAP demo
215-
run: mvn -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true
216-
working-directory: ${{ env.DEMO_MAVEN_MODULE }}
217-
208+
218209
- name: Inc Version and SNAP
219-
run: mvn -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true
220-
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
210+
run: |
211+
modules=("") # root
212+
modules+=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0'))
213+
for i in "${modules[@]}"
214+
do
215+
echo "Processing $i/pom.xml"
216+
(cd "$i" && mvn -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true)
217+
done
221218
222219
- name: Git Commit and Push
223220
run: |

.github/workflows/sonar.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ jobs:
5353
restore-keys: ${{ runner.os }}-m2
5454

5555
- name: Build with Maven
56-
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=${{ env.SONARCLOUD_ORG }}_${{ github.event.repository.name }} -Dsonar.organization=${{ env.SONARCLOUD_ORG }} -Dsonar.host.url=${{ env.SONARCLOUD_HOST }}
56+
run: |
57+
mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
58+
-DskipTests \
59+
-Dsonar.projectKey=${{ env.SONARCLOUD_ORG }}_${{ github.event.repository.name }} \
60+
-Dsonar.organization=${{ env.SONARCLOUD_ORG }} \
61+
-Dsonar.host.url=${{ env.SONARCLOUD_HOST }}
5762
env:
5863
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
5964
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.idea/codeStyles/Project.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 4.2.0
2+
* Fixed some invalid built JavaScript commands #330
3+
* Add basic support for CRS #333
4+
* Added a few new showcase demos
5+
* Updated dependencies
6+
17
## 4.1.1
28
* ⚠️ GroupId changed from ``com.xdev-software`` to ``software.xdev``
39
* Updated dependencies

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>software.xdev</groupId>
88
<artifactId>vaadin-maps-leaflet-flow-root</artifactId>
9-
<version>4.1.2-SNAPSHOT</version>
9+
<version>4.2.0-SNAPSHOT</version>
1010
<packaging>pom</packaging>
1111

1212
<organization>

vaadin-maps-leaflet-flow-demo/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>software.xdev</groupId>
88
<artifactId>vaadin-maps-leaflet-flow-demo</artifactId>
9-
<version>4.1.2-SNAPSHOT</version>
9+
<version>4.2.0-SNAPSHOT</version>
1010
<packaging>jar</packaging>
1111

1212
<inceptionYear>2019</inceptionYear>
@@ -26,9 +26,9 @@
2626
<mainClass>software.xdev.vaadin.Application</mainClass>
2727

2828
<!-- Dependency-Versions -->
29-
<vaadin.version>24.3.3</vaadin.version>
29+
<vaadin.version>24.3.5</vaadin.version>
3030

31-
<org.springframework.boot.version>3.2.1</org.springframework.boot.version>
31+
<org.springframework.boot.version>3.2.2</org.springframework.boot.version>
3232
</properties>
3333

3434
<dependencyManagement>
@@ -191,7 +191,7 @@
191191
<dependency>
192192
<groupId>com.puppycrawl.tools</groupId>
193193
<artifactId>checkstyle</artifactId>
194-
<version>10.12.7</version>
194+
<version>10.13.0</version>
195195
</dependency>
196196
</dependencies>
197197
<configuration>

vaadin-maps-leaflet-flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/DemoView.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import software.xdev.vaadin.maps.leaflet.flow.demo.FreeingUpResourceBenchmarkDemo;
1818
import software.xdev.vaadin.maps.leaflet.flow.demo.InitialResizeDemo;
1919
import software.xdev.vaadin.maps.leaflet.flow.demo.MinimalisticDemo;
20+
import software.xdev.vaadin.maps.leaflet.flow.demo.NotOfThisEarthDemo;
21+
import software.xdev.vaadin.maps.leaflet.flow.demo.WatermarkControlDemo;
2022

2123

2224
@PageTitle("Leaflet + Vaadin demos")
@@ -67,6 +69,16 @@ protected void onAttach(final AttachEvent attachEvent)
6769
"Complex",
6870
"A complex example with various leaflet components and methods"
6971
),
72+
new Example(
73+
NotOfThisEarthDemo.NAV,
74+
"Not of this earth",
75+
"Displays a map that is not from this earth"
76+
),
77+
new Example(
78+
WatermarkControlDemo.NAV,
79+
"Watermark-Control",
80+
"Creates a custom control interface"
81+
),
7082
new Example(
7183
FreeingUpResourceBenchmarkDemo.NAV,
7284
"Freeing up resources Benchmark",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package software.xdev.vaadin.maps.leaflet.flow.demo;
2+
3+
import java.util.Map;
4+
5+
import com.vaadin.flow.component.html.Anchor;
6+
import com.vaadin.flow.router.Route;
7+
8+
import software.xdev.vaadin.maps.leaflet.MapContainer;
9+
import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng;
10+
import software.xdev.vaadin.maps.leaflet.basictypes.LLatLngBounds;
11+
import software.xdev.vaadin.maps.leaflet.crs.LCRS;
12+
import software.xdev.vaadin.maps.leaflet.layer.raster.LImageOverlay;
13+
import software.xdev.vaadin.maps.leaflet.layer.ui.LMarker;
14+
import software.xdev.vaadin.maps.leaflet.layer.vector.LPolyline;
15+
import software.xdev.vaadin.maps.leaflet.map.LMap;
16+
import software.xdev.vaadin.maps.leaflet.map.LMapOptions;
17+
import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry;
18+
import software.xdev.vaadin.maps.leaflet.registry.LDefaultComponentManagementRegistry;
19+
20+
21+
@Route(NotOfThisEarthDemo.NAV)
22+
@SuppressWarnings("checkstyle:MagicNumber")
23+
public class NotOfThisEarthDemo extends AbstractDemo
24+
{
25+
public static final String NAV = "not-of-this-earth";
26+
27+
private final LComponentManagementRegistry reg;
28+
29+
public NotOfThisEarthDemo()
30+
{
31+
// Let the view use 100% of the site
32+
this.setSizeFull();
33+
34+
this.add(new Anchor("https://leafletjs.com/examples/crs-simple/crs-simple.html", "Based on this example"));
35+
36+
// Create the registry which is needed so that components can be reused and their methods invoked
37+
// Note: You normally don't need to invoke any methods of the registry and just hand it over to the components
38+
this.reg = new LDefaultComponentManagementRegistry(this);
39+
40+
this.buildMap();
41+
}
42+
43+
private void buildMap()
44+
{
45+
// Create and add the MapContainer (which contains the map) to the UI
46+
final MapContainer mapContainer = new MapContainer(
47+
this.reg,
48+
new LMapOptions()
49+
.withCrs(LCRS.Defined.SIMPLE)
50+
.withMinZoom(-3));
51+
mapContainer.setSizeFull();
52+
this.add(mapContainer);
53+
54+
final LMap map = mapContainer.getlMap();
55+
56+
new LImageOverlay(
57+
this.reg,
58+
"uqm_map_full.png",
59+
new LLatLngBounds(
60+
this.reg,
61+
this.xy(-25, -26.5),
62+
this.xy(1023, 1021.5))
63+
).addTo(map);
64+
65+
final LLatLng cordSol = this.xy(175.2, 145);
66+
final LLatLng cordDeneb = this.xy(218.7, 8.3);
67+
Map.ofEntries(
68+
Map.entry(cordSol, "Sol"),
69+
Map.entry(this.xy(41.6, 130.1), "Mizar"),
70+
Map.entry(this.xy(13.4, 56.5), "Krueger-Z"),
71+
Map.entry(cordDeneb, "Deneb")
72+
).forEach((cords, text) -> new LMarker(this.reg, cords)
73+
.bindPopup(text)
74+
.addTo(map));
75+
76+
new LPolyline(this.reg, cordSol, cordDeneb)
77+
.addTo(map);
78+
79+
map.setView(this.xy(300, 140), 1);
80+
}
81+
82+
private LLatLng xy(final double x, final double y)
83+
{
84+
return new LLatLng(this.reg, y, x);
85+
}
86+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
package software.xdev.vaadin.maps.leaflet.flow.demo;
2+
3+
import com.vaadin.flow.component.UI;
4+
import com.vaadin.flow.component.html.Anchor;
5+
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
6+
import com.vaadin.flow.router.Route;
7+
8+
import software.xdev.vaadin.maps.leaflet.MapContainer;
9+
import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng;
10+
import software.xdev.vaadin.maps.leaflet.controls.LControl;
11+
import software.xdev.vaadin.maps.leaflet.controls.LControlOptions;
12+
import software.xdev.vaadin.maps.leaflet.layer.raster.LTileLayer;
13+
import software.xdev.vaadin.maps.leaflet.map.LMap;
14+
import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry;
15+
import software.xdev.vaadin.maps.leaflet.registry.LDefaultComponentManagementRegistry;
16+
17+
18+
@Route(WatermarkControlDemo.NAV)
19+
@SuppressWarnings("checkstyle:MagicNumber")
20+
public class WatermarkControlDemo extends VerticalLayout
21+
{
22+
public static final String NAV = "/watermark-control";
23+
24+
@SuppressWarnings("checkstyle:LineLength")
25+
public WatermarkControlDemo()
26+
{
27+
LWatermark.register();
28+
29+
// Let the view use 100% of the site
30+
this.setSizeFull();
31+
32+
this.add(new Anchor(
33+
"https://leafletjs.com/examples/extending/extending-3-controls.html#controls",
34+
"Based on this example"));
35+
36+
// Create the registry which is needed so that components can be reused and their methods invoked
37+
// Note: You normally don't need to invoke any methods of the registry and just hand it over to the components
38+
final LComponentManagementRegistry reg = new LDefaultComponentManagementRegistry(this);
39+
40+
// Create and add the MapContainer (which contains the map) to the UI
41+
final MapContainer mapContainer = new MapContainer(reg);
42+
mapContainer.setSizeFull();
43+
this.add(mapContainer);
44+
45+
final LMap map = mapContainer.getlMap();
46+
47+
// Add a (default) TileLayer so that we can see something on the map
48+
map.addLayer(LTileLayer.createDefaultForOpenStreetMapTileServer(reg));
49+
50+
new LWatermark(reg,
51+
new LWatermarkOptions()
52+
.withPosition(LControl.Positions.BOTTOM_LEFT)
53+
.withWidth("20em")
54+
.withSrc("""
55+
data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="200" viewBox="0 0 18300 4500">
56+
<defs>
57+
<style>
58+
.fil0{fill:%23d71e23}
59+
</style>
60+
</defs>
61+
<g>
62+
<path class="fil0" d="M9763 10965h-920l-17-6-1503-588-1506 588-11 4-13 2-1562 148-1102 105 1064-369 2311-801-1638-633-683-263h1609l16 6 1515 588 1521-588 10-4 9-1 1388-211 1177-178-1131 441-2177 849 1675 647 682 264zM25514 9520l-1909 1442-22 17h-693l-23-19-1765-1440-285-233h907l22 17 1490 1178 1395-1177 23-19h1171zM20426 10961h-4015V9260h4126l-1 127-1 99v126h-112l-3041-3 2 322 3038 3h110l2 124 1 83 2 128h-3146v352l3035-6h112v346z" transform="translate(-5400 -7700)"/>
63+
<path class="fil0" d="M10994 9275h2026a12150 12150 0 0 1 1368 73c292 35 559 83 798 143h1c290 73 510 158 659 254 165 106 248 229 248 368 0 134-85 254-254 359-151 94-375 180-672 256-292 76-618 132-977 170-359 37-751 56-1174 56h-2102V9275h79zm917 1354h1106c300 0 574-14 822-41 247-27 469-67 665-121h1a2470 2470 0 0 0 277-96c176-79 264-164 264-256 0-60-39-118-117-173-92-66-234-125-425-178-197-55-418-96-665-123-248-27-522-41-822-41h-1106v1029z" transform="translate(-5400 -7700)"/>
64+
</g>
65+
</svg>
66+
"""))
67+
.addTo(map);
68+
69+
// Set what part of the world should be shown
70+
map.setView(new LLatLng(reg, 49.6751, 12.1607), 5);
71+
}
72+
73+
public static class LWatermark extends LControl<LWatermark>
74+
{
75+
public LWatermark(
76+
final LComponentManagementRegistry compReg,
77+
final LWatermarkOptions options)
78+
{
79+
super(compReg, "L.control.watermark(" + compReg.writeOptions(options) + ")");
80+
}
81+
82+
public static void register()
83+
{
84+
UI.getCurrent().getPage().executeJs("""
85+
L.Control.Watermark = L.Control.extend({
86+
onAdd: function(map) {
87+
var img = L.DomUtil.create('img');
88+
img.src = this.options.src;
89+
img.style.width = this.options.width;
90+
return img;
91+
},
92+
93+
onRemove: function(map) {
94+
// Nothing to do here
95+
}
96+
});
97+
98+
L.control.watermark = function(opts) {
99+
return new L.Control.Watermark(opts);
100+
}
101+
""");
102+
}
103+
}
104+
105+
public static class LWatermarkOptions extends LControlOptions<LWatermarkOptions>
106+
{
107+
private String src;
108+
private String width;
109+
110+
public String getSrc()
111+
{
112+
return this.src;
113+
}
114+
115+
public void setSrc(final String src)
116+
{
117+
this.src = src;
118+
}
119+
120+
public LWatermarkOptions withSrc(final String src)
121+
{
122+
this.setSrc(src);
123+
return this.self();
124+
}
125+
126+
public String getWidth()
127+
{
128+
return this.width;
129+
}
130+
131+
public void setWidth(final String width)
132+
{
133+
this.width = width;
134+
}
135+
136+
public LWatermarkOptions withWidth(final String width)
137+
{
138+
this.setWidth(width);
139+
return this.self();
140+
}
141+
}
142+
}
307 KB
Loading

0 commit comments

Comments
 (0)