@@ -6,6 +6,7 @@ Now supporting both **JavaFX** and **Vaadin** implementations with a unified API
66* Current version: ** v2.0.0**
77
88Project Source Code: https://github.com/makbn/java_leaflet
9+ Project Wiki: https://github.com/makbn/java_leaflet/wiki
910
1011![ Java-Leaflet Test] ( https://github.com/makbn/java_leaflet/blob/master/.github/doc/app.png?raw=true )
1112
@@ -15,15 +16,6 @@ Project Source Code: https://github.com/makbn/java_leaflet
1516> and mobile platforms, can be extended with lots of plugins, has a beautiful, easy to use and well-documented API and a
1617> simple, readable source code that is a joy to contribute to.
1718
18- ## 🚀 New in Version 2.0.0
19-
20- - ** Multi-Module Architecture** : Clean separation between API, JavaFX, and Vaadin implementations
21- - ** Vaadin Support** : New Vaadin component implementation alongside existing JavaFX support
22- - ** Unified API** : Consistent interface across different UI frameworks
23- - ** Enhanced Modularity** : Better separation of concerns and extensibility
24- - ** Modern Java** : Full Java 17+ and JPMS support
25- - ** Comprehensive Documentation** : Complete JavaDoc coverage with usage examples and technical details
26-
2719## 🏗️ Project Structure
2820
2921This project is now organized as a multi-module Maven project:
@@ -49,14 +41,18 @@ java_leaflet/
4941- ** Multi-Framework Support** : JavaFX and Vaadin implementations
5042- ** Java Platform Module System (JPMS) Compatible** : Fully modularized for Java 17+
5143- ** Unified API** : Consistent interface across different UI frameworks
52- - ** Multiple Map Providers** : Support for OpenStreetMap, Mapnik, and other tile providers
44+ - ** Multiple Map Providers** : Support for OpenStreetMap, Mapnik, and other tile providers with the ability to add custom
45+ providers
5346- ** Interactive Features** : Markers, polygons, polylines, circles, and more
54- - ** Event Handling** : Comprehensive event system for map interactions
55- - ** GeoJSON Support** : Load and display GeoJSON data
47+ - ** Event Handling** : Comprehensive bi-directional event system for map interactions, receiving events from client and
48+ sending commands to the map
49+ - ** GeoJSON Support** : Load and display GeoJSON data with support for custom styling and filtering
5650- ** Customizable** : Extensive customization options for map appearance and behavior
5751- ** Fluent API** : Builder pattern and method chaining for easy configuration
52+ - ** Context Menus** : Support for native context menus on map and objects for both implementations
5853
59- The goal is to match all the features across both implementations while maintaining a clean and modular architecture.
54+ The goal is to match almost all the native Leaflet features across both implementations while maintaining a clean and
55+ modular architecture.
6056However, some features may be available at the moment. To see which features are supported in each implementation,
6157refer to the [ Feature Comparison Table] ( Feature.md ) .
6258
@@ -65,7 +61,7 @@ refer to the [Feature Comparison Table](Feature.md).
6561- ** Java** : 17 or higher
6662- ** Maven** : 3.6+ (for building)
6763- ** JavaFX** : 19.0.2.1 or higher (for JavaFX implementation)
68- - ** Vaadin** : 24.8.6 or higher (for Vaadin implementation)
64+ - ** Vaadin** : 24 or higher (for Vaadin implementation)
6965
7066## 🚀 Quick Start
7167
@@ -74,6 +70,7 @@ refer to the [Feature Comparison Table](Feature.md).
7470Add the JavaFX dependency to your ` pom.xml ` :
7571
7672``` xml
73+
7774<dependency >
7875 <groupId >io.github.makbn</groupId >
7976 <artifactId >jlmap-fx</artifactId >
@@ -86,6 +83,7 @@ Add the JavaFX dependency to your `pom.xml`:
8683Add the Vaadin dependency to your ` pom.xml ` :
8784
8885``` xml
86+
8987<dependency >
9088 <groupId >io.github.makbn</groupId >
9189 <artifactId >jlmap-vaadin</artifactId >
@@ -170,49 +168,83 @@ public class VaadinMapExample extends VerticalLayout {
170168``` java
171169// Change the current coordinate
172170map. setView(JLLatLng . builder()
173- .lng(10 )
174- .lat(10 )
175- .build());
171+ .
172+
173+ lng(10 )
174+ .
175+
176+ lat(10 )
177+ .
178+
179+ build());
176180
177181// Map zoom functionalities
178- map. getControlLayer(). setZoom(5 );
179- map. getControlLayer(). zoomIn(2 );
180- map. getControlLayer(). zoomOut(1 );
182+ map.
183+
184+ getControlLayer().
185+
186+ setZoom(5 );
187+ map.
188+
189+ getControlLayer().
190+
191+ zoomIn(2 );
192+ map.
193+
194+ getControlLayer().
195+
196+ zoomOut(1 );
181197```
182198
183199### Adding Markers
184200
185201``` java
186202// Add a marker to the UI layer
187203JLMarker marker = map. getUiLayer()
188- .addMarker(JLLatLng . builder()
189- .lat(35.63 )
190- .lng(51.45 )
191- .build(), " Tehran" , true );
204+ .addMarker(JLLatLng . builder()
205+ .lat(35.63 )
206+ .lng(51.45 )
207+ .build(), " Tehran" , true );
192208
193209// Add event listeners
194- marker. setOnActionListener((jlMarker, event) - > {
195- if (event instanceof ClickEvent ) {
196- System . out. println(" Marker clicked: " + jlMarker);
210+ marker.
211+
212+ setOnActionListener((jlMarker, event) - > {
213+ if (event instanceof ClickEvent ){
214+ System . out.
215+
216+ println(" Marker clicked: " + jlMarker);
197217 }
198- });
218+ });
219+
220+ marker.
221+
222+ remove(); // Remove the marker
199223```
200224
201- ### Adding Shapes
225+ ### Adding GeoJSON
202226
203227``` java
204- // Add a circle
205- map. getVectorLayer()
206- .addCircle(JLLatLng . builder()
207- .lat(35.63 )
208- .lng(51.45 )
209- .build(),
210- 30000 ,
211- JLOptions . builder()
212- .color(JLColor . BLACK )
213- .build());
228+ import io.github.makbn.jlmap.model.JLGeoJsonOptions ;
229+
230+ // Load GeoJSON with custom styling
231+ JLGeoJsonOptions options = JLGeoJsonOptions . builder()
232+ .styleFunction(features - > JLOptions . builder()
233+ .fill(true )
234+ .fillColor(JLColor . fromHex((String ) features. get(0 ). get(" fill" )))
235+ .fillOpacity((Double ) features. get(0 ). get(" fill-opacity" ))
236+ .stroke(true )
237+ .color(JLColor . fromHex((String ) features. get(0 ). get(" stroke" )))
238+ .build())
239+ .build();
240+
241+ JLGeoJson styledGeoJson = map. getGeoJsonLayer()
242+ .addFromUrl(" https://example.com/data.geojson" , options);
214243```
215244
245+ Read more about examples in
246+ the [ Examples and Tutorials] ( https://github.com/makbn/java_leaflet/wiki/Examples-and-Tutorials ) page.
247+
216248### Layer Management
217249
218250The API provides access to different map layers:
@@ -266,51 +298,6 @@ mvn test
266298mvn package
267299```
268300
269- ### Module-Aware Building
270-
271- The project uses Maven's module-aware compilation. Each module has its own ` module-info.java ` file defining the module
272- structure and dependencies.
273-
274- ## Module Dependencies
275-
276- ### API Module (` jlmap-api ` )
277-
278- ** Exports:**
279-
280- - ` io.github.makbn.jlmap ` - Main package
281- - ` io.github.makbn.jlmap.layer ` - Layer management
282- - ` io.github.makbn.jlmap.layer.leaflet ` - Leaflet-specific layer interfaces
283- - ` io.github.makbn.jlmap.listener ` - Event listeners
284- - ` io.github.makbn.jlmap.model ` - Data models
285- - ` io.github.makbn.jlmap.exception ` - Custom exceptions
286- - ` io.github.makbn.jlmap.geojson ` - GeoJSON support
287- - ` io.github.makbn.jlmap.engine ` - Web engine abstractions
288-
289- ** Dependencies:**
290-
291- - SLF4J for logging
292- - Gson and Jackson for JSON processing
293- - JetBrains annotations
294- - JUnit for testing
295-
296- ### JavaFX Module (` jlmap-fx ` )
297-
298- ** Dependencies:**
299-
300- - ` jlmap-api ` module
301- - JavaFX modules (controls, base, swing, web, graphics)
302- - JDK modules (jsobject)
303-
304- ### Vaadin Module (` jlmap-vaadin ` )
305-
306- ** Dependencies:**
307-
308- - ` jlmap-api ` module
309- - Vaadin Spring Boot Starter
310- - Vaadin Core components
311-
312- ## Migration from Version 1.x
313-
314301If you're migrating from version 1.x:
315302
3163031 . ** Update Dependencies** : Change from ` jlmap ` to ` jlmap-fx ` or ` jlmap-vaadin `
@@ -326,6 +313,7 @@ v2.0.0
326313** Before (v1.x):**
327314
328315``` xml
316+
329317<dependency >
330318 <groupId >io.github.makbn</groupId >
331319 <artifactId >jlmap</artifactId >
@@ -343,11 +331,11 @@ v2.0.0
343331 <version >2.0.0</version >
344332</dependency >
345333
346- <!-- For Vaadin -->
334+ <!-- For Vaadin -->
347335<dependency >
348- <groupId >io.github.makbn</groupId >
349- <artifactId >jlmap-vaadin</artifactId >
350- <version >2.0.0</version >
336+ <groupId >io.github.makbn</groupId >
337+ <artifactId >jlmap-vaadin</artifactId >
338+ <version >2.0.0</version >
351339</dependency >
352340```
353341
@@ -387,29 +375,6 @@ the [LICENSE](LICENSE) file for details.
387375
388376** Matt Akbarian** (@makbn )
389377
390- ## Changelog
391-
392- ### Version 2.0.0
393-
394- - ** Major** : Refactored to multi-module Maven project
395- - ** Major** : Added Vaadin component implementation
396- - ** Major** : Separated API from implementations
397- - ** Major** : Enhanced modularity with JPMS support
398- - ** Enhancement** : Unified API across different UI frameworks & Improved Fluent API
399- - ** Enhancement** : Improved separation of concerns
400- - ** Enhancement** : Added comprehensive demo applications
401- - ** Enhancement** : Complete JavaDoc documentation with usage examples and technical details
402- - ** Fix** : Resolved module system compatibility issues
403-
404- ### Version 1.9.5
405-
406- - ** Major** : Upgraded to Java Platform Module System (JPMS)
407- - ** Major** : Updated to Java 17 compatibility
408- - ** Major** : Removed internal JavaFX API dependencies
409- - ** Enhancement** : Improved module structure and encapsulation
410- - ** Enhancement** : Updated Maven configuration for module support
411- - ** Fix** : Resolved Lombok annotation processing in module environment
412-
413378## Roadmap
414379
415380- [X] Multi-module architecture
@@ -420,19 +385,15 @@ the [LICENSE](LICENSE) file for details.
420385- [X] Better map provider support
421386- [X] Support receiving events on Map and Objects
422387- [X] Support calling methods on JLObjects to set or update value on Js side
388+ - [ ] Publish to Vaadin Directory
423389- [ ] SVG support
424390- [ ] Animation support
425- - [ ] Performance optimizations
426391- [ ] implement object specific ` JLOptions `
392+ - [ ] Performance optimizations
427393
428394## Additional Resources
429395
430396- ** API Documentation** : See the ` jlmap-api ` module for core interfaces
431397- ** JavaFX Examples** : See the ` jlmap-fx ` module for JavaFX usage
432398- ** Vaadin Examples** : See the ` jlmap-vaadin-demo ` for Vaadin usage
433399- ** Leaflet Documentation** : [ https://leafletjs.com/ ] ( https://leafletjs.com/ )
434-
435- ---
436-
437- ** Disclaimer** : This project was originally implemented for academic research in geo-visualization. While not actively
438- maintained, it provides a solid foundation for Java-based mapping applications with multiple UI framework support.
0 commit comments