B4J Question ABMGoogleMaps - Click event does not work over polygons.

Rob White

Member
Licensed User
Hi All,
Has anyone else experienced this problem?

If you draw a polygon using AddPolygon() the click event does not work over that polygon.
Does anyone know how I can activate the click event in this situation?
 

Rob White

Member
Licensed User
No straight on page, here is ConnectPage.
B4X:
public Sub ConnectPage()           
    Dim labTitle As ABMLabel = ABMlab.Add2Page(page,"labtitle",Act.PageTitle1(ws),ABM.SIZE_H5,1,1)
    
    Dim cboCrop As ABMCombo = ABMcbo.Add2Page(page,"cbocrop","Crop",2,1)
    Dim cboVariety As ABMCombo = ABMcbo.Add2Page(page,"cbovariety","Variety",2,2)
    Dim cboFert As ABMCombo = ABMcbo.Add2Page(page,"cbofert","Fertiliser",2,3)
    
    Dim inpCropRate As ABMInput = ABMInp.Add2Page(page,"inpcroprate","kgs/ha",ABM.INPUT_NUMBER,False,3,1)
    Dim inpFertRate As ABMInput = ABMInp.Add2Page(page,"inpfertrate","kgs/ha",ABM.INPUT_NUMBER,False,3,3)
    ' TBD  fill crop with default rate
    inpFertRate.Text = "80"
    
    Dim gmap As ABMGoogleMap
    gmap.Initialize(page,"gmap",-35.06734,147.44832,15,800,ABM.GOOGLEMAPTYPE_SATELLITE,0)
    gmap.Draggable=True
    gmap.HasZoomControl = True
    page.Cell(4,1).AddComponent(gmap)
    
    ' refresh the page
    page.Refresh
    
    ' Tell the browser we finished loading
    page.FinishedLoading
    
    DrawMap(gmap)
    
    
    
    ' Paddocks without boundary data
'    Select P.ID, P.Name As Pname, F.name As Fname, C.name As Cname
'    FROM Paddocks As P, Farms As F, Clients As C
'    WHERE P.Name Not IN
'        (Select P.name FROM PadGeoMarkers As PGM WHERE PGM.PadID = P.ID)  And
'         P.FarmID = F.id And F.ClientId = C.ID
'     ORDER BY Cname,Fname,Pname Asc   
End Sub

Sub DrawMap(GM As ABMGoogleMap)
    Dim AllP As List = DBUtils.ExecuteListOfMaps(Main.PDsql,$"SELECT ID FROM PadGeoMarkers"$)    
    Dim aPad As Map
    aPad.Initialize
    For i = 0 To AllP.Size-1
        aPad = AllP.Get(i)
        Dim nuPad As GMapPad
        nuPad.Initialize
        If nuPad.LoadPad(aPad.get("ID")) Then
            Pads.Put(nuPad.Pid,nuPad)
            Dim IDstr As String = "Poly"&nuPad.Pid
'            For i = 0 To nuPad.PolyPts.Size-1
'                LogDebug($"${i}  ${nuPad.PolyPts.Get(i)}"$)
'            Next
            GM.AddPolygon(IDstr,nuPad.PolyPts, ABM.COLOR_WHITE, ABM.INTENSITY_DARKEN4, 1, 1,ABM.COLOR_green,ABM.INTENSITY_ACCENT1,.5)
            IDstr = "Mkr"&nuPad.Pid
            'GM.AddMarker(IDstr,nuPad.Centroid.lat,nuPad.Centroid.lon,ABM.COLOR_red,nuPad.PadName,"")
        End If
    Next
    GM.Refresh
End Sub
 
Upvote 0
Top