B4i Library [class]GoogleMapsExtra

Status
Not open for further replies.
This class extends GoogleMaps library.
Currently it supports:
- AddCircle - Adds a circle at a give point.
- AddGroundOverlay - Adds an image at the given bounds.
- ZoomToPoints
- SetSelectedMarker
- SetMarkerRotation
- SetGroundAnchor - sets the marker anchor.
- AddPolygon


Example:
B4X:
gextra.Initialize(gmap)
Dim ne, sw As LatLng
ne.Initialize(20, 20)
sw.Initialize(00, 00)
Dim bounds As Object = gextra.CreateBounds(ne, sw)
gextra.AddGroundOverlay(bounds, LoadBitmap(File.DirAssets, "up76.png"))

Note that the bundle in the special folder is not included. You need to download it from the tutorial.

Updates:

v2.15 - New AnimateCameraWithDuration method. Same as gmap.AnimateCamera with configurable duration.
v2.10 - Adds support for custom info windows (appear when the user clicks on a marker).

You need to add this event sub and create the custom panel or return Null:
B4X:
'Return Null for the default marker layout
Sub gmap_MarkerInfoWindow (OMarker As Object) As Object
   Dim SelectedMarker As Marker = OMarker
   Dim p As Panel
   p.Initialize("")
   p.Color = Colors.Red
   p.SetLayoutAnimated(0, 1, 0, 0, 200, 200)
   Dim lbl As Label
   lbl.Initialize("")
   lbl.Text = SelectedMarker.Title
   p.AddView(lbl, 10, 10, 200, 200)
   Return p
End Sub
 

Attachments

  • GoogleMapsExtra.zip
    10.7 KB · Views: 67
Last edited:

iCAB

Well-Known Member
Licensed User
Longtime User
Hi All
I am looking for the equivalent of:

B4X:
GoogleMapsExtras.Snapshot

as in B4A.

Any help is greatly appreciated.
 

iCAB

Well-Known Member
Licensed User
Longtime User
Hi all
Does anyone know how to show/hide the traffic layer.

Thanks in advance
 

iCAB

Well-Known Member
Licensed User
Longtime User
Thanks Erel,
Unbelievable I was so focused on GoogleMapsExtra (as this is what I used with B4A) to the point that forgot to check GoogleMaps :(
 

Paul Leischow

Member
Licensed User
Longtime User
After upgrading to lastest B4I v4.00, the GoogleMapsExtra command AddCircle now returns an empty string.
What am I missing?
 

Paul Leischow

Member
Licensed User
Longtime User
Oops... Right you are :)
Turns out I modified the GoogleMapsExtra.bas file so AddCircle returned a value and when I updated to latest version I lost the Mod.

Any chance we can have this SUB changed in the official file to make it more useful ??

Public Sub AddCircle (Lat As Double, Lon As Double, Radius As Double, Color As Int) As NativeObject
Dim circle As NativeObject = no.RunMethod("createCircle:::", Array(Lat, Lon, Radius))
circle.SetField("map", gm)
circle.SetField("strokeWidth", 5)
circle.SetField("fillColor", circle.ColorToUIColor(Color))
circle.SetField("strokeColor", circle.ColorToUIColor(Color))
Return Circle
End Sub
 

Arnaud

Active Member
Licensed User
Longtime User
Hello,

Is it possible to display a polygone "open" and no close? or maybe to display a single line?

Thanks
 
Status
Not open for further replies.
Top