Hi i try update your sample to 4.1 mapsforge but i cant run it , the InputStream no work , sorry i cant put it in code block , can you some help, tks
CODE:
Sub Globals
Dim MapView1 As OSMDroid_MapView
Private Button1 As Button
Private Button2 As Button
Dim MapCenter As OSMDroid_GeoPoint
Dim MapsForgeTileSourceName As String="MapsForge1"
Dim MapsForgeDatabaseName As String="monaco.map"
Dim MapsForgeDatabasePath As String=File.DirRootExternal
Dim ZoomLevel As Int
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("RENDER")
If File.Exists(MapsForgeDatabasePath, MapsForgeDatabaseName)=False Then
File.Copy(File.DirAssets, MapsForgeDatabaseName, MapsForgeDatabasePath, MapsForgeDatabaseName)
End If
MapView1.Initialize("")
Dim CurrentTilesSources As List=MapView1.GetTileProvider.GetTileSource
If CurrentTilesSources.IndexOf(MapsForgeTileSourceName)=-1 Then
' the MapsForgeTileSource has not been added to the MapView so create it and add it to the map
'
''XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Dim InputStream1 As InputStream
InputStream1 = File.OpenInput( File.DirAssets, "osmarender1.xml")
If InputStream1.IsInitialized Then Log("SI")
MapsForgeTileSource1.GetMapsForgeTileSourceOptions.SetRenderTheme(InputStream1)
MapsForgeTileSource1.GetMapsForgeTileSourceOptions.SetDebugSettings(True,True,True)
MapsForgeTileSource1.Initialize
MapView1.Invalidate
''XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Dim MapsForgeTileSource1 As MapsForgeTileSource
' set the required MapsForgeTileSourceOptions MapDatabaseFile and TileSourceName
MapsForgeTileSource1.GetMapsForgeTileSourceOptions.SetMapDatabaseFile(MapsForgeDatabasePath, MapsForgeDatabaseName)
MapsForgeTileSource1.GetMapsForgeTileSourceOptions.SetTileSourceName(MapsForgeTileSourceName)
' example of setting an optional MapsForgeTileSourceOptions
' MapsForgeTileSource1.GetMapsForgeTileSourceOptions.SetTextScale(2.0)
' now that the required MapsForgeTileSourceOptionshave been set we can call the MapsForgeTileSource Initialize method
MapsForgeTileSource1.Initialize
MapView1.SetTileSource(MapsForgeTileSource1)
End If
MapView1.Initialize("MapView1")
MapView1.SetBuiltInZoomControls(True)
MapView1.SetMultiTouchControls(True)
If File.Exists(File.DirInternal, SavedMapStateFileName) Then
' restore the saved map state
Dim RandomAccessFile1 As RandomAccessFile
RandomAccessFile1.Initialize(File.DirInternal, SavedMapStateFileName, True)
MapCenter=RandomAccessFile1.ReadObject(0)
ZoomLevel=RandomAccessFile1.ReadInt(RandomAccessFile1.CurrentPosition)
RandomAccessFile1.Close
MapView1.GetController.SetZoom(ZoomLevel)
MapView1.GetController.SetCenter(MapCenter)
Else
MapCenter=MapsForgeTileSource1.MapDatabase.MapFileInfo.StartPosition
ZoomLevel=MapsForgeTileSource1.MapDatabase.MapFileInfo.StartZoomLevel
If MapCenter.IsInitialized And ZoomLevel<>-1 Then
' the map database has a start position and a start zoom set
' we'll use that for the default map state
MapView1.GetController.SetZoom(ZoomLevel)
MapView1.GetController.SetCenter(MapCenter)
Else
' the default map state will be defined by the area covered by the map database
'
''XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
MapView1.FitMapToBoundingBox(MapsForgeTileSource1.MapDatabase.MapFileInfo.BoundingBox)
''XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
MapView1.GetBoundingBox2.BringToBoundingBox(MapsForgeTileSource1.MapDatabase.MapFileInfo.BoundingBox)
End If
End If
Activity.AddView(MapView1, 0, 0, 100%x, 90%y)
Activity.AddMenuItem("Clear saved state", "Menu")
MapView1.Invalidate
End Sub