start: add tilegridlayer to menu
This commit is contained in:
parent
4ddf9dcf39
commit
c0369236d2
@ -27,4 +27,11 @@
|
||||
</item>
|
||||
</group>
|
||||
|
||||
<item
|
||||
android:id="@+id/gridlayer"
|
||||
android:showAsAction="never"
|
||||
android:checkable="true"
|
||||
android:title="@string/menu_gridlayer">
|
||||
</item>
|
||||
|
||||
</menu>
|
@ -15,5 +15,6 @@
|
||||
<string name="styler_mode_area">Area</string>
|
||||
<string name="styler_mode_outline">Outline</string>
|
||||
<string name="styler_controls_toggle">Controls</string>
|
||||
<string name="menu_gridlayer">Gridlayer</string>
|
||||
|
||||
</resources>
|
@ -20,6 +20,7 @@ import org.oscim.android.MapActivity;
|
||||
import org.oscim.android.MapView;
|
||||
import org.oscim.android.cache.TileCache;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.layers.TileGridLayer;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.TileSource;
|
||||
@ -36,6 +37,7 @@ public class BaseMapActivity extends MapActivity {
|
||||
MapView mMapView;
|
||||
VectorTileLayer mBaseLayer;
|
||||
TileSource mTileSource;
|
||||
TileGridLayer mGridLayer;
|
||||
|
||||
private TileCache mCache;
|
||||
|
||||
@ -105,6 +107,20 @@ public class BaseMapActivity extends MapActivity {
|
||||
mMap.setTheme(VtmThemes.NEWTRON);
|
||||
item.setChecked(true);
|
||||
return true;
|
||||
|
||||
case R.id.gridlayer:
|
||||
if (item.isChecked()) {
|
||||
item.setChecked(false);
|
||||
mMap.layers().remove(mGridLayer);
|
||||
} else {
|
||||
item.setChecked(true);
|
||||
if (mGridLayer == null)
|
||||
mGridLayer = new TileGridLayer(mMap);
|
||||
|
||||
mMap.layers().add(mGridLayer);
|
||||
}
|
||||
mMap.updateMap(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user