This commit is contained in:
Alexey Pelykh 2014-11-17 12:16:31 +02:00 committed by Victor Shcherb
parent bcc8ab6c7a
commit 6bd4cd64e8
2 changed files with 45 additions and 45 deletions

View file

@ -54,11 +54,11 @@ public class GLActivity extends Activity {
private ResolvedMapStyle _mapStyle; private ResolvedMapStyle _mapStyle;
private ObfsCollection _obfsCollection; private ObfsCollection _obfsCollection;
private MapPresentationEnvironment _mapPresentationEnvironment; private MapPresentationEnvironment _mapPresentationEnvironment;
private Primitiviser _primitiviser; private MapPrimitiviser _mapPrimitiviser;
private BinaryMapDataProvider _binaryMapDataProvider; private ObfMapObjectsProvider _obfMapObjectsProvider;
private BinaryMapPrimitivesProvider _binaryMapPrimitivesProvider; private MapPrimitivesProvider _mapPrimitivesProvider;
private BinaryMapStaticSymbolsProvider _binaryMapStaticSymbolsProvider; private MapObjectsSymbolsProvider _mapObjectsSymbolsProvider;
private BinaryMapRasterLayerProvider _binaryMapRasterLayerProvider; private MapRasterLayerProvider _mapRasterLayerProvider;
private OnlineRasterMapLayerProvider _onlineMapRasterLayerProvider; private OnlineRasterMapLayerProvider _onlineMapRasterLayerProvider;
private IMapRenderer _mapRenderer; private IMapRenderer _mapRenderer;
private GpuWorkerThreadPrologue _gpuWorkerThreadPrologue; private GpuWorkerThreadPrologue _gpuWorkerThreadPrologue;
@ -194,19 +194,19 @@ public class GLActivity extends Activity {
_displayDensityFactor, _displayDensityFactor,
"en"); //TODO: here should be current locale "en"); //TODO: here should be current locale
//mapPresentationEnvironment->setSettings(configuration.styleSettings); //mapPresentationEnvironment->setSettings(configuration.styleSettings);
_primitiviser = new Primitiviser( _mapPrimitiviser = new MapPrimitiviser(
_mapPresentationEnvironment); _mapPresentationEnvironment);
_binaryMapDataProvider = new BinaryMapDataProvider( _obfMapObjectsProvider = new ObfMapObjectsProvider(
_obfsCollection); _obfsCollection);
_binaryMapPrimitivesProvider = new BinaryMapPrimitivesProvider( _mapPrimitivesProvider = new MapPrimitivesProvider(
_binaryMapDataProvider, _obfMapObjectsProvider,
_primitiviser, _mapPrimitiviser,
_rasterTileSize); _rasterTileSize);
_binaryMapStaticSymbolsProvider = new BinaryMapStaticSymbolsProvider( _mapObjectsSymbolsProvider = new MapObjectsSymbolsProvider(
_binaryMapPrimitivesProvider, _mapPrimitivesProvider,
_rasterTileSize); _rasterTileSize);
_binaryMapRasterLayerProvider = new BinaryMapRasterLayerProvider_Software( _mapRasterLayerProvider = new MapRasterLayerProvider_Software(
_binaryMapPrimitivesProvider); _mapPrimitivesProvider);
_onlineMapRasterLayerProvider = OnlineTileSources.getBuiltIn().createProviderFor("Mapnik (OsmAnd)"); _onlineMapRasterLayerProvider = OnlineTileSources.getBuiltIn().createProviderFor("Mapnik (OsmAnd)");
@ -222,14 +222,14 @@ public class GLActivity extends Activity {
atlasRendererConfiguration.setReferenceTileSizeOnScreenInPixels(_referenceTileSize); atlasRendererConfiguration.setReferenceTileSizeOnScreenInPixels(_referenceTileSize);
_mapRenderer.setConfiguration(AtlasMapRendererConfiguration.Casts.downcastTo_MapRendererConfiguration(atlasRendererConfiguration)); _mapRenderer.setConfiguration(AtlasMapRendererConfiguration.Casts.downcastTo_MapRendererConfiguration(atlasRendererConfiguration));
_mapRenderer.addSymbolsProvider(_binaryMapStaticSymbolsProvider); _mapRenderer.addSymbolsProvider(_mapObjectsSymbolsProvider);
updateView(); updateView();
/* /*
IMapRasterLayerProvider mapnik = OnlineTileSources.getBuiltIn().createProviderFor("Mapnik (OsmAnd)"); IMapRasterLayerProvider mapnik = OnlineTileSources.getBuiltIn().createProviderFor("Mapnik (OsmAnd)");
if (mapnik == null) if (mapnik == null)
Log.e(TAG, "Failed to create mapnik"); Log.e(TAG, "Failed to create mapnik");
*/ */
_mapRenderer.setMapLayerProvider(0, _binaryMapRasterLayerProvider); _mapRenderer.setMapLayerProvider(0, _mapRasterLayerProvider);
_glSurfaceView = (GLSurfaceView) findViewById(R.id.glSurfaceView); _glSurfaceView = (GLSurfaceView) findViewById(R.id.glSurfaceView);
//TODO:_glSurfaceView.setPreserveEGLContextOnPause(true); //TODO:_glSurfaceView.setPreserveEGLContextOnPause(true);
@ -289,29 +289,29 @@ public class GLActivity extends Activity {
_mapPresentationEnvironment = null; _mapPresentationEnvironment = null;
} }
if (_primitiviser != null) { if (_mapPrimitiviser != null) {
_primitiviser.delete(); _mapPrimitiviser.delete();
_primitiviser = null; _mapPrimitiviser = null;
} }
if (_binaryMapDataProvider != null) { if (_obfMapObjectsProvider != null) {
_binaryMapDataProvider.delete(); _obfMapObjectsProvider.delete();
_binaryMapDataProvider = null; _obfMapObjectsProvider = null;
} }
if (_binaryMapPrimitivesProvider != null) { if (_mapPrimitivesProvider != null) {
_binaryMapPrimitivesProvider.delete(); _mapPrimitivesProvider.delete();
_binaryMapPrimitivesProvider = null; _mapPrimitivesProvider = null;
} }
if (_binaryMapStaticSymbolsProvider != null) { if (_mapObjectsSymbolsProvider != null) {
_binaryMapStaticSymbolsProvider.delete(); _mapObjectsSymbolsProvider.delete();
_binaryMapStaticSymbolsProvider = null; _mapObjectsSymbolsProvider = null;
} }
if (_binaryMapRasterLayerProvider != null) { if (_mapRasterLayerProvider != null) {
_binaryMapRasterLayerProvider.delete(); _mapRasterLayerProvider.delete();
_binaryMapRasterLayerProvider = null; _mapRasterLayerProvider = null;
} }
if (_mapRenderer != null) { if (_mapRenderer != null) {

View file

@ -12,10 +12,10 @@ import javax.microedition.khronos.egl.EGLSurface;
import net.osmand.core.android.CoreResourcesFromAndroidAssetsCustom; import net.osmand.core.android.CoreResourcesFromAndroidAssetsCustom;
import net.osmand.core.jni.AtlasMapRendererConfiguration; import net.osmand.core.jni.AtlasMapRendererConfiguration;
import net.osmand.core.jni.BinaryMapDataProvider; import net.osmand.core.jni.ObfMapObjectsProvider;
import net.osmand.core.jni.BinaryMapPrimitivesProvider; import net.osmand.core.jni.MapPrimitivesProvider;
import net.osmand.core.jni.BinaryMapRasterLayerProvider_Software; import net.osmand.core.jni.MapRasterLayerProvider_Software;
import net.osmand.core.jni.BinaryMapStaticSymbolsProvider; import net.osmand.core.jni.MapObjectsSymbolsProvider;
import net.osmand.core.jni.IMapRenderer; import net.osmand.core.jni.IMapRenderer;
import net.osmand.core.jni.Logger; import net.osmand.core.jni.Logger;
import net.osmand.core.jni.MapPresentationEnvironment; import net.osmand.core.jni.MapPresentationEnvironment;
@ -26,7 +26,7 @@ import net.osmand.core.jni.ObfsCollection;
import net.osmand.core.jni.OnlineRasterMapLayerProvider; import net.osmand.core.jni.OnlineRasterMapLayerProvider;
import net.osmand.core.jni.OnlineTileSources; import net.osmand.core.jni.OnlineTileSources;
import net.osmand.core.jni.OsmAndCore; import net.osmand.core.jni.OsmAndCore;
import net.osmand.core.jni.Primitiviser; import net.osmand.core.jni.MapPrimitiviser;
import net.osmand.core.jni.QIODeviceLogSink; import net.osmand.core.jni.QIODeviceLogSink;
import net.osmand.core.jni.ResolvedMapStyle; import net.osmand.core.jni.ResolvedMapStyle;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
@ -158,15 +158,15 @@ public class NativeQtLibrary {
MapPresentationEnvironment presentation = notGc(new MapPresentationEnvironment(mapStyle, displayDensityFactor, "en")); MapPresentationEnvironment presentation = notGc(new MapPresentationEnvironment(mapStyle, displayDensityFactor, "en"));
//TODO: here should be current locale //TODO: here should be current locale
//mapPresentationEnvironment->setSettings(configuration.styleSettings); //mapPresentationEnvironment->setSettings(configuration.styleSettings);
BinaryMapPrimitivesProvider binaryMapPrimitivesProvider = notGc(new BinaryMapPrimitivesProvider( MapPrimitivesProvider mapPrimitivesProvider = notGc(new MapPrimitivesProvider(
notGc(new BinaryMapDataProvider(obfsCollection)), notGc(new ObfMapObjectsProvider(obfsCollection)),
notGc(new Primitiviser(presentation)), rasterTileSize)); notGc(new MapPrimitiviser(presentation)), rasterTileSize));
BinaryMapRasterLayerProvider_Software binaryMapRasterLayerProvider = notGc(new BinaryMapRasterLayerProvider_Software( MapRasterLayerProvider_Software mapRasterLayerProvider = notGc(new MapRasterLayerProvider_Software(
binaryMapPrimitivesProvider)); mapPrimitivesProvider));
mapRenderer.setMapLayerProvider(0, binaryMapRasterLayerProvider); mapRenderer.setMapLayerProvider(0, mapRasterLayerProvider);
BinaryMapStaticSymbolsProvider binaryMapStaticSymbolsProvider = notGc(new BinaryMapStaticSymbolsProvider( MapObjectsSymbolsProvider mapObjectsSymbolsProvider = notGc(new MapObjectsSymbolsProvider(
binaryMapPrimitivesProvider, rasterTileSize)); mapPrimitivesProvider, rasterTileSize));
mapRenderer.addSymbolsProvider(binaryMapStaticSymbolsProvider); mapRenderer.addSymbolsProvider(mapObjectsSymbolsProvider);
} else { } else {
OnlineRasterMapLayerProvider onlineMapRasterLayerProvider = notGc(OnlineTileSources.getBuiltIn() OnlineRasterMapLayerProvider onlineMapRasterLayerProvider = notGc(OnlineTileSources.getBuiltIn()
.createProviderFor("Mapnik (OsmAnd)")); .createProviderFor("Mapnik (OsmAnd)"));