Porting mapsforge to JavaFX

403 views
Skip to first unread message

Karl

unread,
Dec 30, 2013, 7:33:53 PM12/30/13
to mapsfo...@googlegroups.com
Hi,

I am interested in a port of mapsforge to JavaFX. I noticed that there is a Swing version which, as I understand some of the posts, seems not to be working.

I might be working on such a port to JavaFX, but I guess, I would need some help.

The intention is to get mapsforge running on something like the DukePad (https://wiki.openjdk.java.net/display/OpenJFX/DukePad), at least on a Raspberry Pi with a touch pad and some GPS receiver, for a start.

Maybe someone could tell me, how difficult it would be to create such a port and give me some hint about where so start.

Thanks in advance

Karl

emux

unread,
Dec 31, 2013, 4:02:27 AM12/31/13
to mapsfo...@googlegroups.com
Hi Karl,

Actually Swing version of mapsforge (rescue branch) is working again after the latest patches.

Which version of JavaFX ?
As JavaFX 2.0+ is now implemented as a native Java library
and therefore applications using JavaFX can be written in native Java code.

From the rewrite branch mapsforge is separated to core libraries and
2D graphics ones (mapsforge-map-android and mapsforge-map-awt).
With this abstraction layer the map rendering and the displaying of
layers can be used besides Android also on other platforms.
The first successful implementation is for AWT.

You may need to examine mapsforge-map-awt to see exactly
how these wrapper classes delegate the calls to the native ones

Best regards, Emux
https://play.google.com/store/apps/details?id=gr.talent.cruiser

Karl

unread,
Dec 31, 2013, 4:56:07 AM12/31/13
to mapsfo...@googlegroups.com
Hi Emux,

thank you for your help! I guess I will give it a try. By the way, I am talking about JavaFX 2.0+ (and Java 1.8.0).

Could you give me some help about what I need to do to get the Swing-Version running? Running the MapViewer I always get a NullPointerException, presumably because no map file is loaded. How do I archive this? Do I have to set some properties -- for example to set the position in MapViewPosition.init?  Is there anything else?

Thank you in advance for your help!

Karl

emux

unread,
Dec 31, 2013, 5:17:10 AM12/31/13
to mapsfo...@googlegroups.com
Hi Karl,

Using the rescue branch:
http://code.google.com/r/ludwigbrinckmann-mapsforge/source/browse?name=rescue

at line 111 of MapViewer class you have to hard code the path of your map file.
Then the map will be loaded fine.

If you're talking about the NPE at MapScaleBar.draw it's harmless.
Just the scale bar tries to draw prior the map view dimension has a value.

Karl

unread,
Dec 31, 2013, 6:36:03 AM12/31/13
to mapsfo...@googlegroups.com
Hi Emux,

thanks again. I think I am all set now for the time being and can start to analyse the code.

Karl

womisa

unread,
Dec 31, 2013, 8:01:06 AM12/31/13
to mapsfo...@googlegroups.com
Hi

I've made a "horrible" DesktopVersion with the Mapsforge-Rescue and Routers (Graphhopper, BRouter)  in a early beta state (!!) However, I'm not a Java expert and cann only sparsely English
You can test it http://www.augilabs.de/download/beta/MySwingMapViewer.rar

Thanks for the MapsforgeRescueWriters
Achim
Reply all
Reply to author
Forward
0 new messages