Running the MapWithMarkers demo resulted in the error:
Cannot get methods of class: uk.co.martinpearman.b4j.jfxtras.labs.map.MapPane, disabling cache.
What could I be doing wrong?
And when would the next tranche of examples follow? - like those for android!
Can you post the full error message?
Have you tried to run it in release mode?
Is anyone still using or interested in using the MapPane?
There's been very little feedback in this thread.
I was gonna upload the library to it's own thread - thinking it was ready for a proper release.
But i think the library is still only beta quality at best so i'll upload the latest update to this thread.
Bad news
This update will break existing apps!
That's mainly because the various MapPane Initialize methods now require an EventName parameter:
- Initialize (EventName As String)
Initialize the MapPane.
The MapPane will have a size of 800x600 and display Mapnik tiles.- Initialize2 (EventName As String, TileSource1 As TileSource)
Initialize the MapPane.
The MapPane will have a size of 800x600 and display tiles from TileSource1.- Initialize3 (EventName As String, TileSource1 As TileSource, X As Int, Y As Int, Width As Int, Height As Int, Zoom As Int)
Initialize the MapPane.
The MapPane will have the defined size and display tiles from TileSource1.
Good news
The MapPane now raises various events which add considerably to it's capabilities:
- MouseClicked (EventData As MouseEvent)
- MouseDragged (EventData As MouseEvent)
- MouseMoved (EventData As MouseEvent)
- MousePressed (EventData As MouseEvent)
- MouseReleased (EventData As MouseEvent)
- Rendered
- Resize (Width As Double, Height As Double)
The MapNodeHost now has a method SetAutoFix (AutoFix As Boolean) which determines whether the MapNodeHost will auto adjust it's position to keep itself wholly displayed on the map.
The SimpleMapMarker and ImageMapMarker MouseClicked event now also passes a MouseEvent to B4J (again this will break existing code):
- MouseClicked (ImageMapMarker1 As ImageMapMarker, MouseEvent1 As MouseEvent)
- MouseClicked (SimpleMapMarker1 As SimpleMapMarker, MouseEvent1 As MouseEvent)
The MapPane 'loading tile' image has also been updated and the MapPane now has methods SetErrorTile (ErrorTile As Image) and SetLoadingTile (LoadingTile As Image) to set the 'loading tile' image and also the 'tile failed to load' image.
That sums up the main changes, the library is now at version 0.09 and is attached with a demo project that shows how to turn a mouse click into a latitude, longitude Coordinate.
Also attached in an updated jCoreExtras.
All and any feedback welcomed!
Martin.
Dim parser As JSONParser
parser.Initialize(res)
Dim m As Map=parser.NextObject
x=m.Get("x")
y=m.Get("y")
lista_sn.Items.Add(m.Get("nazwa"))
MapPane1.SetDisplayPositionByLatLon2(x, y,18)
Program started.
Cannot get methods of class: uk.co.martinpearman.b4j.jfxtras.labs.map.MapPane, disabling cache.
java.lang.NoClassDefFoundError: uk/co/martinpearman/b4j/java/awt/Point
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at anywheresoftware.b4a.shell.Shell$MethodCache.getMethod(Shell.java:864)
at anywheresoftware.b4a.shell.Shell.getMethod(Shell.java:524)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:653)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:232)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:90)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:462)
at anywheresoftware.b4a.keywords.Common.access$0(Common.java:442)
at anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Common.java:516)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: uk.co.martinpearman.b4j.java.awt.Point
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 26 more
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NoClassDefFoundError: uk/co/martinpearman/b4j/java/awt/Point
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:471)
at anywheresoftware.b4a.keywords.Common.access$0(Common.java:442)
at anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Common.java:516)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: uk/co/martinpearman/b4j/java/awt/Point
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:90)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:462)
Sub MapPane1_MouseClicked(EventData As MouseEvent)
Log(MapPane1.GetCoordinate(EventData.X,EventData.Y))
Log(EventData)
End Sub
Is anyone still using or interested in using the MapPane?
...
The MapNodeHost now has a method SetAutoFix (AutoFix As Boolean) which determines whether the MapNodeHost will auto adjust it's position to keep itself wholly displayed on the map.
The SimpleMapMarker and ImageMapMarker MouseClicked event now also passes a MouseEvent to B4J (again this will break existing code):
...
- MouseClicked (ImageMapMarker1 As ImageMapMarker, MouseEvent1 As MouseEvent)
- MouseClicked (SimpleMapMarker1 As SimpleMapMarker, MouseEvent1 As MouseEvent)
Martin.
@gvoulg
Yes that's possible.
Here's a snippet that contains everything you need:
B4X:Sub Process_Globals Private fx As JFX Private MainForm As Form Private MapPane1 As MapPane End Sub Sub AppStart (Form1 As Form, Args() As String) MainForm = Form1 MainForm.Title="jFXtrasMapPane demo" ' the offline tiles used in this example can be downloaded from ' http://b4j.martinpearman.co.uk/jfxtras.labs.map/tiles/map_of_the_uk.zip ' be sure to modify the path to the offline tiles in CustomTileSource1.Initialize2 Dim CustomTileSource1 As CustomTileSource CustomTileSource1.Initialize2("Panorama", "C:\Users\martin\Programming\Basic4Java\jFXtrasMapPane\CustomTileSource-demo\map_of_the_uk", 0, 3) ' the offline custom tiles are JPG images ' so i'll use a CustomTilePathBuilder so jpg tiles are requested ' (by default png tile are requested) Dim CustomTilePathBuilder1 As CustomTilePathBuilder CustomTilePathBuilder1.Initialize CustomTilePathBuilder1.SetTileType("jpg") CustomTileSource1.SetTilePathBuilder(CustomTilePathBuilder1) MapPane1.Initialize3("", CustomTileSource1, 0, 0, 640, 480, 0) MapPane1.SetDisplayPositionByLatLon(0, 0) MainForm.RootPane.AddNode(MapPane1, 0, 0, 640, 480) MainForm.Show End Sub
Martin.
@gvoulg
Yes that's possible.
Here's a snippet that contains everything you need:
B4X:Sub Process_Globals Private fx As JFX Private MainForm As Form Private MapPane1 As MapPane End Sub Sub AppStart (Form1 As Form, Args() As String) MainForm = Form1 MainForm.Title="jFXtrasMapPane demo" ' the offline tiles used in this example can be downloaded from ' http://b4j.martinpearman.co.uk/jfxtras.labs.map/tiles/map_of_the_uk.zip ' be sure to modify the path to the offline tiles in CustomTileSource1.Initialize2 Dim CustomTileSource1 As CustomTileSource CustomTileSource1.Initialize2("Panorama", "C:\Users\martin\Programming\Basic4Java\jFXtrasMapPane\CustomTileSource-demo\map_of_the_uk", 0, 3) ' the offline custom tiles are JPG images ' so i'll use a CustomTilePathBuilder so jpg tiles are requested ' (by default png tile are requested) Dim CustomTilePathBuilder1 As CustomTilePathBuilder CustomTilePathBuilder1.Initialize CustomTilePathBuilder1.SetTileType("jpg") CustomTileSource1.SetTilePathBuilder(CustomTilePathBuilder1) MapPane1.Initialize3("", CustomTileSource1, 0, 0, 640, 480, 0) MapPane1.SetDisplayPositionByLatLon(0, 0) MainForm.RootPane.AddNode(MapPane1, 0, 0, 640, 480) MainForm.Show End Sub
Martin.
I would like to be able to execute your code to incorporate offline tiles, but I can not download the example in the offline tiles used in this example can be downloaded from
http://b4j.martinpearman.co.uk/jfxtras.labs.map/tiles/map_of_the_uk.zip
With MOBAC, in what format should I create the offline map?
Thanks in advance!
THANKS!!Grab the zip file of map tiles from here:
http://b4a.martinpearman.co.uk/temp/map_of_the_uk.zip
Please is it possible to use zip map file format like in Osmdroid for B4A ? - I can use zip file in Osmdroid for B4A. I do not have to unzip it.THANKS!!
Thank you. It works perfectly. However I thought that it allowed to see aerial images offline, but I see that the coordinates are not "real".
Is there any way to have tile source (aerial images) locally created with MOBAC?
OpenStreetMap does not have a hybrid mode ... and I would like to make an app with this control, not with GoogleMap (may be paid)
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?