Sub SetupMapdgOSM(tLLPatient As TMapLatLng, _
tLLCenter As TMapLatLng, _
BB As TMapBoxLatLng, _
iMapZoom As Int, _
iID As Int, _
bDrawCenterLines As Boolean)
Dim tLLCurrentLocation As TMapLatLng
'Lat and Lon of current patient or mapcenter
'-------------------------------------------
If tLLPatient = Null Then
If tLLCenter = Null Then
tLLCenter = MapUtilities.initLatLng(LocationLG.Latitude, LocationLG.Longitude)
End If
cMP.MapCenter = tLLCenter
Else
cMP.MapCenter = tLLPatient
End If
If tLLCenter = Null Then
tLLCenter = cMP.MapCenter
End If
If cMP.MapCenter = Null Then
tLLCurrentLocation = MapUtilities.initLatLng(Tracker.dCurrentLatitude, Tracker.dCurrentLongitude)
Else
tLLCurrentLocation = cMP.MapCenter
End If
If cMP.iEMIS_NUMBER <> -1 Then
If iID = cMP.iEMIS_NUMBER Then
SetCurrentPatientMarker(tLLCenter, False)
End If
Else
'this happens after clearing the find patient dialog
'change any current patient marker (filled circle) to a non-current patient marker (not filled)
'----------------------------------------------------------------------------------------------
For Each iKey As Int In mapMarkerCircles.Keys
Dim cMSC As clsMapShapeCircle = mapMarkerCircles.Get(iKey)
Dim tMSC As TMapShapeCircle = cMSC.get_Shape
If tMSC.fFilled Then
tMSC.fFilled = False
cMSC.set_Shape(tMSC)
Dim cMSC2 As clsMapShapeCircle = mapShapes.Get(iKey)
Dim tMSC2 As TMapShapeCircle = cMSC2.get_Shape
tMSC2.fFilled = False
cMSC2.set_Shape(tMSC2)
Exit
End If
Next
End If
If BB = Null Then
If iMapZoom <> -1 Then
iZoom = iMapZoom
End If
Else
iZoom = MapUtilities.GetZoomToShowAll(tLLCenter, BB)
End If
fMap = MapUtilities.initMap( _
tLLCenter, _ 'alatLng (eg lat/lon of Current patient)
iZoom, _ 'aZoomLevel
0, _ 'aCompassDirection
True, _ 'aOffLineMode
False, _ 'aShowMenu
cMP.bShowGrid, _ 'aShowGrid
True, _ 'aShowCentre
False, _ 'aShowLandMark
False, _ 'aShowCentreLatLng
False, _ 'aShowZoom
False, _ 'aShowScale
False, _ 'aShowCompass
True, _ 'aShowShapes
mapShapes, _ 'aShapes (map)
False, _ 'aShowGPS
False, _ 'aFollowGPS
MapUtilities.initGPS(tLLCurrentLocation, 0), _ 'aGPS
False) 'bMultiShapeClick
Sleep(10) '>>>> this is needed to avoid crash: fViewTiles in cvMap not initialized yet
cvMap1.CenterLatLng = tLLCenter
Sleep(10) '>>>> this is needed to avoid crash: fViewTiles in cvMap not initialized yet
cvMap1.Map = fMap
cvMap1.Draw
If bDrawCenterLines Then
Sleep(0)
cvMap1.DrawCenterLines(Colors.Red, 1, cMP.bFullMapCenterLines, False)
Sleep(0)
End If
If iID > -1 Then
lblPatMap.Text = " " & cMP.GetPatLabelString(-1)
End If
End Sub