Skip to content

Commit

Permalink
Merge pull request #337 from xdev-software/develop
Browse files Browse the repository at this point in the history
Release 4.2.0
  • Loading branch information
AB-xdev authored Feb 16, 2024
2 parents 4490300 + 1511689 commit 4a85e02
Show file tree
Hide file tree
Showing 32 changed files with 422 additions and 62 deletions.
37 changes: 17 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:

env:
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}
DEMO_MAVEN_MODULE: ${{ github.event.repository.name }}-demo

permissions:
contents: write
Expand Down Expand Up @@ -58,17 +57,16 @@ jobs:
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
- name: Un-SNAP root
run: mvn -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false

- name: Un-SNAP demo
run: mvn -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false
working-directory: ${{ env.DEMO_MAVEN_MODULE }}
- name: Un-SNAP
run: mvn -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
run: |
modules=("") # root
modules+=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0'))
for i in "${modules[@]}"
do
echo "Processing $i/pom.xml"
(cd "$i" && mvn -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false)
done
- name: Get version
id: version
Expand Down Expand Up @@ -207,17 +205,16 @@ jobs:
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git pull
- name: Inc Version and SNAP root
run: mvn -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true

- name: Inc Version and SNAP demo
run: mvn -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true
working-directory: ${{ env.DEMO_MAVEN_MODULE }}

- name: Inc Version and SNAP
run: mvn -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
run: |
modules=("") # root
modules+=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0'))
for i in "${modules[@]}"
do
echo "Processing $i/pom.xml"
(cd "$i" && mvn -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true)
done
- name: Git Commit and Push
run: |
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ jobs:
restore-keys: ${{ runner.os }}-m2

- name: Build with Maven
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 }}
run: |
mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
-DskipTests \
-Dsonar.projectKey=${{ env.SONARCLOUD_ORG }}_${{ github.event.repository.name }} \
-Dsonar.organization=${{ env.SONARCLOUD_ORG }} \
-Dsonar.host.url=${{ env.SONARCLOUD_HOST }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
5 changes: 5 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 4.2.0
* Fixed some invalid built JavaScript commands #330
* Add basic support for CRS #333
* Added a few new showcase demos
* Updated dependencies

## 4.1.1
* ⚠️ GroupId changed from ``com.xdev-software`` to ``software.xdev``
* Updated dependencies
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>software.xdev</groupId>
<artifactId>vaadin-maps-leaflet-flow-root</artifactId>
<version>4.1.2-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
<packaging>pom</packaging>

<organization>
Expand Down
8 changes: 4 additions & 4 deletions vaadin-maps-leaflet-flow-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>software.xdev</groupId>
<artifactId>vaadin-maps-leaflet-flow-demo</artifactId>
<version>4.1.2-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
<packaging>jar</packaging>

<inceptionYear>2019</inceptionYear>
Expand All @@ -26,9 +26,9 @@
<mainClass>software.xdev.vaadin.Application</mainClass>

<!-- Dependency-Versions -->
<vaadin.version>24.3.3</vaadin.version>
<vaadin.version>24.3.5</vaadin.version>

<org.springframework.boot.version>3.2.1</org.springframework.boot.version>
<org.springframework.boot.version>3.2.2</org.springframework.boot.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -191,7 +191,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.12.7</version>
<version>10.13.0</version>
</dependency>
</dependencies>
<configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import software.xdev.vaadin.maps.leaflet.flow.demo.FreeingUpResourceBenchmarkDemo;
import software.xdev.vaadin.maps.leaflet.flow.demo.InitialResizeDemo;
import software.xdev.vaadin.maps.leaflet.flow.demo.MinimalisticDemo;
import software.xdev.vaadin.maps.leaflet.flow.demo.NotOfThisEarthDemo;
import software.xdev.vaadin.maps.leaflet.flow.demo.WatermarkControlDemo;


@PageTitle("Leaflet + Vaadin demos")
Expand Down Expand Up @@ -67,6 +69,16 @@ protected void onAttach(final AttachEvent attachEvent)
"Complex",
"A complex example with various leaflet components and methods"
),
new Example(
NotOfThisEarthDemo.NAV,
"Not of this earth",
"Displays a map that is not from this earth"
),
new Example(
WatermarkControlDemo.NAV,
"Watermark-Control",
"Creates a custom control interface"
),
new Example(
FreeingUpResourceBenchmarkDemo.NAV,
"Freeing up resources Benchmark",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package software.xdev.vaadin.maps.leaflet.flow.demo;

import java.util.Map;

import com.vaadin.flow.component.html.Anchor;
import com.vaadin.flow.router.Route;

import software.xdev.vaadin.maps.leaflet.MapContainer;
import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng;
import software.xdev.vaadin.maps.leaflet.basictypes.LLatLngBounds;
import software.xdev.vaadin.maps.leaflet.crs.LCRS;
import software.xdev.vaadin.maps.leaflet.layer.raster.LImageOverlay;
import software.xdev.vaadin.maps.leaflet.layer.ui.LMarker;
import software.xdev.vaadin.maps.leaflet.layer.vector.LPolyline;
import software.xdev.vaadin.maps.leaflet.map.LMap;
import software.xdev.vaadin.maps.leaflet.map.LMapOptions;
import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry;
import software.xdev.vaadin.maps.leaflet.registry.LDefaultComponentManagementRegistry;


@Route(NotOfThisEarthDemo.NAV)
@SuppressWarnings("checkstyle:MagicNumber")
public class NotOfThisEarthDemo extends AbstractDemo
{
public static final String NAV = "not-of-this-earth";

private final LComponentManagementRegistry reg;

public NotOfThisEarthDemo()
{
// Let the view use 100% of the site
this.setSizeFull();

this.add(new Anchor("https://leafletjs.com/examples/crs-simple/crs-simple.html", "Based on this example"));

// Create the registry which is needed so that components can be reused and their methods invoked
// Note: You normally don't need to invoke any methods of the registry and just hand it over to the components
this.reg = new LDefaultComponentManagementRegistry(this);

this.buildMap();
}

private void buildMap()
{
// Create and add the MapContainer (which contains the map) to the UI
final MapContainer mapContainer = new MapContainer(
this.reg,
new LMapOptions()
.withCrs(LCRS.Defined.SIMPLE)
.withMinZoom(-3));
mapContainer.setSizeFull();
this.add(mapContainer);

final LMap map = mapContainer.getlMap();

new LImageOverlay(
this.reg,
"uqm_map_full.png",
new LLatLngBounds(
this.reg,
this.xy(-25, -26.5),
this.xy(1023, 1021.5))
).addTo(map);

final LLatLng cordSol = this.xy(175.2, 145);
final LLatLng cordDeneb = this.xy(218.7, 8.3);
Map.ofEntries(
Map.entry(cordSol, "Sol"),
Map.entry(this.xy(41.6, 130.1), "Mizar"),
Map.entry(this.xy(13.4, 56.5), "Krueger-Z"),
Map.entry(cordDeneb, "Deneb")
).forEach((cords, text) -> new LMarker(this.reg, cords)
.bindPopup(text)
.addTo(map));

new LPolyline(this.reg, cordSol, cordDeneb)
.addTo(map);

map.setView(this.xy(300, 140), 1);
}

private LLatLng xy(final double x, final double y)
{
return new LLatLng(this.reg, y, x);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
package software.xdev.vaadin.maps.leaflet.flow.demo;

import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.html.Anchor;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route;

import software.xdev.vaadin.maps.leaflet.MapContainer;
import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng;
import software.xdev.vaadin.maps.leaflet.controls.LControl;
import software.xdev.vaadin.maps.leaflet.controls.LControlOptions;
import software.xdev.vaadin.maps.leaflet.layer.raster.LTileLayer;
import software.xdev.vaadin.maps.leaflet.map.LMap;
import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry;
import software.xdev.vaadin.maps.leaflet.registry.LDefaultComponentManagementRegistry;


@Route(WatermarkControlDemo.NAV)
@SuppressWarnings("checkstyle:MagicNumber")
public class WatermarkControlDemo extends VerticalLayout
{
public static final String NAV = "/watermark-control";

@SuppressWarnings("checkstyle:LineLength")
public WatermarkControlDemo()
{
LWatermark.register();

// Let the view use 100% of the site
this.setSizeFull();

this.add(new Anchor(
"https://leafletjs.com/examples/extending/extending-3-controls.html#controls",
"Based on this example"));

// Create the registry which is needed so that components can be reused and their methods invoked
// Note: You normally don't need to invoke any methods of the registry and just hand it over to the components
final LComponentManagementRegistry reg = new LDefaultComponentManagementRegistry(this);

// Create and add the MapContainer (which contains the map) to the UI
final MapContainer mapContainer = new MapContainer(reg);
mapContainer.setSizeFull();
this.add(mapContainer);

final LMap map = mapContainer.getlMap();

// Add a (default) TileLayer so that we can see something on the map
map.addLayer(LTileLayer.createDefaultForOpenStreetMapTileServer(reg));

new LWatermark(reg,
new LWatermarkOptions()
.withPosition(LControl.Positions.BOTTOM_LEFT)
.withWidth("20em")
.withSrc("""
data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="200" viewBox="0 0 18300 4500">
<defs>
<style>
.fil0{fill:%23d71e23}
</style>
</defs>
<g>
<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)"/>
<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)"/>
</g>
</svg>
"""))
.addTo(map);

// Set what part of the world should be shown
map.setView(new LLatLng(reg, 49.6751, 12.1607), 5);
}

public static class LWatermark extends LControl<LWatermark>
{
public LWatermark(
final LComponentManagementRegistry compReg,
final LWatermarkOptions options)
{
super(compReg, "L.control.watermark(" + compReg.writeOptions(options) + ")");
}

public static void register()
{
UI.getCurrent().getPage().executeJs("""
L.Control.Watermark = L.Control.extend({
onAdd: function(map) {
var img = L.DomUtil.create('img');
img.src = this.options.src;
img.style.width = this.options.width;
return img;
},
onRemove: function(map) {
// Nothing to do here
}
});
L.control.watermark = function(opts) {
return new L.Control.Watermark(opts);
}
""");
}
}

public static class LWatermarkOptions extends LControlOptions<LWatermarkOptions>
{
private String src;
private String width;

public String getSrc()
{
return this.src;
}

public void setSrc(final String src)
{
this.src = src;
}

public LWatermarkOptions withSrc(final String src)
{
this.setSrc(src);
return this.self();
}

public String getWidth()
{
return this.width;
}

public void setWidth(final String width)
{
this.width = width;
}

public LWatermarkOptions withWidth(final String width)
{
this.setWidth(width);
return this.self();
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4a85e02

Please sign in to comment.