├── .github ├── FUNDING.yml ├── .lycheeignore ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── question.yml │ ├── enhancement.yml │ └── bug_report.yml ├── workflows │ ├── sync-labels.yml │ ├── no-response.yml │ ├── broken-links.yml │ └── test-deploy.yml └── labels.yml ├── plugins ├── geoman │ ├── README.md │ └── src │ │ └── main │ │ └── java │ │ └── software │ │ └── xdev │ │ └── vaadin │ │ └── maps │ │ └── leaflet │ │ └── geoman │ │ ├── LDrawOptions.java │ │ ├── LEditOptions.java │ │ ├── LDrawEditOptions.java │ │ ├── map │ │ └── LMapPMControlOptions.java │ │ ├── LPM.java │ │ ├── LTextOptions.java │ │ └── layer │ │ └── LLayerPM.java ├── maplibre-gl-leaflet │ ├── README.md │ └── src │ │ └── main │ │ └── java │ │ └── software │ │ └── xdev │ │ └── vaadin │ │ └── maps │ │ └── leaflet │ │ └── maplibregl │ │ └── layer │ │ └── vector │ │ ├── LMaplibreGLOptions.java │ │ ├── LAbstractMaplibreGLOptions.java │ │ └── LMaplibreGL.java ├── leaflet-markercluster │ ├── README.md │ └── src │ │ └── main │ │ └── java │ │ └── software │ │ └── xdev │ │ └── vaadin │ │ └── maps │ │ └── leaflet │ │ └── markercluster │ │ └── layer │ │ └── other │ │ ├── LMarkerClusterGroupOptions.java │ │ └── LMarkerClusterGroup.java └── README.md ├── assets ├── demo.avif └── demo.png ├── flow └── src │ └── main │ ├── resources │ └── META-INF │ │ └── resources │ │ ├── layers.png │ │ ├── layers-2x.png │ │ ├── marker-icon.png │ │ ├── marker-icon-2x.png │ │ └── marker-shadow.png │ └── java │ └── software │ └── xdev │ └── vaadin │ └── maps │ └── leaflet │ ├── base │ ├── LComponentOptions.java │ ├── has │ │ ├── LHasRedraw.java │ │ ├── LHasOpacity.java │ │ ├── LHasSetZIndex.java │ │ ├── LHasBringTo.java │ │ ├── LHasSetLatLng.java │ │ └── LHasSetStylePath.java │ ├── RawString.java │ ├── LAbstractComponent.java │ ├── LBaseComponent.java │ └── LComponent.java │ ├── basictypes │ ├── LIconOptions.java │ ├── LDivIcon.java │ ├── LLatLngBounds.java │ ├── LPoint.java │ ├── LIcon.java │ ├── LLatLng.java │ └── LDivIconOptions.java │ ├── map │ ├── LMapPanOptions.java │ ├── LMapZoomPanOptions.java │ ├── AbstractLMapZoomPanOptions.java │ ├── LMapZoomOptions.java │ ├── LMapZoomBaseOptions.java │ ├── LMapPaddingBaseOptions.java │ ├── LMapPaddingOptions.java │ ├── LMapPanBaseOptions.java │ ├── AbstractLMapPanOptions.java │ ├── LMapFitBoundOptions.java │ └── LMapLocateOptions.java │ ├── layer │ ├── raster │ │ ├── LTileLayerOptions.java │ │ ├── LImageOverlayOptions.java │ │ ├── LAbstractTileLayer.java │ │ ├── LVideoOverlay.java │ │ ├── LTileLayerWMS.java │ │ ├── LImageOverlay.java │ │ ├── LTileLayer.java │ │ ├── LVideoOverlayOptions.java │ │ └── LTileLayerWMSOptions.java │ ├── vector │ │ ├── LSVGOverlayOptions.java │ │ ├── LCircleOptions.java │ │ ├── LCircleMarkerOptions.java │ │ ├── LAbstractCircle.java │ │ ├── LPolylineOptions.java │ │ ├── LPath.java │ │ ├── LPolygon.java │ │ ├── LRectangle.java │ │ ├── LSVGOverlay.java │ │ ├── LCircleMarker.java │ │ └── LCircle.java │ ├── LInteractiveLayer.java │ ├── other │ │ ├── LAbstractFeatureGroup.java │ │ ├── LFeatureGroup.java │ │ ├── LGeoJSONLayer.java │ │ └── LGeoJSONLayerOptions.java │ ├── LGridLayer.java │ ├── LLayerOptions.java │ ├── LLayerGroup.java │ ├── LInteractiveLayerOptions.java │ ├── ui │ │ ├── LPopup.java │ │ ├── LTooltip.java │ │ ├── LDivOverlayOptions.java │ │ ├── LTooltipOptions.java │ │ ├── LMarker.java │ │ └── LDivOverlay.java │ ├── LAbstractLayerGroup.java │ └── LAbstractImageOverlayOptions.java │ ├── controls │ ├── LControlZoom.java │ ├── LControlScale.java │ ├── LControlAttribution.java │ ├── LControlAttributionOptions.java │ ├── LControlOptions.java │ ├── LControl.java │ ├── LControlScaleOptions.java │ ├── LControlZoomOptions.java │ └── LControlLayersOptions.java │ └── crs │ └── LCRS.java ├── .idea ├── codeStyles │ └── codeStyleConfig.xml ├── externalDependencies.xml ├── inspectionProfiles │ └── Project_Default.xml ├── PMDPlugin.xml ├── saveactions_settings.xml └── checkstyle-idea.xml ├── flow-demo └── src │ └── main │ ├── resources │ ├── META-INF │ │ └── resources │ │ │ ├── uqm_map_full.png │ │ │ └── assets │ │ │ └── XDEV_LOGO.svg │ └── application.yml │ └── java │ └── software │ └── xdev │ └── vaadin │ ├── Application.java │ └── maps │ └── leaflet │ └── flow │ └── demo │ ├── AbstractDemo.java │ ├── InitialResizeDemo.java │ ├── plugins │ ├── MaplibreGLDemo.java │ ├── GeomanDemo.java │ └── LeafletMarkerClusterDemo.java │ ├── MinimalisticDemo.java │ ├── GeoJSONDemo.java │ ├── NotOfThisEarthDemo.java │ └── EventDemo.java ├── .mvn └── wrapper │ └── maven-wrapper.properties ├── SECURITY.md ├── .config └── checkstyle │ └── suppressions.xml ├── .gitattributes ├── bom └── README.md ├── renovate.json5 ├── .run └── Run Demo.run.xml ├── .gitignore ├── pom.xml └── README.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: Leaflet 2 | open_collective: leafletjs 3 | -------------------------------------------------------------------------------- /.github/.lycheeignore: -------------------------------------------------------------------------------- 1 | # Ignorefile for broken link check 2 | localhost 3 | mvnrepository.com 4 | -------------------------------------------------------------------------------- /plugins/geoman/README.md: -------------------------------------------------------------------------------- 1 | # Plugin for [leaflet-geoman](https://github.com/geoman-io/leaflet-geoman) 2 | -------------------------------------------------------------------------------- /assets/demo.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdev-software/vaadin-maps-leaflet-flow/HEAD/assets/demo.avif -------------------------------------------------------------------------------- /assets/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdev-software/vaadin-maps-leaflet-flow/HEAD/assets/demo.png -------------------------------------------------------------------------------- /plugins/maplibre-gl-leaflet/README.md: -------------------------------------------------------------------------------- 1 | # Plugin for [MapLibre GL Leaflet](https://github.com/maplibre/maplibre-gl-leaflet) 2 | -------------------------------------------------------------------------------- /plugins/leaflet-markercluster/README.md: -------------------------------------------------------------------------------- 1 | # Plugin for [Leaflet.markercluster](https://github.com/Leaflet/Leaflet.markercluster) 2 | -------------------------------------------------------------------------------- /flow/src/main/resources/META-INF/resources/layers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdev-software/vaadin-maps-leaflet-flow/HEAD/flow/src/main/resources/META-INF/resources/layers.png -------------------------------------------------------------------------------- /flow/src/main/resources/META-INF/resources/layers-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdev-software/vaadin-maps-leaflet-flow/HEAD/flow/src/main/resources/META-INF/resources/layers-2x.png -------------------------------------------------------------------------------- /flow/src/main/resources/META-INF/resources/marker-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdev-software/vaadin-maps-leaflet-flow/HEAD/flow/src/main/resources/META-INF/resources/marker-icon.png -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /flow/src/main/resources/META-INF/resources/marker-icon-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdev-software/vaadin-maps-leaflet-flow/HEAD/flow/src/main/resources/META-INF/resources/marker-icon-2x.png -------------------------------------------------------------------------------- /flow/src/main/resources/META-INF/resources/marker-shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdev-software/vaadin-maps-leaflet-flow/HEAD/flow/src/main/resources/META-INF/resources/marker-shadow.png -------------------------------------------------------------------------------- /flow-demo/src/main/resources/META-INF/resources/uqm_map_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdev-software/vaadin-maps-leaflet-flow/HEAD/flow-demo/src/main/resources/META-INF/resources/uqm_map_full.png -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | wrapperVersion=3.3.4 2 | distributionType=only-script 3 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip 4 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/vaadin-maps-leaflet-flow/security/advisories/new). 6 | -------------------------------------------------------------------------------- /.config/checkstyle/suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Force sh files to have LF 5 | *.sh text eol=lf 6 | 7 | # Force MVN Wrapper Linux files LF 8 | mvnw text eol=lf 9 | maven-wrapper.properties text eol=lf 10 | -------------------------------------------------------------------------------- /.idea/externalDependencies.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /flow-demo/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | vaadin: 2 | allowed-packages: software/xdev,com/vaadin/flow 3 | devmode: 4 | usageStatistics: 5 | enabled: false 6 | 7 | spring: 8 | devtools: 9 | restart: 10 | poll-interval: 2s 11 | quiet-period: 1s 12 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /plugins/README.md: -------------------------------------------------------------------------------- 1 | # Plugins for Leaflet 2 | 3 | This folder contains Vaadin adapters for Leaflet plugins. 4 | 5 | If you can't find your plugin feel free to open an issue and (optionally) send us a pull requests which adds it. 6 | 7 | A curated list of available Leaflet plugins can also be found [here](https://leafletjs.com/plugins.html). 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - name: 🍃 Leaflet docs 3 | url: https://leafletjs.com/reference.html 4 | about: "Consolidate this when you have questions about Leaflet itself (and not our Vaadin component)" 5 | - name: 💬 Contact support 6 | url: https://xdev.software/en/services/support 7 | about: "If you need support as soon as possible or/and you can't wait for any pull request" 8 | -------------------------------------------------------------------------------- /.idea/PMDPlugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 14 | 16 | -------------------------------------------------------------------------------- /bom/README.md: -------------------------------------------------------------------------------- 1 | # BOM - [Bill of Materials](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Bill_of_Materials_.28BOM.29_POMs) 2 | 3 | Add it like this 4 | ```xml 5 | 6 | 7 | 8 | software.xdev.vaadin.maps-leaflet 9 | bom 10 | ... 11 | pom 12 | import 13 | 14 | 15 | 16 | ``` 17 | -------------------------------------------------------------------------------- /.github/workflows/sync-labels.yml: -------------------------------------------------------------------------------- 1 | name: Sync labels 2 | 3 | on: 4 | push: 5 | branches: develop 6 | paths: 7 | - .github/labels.yml 8 | 9 | workflow_dispatch: 10 | 11 | permissions: 12 | issues: write 13 | 14 | jobs: 15 | labels: 16 | runs-on: ubuntu-latest 17 | timeout-minutes: 10 18 | steps: 19 | - uses: actions/checkout@v5 20 | with: 21 | sparse-checkout: .github/labels.yml 22 | 23 | - uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2 24 | with: 25 | config-file: .github/labels.yml 26 | -------------------------------------------------------------------------------- /renovate.json5: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "rebaseWhen": "behind-base-branch", 4 | "packageRules": [ 5 | { 6 | "description": "Ignore project internal dependencies", 7 | "packagePattern": "^software.xdev.vaadin.maps-leaflet:", 8 | "datasources": [ 9 | "maven" 10 | ], 11 | "enabled": false 12 | }, 13 | { 14 | "description": "Group net.sourceforge.pmd", 15 | "matchPackagePatterns": [ 16 | "^net.sourceforge.pmd" 17 | ], 18 | "datasources": [ 19 | "maven" 20 | ], 21 | "groupName": "net.sourceforge.pmd" 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /.run/Run Demo.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /.github/workflows/no-response.yml: -------------------------------------------------------------------------------- 1 | name: No Response 2 | 3 | on: 4 | workflow_dispatch: 5 | issue_comment: 6 | types: [created] 7 | schedule: 8 | - cron: '5 5 * * *' 9 | 10 | jobs: 11 | noResponse: 12 | runs-on: ubuntu-latest 13 | permissions: 14 | issues: write 15 | steps: 16 | - uses: actions/stale@v10 17 | with: 18 | days-before-issue-stale: 7 19 | days-before-issue-close: 3 20 | stale-issue-label: "stale" 21 | only-labels: "waiting-for-response" 22 | labels-to-remove-when-unstale: "waiting-for-response" 23 | stale-issue-message: "This issue will be closed soon because there has been no further activity." 24 | days-before-pr-stale: -1 25 | days-before-pr-close: -1 26 | repo-token: ${{ secrets.GITHUB_TOKEN }} 27 | -------------------------------------------------------------------------------- /flow-demo/src/main/java/software/xdev/vaadin/Application.java: -------------------------------------------------------------------------------- 1 | package software.xdev.vaadin; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 6 | 7 | import com.vaadin.flow.component.page.AppShellConfigurator; 8 | import com.vaadin.flow.component.page.Push; 9 | import com.vaadin.flow.spring.annotation.EnableVaadin; 10 | 11 | 12 | @SuppressWarnings({"checkstyle:HideUtilityClassConstructor", "PMD.UseUtilityClass"}) 13 | @SpringBootApplication 14 | @EnableVaadin 15 | @Push 16 | public class Application extends SpringBootServletInitializer implements AppShellConfigurator 17 | { 18 | public static void main(final String[] args) 19 | { 20 | SpringApplication.run(Application.class, args); 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /.idea/saveactions_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 22 | -------------------------------------------------------------------------------- /plugins/geoman/src/main/java/software/xdev/vaadin/maps/leaflet/geoman/LDrawOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.geoman; 17 | 18 | public class LDrawOptions extends LAbstractDrawOptions 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /plugins/geoman/src/main/java/software/xdev/vaadin/maps/leaflet/geoman/LEditOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.geoman; 17 | 18 | public class LEditOptions extends LAbstractEditOptions 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /plugins/geoman/src/main/java/software/xdev/vaadin/maps/leaflet/geoman/LDrawEditOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.geoman; 17 | 18 | public class LDrawEditOptions extends LAbstractEditOptions 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /plugins/geoman/src/main/java/software/xdev/vaadin/maps/leaflet/geoman/map/LMapPMControlOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.geoman.map; 17 | 18 | public class LMapPMControlOptions extends LAbstractMapPMControlOptions 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /plugins/maplibre-gl-leaflet/src/main/java/software/xdev/vaadin/maps/leaflet/maplibregl/layer/vector/LMaplibreGLOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.maplibregl.layer.vector; 17 | 18 | public class LMaplibreGLOptions extends LAbstractMaplibreGLOptions 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/base/LComponentOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.base; 17 | 18 | public interface LComponentOptions> 19 | { 20 | @SuppressWarnings("unchecked") 21 | default S self() 22 | { 23 | return (S)this; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/basictypes/LIconOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.basictypes; 17 | 18 | /** 19 | * @see Leaflet docs 20 | */ 21 | public class LIconOptions extends LAbstractIconOptions 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/map/LMapPanOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.map; 17 | 18 | /** 19 | * @see Leaflet docs 20 | */ 21 | public class LMapPanOptions extends AbstractLMapPanOptions 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /plugins/leaflet-markercluster/src/main/java/software/xdev/vaadin/maps/leaflet/markercluster/layer/other/LMarkerClusterGroupOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.markercluster.layer.other; 17 | 18 | public class LMarkerClusterGroupOptions extends LAbstractMarkerClusterGroupOptions 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/AbstractDemo.java: -------------------------------------------------------------------------------- 1 | package software.xdev.vaadin.maps.leaflet.flow.demo; 2 | 3 | import java.util.concurrent.atomic.AtomicBoolean; 4 | 5 | import com.vaadin.flow.component.button.Button; 6 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 7 | 8 | 9 | public abstract class AbstractDemo extends VerticalLayout 10 | { 11 | protected Button createToggleButton( 12 | final String showText, 13 | final String hideText, 14 | final Runnable onShow, 15 | final Runnable onHide) 16 | { 17 | final AtomicBoolean shown = new AtomicBoolean(false); 18 | final Button btn = new Button( 19 | showText, 20 | ev -> { 21 | final boolean isShow = !shown.get(); 22 | (isShow ? onShow : onHide).run(); 23 | ev.getSource().setText(isShow ? hideText : showText); 24 | 25 | shown.set(isShow); 26 | 27 | ev.getSource().setEnabled(true); 28 | } 29 | ); 30 | btn.setDisableOnClick(true); 31 | return btn; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/map/LMapZoomPanOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.map; 17 | 18 | /** 19 | * @see Leaflet docs 20 | */ 21 | public class LMapZoomPanOptions extends AbstractLMapZoomPanOptions 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/raster/LTileLayerOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.raster; 17 | 18 | /** 19 | * @see Leaflet docs 20 | */ 21 | public class LTileLayerOptions extends LAbstractTileLayerOptions 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/base/has/LHasRedraw.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.base.has; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LComponent; 19 | 20 | 21 | public interface LHasRedraw> extends LComponent 22 | { 23 | default S redraw() 24 | { 25 | this.invokeSelf(".redraw()"); 26 | return this.self(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /.idea/checkstyle-idea.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11.0.0 5 | JavaOnlyWithTests 6 | true 7 | true 8 | 12 | 19 | 20 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/base/has/LHasOpacity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.base.has; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LComponent; 19 | 20 | 21 | public interface LHasOpacity> extends LComponent 22 | { 23 | default S setOpacity(final Number opacity) 24 | { 25 | this.invokeSelf(".setOpacity($0)", opacity); 26 | return this.self(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/base/has/LHasSetZIndex.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.base.has; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LComponent; 19 | 20 | 21 | public interface LHasSetZIndex> extends LComponent 22 | { 23 | default S setZIndex(final Number zIndex) 24 | { 25 | this.invokeSelf(".setZIndex($0)", zIndex); 26 | return this.self(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/vector/LSVGOverlayOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.vector; 17 | 18 | import software.xdev.vaadin.maps.leaflet.layer.LAbstractImageOverlayOptions; 19 | 20 | 21 | /** 22 | * @see Leaflet docs 23 | */ 24 | public class LSVGOverlayOptions extends LAbstractImageOverlayOptions 25 | { 26 | } 27 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/base/RawString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.base; 17 | 18 | public class RawString 19 | { 20 | private String value; 21 | 22 | public RawString(final String value) 23 | { 24 | this.value = value; 25 | } 26 | 27 | public String getValue() 28 | { 29 | return this.value; 30 | } 31 | 32 | public void setValue(final String value) 33 | { 34 | this.value = value; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/raster/LImageOverlayOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.raster; 17 | 18 | import software.xdev.vaadin.maps.leaflet.layer.LAbstractImageOverlayOptions; 19 | 20 | 21 | /** 22 | * @see Leaflet docs 23 | */ 24 | public class LImageOverlayOptions extends LAbstractImageOverlayOptions 25 | { 26 | } 27 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/map/AbstractLMapZoomPanOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.map; 17 | 18 | public class AbstractLMapZoomPanOptions> 19 | extends AbstractLMapPanOptions 20 | implements LMapZoomBaseOptions 21 | { 22 | @Override 23 | public T withAnimate(final Boolean animate) 24 | { 25 | return LMapZoomBaseOptions.super.withAnimate(animate); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.github/labels.yml: -------------------------------------------------------------------------------- 1 | # Default 2 | ## Required for template 3 | - name: bug 4 | description: "Something isn't working" 5 | color: 'd73a4a' 6 | - name: enhancement 7 | description: New feature or request 8 | color: '#a2eeef' 9 | - name: question 10 | description: Information is requested 11 | color: '#d876e3' 12 | ## Others 13 | - name: duplicate 14 | description: This already exists 15 | color: '#cfd3d7' 16 | - name: good first issue 17 | description: Good for newcomers 18 | color: '#7057ff' 19 | - name: help wanted 20 | description: Extra attention is needed 21 | color: '#008672' 22 | - name: invalid 23 | description: "This doesn't seem right" 24 | color: '#e4e669' 25 | # Custom 26 | - name: automated 27 | description: Created by an automation 28 | color: '#000000' 29 | - name: "can't reproduce" 30 | color: '#e95f2c' 31 | - name: customer-requested 32 | description: Was requested by a customer of us 33 | color: '#068374' 34 | - name: stale 35 | color: '#ededed' 36 | - name: waiting-for-response 37 | description: If no response is received after a certain time the issue will be closed 38 | color: '#202020' 39 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/base/has/LHasBringTo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.base.has; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LComponent; 19 | 20 | 21 | public interface LHasBringTo> extends LComponent 22 | { 23 | default S bringToFront() 24 | { 25 | this.invokeSelf(".bringToFront()"); 26 | return this.self(); 27 | } 28 | 29 | default S bringToBack() 30 | { 31 | this.invokeSelf(".bringToBack()"); 32 | return this.self(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/base/has/LHasSetLatLng.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.base.has; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LComponent; 19 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng; 20 | 21 | 22 | public interface LHasSetLatLng> extends LComponent 23 | { 24 | default S setLatLng(final LLatLng latLng) 25 | { 26 | this.invokeSelf(".setLatLng(" + latLng.clientComponentJsAccessor() + ")"); 27 | return this.self(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/basictypes/LDivIcon.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.basictypes; 17 | 18 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 19 | 20 | 21 | /** 22 | * @see Leaflet docs 23 | */ 24 | public class LDivIcon extends LIcon 25 | { 26 | public LDivIcon( 27 | final LComponentManagementRegistry compReg, 28 | final LDivIconOptions options) 29 | { 30 | super(compReg, "L.divIcon", options); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/map/LMapZoomOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.map; 17 | 18 | /** 19 | * @see Leaflet docs 20 | */ 21 | public class LMapZoomOptions implements LMapZoomBaseOptions 22 | { 23 | private Boolean animate; 24 | 25 | @Override 26 | public Boolean getAnimate() 27 | { 28 | return this.animate; 29 | } 30 | 31 | @Override 32 | public void setAnimate(final Boolean animate) 33 | { 34 | this.animate = animate; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.yml: -------------------------------------------------------------------------------- 1 | name: ❓ Question 2 | description: Ask a question 3 | labels: [question] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Thanks for taking the time to fill out this form! 9 | 10 | - type: checkboxes 11 | id: checklist 12 | attributes: 13 | label: "Checklist" 14 | options: 15 | - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/vaadin-maps-leaflet-flow/issues) or [closed](https://github.com/xdev-software/vaadin-maps-leaflet-flow/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to." 16 | required: true 17 | - label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise." 18 | required: true 19 | 20 | - type: textarea 21 | id: what-is-the-question 22 | attributes: 23 | label: What is/are your question(s)? 24 | validations: 25 | required: true 26 | 27 | - type: textarea 28 | id: additional-information 29 | attributes: 30 | label: Additional information 31 | description: "Any other information you'd like to include - for instance logs, screenshots, etc." 32 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/base/has/LHasSetStylePath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.base.has; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LComponent; 19 | import software.xdev.vaadin.maps.leaflet.layer.vector.LPathOptions; 20 | 21 | 22 | public interface LHasSetStylePath> extends LComponent 23 | { 24 | default S setStyle(final LPathOptions options) 25 | { 26 | this.invokeSelf(".setStyle(" + this.componentRegistry().writeOptionsOrEmptyObject(options) + ")"); 27 | return this.self(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/controls/LControlZoom.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.controls; 17 | 18 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 19 | 20 | 21 | /** 22 | * @see Leaflet docs 23 | */ 24 | public class LControlZoom extends LControl 25 | { 26 | public LControlZoom( 27 | final LComponentManagementRegistry compReg, 28 | final LControlZoomOptions options) 29 | { 30 | super(compReg, "L.control.zoom(" + compReg.writeOptions(options) + ")"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/enhancement.yml: -------------------------------------------------------------------------------- 1 | name: ✨ Feature/Enhancement 2 | description: Suggest a new feature or enhancement 3 | labels: [enhancement] 4 | type: feature 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thank you for suggesting a new feature/enhancement. 10 | 11 | - type: checkboxes 12 | id: checklist 13 | attributes: 14 | label: "Checklist" 15 | options: 16 | - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/vaadin-maps-leaflet-flow/issues) or [closed](https://github.com/xdev-software/vaadin-maps-leaflet-flow/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to." 17 | required: true 18 | - label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise." 19 | required: true 20 | - label: "This issue contains only one feature request/enhancement." 21 | required: true 22 | 23 | - type: textarea 24 | id: description 25 | attributes: 26 | label: Description 27 | validations: 28 | required: true 29 | 30 | - type: textarea 31 | id: additional-information 32 | attributes: 33 | label: Additional information 34 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/LInteractiveLayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer; 17 | 18 | import java.io.Serializable; 19 | 20 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 21 | 22 | 23 | public abstract class LInteractiveLayer> extends LLayer 24 | { 25 | protected LInteractiveLayer( 26 | final LComponentManagementRegistry compReg, 27 | final String jsConstructorCallExpression, 28 | final Serializable... parameters) 29 | { 30 | super(compReg, jsConstructorCallExpression, parameters); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/controls/LControlScale.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.controls; 17 | 18 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 19 | 20 | 21 | /** 22 | * @see Leaflet docs 23 | */ 24 | public class LControlScale extends LControl 25 | { 26 | public LControlScale( 27 | final LComponentManagementRegistry compReg, 28 | final LControlScaleOptions options) 29 | { 30 | super(compReg, "L.control.scale(" + compReg.writeOptions(options) + ")"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/map/LMapZoomBaseOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.map; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LComponentOptions; 19 | 20 | 21 | /** 22 | * @see Leaflet docs 23 | */ 24 | public interface LMapZoomBaseOptions> extends LComponentOptions 25 | { 26 | Boolean getAnimate(); 27 | 28 | void setAnimate(final Boolean animate); 29 | 30 | default S withAnimate(final Boolean animate) 31 | { 32 | this.setAnimate(animate); 33 | return this.self(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/controls/LControlAttribution.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.controls; 17 | 18 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 19 | 20 | 21 | /** 22 | * @see Leaflet docs 23 | */ 24 | public class LControlAttribution extends LControl 25 | { 26 | public LControlAttribution( 27 | final LComponentManagementRegistry compReg, 28 | final LControlAttributionOptions options) 29 | { 30 | super(compReg, "L.control.attribution(" + compReg.writeOptions(options) + ")"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/vector/LCircleOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.vector; 17 | 18 | 19 | /** 20 | * @see Leaflet docs 21 | */ 22 | public class LCircleOptions extends LPathOptions 23 | { 24 | private Number radius; 25 | 26 | public Number getRadius() 27 | { 28 | return this.radius; 29 | } 30 | 31 | public void setRadius(final Number radius) 32 | { 33 | this.radius = radius; 34 | } 35 | 36 | public LCircleOptions withRadius(final Number radius) 37 | { 38 | this.setRadius(radius); 39 | return this.self(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/vector/LCircleMarkerOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.vector; 17 | 18 | 19 | /** 20 | * @see Leaflet docs 21 | */ 22 | public class LCircleMarkerOptions extends LPathOptions 23 | { 24 | private Number radius; 25 | 26 | public Number getRadius() 27 | { 28 | return this.radius; 29 | } 30 | 31 | public void setRadius(final Number radius) 32 | { 33 | this.radius = radius; 34 | } 35 | 36 | public LCircleMarkerOptions withRadius(final Number radius) 37 | { 38 | this.setRadius(radius); 39 | return this.self(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/vector/LAbstractCircle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.vector; 17 | 18 | import java.io.Serializable; 19 | 20 | import software.xdev.vaadin.maps.leaflet.base.has.LHasSetLatLng; 21 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 22 | 23 | 24 | public abstract class LAbstractCircle> extends LPath 25 | implements LHasSetLatLng 26 | { 27 | protected LAbstractCircle( 28 | final LComponentManagementRegistry compReg, 29 | final String jsConstructorCallExpression, 30 | final Serializable... parameters) 31 | { 32 | super(compReg, jsConstructorCallExpression, parameters); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/base/LAbstractComponent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.base; 17 | 18 | import java.util.Objects; 19 | 20 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 21 | 22 | 23 | public abstract class LAbstractComponent> implements LComponent 24 | { 25 | private final LComponentManagementRegistry componentRegistry; 26 | 27 | protected LAbstractComponent( 28 | final LComponentManagementRegistry compReg) 29 | { 30 | this.componentRegistry = Objects.requireNonNull(compReg); 31 | } 32 | 33 | @Override 34 | public LComponentManagementRegistry componentRegistry() 35 | { 36 | return this.componentRegistry; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/controls/LControlAttributionOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.controls; 17 | 18 | /** 19 | * @see Leaflet docs 20 | */ 21 | public class LControlAttributionOptions extends LControlOptions 22 | { 23 | // String|false 24 | private Object prefix; 25 | 26 | public Object getPrefix() 27 | { 28 | return this.prefix; 29 | } 30 | 31 | public void setPrefix(final Object prefix) 32 | { 33 | this.prefix = prefix; 34 | } 35 | 36 | public LControlAttributionOptions withPrefix(final Object prefix) 37 | { 38 | this.setPrefix(prefix); 39 | return this.self(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/basictypes/LLatLngBounds.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.basictypes; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LBaseComponent; 19 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 20 | 21 | 22 | /** 23 | * @see Leaflet docs 24 | */ 25 | public class LLatLngBounds extends LBaseComponent 26 | { 27 | public LLatLngBounds( 28 | final LComponentManagementRegistry compReg, 29 | final LLatLng corner1, 30 | final LLatLng corner2) 31 | { 32 | super(compReg, "L.latLngBounds(" + corner1.clientComponentJsAccessor() 33 | + "," + corner2.clientComponentJsAccessor() + ")"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/controls/LControlOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.controls; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LComponentOptions; 19 | 20 | 21 | /** 22 | * @see Leaflet docs 23 | */ 24 | public abstract class LControlOptions> implements LComponentOptions 25 | { 26 | private String position; 27 | 28 | public String getPosition() 29 | { 30 | return this.position; 31 | } 32 | 33 | public void setPosition(final String position) 34 | { 35 | this.position = position; 36 | } 37 | 38 | public S withPosition(final String position) 39 | { 40 | this.setPosition(position); 41 | return this.self(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/basictypes/LPoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.basictypes; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LBaseComponent; 19 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 20 | 21 | 22 | /** 23 | * @see Leaflet docs 24 | */ 25 | public class LPoint extends LBaseComponent 26 | { 27 | public LPoint( 28 | final LComponentManagementRegistry compReg, 29 | final int x, 30 | final int y) 31 | { 32 | super(compReg, "L.point($0, $1)", x, y); 33 | } 34 | 35 | public LPoint( 36 | final LComponentManagementRegistry compReg, 37 | final int[] arr) 38 | { 39 | super(compReg, "L.point($0, $1)", arr[0], arr[1]); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/raster/LAbstractTileLayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.raster; 17 | 18 | import java.io.Serializable; 19 | 20 | import software.xdev.vaadin.maps.leaflet.layer.LGridLayer; 21 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 22 | 23 | 24 | /** 25 | * Represents a tile layer. 26 | */ 27 | public abstract class LAbstractTileLayer> extends LGridLayer 28 | { 29 | protected LAbstractTileLayer( 30 | final LComponentManagementRegistry compReg, 31 | final String jsConstructorCallExpression, 32 | final Serializable... parameters) 33 | { 34 | super(compReg, jsConstructorCallExpression, parameters); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/base/LBaseComponent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.base; 17 | 18 | import java.io.Serializable; 19 | 20 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 21 | 22 | 23 | public abstract class LBaseComponent> extends LAbstractComponent 24 | { 25 | protected LBaseComponent( 26 | final LComponentManagementRegistry compReg, 27 | final String jsConstructorCallExpression, 28 | final Serializable... parameters) 29 | { 30 | super(compReg); 31 | this.componentRegistry().add(this.self(), jsConstructorCallExpression, parameters); 32 | } 33 | 34 | @Override 35 | public String clientComponentJsAccessor() 36 | { 37 | return this.componentRegistry().clientComponentJsAccessor(this); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/basictypes/LIcon.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.basictypes; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LBaseComponent; 19 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 20 | 21 | 22 | /** 23 | * @see Leaflet docs 24 | */ 25 | public class LIcon extends LBaseComponent 26 | { 27 | protected LIcon( 28 | final LComponentManagementRegistry compReg, 29 | final String jsCreate, 30 | final LAbstractIconOptions options) 31 | { 32 | super(compReg, jsCreate + "(" + compReg.writeOptions(options) + ")"); 33 | } 34 | 35 | public LIcon( 36 | final LComponentManagementRegistry compReg, 37 | final LIconOptions options) 38 | { 39 | this(compReg, "L.icon", options); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /plugins/maplibre-gl-leaflet/src/main/java/software/xdev/vaadin/maps/leaflet/maplibregl/layer/vector/LAbstractMaplibreGLOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.maplibregl.layer.vector; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LComponentOptions; 19 | 20 | 21 | /** 22 | * @see MapLibre docs 23 | */ 24 | public abstract class LAbstractMaplibreGLOptions> 25 | implements LComponentOptions 26 | { 27 | private String style; 28 | 29 | public String getStyle() 30 | { 31 | return this.style; 32 | } 33 | 34 | public void setStyle(final String style) 35 | { 36 | this.style = style; 37 | } 38 | 39 | public S withStyle(final String style) 40 | { 41 | this.setStyle(style); 42 | return this.self(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/basictypes/LLatLng.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.basictypes; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LBaseComponent; 19 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 20 | 21 | 22 | /** 23 | * @see Leaflet docs 24 | */ 25 | public class LLatLng extends LBaseComponent 26 | { 27 | public LLatLng(final LComponentManagementRegistry componentRegistry, final double lat, final double lng) 28 | { 29 | super(componentRegistry, "L.latLng($0, $1)", lat, lng); 30 | } 31 | 32 | public LLatLng( 33 | final LComponentManagementRegistry componentRegistry, 34 | final double lat, 35 | final double lng, 36 | final double altitude) 37 | { 38 | super(componentRegistry, "L.latLng($0, $1, $2)", lat, lng, altitude); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Maven 2 | target/ 3 | dependency-reduced-pom.xml 4 | 5 | # Maven Wrapper 6 | .mvn/wrapper/maven-wrapper.jar 7 | 8 | # Maven Flatten Plugin 9 | .flattened-pom.xml 10 | 11 | # Compiled class file 12 | *.class 13 | 14 | # Log file 15 | *.log 16 | 17 | # Package/Binary Files don't belong into a git repo 18 | *.jar 19 | *.war 20 | *.ear 21 | *.zip 22 | *.tar.gz 23 | *.dll 24 | *.exe 25 | *.bin 26 | 27 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 28 | hs_err_pid* 29 | 30 | # Eclipse 31 | .metadata 32 | .settings 33 | .classpath 34 | .project 35 | 36 | #vaadin/node webpack/frontend stuff 37 | # Ignore Node 38 | node/ 39 | 40 | # The following files are generated/updated by vaadin-maven-plugin 41 | node_modules/ 42 | 43 | # Vaadin 44 | package.json 45 | package-lock.json 46 | webpack.generated.js 47 | webpack.config.js 48 | tsconfig.json 49 | types.d.ts 50 | vite.config.ts 51 | vite.generated.ts 52 | **/src/main/frontend/generated/ 53 | **/src/main/frontend/index.html 54 | **/src/main/bundles/ 55 | *.lock 56 | 57 | 58 | # == IntelliJ == 59 | *.iml 60 | *.ipr 61 | 62 | # Some files are user/installation independent and are used for configuring the IDE 63 | # See also https://stackoverflow.com/a/35279076 64 | 65 | .idea/* 66 | !.idea/saveactions_settings.xml 67 | !.idea/checkstyle-idea.xml 68 | !.idea/externalDependencies.xml 69 | !.idea/PMDPlugin.xml 70 | 71 | !.idea/inspectionProfiles/ 72 | .idea/inspectionProfiles/* 73 | !.idea/inspectionProfiles/Project_Default.xml 74 | 75 | !.idea/codeStyles/ 76 | .idea/codeStyles/* 77 | !.idea/codeStyles/codeStyleConfig.xml 78 | !.idea/codeStyles/Project.xml 79 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/crs/LCRS.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.crs; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.RawString; 19 | 20 | 21 | /** 22 | * @apiNote CRS can't be constructed 23 | * @see Leaflet docs 24 | */ 25 | public final class LCRS 26 | { 27 | public static final class Defined 28 | { 29 | public static final RawString EARTH = new RawString("L.CRS.Earth"); 30 | 31 | public static final RawString EPSG3395 = new RawString("L.CRS.EPSG3395"); 32 | public static final RawString EPSG3857 = new RawString("L.CRS.EPSG3857"); 33 | public static final RawString EPSG4326 = new RawString("L.CRS.EPSG4326"); 34 | public static final RawString BASE = new RawString("L.CRS.Base"); 35 | public static final RawString SIMPLE = new RawString("L.CRS.Simple"); 36 | 37 | private Defined() 38 | { 39 | } 40 | } 41 | 42 | private LCRS() 43 | { 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /.github/workflows/broken-links.yml: -------------------------------------------------------------------------------- 1 | name: Broken links 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: "23 23 * * 0" 7 | 8 | permissions: 9 | issues: write 10 | 11 | jobs: 12 | link-checker: 13 | runs-on: ubuntu-latest 14 | timeout-minutes: 15 15 | steps: 16 | - uses: actions/checkout@v5 17 | 18 | - run: mv .github/.lycheeignore .lycheeignore 19 | 20 | - name: Link Checker 21 | id: lychee 22 | uses: lycheeverse/lychee-action@885c65f3dc543b57c898c8099f4e08c8afd178a2 # v2 23 | with: 24 | fail: false # Don't fail on broken links, create an issue instead 25 | 26 | - name: Find already existing issue 27 | id: find-issue 28 | run: | 29 | echo "number=$(gh issue list -l 'bug' -l 'automated' -L 1 -S 'in:title "Link Checker Report"' -s 'open' --json 'number' --jq '.[].number')" >> $GITHUB_OUTPUT 30 | env: 31 | GH_TOKEN: ${{ github.token }} 32 | 33 | - name: Close issue if everything is fine 34 | if: steps.lychee.outputs.exit_code == 0 && steps.find-issue.outputs.number != '' 35 | run: gh issue close -r 'not planned' ${{ steps.find-issue.outputs.number }} 36 | env: 37 | GH_TOKEN: ${{ github.token }} 38 | 39 | - name: Create Issue From File 40 | if: steps.lychee.outputs.exit_code != 0 41 | uses: peter-evans/create-issue-from-file@fca9117c27cdc29c6c4db3b86c48e4115a786710 # v6 42 | with: 43 | issue-number: ${{ steps.find-issue.outputs.number }} 44 | title: Link Checker Report 45 | content-filepath: ./lychee/out.md 46 | labels: bug, automated 47 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/basictypes/LDivIconOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.basictypes; 17 | 18 | /** 19 | * @see Leaflet docs 20 | */ 21 | public class LDivIconOptions extends LAbstractIconOptions 22 | { 23 | private String html; 24 | private LPoint bgPos; 25 | 26 | public String getHtml() 27 | { 28 | return this.html; 29 | } 30 | 31 | public void setHtml(final String html) 32 | { 33 | this.html = html; 34 | } 35 | 36 | public LDivIconOptions withHtml(final String html) 37 | { 38 | this.setHtml(html); 39 | return this.self(); 40 | } 41 | 42 | public LPoint getBgPos() 43 | { 44 | return this.bgPos; 45 | } 46 | 47 | public void setBgPos(final LPoint bgPos) 48 | { 49 | this.bgPos = bgPos; 50 | } 51 | 52 | public LDivIconOptions withBgPos(final LPoint bgPos) 53 | { 54 | this.setBgPos(bgPos); 55 | return this.self(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/vector/LPolylineOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.vector; 17 | 18 | public class LPolylineOptions extends LPathOptions 19 | { 20 | private Number smoothFactor; 21 | private Boolean noClip; 22 | 23 | public Number getSmoothFactor() 24 | { 25 | return this.smoothFactor; 26 | } 27 | 28 | public void setSmoothFactor(final Number smoothFactor) 29 | { 30 | this.smoothFactor = smoothFactor; 31 | } 32 | 33 | public LPolylineOptions withSmoothFactor(final Number smoothFactor) 34 | { 35 | this.setSmoothFactor(smoothFactor); 36 | return this.self(); 37 | } 38 | 39 | public Boolean getNoClip() 40 | { 41 | return this.noClip; 42 | } 43 | 44 | public void setNoClip(final Boolean noClip) 45 | { 46 | this.noClip = noClip; 47 | } 48 | 49 | public LPolylineOptions withNoClip(final Boolean noClip) 50 | { 51 | this.setNoClip(noClip); 52 | return this.self(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/other/LAbstractFeatureGroup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.other; 17 | 18 | import java.io.Serializable; 19 | 20 | import software.xdev.vaadin.maps.leaflet.base.has.LHasBringTo; 21 | import software.xdev.vaadin.maps.leaflet.base.has.LHasSetStylePath; 22 | import software.xdev.vaadin.maps.leaflet.layer.LAbstractLayerGroup; 23 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 24 | 25 | 26 | /** 27 | * @see Leaflet docs 28 | */ 29 | public class LAbstractFeatureGroup> extends LAbstractLayerGroup 30 | implements LHasBringTo, LHasSetStylePath 31 | { 32 | protected LAbstractFeatureGroup( 33 | final LComponentManagementRegistry compReg, 34 | final String jsConstructorCallExpression, 35 | final Serializable... parameters) 36 | { 37 | super(compReg, jsConstructorCallExpression, parameters); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/vector/LPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.vector; 17 | 18 | import java.io.Serializable; 19 | 20 | import software.xdev.vaadin.maps.leaflet.base.has.LHasBringTo; 21 | import software.xdev.vaadin.maps.leaflet.base.has.LHasRedraw; 22 | import software.xdev.vaadin.maps.leaflet.base.has.LHasSetStylePath; 23 | import software.xdev.vaadin.maps.leaflet.layer.LInteractiveLayer; 24 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 25 | 26 | 27 | /** 28 | * @see Leaflet docs 29 | */ 30 | public abstract class LPath> extends LInteractiveLayer 31 | implements LHasBringTo, LHasRedraw, LHasSetStylePath 32 | { 33 | protected LPath( 34 | final LComponentManagementRegistry compReg, 35 | final String jsConstructorCallExpression, 36 | final Serializable... parameters) 37 | { 38 | super(compReg, jsConstructorCallExpression, parameters); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/LGridLayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer; 17 | 18 | import java.io.Serializable; 19 | 20 | import software.xdev.vaadin.maps.leaflet.base.has.LHasBringTo; 21 | import software.xdev.vaadin.maps.leaflet.base.has.LHasOpacity; 22 | import software.xdev.vaadin.maps.leaflet.base.has.LHasRedraw; 23 | import software.xdev.vaadin.maps.leaflet.base.has.LHasSetZIndex; 24 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 25 | 26 | 27 | /** 28 | * @see Leaflet docs 29 | */ 30 | public abstract class LGridLayer> extends LLayer 31 | implements LHasBringTo, LHasOpacity, LHasRedraw, LHasSetZIndex 32 | { 33 | protected LGridLayer( 34 | final LComponentManagementRegistry compReg, 35 | final String jsConstructorCallExpression, 36 | final Serializable... parameters) 37 | { 38 | super(compReg, jsConstructorCallExpression, parameters); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/raster/LVideoOverlay.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.raster; 17 | 18 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLngBounds; 19 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 20 | 21 | 22 | /** 23 | * @see Leaflet docs 24 | */ 25 | public class LVideoOverlay extends LImageOverlay 26 | { 27 | public LVideoOverlay( 28 | final LComponentManagementRegistry compReg, 29 | final String video, 30 | final LLatLngBounds bounds, 31 | final LVideoOverlayOptions options) 32 | { 33 | super(compReg, 34 | "L.videoOverlay($0, " 35 | + bounds.clientComponentJsAccessor() 36 | + compReg.writeOptionsOptionalNextParameter(options) 37 | + ")", 38 | video); 39 | } 40 | 41 | public LVideoOverlay( 42 | final LComponentManagementRegistry compReg, 43 | final String video, 44 | final LLatLngBounds bounds) 45 | { 46 | this(compReg, video, bounds, null); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/vector/LPolygon.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.vector; 17 | 18 | import java.util.Collection; 19 | import java.util.List; 20 | 21 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng; 22 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 23 | 24 | 25 | /** 26 | * @see Leaflet docs 27 | */ 28 | @SuppressWarnings("java:S110") 29 | public class LPolygon extends LPolyline 30 | { 31 | public LPolygon( 32 | final LComponentManagementRegistry compReg, 33 | final Collection latLngs, 34 | final LPolylineOptions options) 35 | { 36 | super(compReg, "L.polygon", latLngs, options); 37 | } 38 | 39 | public LPolygon( 40 | final LComponentManagementRegistry compReg, 41 | final Collection latLngs) 42 | { 43 | this(compReg, latLngs, null); 44 | } 45 | 46 | public LPolygon( 47 | final LComponentManagementRegistry compReg, 48 | final LLatLng... latLngs) 49 | { 50 | this(compReg, List.of(latLngs), null); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/vector/LRectangle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.vector; 17 | 18 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLngBounds; 19 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 20 | 21 | 22 | /** 23 | * @see Leaflet docs 24 | */ 25 | @SuppressWarnings("java:S110") 26 | public class LRectangle extends LPolyline 27 | { 28 | public LRectangle( 29 | final LComponentManagementRegistry compReg, 30 | final LLatLngBounds bounds, 31 | final LPolylineOptions options) 32 | { 33 | super(compReg, "L.rectangle(" 34 | + bounds.clientComponentJsAccessor() 35 | + compReg.writeOptionsOptionalNextParameter(options) 36 | + ")"); 37 | } 38 | 39 | /** 40 | * @see Leaflet docs 41 | */ 42 | public LRectangle setBounds(final LLatLngBounds bounds) 43 | { 44 | this.invokeSelf(".setBounds(" + bounds.clientComponentJsAccessor() + ")"); 45 | return this; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/LLayerOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LComponentOptions; 19 | 20 | 21 | /** 22 | * @see Leaflet docs 23 | */ 24 | public abstract class LLayerOptions> implements LComponentOptions 25 | { 26 | private String pane; 27 | private String attribution; 28 | 29 | public String getPane() 30 | { 31 | return this.pane; 32 | } 33 | 34 | public void setPane(final String pane) 35 | { 36 | this.pane = pane; 37 | } 38 | 39 | public S withPane(final String pane) 40 | { 41 | this.setPane(pane); 42 | return this.self(); 43 | } 44 | 45 | public String getAttribution() 46 | { 47 | return this.attribution; 48 | } 49 | 50 | public void setAttribution(final String attribution) 51 | { 52 | this.attribution = attribution; 53 | } 54 | 55 | public S withAttribution(final String attribution) 56 | { 57 | this.setAttribution(attribution); 58 | return this.self(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/base/LComponent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.base; 17 | 18 | import java.io.Serializable; 19 | 20 | import com.vaadin.flow.component.page.PendingJavaScriptResult; 21 | 22 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 23 | 24 | 25 | public interface LComponent> 26 | { 27 | LComponentManagementRegistry componentRegistry(); 28 | 29 | String clientComponentJsAccessor(); 30 | 31 | default PendingJavaScriptResult invokeSelf(final String payload, final Serializable... params) 32 | { 33 | return this.componentRegistry().execJs(this.clientComponentJsAccessor() + payload, params); 34 | } 35 | 36 | /** 37 | * @apiNote Usage is not recommended as clientside data can be manipulated 38 | */ 39 | default PendingJavaScriptResult invokeSelfReturn(final String payload, final Serializable... params) 40 | { 41 | return this.componentRegistry().execJs("return " + this.clientComponentJsAccessor() + payload, params); 42 | } 43 | 44 | @SuppressWarnings("unchecked") 45 | default S self() 46 | { 47 | return (S)this; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/vector/LSVGOverlay.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.vector; 17 | 18 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLngBounds; 19 | import software.xdev.vaadin.maps.leaflet.layer.raster.LImageOverlay; 20 | import software.xdev.vaadin.maps.leaflet.layer.raster.LVideoOverlayOptions; 21 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 22 | 23 | 24 | /** 25 | * @see Leaflet docs 26 | */ 27 | public class LSVGOverlay extends LImageOverlay 28 | { 29 | public LSVGOverlay( 30 | final LComponentManagementRegistry compReg, 31 | final String svg, 32 | final LLatLngBounds bounds, 33 | final LVideoOverlayOptions options) 34 | { 35 | super(compReg, 36 | "L.svgOverlay($0, " 37 | + bounds.clientComponentJsAccessor() 38 | + compReg.writeOptionsOptionalNextParameter(options) 39 | + ")", 40 | svg); 41 | } 42 | 43 | public LSVGOverlay( 44 | final LComponentManagementRegistry compReg, 45 | final String video, 46 | final LLatLngBounds bounds) 47 | { 48 | this(compReg, video, bounds, null); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/LLayerGroup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer; 17 | 18 | import java.util.stream.Collectors; 19 | import java.util.stream.Stream; 20 | 21 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 22 | 23 | 24 | /** 25 | * @see Leaflet docs 26 | */ 27 | public class LLayerGroup extends LAbstractLayerGroup 28 | { 29 | public LLayerGroup( 30 | final LComponentManagementRegistry compReg, 31 | final LLayer[] layers, 32 | final LLayerOptions[] options) 33 | { 34 | super( 35 | compReg, 36 | "L.layerGroup(" 37 | + (layers != null 38 | ? "[" + Stream.of(layers) 39 | .map(LLayer::clientComponentJsAccessor) 40 | .collect(Collectors.joining(",")) + "]" 41 | : "") 42 | + (options != null 43 | ? ", [" + Stream.of(options) 44 | .map(compReg::writeOptionsOrEmptyObject) 45 | .collect(Collectors.joining(",")) + "]" 46 | : "") 47 | + ")"); 48 | } 49 | 50 | public LLayerGroup( 51 | final LComponentManagementRegistry compReg, 52 | final LLayer... layers) 53 | { 54 | this(compReg, layers, null); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/LInteractiveLayerOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer; 17 | 18 | /** 19 | * @see Leaflet docs 20 | */ 21 | public abstract class LInteractiveLayerOptions> extends LLayerOptions 22 | { 23 | private Boolean interactive; 24 | private Boolean bubblingMouseEvents; 25 | 26 | public Boolean getInteractive() 27 | { 28 | return this.interactive; 29 | } 30 | 31 | public void setInteractive(final Boolean interactive) 32 | { 33 | this.interactive = interactive; 34 | } 35 | 36 | public S withInteractive(final Boolean interactive) 37 | { 38 | this.setInteractive(interactive); 39 | return this.self(); 40 | } 41 | 42 | public Boolean getBubblingMouseEvents() 43 | { 44 | return this.bubblingMouseEvents; 45 | } 46 | 47 | public void setBubblingMouseEvents(final Boolean bubblingMouseEvents) 48 | { 49 | this.bubblingMouseEvents = bubblingMouseEvents; 50 | } 51 | 52 | public S withBubblingMouseEvents(final Boolean bubblingMouseEvents) 53 | { 54 | this.setBubblingMouseEvents(bubblingMouseEvents); 55 | return this.self(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/map/LMapPaddingBaseOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.map; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LComponentOptions; 19 | import software.xdev.vaadin.maps.leaflet.basictypes.LPoint; 20 | 21 | 22 | /** 23 | * @see Leaflet docs 24 | */ 25 | 26 | public interface LMapPaddingBaseOptions> extends LComponentOptions 27 | { 28 | LPoint getPaddingTopLeft(); 29 | 30 | void setPaddingTopLeft(final LPoint paddingTopLeft); 31 | 32 | default S withPaddingTopLeft(final LPoint paddingTopLeft) 33 | { 34 | this.setPaddingTopLeft(paddingTopLeft); 35 | return this.self(); 36 | } 37 | 38 | LPoint getPaddingBottomRight(); 39 | 40 | void setPaddingBottomRight(final LPoint paddingBottomRight); 41 | 42 | default S withPaddingBottomRight(final LPoint paddingBottomRight) 43 | { 44 | this.setPaddingBottomRight(paddingBottomRight); 45 | return this.self(); 46 | } 47 | 48 | LPoint getPadding(); 49 | 50 | void setPadding(final LPoint padding); 51 | 52 | default S withPadding(final LPoint padding) 53 | { 54 | this.setPadding(padding); 55 | return this.self(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/map/LMapPaddingOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.map; 17 | 18 | import software.xdev.vaadin.maps.leaflet.basictypes.LPoint; 19 | 20 | 21 | /** 22 | * @see Leaflet docs 23 | */ 24 | public class LMapPaddingOptions implements LMapPaddingBaseOptions 25 | { 26 | private LPoint paddingTopLeft; 27 | private LPoint paddingBottomRight; 28 | private LPoint padding; 29 | 30 | @Override 31 | public LPoint getPaddingTopLeft() 32 | { 33 | return this.paddingTopLeft; 34 | } 35 | 36 | @Override 37 | public void setPaddingTopLeft(final LPoint paddingTopLeft) 38 | { 39 | this.paddingTopLeft = paddingTopLeft; 40 | } 41 | 42 | @Override 43 | public LPoint getPaddingBottomRight() 44 | { 45 | return this.paddingBottomRight; 46 | } 47 | 48 | @Override 49 | public void setPaddingBottomRight(final LPoint paddingBottomRight) 50 | { 51 | this.paddingBottomRight = paddingBottomRight; 52 | } 53 | 54 | @Override 55 | public LPoint getPadding() 56 | { 57 | return this.padding; 58 | } 59 | 60 | @Override 61 | public void setPadding(final LPoint padding) 62 | { 63 | this.padding = padding; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/vector/LCircleMarker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.vector; 17 | 18 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng; 19 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 20 | 21 | 22 | /** 23 | * @see Leaflet docs 24 | */ 25 | @SuppressWarnings("java:S110") 26 | public class LCircleMarker extends LAbstractCircle 27 | { 28 | public LCircleMarker( 29 | final LComponentManagementRegistry compReg, 30 | final LLatLng latLng, 31 | final LCircleMarkerOptions options) 32 | { 33 | super(compReg, "L.circleMarker(" 34 | + latLng.clientComponentJsAccessor() 35 | + compReg.writeOptionsOptionalNextParameter(options) 36 | + ")"); 37 | } 38 | 39 | public LCircleMarker( 40 | final LComponentManagementRegistry compReg, 41 | final LLatLng latLng) 42 | { 43 | this(compReg, latLng, null); 44 | } 45 | 46 | /** 47 | * @see Leaflet docs 48 | */ 49 | public LCircleMarker setRadius(final Number radius) 50 | { 51 | this.invokeSelf(".setRadius($0)", radius); 52 | return this.self(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/vector/LCircle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.vector; 17 | 18 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng; 19 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 20 | 21 | 22 | /** 23 | * @see Leaflet docs 24 | */ 25 | @SuppressWarnings("java:S110") 26 | public class LCircle extends LAbstractCircle 27 | { 28 | public LCircle( 29 | final LComponentManagementRegistry compReg, 30 | final LLatLng latLng, 31 | final LCircleOptions options) 32 | { 33 | super(compReg, "L.circle(" 34 | + latLng.clientComponentJsAccessor() 35 | + compReg.writeOptionsOptionalNextParameter(options) 36 | + ")"); 37 | } 38 | 39 | public LCircle( 40 | final LComponentManagementRegistry compReg, 41 | final LLatLng latLng, 42 | final double radius) 43 | { 44 | this(compReg, latLng, new LCircleOptions().withRadius(radius)); 45 | } 46 | 47 | /** 48 | * @see Leaflet docs 49 | */ 50 | public LCircle setRadius(final Number radius) 51 | { 52 | this.invokeSelf(".setRadius($0)", radius); 53 | return this.self(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /flow-demo/src/main/resources/META-INF/resources/assets/XDEV_LOGO.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/raster/LTileLayerWMS.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.raster; 17 | 18 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 19 | 20 | 21 | /** 22 | * Represents a WMS tile layer. 23 | */ 24 | public class LTileLayerWMS extends LAbstractTileLayer 25 | { 26 | public LTileLayerWMS( 27 | final LComponentManagementRegistry compReg, 28 | final String baseUrl, 29 | final LTileLayerWMSOptions options) 30 | { 31 | super(compReg, "L.tileLayer.wms($0" + compReg.writeOptionsOptionalNextParameter(options) + ")", baseUrl); 32 | } 33 | 34 | public LTileLayerWMS( 35 | final LComponentManagementRegistry compReg, 36 | final String baseUrl, 37 | final String layers) 38 | { 39 | this(compReg, baseUrl, new LTileLayerWMSOptions().withLayers(layers)); 40 | } 41 | 42 | public LTileLayerWMS( 43 | final LComponentManagementRegistry compReg, 44 | final String baseUrl, 45 | final String layers, 46 | final int maxZoom, 47 | final String attribution) 48 | { 49 | this(compReg, baseUrl, new LTileLayerWMSOptions() 50 | .withLayers(layers) 51 | .withMaxZoom(maxZoom) 52 | .withAttribution(attribution)); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/map/LMapPanBaseOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.map; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LComponentOptions; 19 | 20 | 21 | /** 22 | * @see Leaflet docs 23 | */ 24 | @SuppressWarnings("unused") 25 | public interface LMapPanBaseOptions> extends LComponentOptions 26 | { 27 | Boolean getAnimate(); 28 | 29 | void setAnimate(final Boolean animate); 30 | 31 | default S withAnimate(final Boolean animate) 32 | { 33 | this.setAnimate(animate); 34 | return this.self(); 35 | } 36 | 37 | Number getDuration(); 38 | 39 | void setDuration(final Number duration); 40 | 41 | default S withDuration(final Number duration) 42 | { 43 | this.setDuration(duration); 44 | return this.self(); 45 | } 46 | 47 | Number getEaseLinearity(); 48 | 49 | void setEaseLinearity(final Number easeLinearity); 50 | 51 | default S withEaseLinearity(final Number easeLinearity) 52 | { 53 | this.setEaseLinearity(easeLinearity); 54 | return this.self(); 55 | } 56 | 57 | Boolean getNoMoveStart(); 58 | 59 | void setNoMoveStart(final Boolean noMoveStart); 60 | 61 | default S withNoMoveStart(final Boolean noMoveStart) 62 | { 63 | this.setNoMoveStart(noMoveStart); 64 | return this.self(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /plugins/geoman/src/main/java/software/xdev/vaadin/maps/leaflet/geoman/LPM.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.geoman; 17 | 18 | import com.vaadin.flow.component.dependency.CssImport; 19 | import com.vaadin.flow.component.dependency.JsModule; 20 | import com.vaadin.flow.component.dependency.NpmPackage; 21 | 22 | import software.xdev.vaadin.maps.leaflet.base.LAbstractComponent; 23 | import software.xdev.vaadin.maps.leaflet.layer.LLayer; 24 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 25 | 26 | 27 | /** 28 | * @see Docs 29 | */ 30 | @NpmPackage(value = "@geoman-io/leaflet-geoman-free", version = "2.18.3") 31 | @JsModule("@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.js") 32 | @CssImport("@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css") 33 | public class LPM extends LAbstractComponent 34 | { 35 | public LPM(final LComponentManagementRegistry compReg) 36 | { 37 | super(compReg); 38 | } 39 | 40 | public LPM setOptIn(final boolean optIn) 41 | { 42 | this.invokeSelf(".setOptIn(" + optIn + ")"); 43 | return this; 44 | } 45 | 46 | public LPM reInitLayer(final LLayer layer) 47 | { 48 | this.invokeSelf(".reInitLayer(" + layer.clientComponentJsAccessor() + ")"); 49 | return this; 50 | } 51 | 52 | @Override 53 | public String clientComponentJsAccessor() 54 | { 55 | return "L.PM"; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /plugins/maplibre-gl-leaflet/src/main/java/software/xdev/vaadin/maps/leaflet/maplibregl/layer/vector/LMaplibreGL.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.maplibregl.layer.vector; 17 | 18 | import com.vaadin.flow.component.dependency.CssImport; 19 | import com.vaadin.flow.component.dependency.JsModule; 20 | import com.vaadin.flow.component.dependency.NpmPackage; 21 | 22 | import software.xdev.vaadin.maps.leaflet.layer.LLayer; 23 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 24 | 25 | 26 | /** 27 | * Layer for MaplibreGL 28 | * 29 | * @see MapLibre-GL-Leaflet API docs 30 | */ 31 | @NpmPackage(value = "maplibre-gl", version = "5.6.1") 32 | @JsModule("maplibre-gl/dist/maplibre-gl.js") 33 | @CssImport("maplibre-gl/dist/maplibre-gl.css") 34 | @JsModule("./src/leaflet-maplibre-gl.js") // Use bundled forked version to load it correctly 35 | public class LMaplibreGL extends LLayer 36 | { 37 | public LMaplibreGL( 38 | final LComponentManagementRegistry compReg, 39 | final LAbstractMaplibreGLOptions options) 40 | { 41 | super(compReg, "L.maplibreGL(" + compReg.writeOptionsOrEmptyObject(options) + ")"); 42 | } 43 | 44 | public LMaplibreGL( 45 | final LComponentManagementRegistry compReg, 46 | final String style) 47 | { 48 | this(compReg, new LMaplibreGLOptions().withStyle(style)); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/InitialResizeDemo.java: -------------------------------------------------------------------------------- 1 | package software.xdev.vaadin.maps.leaflet.flow.demo; 2 | 3 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 4 | import com.vaadin.flow.router.Route; 5 | 6 | import software.xdev.vaadin.maps.leaflet.MapContainer; 7 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng; 8 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLngBounds; 9 | import software.xdev.vaadin.maps.leaflet.layer.raster.LTileLayer; 10 | import software.xdev.vaadin.maps.leaflet.layer.vector.LPolylineOptions; 11 | import software.xdev.vaadin.maps.leaflet.layer.vector.LRectangle; 12 | import software.xdev.vaadin.maps.leaflet.map.LMap; 13 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 14 | import software.xdev.vaadin.maps.leaflet.registry.LDefaultComponentManagementRegistry; 15 | 16 | 17 | @Route(InitialResizeDemo.NAV) 18 | public class InitialResizeDemo extends VerticalLayout 19 | { 20 | public static final String NAV = "/initial-resize"; 21 | 22 | public InitialResizeDemo() 23 | { 24 | this.setSizeFull(); 25 | 26 | final LComponentManagementRegistry reg = new LDefaultComponentManagementRegistry(this); 27 | 28 | // We want to show this area initially 29 | final LLatLngBounds bounds = new LLatLngBounds( 30 | reg, 31 | new LLatLng(reg, 49, 12), 32 | new LLatLng(reg, 50, 11) 33 | ); 34 | 35 | final MapContainer mapContainer = new MapContainer( 36 | reg, map -> 37 | // This needs to be done after the map was initially resized 38 | // otherwise the view is calculated incorrectly 39 | map.fitBounds(bounds) 40 | ); 41 | mapContainer.setSizeFull(); 42 | this.add(mapContainer); 43 | 44 | final LMap map = mapContainer.getlMap(); 45 | map.addLayer(LTileLayer.createDefaultForOpenStreetMapTileServer(reg)); 46 | 47 | // Still required as the map refuses to work otherwise 48 | map.setView(new LLatLng(reg, 0, 0), 1); 49 | 50 | // Create rectangle for reference 51 | new LRectangle(reg, bounds, new LPolylineOptions()) 52 | .addTo(map); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/other/LFeatureGroup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.other; 17 | 18 | import java.util.stream.Collectors; 19 | import java.util.stream.Stream; 20 | 21 | import software.xdev.vaadin.maps.leaflet.layer.LAbstractLayerGroup; 22 | import software.xdev.vaadin.maps.leaflet.layer.LLayer; 23 | import software.xdev.vaadin.maps.leaflet.layer.LLayerOptions; 24 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 25 | 26 | 27 | /** 28 | * @see Leaflet docs 29 | */ 30 | public class LFeatureGroup extends LAbstractLayerGroup 31 | { 32 | public LFeatureGroup( 33 | final LComponentManagementRegistry compReg, 34 | final LLayer[] layers, 35 | final LLayerOptions[] options) 36 | { 37 | super( 38 | compReg, 39 | "L.featureGroup(" 40 | + (layers != null 41 | ? "[" + Stream.of(layers) 42 | .map(LLayer::clientComponentJsAccessor) 43 | .collect(Collectors.joining(",")) + "]" 44 | : "") 45 | + (options != null 46 | ? ", [" + Stream.of(options) 47 | .map(compReg::writeOptionsOrEmptyObject) 48 | .collect(Collectors.joining(",")) + "]" 49 | : "") 50 | + ")"); 51 | } 52 | 53 | public LFeatureGroup( 54 | final LComponentManagementRegistry compReg, 55 | final LLayer... layers) 56 | { 57 | this(compReg, layers, null); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/ui/LPopup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.ui; 17 | 18 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng; 19 | import software.xdev.vaadin.maps.leaflet.layer.LLayer; 20 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 21 | 22 | 23 | public class LPopup extends LDivOverlay 24 | { 25 | public LPopup( 26 | final LComponentManagementRegistry compReg, 27 | final LPopupOptions options, 28 | final LLayer source) 29 | { 30 | super(compReg, "L.popup(" 31 | + compReg.writeOptions(options) 32 | + (source != null ? ", " + source.clientComponentJsAccessor() : "") 33 | + ")"); 34 | } 35 | 36 | public LPopup( 37 | final LComponentManagementRegistry compReg, 38 | final LPopupOptions options) 39 | { 40 | this(compReg, options, null); 41 | } 42 | 43 | public LPopup(final LComponentManagementRegistry compReg) 44 | { 45 | super(compReg, "L.popup()"); 46 | } 47 | 48 | public LPopup( 49 | final LComponentManagementRegistry compReg, 50 | final LLatLng latLng, 51 | final LPopupOptions options) 52 | { 53 | super(compReg, "L.popup(" 54 | + latLng.clientComponentJsAccessor() 55 | + compReg.writeOptionsOptionalNextParameter(options) 56 | + ")"); 57 | } 58 | 59 | public LPopup( 60 | final LComponentManagementRegistry compReg, 61 | final LLatLng latLng) 62 | { 63 | this(compReg, latLng, null); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/map/AbstractLMapPanOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.map; 17 | 18 | public class AbstractLMapPanOptions> 19 | implements LMapPanBaseOptions 20 | { 21 | private Boolean animate; 22 | private Number duration; 23 | private Number easeLinearity; 24 | private Boolean noMoveStart; 25 | 26 | @Override 27 | public Boolean getAnimate() 28 | { 29 | return this.animate; 30 | } 31 | 32 | @Override 33 | public void setAnimate(final Boolean animate) 34 | { 35 | this.animate = animate; 36 | } 37 | 38 | @Override 39 | public T withAnimate(final Boolean animate) 40 | { 41 | return LMapPanBaseOptions.super.withAnimate(animate); 42 | } 43 | 44 | @Override 45 | public Number getDuration() 46 | { 47 | return this.duration; 48 | } 49 | 50 | @Override 51 | public void setDuration(final Number duration) 52 | { 53 | this.duration = duration; 54 | } 55 | 56 | @Override 57 | public Number getEaseLinearity() 58 | { 59 | return this.easeLinearity; 60 | } 61 | 62 | @Override 63 | public void setEaseLinearity(final Number easeLinearity) 64 | { 65 | this.easeLinearity = easeLinearity; 66 | } 67 | 68 | @Override 69 | public Boolean getNoMoveStart() 70 | { 71 | return this.noMoveStart; 72 | } 73 | 74 | @Override 75 | public void setNoMoveStart(final Boolean noMoveStart) 76 | { 77 | this.noMoveStart = noMoveStart; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/plugins/MaplibreGLDemo.java: -------------------------------------------------------------------------------- 1 | package software.xdev.vaadin.maps.leaflet.flow.demo.plugins; 2 | 3 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 4 | import com.vaadin.flow.router.Route; 5 | 6 | import software.xdev.vaadin.maps.leaflet.MapContainer; 7 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng; 8 | import software.xdev.vaadin.maps.leaflet.layer.ui.LMarker; 9 | import software.xdev.vaadin.maps.leaflet.map.LMap; 10 | import software.xdev.vaadin.maps.leaflet.maplibregl.layer.vector.LMaplibreGL; 11 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 12 | import software.xdev.vaadin.maps.leaflet.registry.LDefaultComponentManagementRegistry; 13 | 14 | 15 | @Route(MaplibreGLDemo.NAV) 16 | @SuppressWarnings("checkstyle:MagicNumber") 17 | public class MaplibreGLDemo extends VerticalLayout 18 | { 19 | public static final String NAV = "/maplibre-gl"; 20 | 21 | public MaplibreGLDemo() 22 | { 23 | // Let the view use 100% of the site 24 | this.setSizeFull(); 25 | 26 | // Create the registry which is needed so that components can be reused and their methods invoked 27 | // Note: You normally don't need to invoke any methods of the registry and just hand it over to the components 28 | final LComponentManagementRegistry reg = new LDefaultComponentManagementRegistry(this); 29 | 30 | // Create and add the MapContainer (which contains the map) to the UI 31 | final MapContainer mapContainer = new MapContainer(reg); 32 | mapContainer.setSizeFull(); 33 | this.add(mapContainer); 34 | 35 | final LMap map = mapContainer.getlMap(); 36 | 37 | // Add maplibre layer 38 | new LMaplibreGL(reg, "https://demotiles.maplibre.org/style.json").addTo(map); 39 | 40 | // Set what part of the world should be shown 41 | map.setView(new LLatLng(reg, 49.6751, 12.1607), 5); 42 | 43 | // Create a new marker 44 | new LMarker(reg, new LLatLng(reg, 49.6756, 12.1610)) 45 | // Bind a popup which is displayed when clicking the marker 46 | .bindPopup("XDEV Software") 47 | // Add it to the map 48 | .addTo(map); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/ui/LTooltip.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.ui; 17 | 18 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng; 19 | import software.xdev.vaadin.maps.leaflet.layer.LLayer; 20 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 21 | 22 | 23 | public class LTooltip extends LDivOverlay 24 | { 25 | public LTooltip( 26 | final LComponentManagementRegistry compReg, 27 | final LTooltipOptions options, 28 | final LLayer source) 29 | { 30 | super(compReg, "L.tooltip(" 31 | + compReg.writeOptions(options) 32 | + (source != null ? ", " + source.clientComponentJsAccessor() : "") 33 | + ")"); 34 | } 35 | 36 | public LTooltip( 37 | final LComponentManagementRegistry compReg, 38 | final LTooltipOptions options) 39 | { 40 | this(compReg, options, null); 41 | } 42 | 43 | public LTooltip(final LComponentManagementRegistry compReg) 44 | { 45 | super(compReg, "L.tooltip()"); 46 | } 47 | 48 | public LTooltip( 49 | final LComponentManagementRegistry compReg, 50 | final LLatLng latLng, 51 | final LTooltipOptions options) 52 | { 53 | super(compReg, "L.tooltip(" 54 | + latLng.clientComponentJsAccessor() 55 | + compReg.writeOptionsOptionalNextParameter(options) 56 | + ")"); 57 | } 58 | 59 | public LTooltip( 60 | final LComponentManagementRegistry compReg, 61 | final LLatLng latLng) 62 | { 63 | this(compReg, latLng, null); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/MinimalisticDemo.java: -------------------------------------------------------------------------------- 1 | package software.xdev.vaadin.maps.leaflet.flow.demo; 2 | 3 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 4 | import com.vaadin.flow.router.Route; 5 | 6 | import software.xdev.vaadin.maps.leaflet.MapContainer; 7 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng; 8 | import software.xdev.vaadin.maps.leaflet.layer.raster.LTileLayer; 9 | import software.xdev.vaadin.maps.leaflet.layer.ui.LMarker; 10 | import software.xdev.vaadin.maps.leaflet.map.LMap; 11 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 12 | import software.xdev.vaadin.maps.leaflet.registry.LDefaultComponentManagementRegistry; 13 | 14 | 15 | @Route(MinimalisticDemo.NAV) 16 | @SuppressWarnings("checkstyle:MagicNumber") 17 | public class MinimalisticDemo extends VerticalLayout 18 | { 19 | public static final String NAV = "/minimalistic"; 20 | 21 | public MinimalisticDemo() 22 | { 23 | // Let the view use 100% of the site 24 | this.setSizeFull(); 25 | 26 | // Create the registry which is needed so that components can be reused and their methods invoked 27 | // Note: You normally don't need to invoke any methods of the registry and just hand it over to the components 28 | final LComponentManagementRegistry reg = new LDefaultComponentManagementRegistry(this); 29 | 30 | // Create and add the MapContainer (which contains the map) to the UI 31 | final MapContainer mapContainer = new MapContainer(reg); 32 | mapContainer.setSizeFull(); 33 | this.add(mapContainer); 34 | 35 | final LMap map = mapContainer.getlMap(); 36 | 37 | // Add a (default) TileLayer so that we can see something on the map 38 | map.addLayer(LTileLayer.createDefaultForOpenStreetMapTileServer(reg)); 39 | 40 | // Set what part of the world should be shown 41 | map.setView(new LLatLng(reg, 49.6751, 12.1607), 17); 42 | 43 | // Create a new marker 44 | new LMarker(reg, new LLatLng(reg, 49.6756, 12.1610)) 45 | // Bind a popup which is displayed when clicking the marker 46 | .bindPopup("XDEV Software") 47 | // Add it to the map 48 | .addTo(map); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/ui/LDivOverlayOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.ui; 17 | 18 | import software.xdev.vaadin.maps.leaflet.basictypes.LPoint; 19 | import software.xdev.vaadin.maps.leaflet.layer.LInteractiveLayerOptions; 20 | 21 | /** 22 | * @see Leaflet docs 23 | */ 24 | public abstract class LDivOverlayOptions> extends LInteractiveLayerOptions 25 | { 26 | private LPoint offset; 27 | private String className; 28 | private Object content; 29 | 30 | public LPoint getOffset() 31 | { 32 | return this.offset; 33 | } 34 | 35 | public void setOffset(final LPoint offset) 36 | { 37 | this.offset = offset; 38 | } 39 | 40 | public S withOffset(final LPoint offset) 41 | { 42 | this.setOffset(offset); 43 | return this.self(); 44 | } 45 | 46 | public String getClassName() 47 | { 48 | return this.className; 49 | } 50 | 51 | public void setClassName(final String className) 52 | { 53 | this.className = className; 54 | } 55 | 56 | public S withClassName(final String className) 57 | { 58 | this.setClassName(className); 59 | return this.self(); 60 | } 61 | 62 | public Object getContent() 63 | { 64 | return this.content; 65 | } 66 | 67 | public void setContent(final Object content) 68 | { 69 | this.content = content; 70 | } 71 | 72 | public S withContent(final Object content) 73 | { 74 | this.setContent(content); 75 | return this.self(); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/LAbstractLayerGroup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer; 17 | 18 | import java.io.Serializable; 19 | 20 | import software.xdev.vaadin.maps.leaflet.base.has.LHasSetZIndex; 21 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 22 | 23 | 24 | /** 25 | * @see Leaflet docs 26 | */ 27 | public class LAbstractLayerGroup> extends LLayer 28 | implements LHasSetZIndex 29 | { 30 | protected LAbstractLayerGroup( 31 | final LComponentManagementRegistry compReg, 32 | final String jsConstructorCallExpression, 33 | final Serializable... parameters) 34 | { 35 | super(compReg, jsConstructorCallExpression, parameters); 36 | } 37 | 38 | /** 39 | * @see Leaflet docs 40 | */ 41 | public S addLayer(final LLayer layer) 42 | { 43 | this.invokeSelf(".addLayer(" + layer.clientComponentJsAccessor() + ")"); 44 | return this.self(); 45 | } 46 | 47 | /** 48 | * @see Leaflet docs 49 | */ 50 | public S removeLayer(final LLayer layer) 51 | { 52 | this.invokeSelf(".removeLayer(" + layer.clientComponentJsAccessor() + ")"); 53 | return this.self(); 54 | } 55 | 56 | /** 57 | * @see Leaflet docs 58 | */ 59 | public S clearLayers() 60 | { 61 | this.invokeSelf(".clearLayers()"); 62 | return this.self(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/ui/LTooltipOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.ui; 17 | 18 | public class LTooltipOptions extends LDivOverlayOptions 19 | { 20 | private String direction; 21 | private Boolean permanent; 22 | private Boolean sticky; 23 | private Number opacity; 24 | 25 | public String getDirection() 26 | { 27 | return this.direction; 28 | } 29 | 30 | public void setDirection(final String direction) 31 | { 32 | this.direction = direction; 33 | } 34 | 35 | public LTooltipOptions withDirection(final String direction) 36 | { 37 | this.setDirection(direction); 38 | return this.self(); 39 | } 40 | 41 | public Boolean getPermanent() 42 | { 43 | return this.permanent; 44 | } 45 | 46 | public void setPermanent(final Boolean permanent) 47 | { 48 | this.permanent = permanent; 49 | } 50 | 51 | public LTooltipOptions withPermanent(final Boolean permanent) 52 | { 53 | this.setPermanent(permanent); 54 | return this.self(); 55 | } 56 | 57 | public Boolean getSticky() 58 | { 59 | return this.sticky; 60 | } 61 | 62 | public void setSticky(final Boolean sticky) 63 | { 64 | this.sticky = sticky; 65 | } 66 | 67 | public LTooltipOptions withSticky(final Boolean sticky) 68 | { 69 | this.setSticky(sticky); 70 | return this.self(); 71 | } 72 | 73 | public Number getOpacity() 74 | { 75 | return this.opacity; 76 | } 77 | 78 | public void setOpacity(final Number opacity) 79 | { 80 | this.opacity = opacity; 81 | } 82 | 83 | public LTooltipOptions withOpacity(final Number opacity) 84 | { 85 | this.setOpacity(opacity); 86 | return this.self(); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/map/LMapFitBoundOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.map; 17 | 18 | import software.xdev.vaadin.maps.leaflet.basictypes.LPoint; 19 | 20 | 21 | /** 22 | * @see Leaflet docs 23 | */ 24 | @SuppressWarnings("unused") 25 | public class LMapFitBoundOptions extends AbstractLMapZoomPanOptions 26 | implements LMapPaddingBaseOptions 27 | { 28 | private LPoint paddingTopLeft; 29 | private LPoint paddingBottomRight; 30 | private LPoint padding; 31 | 32 | private Number maxZoom; 33 | 34 | @Override 35 | public LPoint getPaddingTopLeft() 36 | { 37 | return this.paddingTopLeft; 38 | } 39 | 40 | @Override 41 | public void setPaddingTopLeft(final LPoint paddingTopLeft) 42 | { 43 | this.paddingTopLeft = paddingTopLeft; 44 | } 45 | 46 | @Override 47 | public LPoint getPaddingBottomRight() 48 | { 49 | return this.paddingBottomRight; 50 | } 51 | 52 | @Override 53 | public void setPaddingBottomRight(final LPoint paddingBottomRight) 54 | { 55 | this.paddingBottomRight = paddingBottomRight; 56 | } 57 | 58 | @Override 59 | public LPoint getPadding() 60 | { 61 | return this.padding; 62 | } 63 | 64 | @Override 65 | public void setPadding(final LPoint padding) 66 | { 67 | this.padding = padding; 68 | } 69 | 70 | public Number getMaxZoom() 71 | { 72 | return this.maxZoom; 73 | } 74 | 75 | public void setMaxZoom(final Number maxZoom) 76 | { 77 | this.maxZoom = maxZoom; 78 | } 79 | 80 | public LMapFitBoundOptions withMaxZoom(final Number maxZoom) 81 | { 82 | this.setMaxZoom(maxZoom); 83 | return this.self(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/ui/LMarker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.ui; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.has.LHasOpacity; 19 | import software.xdev.vaadin.maps.leaflet.base.has.LHasSetLatLng; 20 | import software.xdev.vaadin.maps.leaflet.basictypes.LIcon; 21 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng; 22 | import software.xdev.vaadin.maps.leaflet.layer.LInteractiveLayer; 23 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 24 | 25 | 26 | /** 27 | * @see Leaflet docs 28 | */ 29 | public class LMarker extends LInteractiveLayer 30 | implements LHasSetLatLng, LHasOpacity 31 | { 32 | public LMarker( 33 | final LComponentManagementRegistry componentRegistry, 34 | final LLatLng latLng) 35 | { 36 | this(componentRegistry, latLng, null); 37 | } 38 | 39 | public LMarker( 40 | final LComponentManagementRegistry compReg, 41 | final LLatLng latLng, 42 | final LMarkerOptions options) 43 | { 44 | super( 45 | compReg, 46 | "L.marker(" 47 | + compReg.clientComponentJsAccessor(latLng) 48 | + compReg.writeOptionsOptionalNextParameter(options) 49 | + ")"); 50 | } 51 | 52 | /** 53 | * @see Leaflet docs 54 | */ 55 | public LMarker setZIndexOffset(final Number offset) 56 | { 57 | this.invokeSelf(".setZIndexOffset($0)", offset); 58 | return this.self(); 59 | } 60 | 61 | /** 62 | * @see Leaflet docs 63 | */ 64 | public LMarker setIcon(final LIcon icon) 65 | { 66 | this.invokeSelf(".setIcon(" + icon.clientComponentJsAccessor() + ")"); 67 | return this.self(); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/controls/LControl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.controls; 17 | 18 | import java.io.Serializable; 19 | 20 | import software.xdev.vaadin.maps.leaflet.base.LBaseComponent; 21 | import software.xdev.vaadin.maps.leaflet.map.LMap; 22 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 23 | 24 | 25 | /** 26 | * @see Leaflet docs 27 | */ 28 | public abstract class LControl> extends LBaseComponent 29 | { 30 | protected LControl( 31 | final LComponentManagementRegistry compReg, 32 | final String jsConstructorCallExpression, 33 | final Serializable... parameters) 34 | { 35 | super(compReg, jsConstructorCallExpression, parameters); 36 | } 37 | 38 | /** 39 | * @see Leaflet docs 40 | */ 41 | public S setPosition(final String position) 42 | { 43 | this.invokeSelf(".setPosition($0)", position); 44 | return this.self(); 45 | } 46 | 47 | /** 48 | * @see Leaflet docs 49 | */ 50 | public S addTo(final LMap map) 51 | { 52 | this.invokeSelf(".addTo(" + map.clientComponentJsAccessor() + ")"); 53 | return this.self(); 54 | } 55 | 56 | /** 57 | * The possible values of position 58 | * 59 | * @see Leaflet docs 60 | */ 61 | public static final class Positions 62 | { 63 | public static final String TOP_LEFT = "topleft"; 64 | public static final String TOP_RIGHT = "topright"; 65 | public static final String BOTTOM_LEFT = "bottomleft"; 66 | public static final String BOTTOM_RIGHT = "bottomright"; 67 | 68 | private Positions() 69 | { 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: 🐞 Bug 2 | description: Create a bug report for something that is broken 3 | labels: [bug] 4 | type: bug 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thank you for reporting a bug. 10 | 11 | Please fill in as much information as possible about your bug so that we don't have to play "information ping-pong" and can help you immediately. 12 | 13 | - type: checkboxes 14 | id: checklist 15 | attributes: 16 | label: "Checklist" 17 | options: 18 | - label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/vaadin-maps-leaflet-flow/releases/latest)" 19 | required: true 20 | - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/vaadin-maps-leaflet-flow/issues) or [closed](https://github.com/xdev-software/vaadin-maps-leaflet-flow/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to." 21 | required: true 22 | - label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise." 23 | required: true 24 | - label: "This issue contains only one bug." 25 | required: true 26 | 27 | - type: input 28 | id: app-version 29 | attributes: 30 | label: Affected version 31 | description: "In which version did you encounter the bug?" 32 | placeholder: "x.x.x" 33 | validations: 34 | required: true 35 | 36 | - type: textarea 37 | id: description 38 | attributes: 39 | label: Description of the problem 40 | description: | 41 | Describe as exactly as possible what is not working. 42 | validations: 43 | required: true 44 | 45 | - type: textarea 46 | id: steps-to-reproduce 47 | attributes: 48 | label: Steps to reproduce the bug 49 | description: | 50 | What did you do for the bug to show up? 51 | 52 | If you can't cause the bug to show up again reliably (and hence don't have a proper set of steps to give us), please still try to give as many details as possible on how you think you encountered the bug. 53 | placeholder: | 54 | 1. Use '...' 55 | 2. Do '...' 56 | validations: 57 | required: true 58 | 59 | - type: textarea 60 | id: additional-information 61 | attributes: 62 | label: Additional information 63 | description: | 64 | Any other relevant information you'd like to include 65 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/controls/LControlScaleOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.controls; 17 | 18 | /** 19 | * @see Leaflet docs 20 | */ 21 | public class LControlScaleOptions extends LControlOptions 22 | { 23 | private Number maxWidth; 24 | private Boolean metric; 25 | private Boolean imperial; 26 | private Boolean updateWhenIdle; 27 | 28 | public Number getMaxWidth() 29 | { 30 | return this.maxWidth; 31 | } 32 | 33 | public void setMaxWidth(final Number maxWidth) 34 | { 35 | this.maxWidth = maxWidth; 36 | } 37 | 38 | public LControlScaleOptions withMaxWidth(final Number maxWidth) 39 | { 40 | this.setMaxWidth(maxWidth); 41 | return this.self(); 42 | } 43 | 44 | public Boolean getMetric() 45 | { 46 | return this.metric; 47 | } 48 | 49 | public void setMetric(final Boolean metric) 50 | { 51 | this.metric = metric; 52 | } 53 | 54 | public LControlScaleOptions withMetric(final Boolean metric) 55 | { 56 | this.setMetric(metric); 57 | return this.self(); 58 | } 59 | 60 | public Boolean getImperial() 61 | { 62 | return this.imperial; 63 | } 64 | 65 | public void setImperial(final Boolean imperial) 66 | { 67 | this.imperial = imperial; 68 | } 69 | 70 | public LControlScaleOptions withImperial(final Boolean imperial) 71 | { 72 | this.setImperial(imperial); 73 | return this.self(); 74 | } 75 | 76 | public Boolean getUpdateWhenIdle() 77 | { 78 | return this.updateWhenIdle; 79 | } 80 | 81 | public void setUpdateWhenIdle(final Boolean updateWhenIdle) 82 | { 83 | this.updateWhenIdle = updateWhenIdle; 84 | } 85 | 86 | public LControlScaleOptions withUpdateWhenIdle(final Boolean updateWhenIdle) 87 | { 88 | this.setUpdateWhenIdle(updateWhenIdle); 89 | return this.self(); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /.github/workflows/test-deploy.yml: -------------------------------------------------------------------------------- 1 | name: Test Deployment 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | env: 7 | PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }} 8 | 9 | jobs: 10 | publish-maven: 11 | runs-on: ubuntu-latest 12 | timeout-minutes: 60 13 | steps: 14 | - uses: actions/checkout@v5 15 | 16 | - name: Set up JDK 17 | uses: actions/setup-java@v5 18 | with: # running setup-java overwrites the settings.xml 19 | distribution: 'temurin' 20 | java-version: '17' 21 | server-id: github-central 22 | server-password: PACKAGES_CENTRAL_TOKEN 23 | gpg-passphrase: MAVEN_GPG_PASSPHRASE 24 | gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once 25 | 26 | - name: Publish to GitHub Packages 27 | run: | 28 | modules_block=$(grep -ozP '(\r|\n|.)*<\/modules>' 'pom.xml' | tr -d '\0') 29 | modules=($(echo $modules_block | grep -oP '(?<=)[^<]+' | grep -v demo)) 30 | printf -v modules_joined '%s,' "${modules[@]}" 31 | modules_arg=$(echo "${modules_joined%,}") 32 | ./mvnw -B deploy -pl "$modules_arg" -am -T2C -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central 33 | env: 34 | PACKAGES_CENTRAL_TOKEN: ${{ secrets.PACKAGES_CENTRAL_TOKEN }} 35 | MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} 36 | 37 | - name: Set up JDK 38 | uses: actions/setup-java@v5 39 | with: # running setup-java again overwrites the settings.xml 40 | distribution: 'temurin' 41 | java-version: '17' 42 | server-id: sonatype-central-portal 43 | server-username: MAVEN_CENTRAL_USERNAME 44 | server-password: MAVEN_CENTRAL_TOKEN 45 | gpg-passphrase: MAVEN_GPG_PASSPHRASE 46 | 47 | - name: Publish to Central Portal 48 | run: | 49 | modules_block=$(grep -ozP '(\r|\n|.)*<\/modules>' 'pom.xml' | tr -d '\0') 50 | modules=($(echo $modules_block | grep -oP '(?<=)[^<]+' | grep -v demo)) 51 | printf -v modules_joined '%s,' "${modules[@]}" 52 | modules_arg=$(echo "${modules_joined%,}") 53 | ./mvnw -B deploy -pl "$modules_arg" -am -T2C -P publish,publish-sonatype-central-portal -DskipTests 54 | env: 55 | MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }} 56 | MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN }} 57 | MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} 58 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/controls/LControlZoomOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.controls; 17 | 18 | 19 | /** 20 | * @see Leaflet docs 21 | */ 22 | public class LControlZoomOptions extends LControlOptions 23 | { 24 | private String zoomInText; 25 | private String zoomInTitle; 26 | private String zoomOutText; 27 | private String zoomOutTitle; 28 | 29 | public String getZoomInText() 30 | { 31 | return this.zoomInText; 32 | } 33 | 34 | public void setZoomInText(final String zoomInText) 35 | { 36 | this.zoomInText = zoomInText; 37 | } 38 | 39 | public LControlZoomOptions withZoomInText(final String zoomInText) 40 | { 41 | this.setZoomInText(zoomInText); 42 | return this.self(); 43 | } 44 | 45 | public String getZoomInTitle() 46 | { 47 | return this.zoomInTitle; 48 | } 49 | 50 | public void setZoomInTitle(final String zoomInTitle) 51 | { 52 | this.zoomInTitle = zoomInTitle; 53 | } 54 | 55 | public LControlZoomOptions withZoomInTitle(final String zoomInTitle) 56 | { 57 | this.setZoomInTitle(zoomInTitle); 58 | return this.self(); 59 | } 60 | 61 | public String getZoomOutText() 62 | { 63 | return this.zoomOutText; 64 | } 65 | 66 | public void setZoomOutText(final String zoomOutText) 67 | { 68 | this.zoomOutText = zoomOutText; 69 | } 70 | 71 | public LControlZoomOptions withZoomOutText(final String zoomOutText) 72 | { 73 | this.setZoomOutText(zoomOutText); 74 | return this.self(); 75 | } 76 | 77 | public String getZoomOutTitle() 78 | { 79 | return this.zoomOutTitle; 80 | } 81 | 82 | public void setZoomOutTitle(final String zoomOutTitle) 83 | { 84 | this.zoomOutTitle = zoomOutTitle; 85 | } 86 | 87 | public LControlZoomOptions withZoomOutTitle(final String zoomOutTitle) 88 | { 89 | this.setZoomOutTitle(zoomOutTitle); 90 | return this.self(); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/raster/LImageOverlay.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.raster; 17 | 18 | import java.io.Serializable; 19 | 20 | import software.xdev.vaadin.maps.leaflet.base.has.LHasBringTo; 21 | import software.xdev.vaadin.maps.leaflet.base.has.LHasOpacity; 22 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLngBounds; 23 | import software.xdev.vaadin.maps.leaflet.layer.LInteractiveLayer; 24 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 25 | 26 | 27 | /** 28 | * @see Leaflet docs 29 | */ 30 | public class LImageOverlay extends LInteractiveLayer 31 | implements LHasBringTo, LHasOpacity 32 | { 33 | protected LImageOverlay( 34 | final LComponentManagementRegistry compReg, 35 | final String jsConstructorCallExpression, 36 | final Serializable... parameters) 37 | { 38 | super(compReg, jsConstructorCallExpression, parameters); 39 | } 40 | 41 | public LImageOverlay( 42 | final LComponentManagementRegistry compReg, 43 | final String imageUrl, 44 | final LLatLngBounds bounds, 45 | final LImageOverlayOptions options) 46 | { 47 | super( 48 | compReg, 49 | "L.imageOverlay($0, " 50 | + bounds.clientComponentJsAccessor() 51 | + compReg.writeOptionsOptionalNextParameter(options) + ")", 52 | imageUrl); 53 | } 54 | 55 | public LImageOverlay( 56 | final LComponentManagementRegistry compReg, 57 | final String imageUrl, 58 | final LLatLngBounds bounds) 59 | { 60 | this(compReg, imageUrl, bounds, null); 61 | } 62 | 63 | /** 64 | * @see Leaflet docs 65 | */ 66 | public LImageOverlay setBounds(final LLatLngBounds bounds) 67 | { 68 | this.invokeSelf(".setBounds(" + bounds.clientComponentJsAccessor() + ")"); 69 | return this.self(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/raster/LTileLayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.raster; 17 | 18 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 19 | 20 | 21 | /** 22 | * Represents a tile layer. 23 | *

24 | * Important 25 | *

    26 | *
  • Before using tile servers check their usage policies
  • 27 | *
  • If the server is funded by donations consider donating
  • 28 | *
29 | * 30 | * @see List of raster tile providers 31 | */ 32 | public class LTileLayer extends LAbstractTileLayer 33 | { 34 | public LTileLayer( 35 | final LComponentManagementRegistry compReg, 36 | final String urlTemplate) 37 | { 38 | this(compReg, urlTemplate, null); 39 | } 40 | 41 | public LTileLayer( 42 | final LComponentManagementRegistry compReg, 43 | final String urlTemplate, 44 | final LTileLayerOptions options) 45 | { 46 | super(compReg, "L.tileLayer($0" + compReg.writeOptionsOptionalNextParameter(options) + ")", urlTemplate); 47 | } 48 | 49 | public LTileLayer( 50 | final LComponentManagementRegistry compReg, 51 | final String urlTemplate, 52 | final int maxZoom, 53 | final String attribution) 54 | { 55 | this(compReg, urlTemplate, new LTileLayerOptions().withMaxZoom(maxZoom).withAttribution(attribution)); 56 | } 57 | 58 | /** 59 | * Use OpenStreetMap's tile server
60 | * Important: By using this you accept the Usage Policy 61 | */ 62 | @SuppressWarnings("checkstyle:MagicNumber") // Default max Zoom 63 | public static LTileLayer createDefaultForOpenStreetMapTileServer(final LComponentManagementRegistry compReg) 64 | { 65 | return new LTileLayer( 66 | compReg, 67 | "https://tile.openstreetmap.org/{z}/{x}/{y}.png", 68 | 19, 69 | "© OpenStreetMap" 70 | ); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/other/LGeoJSONLayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.other; 17 | 18 | import java.io.Serializable; 19 | 20 | import software.xdev.vaadin.maps.leaflet.layer.LLayer; 21 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 22 | 23 | 24 | /** 25 | * @see Leaflet docs 26 | */ 27 | public class LGeoJSONLayer extends LAbstractFeatureGroup 28 | { 29 | protected LGeoJSONLayer( 30 | final LComponentManagementRegistry compReg, 31 | final String jsConstructorCallExpression, 32 | final Serializable... parameters) 33 | { 34 | super(compReg, jsConstructorCallExpression, parameters); 35 | } 36 | 37 | public LGeoJSONLayer( 38 | final LComponentManagementRegistry compReg, 39 | final String serializedGeoJSON, 40 | final LGeoJSONLayerOptions options) 41 | { 42 | super( 43 | compReg, 44 | "L.geoJSON(" 45 | + serializedGeoJSON 46 | + compReg.writeOptionsOptionalNextParameter(options) + ")"); 47 | } 48 | 49 | public LGeoJSONLayer( 50 | final LComponentManagementRegistry compReg, 51 | final String serializedGeoJSON) 52 | { 53 | this(compReg, serializedGeoJSON, (LGeoJSONLayerOptions)null); 54 | } 55 | 56 | /** 57 | * @see Leaflet docs 58 | */ 59 | public LGeoJSONLayer addData(final String serializedGeoJSON) 60 | { 61 | this.invokeSelf(".addLayer(" + serializedGeoJSON + ")"); 62 | return this.self(); 63 | } 64 | 65 | /** 66 | * @see Leaflet docs 67 | */ 68 | public LGeoJSONLayer resetStyle(final LLayer layer) 69 | { 70 | this.invokeSelf(".resetStyle(" + (layer != null ? layer.clientComponentJsAccessor() : "") + ")"); 71 | return this.self(); 72 | } 73 | 74 | /** 75 | * @see Leaflet docs 76 | */ 77 | public LGeoJSONLayer resetStyle() 78 | { 79 | return this.resetStyle(null); 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/plugins/GeomanDemo.java: -------------------------------------------------------------------------------- 1 | package software.xdev.vaadin.maps.leaflet.flow.demo.plugins; 2 | 3 | import com.vaadin.flow.component.button.Button; 4 | import com.vaadin.flow.component.orderedlayout.HorizontalLayout; 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.geoman.LTextOptions; 11 | import software.xdev.vaadin.maps.leaflet.geoman.map.LMapPM; 12 | import software.xdev.vaadin.maps.leaflet.layer.raster.LTileLayer; 13 | import software.xdev.vaadin.maps.leaflet.layer.ui.LMarker; 14 | import software.xdev.vaadin.maps.leaflet.map.LMap; 15 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 16 | import software.xdev.vaadin.maps.leaflet.registry.LDefaultComponentManagementRegistry; 17 | 18 | 19 | @Route(GeomanDemo.NAV) 20 | @SuppressWarnings("checkstyle:MagicNumber") 21 | public class GeomanDemo extends VerticalLayout 22 | { 23 | public static final String NAV = "/geoman"; 24 | 25 | public GeomanDemo() 26 | { 27 | // Let the view use 100% of the site 28 | this.setSizeFull(); 29 | 30 | // Create the registry which is needed so that components can be reused and their methods invoked 31 | // Note: You normally don't need to invoke any methods of the registry and just hand it over to the components 32 | final LComponentManagementRegistry reg = new LDefaultComponentManagementRegistry(this); 33 | 34 | // Create and add the MapContainer (which contains the map) to the UI 35 | final MapContainer mapContainer = new MapContainer(reg); 36 | mapContainer.setSizeFull(); 37 | this.add(mapContainer); 38 | 39 | final LMap map = mapContainer.getlMap(); 40 | 41 | // Add a (default) TileLayer so that we can see something on the map 42 | map.addLayer(LTileLayer.createDefaultForOpenStreetMapTileServer(reg)); 43 | 44 | // Set what part of the world should be shown 45 | map.setView(new LLatLng(reg, 49.6751, 12.1607), 17); 46 | 47 | // Create a new marker 48 | new LMarker(reg, new LLatLng(reg, 49.6756, 12.1610)) 49 | // Bind a popup which is displayed when clicking the marker 50 | .bindPopup("XDEV Software") 51 | // Add it to the map 52 | .addTo(map); 53 | 54 | // Add Geoman Controls 55 | final LMapPM lMapPM = new LMapPM(map); 56 | lMapPM.addControls(); 57 | 58 | final HorizontalLayout hlButtons = new HorizontalLayout(); 59 | this.add(hlButtons); 60 | 61 | final Button btnText = new Button( 62 | "Add text", ev -> lMapPM.enableDrawText(new LTextOptions() 63 | .withText("Some text") 64 | .withTextMarkerCentered(true))); 65 | hlButtons.add(btnText); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /plugins/geoman/src/main/java/software/xdev/vaadin/maps/leaflet/geoman/LTextOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.geoman; 17 | 18 | public class LTextOptions 19 | { 20 | private String text; 21 | private Boolean focusAfterDraw; 22 | private Boolean removeIfEmpty; 23 | private String className; 24 | private Boolean textMarkerCentered; 25 | 26 | public String getText() 27 | { 28 | return this.text; 29 | } 30 | 31 | public void setText(final String text) 32 | { 33 | this.text = text; 34 | } 35 | 36 | public LTextOptions withText(final String text) 37 | { 38 | this.setText(text); 39 | return this; 40 | } 41 | 42 | public Boolean getFocusAfterDraw() 43 | { 44 | return this.focusAfterDraw; 45 | } 46 | 47 | public void setFocusAfterDraw(final Boolean focusAfterDraw) 48 | { 49 | this.focusAfterDraw = focusAfterDraw; 50 | } 51 | 52 | public LTextOptions withFocusAfterDraw(final Boolean focusAfterDraw) 53 | { 54 | this.setFocusAfterDraw(focusAfterDraw); 55 | return this; 56 | } 57 | 58 | public Boolean getRemoveIfEmpty() 59 | { 60 | return this.removeIfEmpty; 61 | } 62 | 63 | public void setRemoveIfEmpty(final Boolean removeIfEmpty) 64 | { 65 | this.removeIfEmpty = removeIfEmpty; 66 | } 67 | 68 | public LTextOptions withRemoveIfEmpty(final Boolean removeIfEmpty) 69 | { 70 | this.setRemoveIfEmpty(removeIfEmpty); 71 | return this; 72 | } 73 | 74 | public String getClassName() 75 | { 76 | return this.className; 77 | } 78 | 79 | public void setClassName(final String className) 80 | { 81 | this.className = className; 82 | } 83 | 84 | public LTextOptions withClassName(final String className) 85 | { 86 | this.setClassName(className); 87 | return this; 88 | } 89 | 90 | public Boolean getTextMarkerCentered() 91 | { 92 | return this.textMarkerCentered; 93 | } 94 | 95 | public void setTextMarkerCentered(final Boolean textMarkerCentered) 96 | { 97 | this.textMarkerCentered = textMarkerCentered; 98 | } 99 | 100 | public LTextOptions withTextMarkerCentered(final Boolean textMarkerCentered) 101 | { 102 | this.setTextMarkerCentered(textMarkerCentered); 103 | return this; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/GeoJSONDemo.java: -------------------------------------------------------------------------------- 1 | package software.xdev.vaadin.maps.leaflet.flow.demo; 2 | 3 | import com.vaadin.flow.component.html.Anchor; 4 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 5 | import com.vaadin.flow.router.Route; 6 | 7 | import software.xdev.vaadin.maps.leaflet.MapContainer; 8 | import software.xdev.vaadin.maps.leaflet.base.RawString; 9 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng; 10 | import software.xdev.vaadin.maps.leaflet.layer.other.LGeoJSONLayer; 11 | import software.xdev.vaadin.maps.leaflet.layer.other.LGeoJSONLayerOptions; 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(GeoJSONDemo.NAV) 19 | @SuppressWarnings("checkstyle:MagicNumber") 20 | public class GeoJSONDemo extends VerticalLayout 21 | { 22 | public static final String NAV = "/geojson"; 23 | 24 | public GeoJSONDemo() 25 | { 26 | // Let the view use 100% of the site 27 | this.setSizeFull(); 28 | 29 | this.add(new Anchor("https://leafletjs.com/examples/geojson", "Based on this example")); 30 | 31 | // Create the registry which is needed so that components can be reused and their methods invoked 32 | // Note: You normally don't need to invoke any methods of the registry and just hand it over to the components 33 | final LComponentManagementRegistry reg = new LDefaultComponentManagementRegistry(this); 34 | 35 | // Create and add the MapContainer (which contains the map) to the UI 36 | final MapContainer mapContainer = new MapContainer(reg); 37 | mapContainer.setSizeFull(); 38 | this.add(mapContainer); 39 | 40 | final LMap map = mapContainer.getlMap(); 41 | 42 | // Add a (default) TileLayer so that we can see something on the map 43 | map.addLayer(LTileLayer.createDefaultForOpenStreetMapTileServer(reg)); 44 | 45 | // Set what part of the world should be shown 46 | map.setView(new LLatLng(reg, 39.75621, -104.99404), 17); 47 | 48 | // Handle GeoJSON 49 | final String serializedGeoJSON = """ 50 | { 51 | "type": "Feature", 52 | "properties": { 53 | "name": "Coors Field", 54 | "amenity": "Baseball Stadium", 55 | "popupContent": "This is where the Rockies play!" 56 | }, 57 | "geometry": { 58 | "type": "Point", 59 | "coordinates": [-104.99404, 39.75621] 60 | } 61 | } 62 | """; 63 | new LGeoJSONLayer( 64 | reg, 65 | serializedGeoJSON, 66 | new LGeoJSONLayerOptions() 67 | .withOnEachFeature(new RawString("(feature, layer) => { " 68 | + " if (feature.properties && feature.properties.popupContent) { " 69 | + " layer.bindPopup(feature.properties.popupContent); " 70 | + " }" 71 | + " }")) 72 | ) 73 | .addTo(map); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/NotOfThisEarthDemo.java: -------------------------------------------------------------------------------- 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 | } 87 | -------------------------------------------------------------------------------- /flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/EventDemo.java: -------------------------------------------------------------------------------- 1 | package software.xdev.vaadin.maps.leaflet.flow.demo; 2 | 3 | import com.vaadin.flow.component.button.Button; 4 | import com.vaadin.flow.component.orderedlayout.HorizontalLayout; 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.layer.raster.LTileLayer; 11 | import software.xdev.vaadin.maps.leaflet.layer.ui.LMarker; 12 | import software.xdev.vaadin.maps.leaflet.map.LMap; 13 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 14 | import software.xdev.vaadin.maps.leaflet.registry.LDefaultComponentManagementRegistry; 15 | 16 | 17 | @Route(EventDemo.NAV) 18 | @SuppressWarnings("checkstyle:MagicNumber") 19 | public class EventDemo extends VerticalLayout 20 | { 21 | public static final String NAV = "/event"; 22 | 23 | public EventDemo() 24 | { 25 | // Let the view use 100% of the site 26 | this.setSizeFull(); 27 | 28 | // Create the registry which is needed so that components can be reused and their methods invoked 29 | // Note: You normally don't need to invoke any methods of the registry and just hand it over to the components 30 | final LComponentManagementRegistry reg = new LDefaultComponentManagementRegistry(this); 31 | 32 | // Create and add the MapContainer (which contains the map) to the UI 33 | final MapContainer mapContainer = new MapContainer(reg); 34 | mapContainer.setSizeFull(); 35 | this.add(mapContainer); 36 | 37 | final LMap map = mapContainer.getlMap(); 38 | 39 | // Add a (default) TileLayer so that we can see something on the map 40 | map.addLayer(LTileLayer.createDefaultForOpenStreetMapTileServer(reg)); 41 | 42 | // Set what part of the world should be shown 43 | map.setView(new LLatLng(reg, 49.6751, 12.1607), 17); 44 | 45 | // Create a new marker 46 | new LMarker(reg, new LLatLng(reg, 49.6756, 12.1610)) 47 | // Bind a popup which is displayed when clicking the marker 48 | .bindPopup("XDEV Software") 49 | // Add it to the map 50 | .addTo(map); 51 | 52 | final HorizontalLayout hlButtons = new HorizontalLayout(); 53 | 54 | // !!! NOTE !!! 55 | // A more complex demo which also sends data back from the client to the server 56 | // can be found in ComplexDemo#addEventDemo 57 | 58 | // Bind clickFunc to map so that it gets disposed when the map is disposed 59 | final String clickFuncReference = map.clientComponentJsAccessor() + ".myCoolClickFunc"; 60 | reg.execJs(clickFuncReference + "=e => alert('You clicked: ' + e.latlng)"); 61 | 62 | final String type = "click"; 63 | hlButtons.add(new Button("Register click", ev -> map.on(type, clickFuncReference))); 64 | hlButtons.add(new Button("Register click once", ev -> map.once(type, clickFuncReference))); 65 | hlButtons.add(new Button("Unregister click", ev -> map.off(type, clickFuncReference))); 66 | 67 | hlButtons.setWidthFull(); 68 | this.add(hlButtons); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/raster/LVideoOverlayOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.raster; 17 | 18 | import software.xdev.vaadin.maps.leaflet.layer.LAbstractImageOverlayOptions; 19 | 20 | 21 | /** 22 | * @see Leaflet docs 23 | */ 24 | public class LVideoOverlayOptions extends LAbstractImageOverlayOptions 25 | { 26 | private Boolean autoplay; 27 | private Boolean loop; 28 | private Boolean keepAspectRatio; 29 | private Boolean muted; 30 | private Boolean playsInline; 31 | 32 | public Boolean getAutoplay() 33 | { 34 | return this.autoplay; 35 | } 36 | 37 | public void setAutoplay(final Boolean autoplay) 38 | { 39 | this.autoplay = autoplay; 40 | } 41 | 42 | public LVideoOverlayOptions withAutoplay(final Boolean autoplay) 43 | { 44 | this.setAutoplay(autoplay); 45 | return this.self(); 46 | } 47 | 48 | public Boolean getLoop() 49 | { 50 | return this.loop; 51 | } 52 | 53 | public void setLoop(final Boolean loop) 54 | { 55 | this.loop = loop; 56 | } 57 | 58 | public LVideoOverlayOptions withLoop(final Boolean loop) 59 | { 60 | this.setLoop(loop); 61 | return this.self(); 62 | } 63 | 64 | public Boolean getKeepAspectRatio() 65 | { 66 | return this.keepAspectRatio; 67 | } 68 | 69 | public void setKeepAspectRatio(final Boolean keepAspectRatio) 70 | { 71 | this.keepAspectRatio = keepAspectRatio; 72 | } 73 | 74 | public LVideoOverlayOptions withKeepAspectRatio(final Boolean keepAspectRatio) 75 | { 76 | this.setKeepAspectRatio(keepAspectRatio); 77 | return this.self(); 78 | } 79 | 80 | public Boolean getMuted() 81 | { 82 | return this.muted; 83 | } 84 | 85 | public void setMuted(final Boolean muted) 86 | { 87 | this.muted = muted; 88 | } 89 | 90 | public LVideoOverlayOptions withMuted(final Boolean muted) 91 | { 92 | this.setMuted(muted); 93 | return this.self(); 94 | } 95 | 96 | public Boolean getPlaysInline() 97 | { 98 | return this.playsInline; 99 | } 100 | 101 | public void setPlaysInline(final Boolean playsInline) 102 | { 103 | this.playsInline = playsInline; 104 | } 105 | 106 | public LVideoOverlayOptions withPlaysInline(final Boolean playsInline) 107 | { 108 | this.setPlaysInline(playsInline); 109 | return this.self(); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/plugins/LeafletMarkerClusterDemo.java: -------------------------------------------------------------------------------- 1 | package software.xdev.vaadin.maps.leaflet.flow.demo.plugins; 2 | 3 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 4 | import com.vaadin.flow.router.Route; 5 | 6 | import software.xdev.vaadin.maps.leaflet.MapContainer; 7 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng; 8 | import software.xdev.vaadin.maps.leaflet.layer.raster.LTileLayer; 9 | import software.xdev.vaadin.maps.leaflet.layer.ui.LMarker; 10 | import software.xdev.vaadin.maps.leaflet.map.LMap; 11 | import software.xdev.vaadin.maps.leaflet.markercluster.layer.other.LMarkerClusterGroup; 12 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 13 | import software.xdev.vaadin.maps.leaflet.registry.LDefaultComponentManagementRegistry; 14 | 15 | 16 | @Route(LeafletMarkerClusterDemo.NAV) 17 | @SuppressWarnings("checkstyle:MagicNumber") 18 | public class LeafletMarkerClusterDemo extends VerticalLayout 19 | { 20 | public static final String NAV = "/leaflet-markercluster"; 21 | 22 | public LeafletMarkerClusterDemo() 23 | { 24 | // Let the view use 100% of the site 25 | this.setSizeFull(); 26 | 27 | // Create the registry which is needed so that components can be reused and their methods invoked 28 | // Note: You normally don't need to invoke any methods of the registry and just hand it over to the components 29 | final LComponentManagementRegistry reg = new LDefaultComponentManagementRegistry(this); 30 | 31 | // Create and add the MapContainer (which contains the map) to the UI 32 | final MapContainer mapContainer = new MapContainer(reg); 33 | mapContainer.setSizeFull(); 34 | this.add(mapContainer); 35 | 36 | final LMap map = mapContainer.getlMap(); 37 | 38 | // Add a (default) TileLayer so that we can see something on the map 39 | map.addLayer(LTileLayer.createDefaultForOpenStreetMapTileServer(reg)); 40 | 41 | // Set what part of the world should be shown 42 | map.setView(new LLatLng(reg, 49.1, 12), 8); 43 | 44 | final LMarkerClusterGroup markerClusterGroup = new LMarkerClusterGroup(reg); 45 | markerClusterGroup.addLayer(new LMarker(reg, new LLatLng(reg, 49.6756, 12.1610)) 46 | .bindPopup("XDEV Software")); 47 | markerClusterGroup.addLayer(new LMarker(reg, new LLatLng(reg, 49.673800, 12.160113)) 48 | .bindPopup("Schnitzel")); 49 | 50 | markerClusterGroup.addLayer(new LMarker(reg, new LLatLng(reg, 49.67, 12.16)) 51 | .bindPopup("Weiden i.d.OPf.")); 52 | markerClusterGroup.addLayer(new LMarker(reg, new LLatLng(reg, 49.44, 11.86)) 53 | .bindPopup("Amberg")); 54 | markerClusterGroup.addLayer(new LMarker(reg, new LLatLng(reg, 49.33, 12.11)) 55 | .bindPopup("Schwandorf")); 56 | markerClusterGroup.addLayer(new LMarker(reg, new LLatLng(reg, 49.45, 11.08)) 57 | .bindPopup("Nürnberg")); 58 | markerClusterGroup.addLayer(new LMarker(reg, new LLatLng(reg, 49.02, 12.1)) 59 | .bindPopup("Regensburg")); 60 | markerClusterGroup.addLayer(new LMarker(reg, new LLatLng(reg, 48.14, 11.57)) 61 | .bindPopup("München")); 62 | 63 | map.addLayer(markerClusterGroup); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/controls/LControlLayersOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.controls; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.RawString; 19 | 20 | 21 | /** 22 | * @see Leaflet docs 23 | */ 24 | public class LControlLayersOptions extends LControlOptions 25 | { 26 | private Boolean collapsed; 27 | private Boolean autoZIndex; 28 | private Boolean hideSingleBase; 29 | private Boolean sortLayers; 30 | private RawString sortFunction; 31 | 32 | public Boolean getCollapsed() 33 | { 34 | return this.collapsed; 35 | } 36 | 37 | public void setCollapsed(final Boolean collapsed) 38 | { 39 | this.collapsed = collapsed; 40 | } 41 | 42 | public LControlLayersOptions withCollapsed(final Boolean collapsed) 43 | { 44 | this.setCollapsed(collapsed); 45 | return this.self(); 46 | } 47 | 48 | public Boolean getAutoZIndex() 49 | { 50 | return this.autoZIndex; 51 | } 52 | 53 | public void setAutoZIndex(final Boolean autoZIndex) 54 | { 55 | this.autoZIndex = autoZIndex; 56 | } 57 | 58 | public LControlLayersOptions withAutoZIndex(final Boolean autoZIndex) 59 | { 60 | this.setAutoZIndex(autoZIndex); 61 | return this.self(); 62 | } 63 | 64 | public Boolean getHideSingleBase() 65 | { 66 | return this.hideSingleBase; 67 | } 68 | 69 | public void setHideSingleBase(final Boolean hideSingleBase) 70 | { 71 | this.hideSingleBase = hideSingleBase; 72 | } 73 | 74 | public LControlLayersOptions withHideSingleBase(final Boolean hideSingleBase) 75 | { 76 | this.setHideSingleBase(hideSingleBase); 77 | return this.self(); 78 | } 79 | 80 | public Boolean getSortLayers() 81 | { 82 | return this.sortLayers; 83 | } 84 | 85 | public void setSortLayers(final Boolean sortLayers) 86 | { 87 | this.sortLayers = sortLayers; 88 | } 89 | 90 | public LControlLayersOptions withSortLayers(final Boolean sortLayers) 91 | { 92 | this.setSortLayers(sortLayers); 93 | return this.self(); 94 | } 95 | 96 | public RawString getSortFunction() 97 | { 98 | return this.sortFunction; 99 | } 100 | 101 | public void setSortFunction(final RawString sortFunction) 102 | { 103 | this.sortFunction = sortFunction; 104 | } 105 | 106 | public LControlLayersOptions withSortFunction(final RawString sortFunction) 107 | { 108 | this.setSortFunction(sortFunction); 109 | return this.self(); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/LAbstractImageOverlayOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer; 17 | 18 | @SuppressWarnings("unused") 19 | public abstract class LAbstractImageOverlayOptions> 20 | extends LInteractiveLayerOptions 21 | { 22 | private Number opacity; 23 | private String alt; 24 | // Boolean|String 25 | private Object crossOrigin; 26 | private String errorOverlayUrl; 27 | private Number zIndex; 28 | private String className; 29 | 30 | public Number getOpacity() 31 | { 32 | return this.opacity; 33 | } 34 | 35 | public void setOpacity(final Number opacity) 36 | { 37 | this.opacity = opacity; 38 | } 39 | 40 | public S withOpacity(final Number opacity) 41 | { 42 | this.setOpacity(opacity); 43 | return this.self(); 44 | } 45 | 46 | public String getAlt() 47 | { 48 | return this.alt; 49 | } 50 | 51 | public void setAlt(final String alt) 52 | { 53 | this.alt = alt; 54 | } 55 | 56 | public S withAlt(final String alt) 57 | { 58 | this.setAlt(alt); 59 | return this.self(); 60 | } 61 | 62 | public Object getCrossOrigin() 63 | { 64 | return this.crossOrigin; 65 | } 66 | 67 | public void setCrossOrigin(final Object crossOrigin) 68 | { 69 | this.crossOrigin = crossOrigin; 70 | } 71 | 72 | public S withCrossOrigin(final Object crossOrigin) 73 | { 74 | this.setCrossOrigin(crossOrigin); 75 | return this.self(); 76 | } 77 | 78 | public String getErrorOverlayUrl() 79 | { 80 | return this.errorOverlayUrl; 81 | } 82 | 83 | public void setErrorOverlayUrl(final String errorOverlayUrl) 84 | { 85 | this.errorOverlayUrl = errorOverlayUrl; 86 | } 87 | 88 | public S withErrorOverlayUrl(final String errorOverlayUrl) 89 | { 90 | this.setErrorOverlayUrl(errorOverlayUrl); 91 | return this.self(); 92 | } 93 | 94 | public Number getzIndex() 95 | { 96 | return this.zIndex; 97 | } 98 | 99 | public void setzIndex(final Number zIndex) 100 | { 101 | this.zIndex = zIndex; 102 | } 103 | 104 | public S withZIndex(final Number zIndex) 105 | { 106 | this.setzIndex(zIndex); 107 | return this.self(); 108 | } 109 | 110 | public String getClassName() 111 | { 112 | return this.className; 113 | } 114 | 115 | public void setClassName(final String className) 116 | { 117 | this.className = className; 118 | } 119 | 120 | public S withClassName(final String className) 121 | { 122 | this.setClassName(className); 123 | return this.self(); 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /plugins/leaflet-markercluster/src/main/java/software/xdev/vaadin/maps/leaflet/markercluster/layer/other/LMarkerClusterGroup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.markercluster.layer.other; 17 | 18 | import java.util.Collection; 19 | import java.util.stream.Collectors; 20 | 21 | import com.vaadin.flow.component.dependency.CssImport; 22 | import com.vaadin.flow.component.dependency.JsModule; 23 | import com.vaadin.flow.component.dependency.NpmPackage; 24 | 25 | import software.xdev.vaadin.maps.leaflet.base.LBaseComponent; 26 | import software.xdev.vaadin.maps.leaflet.layer.LAbstractLayerGroup; 27 | import software.xdev.vaadin.maps.leaflet.layer.LLayer; 28 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 29 | 30 | 31 | /** 32 | * @see Docs 33 | */ 34 | @NpmPackage(value = "leaflet.markercluster", version = "1.5.3") 35 | @JsModule("leaflet.markercluster/dist/leaflet.markercluster.js") 36 | @CssImport("leaflet.markercluster/dist/MarkerCluster.css") 37 | @CssImport("leaflet.markercluster/dist/MarkerCluster.Default.css") 38 | public class LMarkerClusterGroup extends LAbstractLayerGroup 39 | { 40 | public LMarkerClusterGroup( 41 | final LComponentManagementRegistry compReg, 42 | final LAbstractMarkerClusterGroupOptions options) 43 | { 44 | super( 45 | compReg, 46 | "L.markerClusterGroup(" 47 | + compReg.writeOptions(options) 48 | + ")"); 49 | } 50 | 51 | public LMarkerClusterGroup(final LComponentManagementRegistry compReg) 52 | { 53 | this(compReg, null); 54 | } 55 | 56 | public LMarkerClusterGroup refreshClusters() 57 | { 58 | this.invokeSelf(".refreshClusters()"); 59 | return this.self(); 60 | } 61 | 62 | public LMarkerClusterGroup refreshClusters(final LLayer layer) 63 | { 64 | this.invokeSelf(".refreshClusters(" + layer.clientComponentJsAccessor() + ")"); 65 | return this.self(); 66 | } 67 | 68 | public LMarkerClusterGroup refreshClusters(final Collection> layers) 69 | { 70 | this.invokeSelf(".refreshClusters([" 71 | + layers.stream().map(LBaseComponent::clientComponentJsAccessor).collect(Collectors.joining(", ")) 72 | + "])"); 73 | return this.self(); 74 | } 75 | 76 | public LMarkerClusterGroup zoomToShowLayer(final LLayer layer) 77 | { 78 | return this.zoomToShowLayer(layer, null); 79 | } 80 | 81 | public LMarkerClusterGroup zoomToShowLayer(final LLayer layer, final String callback) 82 | { 83 | this.invokeSelf(".zoomToShowLayer(" 84 | + layer.clientComponentJsAccessor() 85 | + (callback != null ? ", " + callback : "") 86 | + ")"); 87 | return this.self(); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/other/LGeoJSONLayerOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.other; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.RawString; 19 | import software.xdev.vaadin.maps.leaflet.layer.LInteractiveLayerOptions; 20 | 21 | 22 | /** 23 | * @see Leaflet docs 24 | */ 25 | public class LGeoJSONLayerOptions extends LInteractiveLayerOptions 26 | { 27 | private RawString pointToLayer; 28 | private RawString style; 29 | private RawString onEachFeature; 30 | private RawString coordsToLatLng; 31 | private Boolean markersInheritOptions; 32 | 33 | public RawString getPointToLayer() 34 | { 35 | return this.pointToLayer; 36 | } 37 | 38 | public void setPointToLayer(final RawString pointToLayer) 39 | { 40 | this.pointToLayer = pointToLayer; 41 | } 42 | 43 | public LGeoJSONLayerOptions withPointToLayer(final RawString pointToLayer) 44 | { 45 | this.setPointToLayer(pointToLayer); 46 | return this.self(); 47 | } 48 | 49 | public RawString getStyle() 50 | { 51 | return this.style; 52 | } 53 | 54 | public void setStyle(final RawString style) 55 | { 56 | this.style = style; 57 | } 58 | 59 | public LGeoJSONLayerOptions withStyle(final RawString style) 60 | { 61 | this.setStyle(style); 62 | return this.self(); 63 | } 64 | 65 | public RawString getOnEachFeature() 66 | { 67 | return this.onEachFeature; 68 | } 69 | 70 | public void setOnEachFeature(final RawString onEachFeature) 71 | { 72 | this.onEachFeature = onEachFeature; 73 | } 74 | 75 | public LGeoJSONLayerOptions withOnEachFeature(final RawString onEachFeature) 76 | { 77 | this.setOnEachFeature(onEachFeature); 78 | return this.self(); 79 | } 80 | 81 | public RawString getCoordsToLatLng() 82 | { 83 | return this.coordsToLatLng; 84 | } 85 | 86 | public void setCoordsToLatLng(final RawString coordsToLatLng) 87 | { 88 | this.coordsToLatLng = coordsToLatLng; 89 | } 90 | 91 | public LGeoJSONLayerOptions withCoordsToLatLng(final RawString coordsToLatLng) 92 | { 93 | this.setCoordsToLatLng(coordsToLatLng); 94 | return this.self(); 95 | } 96 | 97 | public Boolean getMarkersInheritOptions() 98 | { 99 | return this.markersInheritOptions; 100 | } 101 | 102 | public void setMarkersInheritOptions(final Boolean markersInheritOptions) 103 | { 104 | this.markersInheritOptions = markersInheritOptions; 105 | } 106 | 107 | public LGeoJSONLayerOptions withMarkersInheritOptions(final Boolean markersInheritOptions) 108 | { 109 | this.setMarkersInheritOptions(markersInheritOptions); 110 | return this.self(); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/map/LMapLocateOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.map; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LComponentOptions; 19 | 20 | 21 | /** 22 | * @see Leaflet docs 23 | */ 24 | public class LMapLocateOptions implements LComponentOptions 25 | { 26 | private Boolean watch; 27 | private Boolean setView; 28 | private Number maxZoom; 29 | private Number timeout; 30 | private Number maximumAge; 31 | private Boolean enableHighAccuracy; 32 | 33 | public Boolean getWatch() 34 | { 35 | return this.watch; 36 | } 37 | 38 | public void setWatch(final Boolean watch) 39 | { 40 | this.watch = watch; 41 | } 42 | 43 | public LMapLocateOptions withWatch(final Boolean watch) 44 | { 45 | this.setWatch(watch); 46 | return this.self(); 47 | } 48 | 49 | public Boolean getSetView() 50 | { 51 | return this.setView; 52 | } 53 | 54 | public void setSetView(final Boolean setView) 55 | { 56 | this.setView = setView; 57 | } 58 | 59 | public LMapLocateOptions withSetView(final Boolean setView) 60 | { 61 | this.setSetView(setView); 62 | return this.self(); 63 | } 64 | 65 | public Number getMaxZoom() 66 | { 67 | return this.maxZoom; 68 | } 69 | 70 | public void setMaxZoom(final Number maxZoom) 71 | { 72 | this.maxZoom = maxZoom; 73 | } 74 | 75 | public LMapLocateOptions withMaxZoom(final Number maxZoom) 76 | { 77 | this.setMaxZoom(maxZoom); 78 | return this.self(); 79 | } 80 | 81 | public Number getTimeout() 82 | { 83 | return this.timeout; 84 | } 85 | 86 | public void setTimeout(final Number timeout) 87 | { 88 | this.timeout = timeout; 89 | } 90 | 91 | public LMapLocateOptions withTimeout(final Number timeout) 92 | { 93 | this.setTimeout(timeout); 94 | return this.self(); 95 | } 96 | 97 | public Number getMaximumAge() 98 | { 99 | return this.maximumAge; 100 | } 101 | 102 | public void setMaximumAge(final Number maximumAge) 103 | { 104 | this.maximumAge = maximumAge; 105 | } 106 | 107 | public LMapLocateOptions withMaximumAge(final Number maximumAge) 108 | { 109 | this.setMaximumAge(maximumAge); 110 | return this.self(); 111 | } 112 | 113 | public Boolean getEnableHighAccuracy() 114 | { 115 | return this.enableHighAccuracy; 116 | } 117 | 118 | public void setEnableHighAccuracy(final Boolean enableHighAccuracy) 119 | { 120 | this.enableHighAccuracy = enableHighAccuracy; 121 | } 122 | 123 | public LMapLocateOptions withEnableHighAccuracy(final Boolean enableHighAccuracy) 124 | { 125 | this.setEnableHighAccuracy(enableHighAccuracy); 126 | return this.self(); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | software.xdev.vaadin.maps-leaflet 8 | root 9 | 5.0.2-SNAPSHOT 10 | pom 11 | 12 | 13 | XDEV Software 14 | https://xdev.software 15 | 16 | 17 | 18 | bom 19 | flow 20 | flow-demo 21 | plugins/geoman 22 | plugins/leaflet-markercluster 23 | plugins/maplibre-gl-leaflet 24 | 25 | 26 | 27 | UTF-8 28 | UTF-8 29 | 30 | 31 | 32 | 33 | Apache-2.0 34 | https://www.apache.org/licenses/LICENSE-2.0.txt 35 | repo 36 | 37 | 38 | 39 | 40 | 41 | checkstyle 42 | 43 | 44 | 45 | org.apache.maven.plugins 46 | maven-checkstyle-plugin 47 | 3.6.0 48 | 49 | 50 | com.puppycrawl.tools 51 | checkstyle 52 | 12.1.0 53 | 54 | 55 | 56 | .config/checkstyle/checkstyle.xml 57 | true 58 | 59 | 60 | 61 | 62 | check 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | pmd 72 | 73 | 74 | 75 | org.apache.maven.plugins 76 | maven-pmd-plugin 77 | 3.28.0 78 | 79 | true 80 | true 81 | true 82 | 83 | .config/pmd/java/ruleset.xml 84 | 85 | 86 | 87 | 88 | net.sourceforge.pmd 89 | pmd-core 90 | 7.17.0 91 | 92 | 93 | net.sourceforge.pmd 94 | pmd-java 95 | 7.17.0 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | org.apache.maven.plugins 106 | maven-jxr-plugin 107 | 3.6.0 108 | 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/ui/LDivOverlay.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.ui; 17 | 18 | import java.io.Serializable; 19 | 20 | import software.xdev.vaadin.maps.leaflet.base.LComponent; 21 | import software.xdev.vaadin.maps.leaflet.base.has.LHasBringTo; 22 | import software.xdev.vaadin.maps.leaflet.base.has.LHasSetLatLng; 23 | import software.xdev.vaadin.maps.leaflet.layer.LInteractiveLayer; 24 | import software.xdev.vaadin.maps.leaflet.layer.LLayer; 25 | import software.xdev.vaadin.maps.leaflet.map.LMap; 26 | import software.xdev.vaadin.maps.leaflet.registry.LComponentManagementRegistry; 27 | 28 | 29 | /** 30 | * @see Leaflet docs 31 | */ 32 | public abstract class LDivOverlay> extends LInteractiveLayer 33 | implements LHasBringTo, LHasSetLatLng 34 | { 35 | protected LDivOverlay( 36 | final LComponentManagementRegistry compReg, 37 | final String jsConstructorCallExpression, 38 | final Serializable... parameters) 39 | { 40 | super(compReg, jsConstructorCallExpression, parameters); 41 | } 42 | 43 | /** 44 | * @see Leaflet docs 45 | */ 46 | public S openOn(final LMap map) 47 | { 48 | this.invokeSelf(".openOn(" + map.clientComponentJsAccessor() + ")"); 49 | return this.self(); 50 | } 51 | 52 | /** 53 | * @see Leaflet docs 54 | */ 55 | public S close() 56 | { 57 | this.invokeSelf(".close()"); 58 | return this.self(); 59 | } 60 | 61 | /** 62 | * @see Leaflet docs 63 | */ 64 | public S toggle(final LLayer layer) 65 | { 66 | this.invokeSelf(".toggle(" + (layer != null ? layer.clientComponentJsAccessor() : "") + ")"); 67 | return this.self(); 68 | } 69 | 70 | /** 71 | * @see Leaflet docs 72 | */ 73 | public S toggle() 74 | { 75 | return this.toggle(null); 76 | } 77 | 78 | /** 79 | * @see Leaflet docs 80 | */ 81 | public S setContent(final String content) 82 | { 83 | this.invokeSelf(".setContent($0)", content); 84 | return this.self(); 85 | } 86 | 87 | /** 88 | * @see Leaflet docs 89 | */ 90 | public S setContent(final LComponent content) 91 | { 92 | this.invokeSelf(".setContent($0)", content.clientComponentJsAccessor()); 93 | return this.self(); 94 | } 95 | 96 | /** 97 | * @see Leaflet docs 98 | */ 99 | public S update() 100 | { 101 | this.invokeSelf(".update()"); 102 | return this.self(); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /plugins/geoman/src/main/java/software/xdev/vaadin/maps/leaflet/geoman/layer/LLayerPM.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.geoman.layer; 17 | 18 | import software.xdev.vaadin.maps.leaflet.base.LAbstractComponent; 19 | import software.xdev.vaadin.maps.leaflet.basictypes.LLatLng; 20 | import software.xdev.vaadin.maps.leaflet.geoman.LAbstractEditOptions; 21 | import software.xdev.vaadin.maps.leaflet.layer.LLayer; 22 | 23 | 24 | /** 25 | * @see Docs 26 | */ 27 | public class LLayerPM extends LAbstractComponent 28 | { 29 | private final LLayer layer; 30 | 31 | public LLayerPM(final LLayer layer) 32 | { 33 | super(layer.componentRegistry()); 34 | this.layer = layer; 35 | } 36 | 37 | public LLayerPM enable(final LAbstractEditOptions options) 38 | { 39 | this.invokeSelf(".enable(" + this.componentRegistry().writeOptionsOrEmptyObject(options) + ")"); 40 | return this; 41 | } 42 | 43 | public LLayerPM disable() 44 | { 45 | this.invokeSelf(".disable()"); 46 | return this; 47 | } 48 | 49 | public LLayerPM toggleEdit(final LAbstractEditOptions options) 50 | { 51 | this.invokeSelf(".toggleEdit(" + this.componentRegistry().writeOptionsOrEmptyObject(options) + ")"); 52 | return this; 53 | } 54 | 55 | public LLayerPM remove() 56 | { 57 | this.invokeSelf(".remove()"); 58 | return this; 59 | } 60 | 61 | public LLayerPM setOptions(final LAbstractEditOptions options) 62 | { 63 | this.invokeSelf(".setOptions(" + this.componentRegistry().writeOptionsOrEmptyObject(options) + ")"); 64 | return this; 65 | } 66 | 67 | public LLayerPM enableLayerDrag() 68 | { 69 | this.invokeSelf(".enableLayerDrag()"); 70 | return this; 71 | } 72 | 73 | public LLayerPM disableLayerDrag() 74 | { 75 | this.invokeSelf(".disableLayerDrag()"); 76 | return this; 77 | } 78 | 79 | public LLayerPM enableRotate() 80 | { 81 | this.invokeSelf(".enableRotate()"); 82 | return this; 83 | } 84 | 85 | public LLayerPM disableRotate() 86 | { 87 | this.invokeSelf(".disableRotate()"); 88 | return this; 89 | } 90 | 91 | public LLayerPM rotateLayer(final Number degrees) 92 | { 93 | this.invokeSelf(".rotateLayer($0)", degrees); 94 | return this; 95 | } 96 | 97 | public LLayerPM rotateLayerToAngle(final Number degrees) 98 | { 99 | this.invokeSelf(".rotateLayerToAngle($0)", degrees); 100 | return this; 101 | } 102 | 103 | public LLayerPM setInitAngle(final Number degrees) 104 | { 105 | this.invokeSelf(".setInitAngle($0)", degrees); 106 | return this; 107 | } 108 | 109 | public LLayerPM setRotationCenter(final LLatLng center) 110 | { 111 | this.invokeSelf(".setRotationCenter(" + center.clientComponentJsAccessor() + ")"); 112 | return this; 113 | } 114 | 115 | @Override 116 | public String clientComponentJsAccessor() 117 | { 118 | return this.layer.clientComponentJsAccessor() + ".pm"; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /flow/src/main/java/software/xdev/vaadin/maps/leaflet/layer/raster/LTileLayerWMSOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2019 XDEV Software (https://xdev.software) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package software.xdev.vaadin.maps.leaflet.layer.raster; 17 | 18 | 19 | /** 20 | * @see Leaflet docs 21 | */ 22 | public class LTileLayerWMSOptions extends LAbstractTileLayerOptions 23 | { 24 | private String layers; 25 | private String styles; 26 | private String format; 27 | private Boolean transparent; 28 | private String version; 29 | private Object crs; 30 | private Boolean uppercase; 31 | 32 | public String getLayers() 33 | { 34 | return this.layers; 35 | } 36 | 37 | public void setLayers(final String layers) 38 | { 39 | this.layers = layers; 40 | } 41 | 42 | public LTileLayerWMSOptions withLayers(final String layers) 43 | { 44 | this.setLayers(layers); 45 | return this.self(); 46 | } 47 | 48 | public String getStyles() 49 | { 50 | return this.styles; 51 | } 52 | 53 | public void setStyles(final String styles) 54 | { 55 | this.styles = styles; 56 | } 57 | 58 | public LTileLayerWMSOptions withStyles(final String styles) 59 | { 60 | this.setStyles(styles); 61 | return this.self(); 62 | } 63 | 64 | public String getFormat() 65 | { 66 | return this.format; 67 | } 68 | 69 | public void setFormat(final String format) 70 | { 71 | this.format = format; 72 | } 73 | 74 | public LTileLayerWMSOptions withFormat(final String format) 75 | { 76 | this.setFormat(format); 77 | return this.self(); 78 | } 79 | 80 | public Boolean getTransparent() 81 | { 82 | return this.transparent; 83 | } 84 | 85 | public void setTransparent(final Boolean transparent) 86 | { 87 | this.transparent = transparent; 88 | } 89 | 90 | public LTileLayerWMSOptions withTransparent(final Boolean transparent) 91 | { 92 | this.setTransparent(transparent); 93 | return this.self(); 94 | } 95 | 96 | public String getVersion() 97 | { 98 | return this.version; 99 | } 100 | 101 | public void setVersion(final String version) 102 | { 103 | this.version = version; 104 | } 105 | 106 | public LTileLayerWMSOptions withVersion(final String version) 107 | { 108 | this.setVersion(version); 109 | return this.self(); 110 | } 111 | 112 | public Object getCrs() 113 | { 114 | return this.crs; 115 | } 116 | 117 | public void setCrs(final Object crs) 118 | { 119 | this.crs = crs; 120 | } 121 | 122 | public LTileLayerWMSOptions withCrs(final Object crs) 123 | { 124 | this.setCrs(crs); 125 | return this.self(); 126 | } 127 | 128 | public Boolean getUppercase() 129 | { 130 | return this.uppercase; 131 | } 132 | 133 | public void setUppercase(final Boolean uppercase) 134 | { 135 | this.uppercase = uppercase; 136 | } 137 | 138 | public LTileLayerWMSOptions withUppercase(final Boolean uppercase) 139 | { 140 | this.setUppercase(uppercase); 141 | return this.self(); 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0?logo=vaadin)](https://vaadin.com/directory/component/leafletmap-for-vaadin) 2 | [![Latest version](https://img.shields.io/maven-central/v/software.xdev/vaadin-maps-leaflet-flow?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/vaadin-maps-leaflet-flow) 3 | [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/vaadin-maps-leaflet-flow/check-build.yml?branch=develop)](https://github.com/xdev-software/vaadin-maps-leaflet-flow/actions/workflows/check-build.yml?query=branch%3Adevelop) 4 | ![Vaadin 24+](https://img.shields.io/badge/Vaadin%20Platform/Flow-24+-00b4f0) 5 | 6 | # LeafletMap for Vaadin 7 | A Vaadin Flow Java API for [Leaflet](https://leafletjs.com/). 8 | 9 | ![demo](assets/demo.png) 10 | 11 | ## Usage 12 | 13 | This API wraps the Leaflet API in a Vaadin friendly way.
It uses a similar structure (classes, methods) as the [Leaflet JavaScript API](https://leafletjs.com/reference.html). 14 | 15 | To get started it's recommended to have a look at the [demo](./flow-demo), notably the [minimalistic example](./flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/MinimalisticDemo.java). 16 | 17 | > [!NOTE] 18 | > **The API only supports sending instructions to the client**
19 | > Due to data integrity retrieving client-side data (that can be modified by users) is not supported. 20 | > 21 | > Event listeners can still be registered but this needs to be done manually. An example is available [in the demo](./flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/EventDemo.java). 22 | > 23 | >
The following code snippet is a simplification of an even more complex example which sends (unvalidated!) client side data back to the server (click to expand) 24 | > 25 | > ```java 26 | > this.map.on("click", "e => document.getElementById('" + ID + "').$server.mapClicked(e.latlng.lat, e.latng.lng)"); 27 | > ... 28 | > @ClientCallable 29 | > public void mapClicked(double lat, double lng) 30 | > { 31 | > LOG.info("Map clicked - lat: {}, lng: {}", lat, lng); 32 | > } 33 | > ``` 34 | >
35 | 36 | ### Plugins 37 | 38 | We also offer various [predefined plugins](./plugins/) which you can utilize to enhance your Leaflet experience. 39 | 40 | ## Installation 41 | [Installation guide of the latest release](https://github.com/xdev-software/vaadin-maps-leaflet-flow/releases/latest#Installation) 42 | 43 | #### Static resources 44 | Please note that Leaflet uses a few default icons for various components (e.g. Markers).
45 | These are also shipped with the library and can be found inside [``META-INF/resources``](./flow/src/main/resources/META-INF/resources/).
46 | You might have to fine tune your security configuration to allow these. 47 | 48 | #### Compatibility with Vaadin 49 | | Vaadin version | vaadin-maps-leaflet-flow version | 50 | | --- | --- | 51 | | Vaadin 24+ (latest) | ``3+`` | 52 | 53 | ### Spring-Boot 54 | * You may have to include ``software/xdev`` inside [``vaadin.allowed-packages``](https://vaadin.com/docs/latest/integrations/spring/configuration#configure-the-scanning-of-packages) 55 | 56 | ## Run the Demo 57 | * Checkout the repo 58 | * Run ``mvn install && mvn -f flow-demo spring-boot:run`` 59 | * Open http://localhost:8080 60 | 61 |
62 | Show example 63 | 64 | ![demo](assets/demo.avif) 65 |
66 | 67 | ## Support 68 | If you need support as soon as possible and you can't wait for any pull request, feel free to use [our support](https://xdev.software/en/services/support). 69 | 70 | ## Contributing 71 | See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project. 72 | 73 | ## Dependencies and Licenses 74 | View the [license of the current project](LICENSE) or the [docs that contain a dependency summary (per module)](https://xdev-software.github.io/vaadin-maps-leaflet-flow/) 75 | --------------------------------------------------------------------------------