### GMapsFX API

Google Maps GMapsFX API.
Reference http://rterp.github.io/GMapsFX/apidocs/
See also the B4J jGoogleMaps Tutorial:
https://www.b4x.com/android/forum/threads/jgooglemaps-library.56744/#content
If functionality is missing as provided by the jGoogleMaps library, then develop own subroutines by using the Google Maps API.
See B4J HowTo Category Google Maps > GMapsFX API or JavaScript API (which is my favorite to use).
Usage of the API
With JavaObject example for Calculating the Distance between two points using the class LatLong
Defined in the API
Java Class LatLong
java.lang.Object
com.lynden.gmapsfx.javascript.JavascriptObject
com.lynden.gmapsfx.javascript.object.LatLong
Java Constructor and Description
LatLong(double latitude, double longitude)
Java API Method distanceFrom
public double distanceFrom(LatLong end)
Calculates the distance between this LatLong point and another.
Parameters: end - The end point to calculate the distance to.
Returns: Distance, in metres, to the end point.
This is translated into B4J Code using a Sub
`Sub MapDistanceBetween(mLatFrom As Double, mLonFrom As Double, mLatTo As Double, mLonTo As Double) As Double
'Define the JavaObject holding the From Position
Dim joLatLonFrom As JavaObject
'Create the constructor using the From Position Latitude and Longitude.
'The JavaObject joLatLonFrom holds now the From Postion
joLatLonFrom.InitializeNewInstance("com.lynden.gmapsfx.javascript.object.LatLong", Array(mLatFrom, mLonFrom))
'Create a LatLng object for the To Position
Dim mLatLonTo As LatLng
'Init the To Position with the Latitude and Longitude Parameters
mLatLonTo.Initialize(mLatTo, mLonTo)
'Apply the API method distanceFrom to get the distance between the points.
'Important to use exact case for the API method - so stick to distanceFrom and do not use like DistanceFrom
Return joLatLonFrom.RunMethod("distanceFrom", Array(mLatLonTo))
End Sub`
Some examples
To cut and paste for usage - more in the various GoogleMap HowTos.
'Calculate the distance in m between two points via a JavaObject
'Example: mDistance = MapDistanceBetween(mLatC, mLonC, mLatP, mLonP)
`Sub MapDistanceBetween(mLatFrom As Double, mLonFrom As Double, mLatTo As Double, mLonTo As Double) As Double
Dim joLatLonFrom As JavaObject
joLatLonFrom.InitializeNewInstance("com.lynden.gmapsfx.javascript.object.LatLong", Array(mLatFrom, mLonFrom))
Dim mLatLon As LatLng
mLatLon.Initialize(mLatTo, mLonTo)
Return joLatLonFrom.RunMethod("distanceFrom", Array(mLatLon))
End Sub`
'Attach an infowindow to a marker
'Uses a JavaObject (see API ref: rterp.github.io/GMapsFX/apidocs/ , select infowindow)
`Sub MarkerAttachInfoWindow (Marker As Marker, Text As String)
Dim infoWindow As JavaObject
infoWindow.InitializeNewInstance("com.lynden.gmapsfx.javascript.object.InfoWindow", Null)
infoWindow.RunMethod("setContent", Array (Text))
MarkerMap.Put(Marker, infoWindow)
End Sub`
'Get the EarthRadiusMeters. Returns 6378137.0
`Sub MapEarthRadiusMeters As Double
Dim joLatLonFrom As JavaObject
joLatLonFrom.InitializeStatic("com.lynden.gmapsfx.javascript.object.LatLong")
Return joLatLonFrom.GetField("EarthRadiusMeters")
End Sub`

Changed: , Category: Google Maps, File: T6C197M1444.htm, ID: 1444