You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
140 lines
3.3 KiB
140 lines
3.3 KiB
B4A=true
|
|
Group=Default Group
|
|
ModulesStructureVersion=1
|
|
Type=Activity
|
|
Version=9.801
|
|
@EndOfDesignText@
|
|
#Region Activity Attributes
|
|
#FullScreen: False
|
|
#IncludeTitle: True
|
|
#End Region
|
|
|
|
Sub Process_Globals
|
|
Private rp As RuntimePermissions
|
|
End Sub
|
|
|
|
Sub Globals
|
|
Private gmap As GoogleMap
|
|
Private MapFragment1 As MapFragment
|
|
Private centerloc As CameraPosition
|
|
Private bmp As Bitmap
|
|
Private gmapx As GoogleMapsExtras
|
|
|
|
End Sub
|
|
|
|
Sub Activity_Create(FirstTime As Boolean)
|
|
'Do not forget to load the layout file created with the visual designer. For example:
|
|
Activity.LoadLayout("mapfrag")
|
|
bmp = LoadBitmapResize(File.DirAssets, "marker2.png", 20dip, 20dip, True)
|
|
Wait For MapFragment1_Ready
|
|
gmap = MapFragment1.GetMap
|
|
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
|
|
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
|
|
If Result Then
|
|
gmap.MyLocationEnabled = True
|
|
Else
|
|
Log("No permission!")
|
|
End If
|
|
|
|
'matchingsub
|
|
add_line
|
|
'gmap.mMoveCamera(-centerloc)
|
|
End Sub
|
|
|
|
Sub Log_Markers
|
|
'Regex.
|
|
'For Main.rocklist
|
|
|
|
End Sub
|
|
|
|
Sub matchingsub 'currently pulls location
|
|
Do Until MapFragment1.GetMap.IsInitialized 'necissary to prevent 'googlemaps not initialized' error, which is misleading
|
|
Sleep(100)
|
|
Loop
|
|
gmap.MapType = gmap.MAP_TYPE_SATELLITE
|
|
centerloc.initialize (-32.676910,118.211034,14)
|
|
gmap.MoveCamera(centerloc)
|
|
'\d*\.?\d*(L|ml|kg|g])\s(\w+\s?\w*)\s?(\$?\d*\.?\d*)[\n]
|
|
If Main.headerlist.Size >0 Then
|
|
For i = 0 To Main.headerlist.Size - 1
|
|
' sb.Append(headerlist.get(i)).Append(CRLF)
|
|
' sb.Append(Main.locationstringlist.get(i+1)).Append(CRLF)
|
|
Next
|
|
For i = 0 To Main.headerlist.size-1
|
|
Dim m As Matcher =Regex.Matcher(",(.+?) (.+?),", Main.locationstringlist.Get(i+1))
|
|
Do While m.Find
|
|
gmap.AddMarker3(m.group(1),m.group(2),Main.headerlist.get(i),bmp)
|
|
Loop
|
|
Next
|
|
End If
|
|
' For i = 1 To Main.PointList.Size-1
|
|
' Dim m As Matcher =Regex.Matcher("(?<=,)(.+) (.+)(?=,)", Main.PointList.Get(i))
|
|
' Do While m.Find
|
|
' gmap.AddMarker(m.group(1),m.group(2),"Point")
|
|
' Loop
|
|
' Next
|
|
' For i = 1 To Main.WeedList.Size-1
|
|
' Dim m As Matcher =Regex.Matcher("(?<=,)(.+) (.+)(?=,)", Main.WeedList.Get(i))
|
|
' Do While m.Find
|
|
' gmap.AddMarker(m.group(1),m.group(2),"Weed")
|
|
' Loop
|
|
' Next
|
|
End Sub
|
|
|
|
Sub add_line
|
|
Dim line As Polyline
|
|
Dim points As List
|
|
Dim point As LatLng
|
|
Dim grpvop As GroundOverlayOptions
|
|
Dim grov As GroundOverlay
|
|
Dim overlay4 As Bitmap
|
|
Dim centr As LatLng
|
|
grpvop.Initialize
|
|
overlay4 = LoadBitmap(File.DirAssets, "overlaywhite.png")
|
|
grpvop.Image(overlay4)
|
|
centr.Initialize(-32.6972,118.1908)
|
|
grpvop.Position(centr,29000,16000)
|
|
grpvop.SetTransparency(.5)
|
|
|
|
gmapx.AddGroundOverlay(gmap,grpvop)
|
|
line=gmap.AddPolyline
|
|
points.Initialize
|
|
|
|
line.Color=Colors.Red
|
|
line.Visible=True
|
|
line.Width=2
|
|
point.Initialize(-32.6758, 118.1967)
|
|
points.Add(point)
|
|
point.Initialize(-32.6757, 118.1756)
|
|
points.Add(point)
|
|
point.Initialize(-32.6608, 118.1756)
|
|
points.Add(point)
|
|
point.Initialize(-32.6564, 118.182)
|
|
points.Add(point)
|
|
point.Initialize(-32.6564, 118.1963)
|
|
points.Add(point)
|
|
point.Initialize(-32.6758, 118.1967)
|
|
points.Add(point)
|
|
line.Points=points
|
|
|
|
End Sub
|
|
|
|
Sub MapFragment1_Click (Point As LatLng)
|
|
gmap.AddMarker(Point.Latitude, Point.Longitude, "New Marker")
|
|
Log(Point)
|
|
|
|
End Sub
|
|
|
|
Sub Activity_Resume
|
|
'add_line
|
|
matchingsub
|
|
End Sub
|
|
|
|
Sub Activity_Pause (UserClosed As Boolean)
|
|
|
|
End Sub
|
|
|
|
Sub button1_Click
|
|
StartActivity(Main)
|
|
End Sub
|