Sub gm1_Clicked(Latitude As Double, Longitude As Double) ' ABMaterial google map clicked event
If pntedit Then ' if editing a previously created polygon point placement
Dim str1 As String = NumberFormat2(Latitude,0,6,6,False)
Dim str2 As String = NumberFormat2(Longitude,0,6,6,False)
Dim lat1 As Double = str1
Dim lon1 As Double = str2
gm1.AddMarker("newmarker" , str1, str2, ABM.COLOR_BLUE, "New", "")
gm1.refresh ' IMPORTANT
Log("Marker: "&lat1&" "&lon1)
Dim SQL As SQL = DBM.GetSQL
SQL.ExecNonQuery2("UPDATE zonedet set lat = ?,lon = ? where pk = ?",Array As Object(lat1,lon1,sel_pnt)) ' update the old point to new location
DBM.CloseSQL(SQL)
' Toast(" Select Zone Name to Refresh This Item",3000)
Checkselected(lat1,lon1)
tblcases_clicked(rclist)
'pntedit = False
End If
If pntnew Then ' if creating a new polygon from scratch
Dim str1 As String = NumberFormat2(Latitude,0,6,6,False) ' force to six decimal place
Dim str2 As String = NumberFormat2(Longitude,0,6,6,False)
Dim lat1 As Double = str1 ' convert back to double (probably not needed)
Dim lon1 As Double = str2
gm1.AddMarker("newmarker" , str1, str2, ABM.COLOR_BLUE, "New", "")
Markers.Add(lat1)
Markers.Add(lon1)
Mark.Put(lat1,lon1)
gm1.RemovePolyLines ' remove what was created so far
gm1.AddPolyLine(Markers, ABM.COLOR_DEEPORANGE, ABM.INTENSITY_NORMAL, 0.6, 5) ' redraw all Markers
gm1.refresh ' IMPORTANT
End If
End Sub