Sub MapFragment1_Ready ' DRAWS MAP
Log("Map Ready")
gmap = MapFragment1.GetMap
Dim listofpolylines As List
listofpolylines.Initialize
'MAP TYPE
'gmap.MapType=gmap.MAP_TYPE_NORMAL
Dim listofpoints As List
listofpoints.Initialize
Dim counter As Int = 0
Dim pl As Polyline
'LOOP THROUGH SEGMENTS
For Each item As segment In interimList
pl = gmap.AddPolyline
'SET MARKERS
Dim fl As Float = item.averageSpeed
'create marker
'Dim markerSL As Marker
' set marker colour
gmap.AddMarker2(item.SLlatitude,item.sllongitude,item.SLid&"group "&item.STgroupType&" vol "&Round(item.totalVolume) & " cars/min",gmap.HUE_GREEN)
'Dim markerEL As Marker
'set colour
gmap.AddMarker2(item.ELlatitude,item.ELlongitude,item.ELid&"group "&item.STgroupType&" vol "&item.totalVolume & " cars/min",gmap.HUE_RED)
' DRAW LINE
Dim xPoint As LatLng
xPoint.Initialize(item.SLlatitude,item.sllongitude)
listofpoints.Add(xPoint)
Dim xPoint As LatLng
xPoint.Initialize(item.ELlatitude,item.ellongitude)
listofpoints.Add(xPoint)
''CONFIG LINE
'line colour based on speed (cars/min)
Dim linecalcvar As Int
'sets speedlimit to 100 if speedlimit = 0 which it does quite often
If item.elspeedLimit = 0 Then
item.elspeedLimit = 75
End If
linecalcvar = ((item.averageSpeed/item.elspeedlimit) * 100)
Log(linecalcvar&" " & item.sectionName)
If linecalcvar < 30 Then
pl.Color =Colors.Black
End If
If linecalcvar >30 And linecalcvar<60 Then
pl.Color=Colors.red
End If
If linecalcvar > 59 And linecalcvar < 80 Then
pl.Color = Colors.RGB(255,165,0) 'orange
End If
If linecalcvar > 80 Then
pl.Color = Colors.Green
End If
'
' ' line width based on volume (cars/min)
If item.totalvolume <5 Then
pl.width =5
End If
If item.totalvolume >9 And item.totalvolume<20 Then
pl.width=10
End If
If item.totalvolume > 19 And item.totalvolume< 40 Then
pl.width=20
End If
If item.totalvolume > 40 Then
pl.width = 30
End If
'add listofpoints to polyline
pl.points=listofpoints
'listofpolylines.Add(pl)
Next
'END OF LOOP
'For Each poly As Polyline In listofpolylines
' poly=gmap.AddPolyline
'Next
Log ("finished drawing map")
End Sub