German GPS-Example von Klaus

D

Deleted member 103

Guest
Hallo Klaus,

kannst du mir bitte sagen warum die Karte auf dem Emulator angezeigt wird und auf mein HTC-Desire nicht?
Die GPS-Daten Latitude, Longitude und Altitude werden richtig angeziegt.


Ciao,
Filippo
 
D

Deleted member 103

Guest
Hallo Klaus,

es hat bei mir nicht funktioniert weil mein Wifi nicht eingeschaltet war.

Ich habe jetzt ein paar korrektur in dein Super-Programm(ist echt Super :sign0098 gemacht, könntest Du meine korrekturen hinzufügen?

B4X:
Sub Activity_Pause (UserClosed As Boolean)
   SaveSetup
   If UserClosed AND GPS_On Then
      GPS1.Stop
      'Changed by Filippo
      ExitApplication 'Damit der GPS wirklich ausgeschaltet wird 
      '-------------
   End If
End Sub

Sub Activity_Resume
   Dim txt As String
   Dim pnlTop As Float
   
   If DispMapTypeControl = True OR DispMapScaleControl = True Then
      pnlTop = 40dip
   Else
      pnlTop = 0
   End If
   pnlDispGPSLatLng.Left = 0
   pnlDispGPSLatLng.Top = pnlTop
   pnlDispGPSAltitude.Top = pnlDispGPSLatLng.Top
   pnlDispGPSBearing.Top = pnlDispGPSLatLng.Top + pnlDispGPSLatLng.Height
   pnlDispGPSSpeed.Top = pnlDispGPSLatLng.Top + pnlDispGPSLatLng.Height
   pnlDispGPSWindrose.Height = pnlToolBox.Top - pnlDispGPSSpeed.Top - pnlDispGPSSpeed.Height - 5dip
   pnlDispGPSWindrose.Top = pnlDispGPSSpeed.Top + pnlDispGPSSpeed.Height - 5dip
   pnlDispGPSWindrose.Width = pnlDispGPSWindrose.Height
   pnlDispGPSNeedle.Width = pnlDispGPSWindrose.Height
   pnlDispGPSNeedle.Height = pnlDispGPSWindrose.Height
   pnlDispGPSWindrose.Left = (Activity.Width - pnlDispGPSWindrose.Width) / 2
   pnlDispGPSWindrose.Visible = False
   cvsDispGPSWindrose.Initialize(pnlDispGPSWindrose)
   cvsDispGPSNeedle.Initialize(pnlDispGPSNeedle)
   imvNeedle.Visible = False

   'Changed by Filippo
   pnlDispGPSSpeed.Visible = GPS_On AND GPSDispSpeed
   pnlDispGPSBearing.Visible = GPS_On AND GPSDispBearing
   pnlDispGPSWindrose.Visible = GPS_On AND GPSDispWindrose
   '----------------

   If GPS_On = True Then
      GPS1.Start(GPSMinTime, GPSMinDistance)
   End If
   
   If MapCenter.IsInitialized = False Then
      MapCenter.Initialize
      MapCenter.Latitude = MapDefaultLat
      MapCenter.Longitude = MapDefaultLng
   End If
   
   If GPSPath.Size > 0 AND MapZoomCalculated = False Then
      CalcMapZoom
   End If
   
   ' sets the right image to bntMap
   Dim bmd As BitmapDrawable
   If Map_On = False Then
      If MapSetDraggable = True Then
         bmd.Initialize(LoadBitmap(File.DirAssets, "btnmapmove0.png"))
      Else
         bmd.Initialize(LoadBitmap(File.DirAssets, "btnmapcoord0.png"))
      End If
   Else
      If MapSetDraggable = True Then
         bmd.Initialize(LoadBitmap(File.DirAssets, "btnmapmove1.png"))
      Else
         bmd.Initialize(LoadBitmap(File.DirAssets, "btnmapcoord1.png"))
      End If
      MapShow
   End If
   btnMap.Background = bmd
   
   ' sets the right image to btnGPSPath
   Dim bmd As BitmapDrawable
   If DispMapMarkers = True Then
      bmd.Initialize(LoadBitmap(File.DirAssets, "btngpspathmarker0.png"))
   Else If   DispMapPolylne = True Then
      bmd.Initialize(LoadBitmap(File.DirAssets, "btngpspathline0.png"))
   Else
      bmd.Initialize(LoadBitmap(File.DirAssets, "btngpspath0.png"))
   End If
   btnGPSPath.Background = bmd
   
   Activity.Title = ProgName & " : " & ProgVersion
   
   InitWindrose
   InitNeedle
End Sub

Sub MapShow
   ' Shows the map depending on the setup options
   If Map_On = True Then 
      MapViewer.Visible = True
      pnlMap.Visible = True
      If DispMapPolylne = True OR DispMapMarkers = True Then
         MapCenter.Latitude = GPSPathLatMean
         MapCenter.Longitude = GPSPathLngMean
      Else
         'Changed by Filippo
         If lblLatitude.Text="- - -" AND lblLongitude.Text="- - -" Then
            MapCenter.Latitude = MapDefaultLat
            MapCenter.Longitude = MapDefaultLng
         Else
            MapCenter.Latitude = lblLatitude.Text
            MapCenter.Longitude = lblLongitude.Text
         End If
         '-----------------------
      End If
       If ShowGPSOnMap = True AND GPS_On = True Then 
         MapDisp(MapCenter.Latitude, MapCenter.Longitude, MapSetDraggable, MapZoomLevel, DispMapTypeControl, DispMapTypeControlID, DispMapZoomControl, "LEFT_CENTER", DispMapZoomControlType, DispMapScaleControl, "TOP_RIGHT", DispMapCenter, GPSPath, False, False, False, False, MapLineColor, MapLineOpacity, MapLineWidth)
      Else
         MapDisp(MapCenter.Latitude, MapCenter.Longitude, MapSetDraggable, MapZoomLevel, DispMapTypeControl, DispMapTypeControlID, DispMapZoomControl, "LEFT_CENTER", DispMapZoomControlType, DispMapScaleControl, "TOP_RIGHT", DispMapCenter, GPSPath, DispMapMarkers, MapMarkerClickable, MapMarkerDragable, DispMapPolylne, MapLineColor, MapLineOpacity, MapLineWidth)
      End If
   End If
End Sub

Ciao,
Filippo
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…