example: use stored map position
This commit is contained in:
parent
ce38b484f6
commit
41c92f0a38
@ -19,6 +19,7 @@ package org.oscim.android.test;
|
|||||||
import org.oscim.android.MapActivity;
|
import org.oscim.android.MapActivity;
|
||||||
import org.oscim.android.MapView;
|
import org.oscim.android.MapView;
|
||||||
import org.oscim.android.cache.TileCache;
|
import org.oscim.android.cache.TileCache;
|
||||||
|
import org.oscim.core.MapPosition;
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
import org.oscim.theme.VtmThemes;
|
import org.oscim.theme.VtmThemes;
|
||||||
import org.oscim.tiling.TileSource;
|
import org.oscim.tiling.TileSource;
|
||||||
@ -64,6 +65,13 @@ public class BaseMapActivity extends MapActivity {
|
|||||||
mTileSource.setCache(mCache);
|
mTileSource.setCache(mCache);
|
||||||
}
|
}
|
||||||
mBaseLayer = mMap.setBaseMap(mTileSource);
|
mBaseLayer = mMap.setBaseMap(mTileSource);
|
||||||
|
|
||||||
|
/* set initial position on first run */
|
||||||
|
MapPosition pos = new MapPosition();
|
||||||
|
mMap.getMapPosition(pos);
|
||||||
|
if (pos.x == 0.5 && pos.y == 0.5)
|
||||||
|
mMap.setMapPosition(53.08, 8.83, Math.pow(2, 16));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -63,8 +63,6 @@ public class BitmapTileMapActivity extends MapActivity {
|
|||||||
|
|
||||||
mBitmapLayer = new BitmapTileLayer(mMap, mTileSource);
|
mBitmapLayer = new BitmapTileLayer(mMap, mTileSource);
|
||||||
mMap.layers().add(mBitmapLayer);
|
mMap.layers().add(mBitmapLayer);
|
||||||
|
|
||||||
mMap.setMapPosition(0, 0, 1 << 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -31,7 +31,6 @@ public class S3DBMapActivity extends BaseMapActivity {
|
|||||||
|
|
||||||
mMap.layers().add(new S3DBLayer(mMap, ts));
|
mMap.layers().add(new S3DBLayer(mMap, ts));
|
||||||
mMap.layers().add(new LabelLayer(mMap, mBaseLayer));
|
mMap.layers().add(new LabelLayer(mMap, mBaseLayer));
|
||||||
mMap.setMapPosition(53.08, 8.83, Math.pow(2, 14));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
import org.oscim.layers.tile.vector.BuildingLayer;
|
import org.oscim.layers.tile.vector.BuildingLayer;
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
import org.oscim.map.Layers;
|
import org.oscim.map.Layers;
|
||||||
|
import org.oscim.map.Map;
|
||||||
import org.oscim.theme.VtmThemes;
|
import org.oscim.theme.VtmThemes;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -27,19 +28,17 @@ public class SimpleMapActivity extends BaseMapActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
Map m = this.map();
|
||||||
|
|
||||||
Layers layers = mMap.layers();
|
Layers layers = mMap.layers();
|
||||||
layers.add(new BuildingLayer(mMap, mBaseLayer));
|
layers.add(new BuildingLayer(mMap, mBaseLayer));
|
||||||
layers.add(new LabelLayer(mMap, mBaseLayer));
|
layers.add(new LabelLayer(mMap, mBaseLayer));
|
||||||
|
|
||||||
//layers.add(new TileGridLayer(mMap));
|
//layers.add(new TileGridLayer(mMap));
|
||||||
|
|
||||||
mMap.setTheme(VtmThemes.DEFAULT);
|
m.setTheme(VtmThemes.DEFAULT);
|
||||||
//mMap.setTheme(VtmThemes.TRONRENDER);
|
//mMap.setTheme(VtmThemes.TRONRENDER);
|
||||||
//mMap.setTheme(VtmThemes.TRON2);
|
//mMap.setTheme(VtmThemes.TRON2);
|
||||||
//mMap.setTheme(VtmThemes.OSMARENDER);
|
//mMap.setTheme(VtmThemes.OSMARENDER);
|
||||||
|
|
||||||
mMap.setMapPosition(53.08, 8.83, Math.pow(2, 10));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stress testing
|
// Stress testing
|
||||||
|
@ -46,7 +46,6 @@ public class ThemeStylerActivity extends BaseMapActivity implements OnSeekBarCha
|
|||||||
layers.add(new LabelLayer(mMap, mBaseLayer));
|
layers.add(new LabelLayer(mMap, mBaseLayer));
|
||||||
|
|
||||||
mMap.setTheme(VtmThemes.DEFAULT);
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
mMap.setMapPosition(53.08, 8.83, Math.pow(2, 10));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ModStyleVisitor extends RuleVisitor {
|
class ModStyleVisitor extends RuleVisitor {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user