Windows Phone 7 で 2 地点間の距離を読み取るアプリを開発しました。しかし、アプリをテストしているときに、数センチ移動するたびに、13000 の値が表示され始めます。
Public Sub watcher1_PositionChanged(sender As Object, e As GeoPositionChangedEventArgs(Of GeoCoordinate))
Dim dCoord As GeoCoordinate
Dim currentDistance As Double
Dim convertedDistance As Double
dCoord = New GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude)
If mlastCoordinate.Latitude <> 0.0 Then
'distanceText.Text = e.Position.Location.Latitude.ToString()
currentDistance = mlastCoordinate.GetDistanceTo(dCoord)
mDistance = startCoordinate.GetDistanceTo(dCoord)
' mDistance += currentDistance
'mDistance = Math.Round(mDistance, 2)
'Dim distance As String
'distance = String.Format("%.2", mDistance)
If selectedSystemState.Equals("centi") Then
convertedDistance = mDistance * 100
ElseIf selectedSystemState.Equals("meter") Then
convertedDistance = mDistance
ElseIf selectedSystemState.Equals("inches") Then
convertedDistance = mDistance * 39.37
ElseIf selectedSystemState.Equals("feet") Then
convertedDistance = mDistance * 3.28
End If
convertedDistance = Math.Round(convertedDistance, 2)