GoogleApis - To be or not to be that is the question

Star-Dust

Expert
Licensed User
Longtime User
Since the GMaps javascript api is no longer fully compatible with WebView (Desktop), various software have problems as they only display the satellite map.

I looked for alternatives with alternative classes to WebView and there are several of excellent quality, some for a fee but which guarantee many functions like a Browser.
It would be an optimal solution if it weren't for the fact that some are paid and I haven't been able to implement them.

So I resorted to the browser managed by b4J with the help of a Javascript code that acts as a collector.

The result is almost sufficient, there is still a lot to work on... but it is a positive hope to guarantee at least the minimum of functions

1717759426906.png
 

Star-Dust

Expert
Licensed User
Longtime User
It seems complete but still missing: Marker, InfoWindow, GroundOverlay, Directions, Street View
I probably won't be able to fit everything in... but we'll see

jSDGoogleMaps

Author:
Star-Dust
Version: 1
  • SD_GM
    • Events:
      • Clicked (Lat As Doble, Lng As Double)
      • DoubleClicked (Lat As Doble, Lng As Double)
      • MapMoved (Lat As Doble, Lng As Double)
      • MouseMoved (Lat As Doble, Lng As Double)
    • Functions:
      • AddCircle (Lat As Double, Lng As Double, Color As Int, Border As Int, meter As Int) As String
      • AddCircleByMap As String
      • AddLine (lat1 As Double, lng1 As Double, lat2 As Double, lng2 As Double, Color As Int) As String
      • AddPoLine (listOfPointMap As List, Color As Int) As String
        AddPoLine(Array As Map (CreateMap("lat":Lat1,"lng":Lng1),CreateMap("lat":Lat2,"lng":Lng2),CreateMap("lat":Lat3,"lng":Lng3)))
      • AddPoLineByMap As String
      • AddPolygon (Nome As String, Nota As String, Color As Int, ListOfPointMap As List) As String
        AddPolygon(array as map(CreateMap("lat":37.12,"lng":15.01)))
      • AddPolygonByMap As String
      • AddRecByMap As String
      • Class_Globals As String
      • DeleteCircle As String
      • DeleteLastCircle As String
      • DeleteLastPoline As String
      • DeleteLastPolygon As String
      • DeletePoline As String
      • DeletePolygon As String
      • HideCircle As String
      • HidePoline As String
      • HidePolygon As String
      • Initialize (CallBack As Object, EventName As String, ApiKey As String) As String
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • ShowCircle As String
      • ShowPoline As String
      • ShowPolygon As String
      • Start As String
      • Stop As String

Esample
B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
 
    Dim GoogleMaps As SD_GM
    Public srvr As Server
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
     MainForm.RootPane.LoadLayout("Main")
    MainForm.Show
    MainForm.Resizable=False
    MainForm.AlwaysOnTop=True
    MainForm.WindowLeft=fx.PrimaryScreen.MaxX-MainForm.Width
    MainForm.WindowTop=0
 
    GoogleMaps.Initialize(Me,"GoogleMaps","AIzaSyCFYoy0NOKz_4hIWw-ISRBSusb6obUWQ70")
    GoogleMaps.Start
    fx.ShowExternalDocument("http://127.0.0.1/")
End Sub

Private Sub MainForm_Closed
    'GoogleMaps.Stop
    ExitApplication
End Sub

Private Sub ButtonLine_Click
    GoogleMaps.AddPoLineByMap
End Sub

Private Sub ButtonRec_Click
    GoogleMaps.AddRecByMap
End Sub

Private Sub ButtonCircle_Click
    GoogleMaps.AddCircleByMap
End Sub

Private Sub ButtonPolygon_Click
    GoogleMaps.AddPolygonByMap
End Sub

Private Sub CheckPoline_CheckedChange(Checked As Boolean)
    If Checked Then GoogleMaps.ShowPoline Else GoogleMaps.HidePoline
End Sub

Private Sub CheckPolygon_CheckedChange(Checked As Boolean)
    If Checked Then GoogleMaps.ShowPolygon Else GoogleMaps.HidePolygon
End Sub

Private Sub CheckCicle_CheckedChange(Checked As Boolean)
    If Checked Then GoogleMaps.ShowCircle Else GoogleMaps.HideCircle
End Sub
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
While working on my library I managed to get it working inside a WebView.

My intuition was right, version 3.56 should have been specified and not 3.exp which uses jGoogleMaps. And so it works correctly.

I don't know if @Erel will update the JGoogleMpas library. If he updates it I will stop, because it takes time that I don't have, but if he doesn't update it I will continue to develop my
 
Top