TileGridLayer

This commit is contained in:
Hannes Janetzek 2014-01-31 01:45:46 +01:00
parent a828007c89
commit f6f64deffb
2 changed files with 16 additions and 0 deletions

View File

@ -17,7 +17,10 @@ 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.backend.canvas.Color;
import org.oscim.layers.TileGridLayer;
import org.oscim.layers.tile.BitmapTileLayer; import org.oscim.layers.tile.BitmapTileLayer;
import org.oscim.renderer.MapRenderer;
import org.oscim.tiling.source.TileSource; import org.oscim.tiling.source.TileSource;
import org.oscim.tiling.source.bitmap.DefaultSources; import org.oscim.tiling.source.bitmap.DefaultSources;
@ -48,6 +51,9 @@ public class BitmapTileMapActivity extends MapActivity {
mMapView = (MapView) findViewById(R.id.mapView); mMapView = (MapView) findViewById(R.id.mapView);
registerMapView(mMapView); registerMapView(mMapView);
MapRenderer.setBackgroundColor(0xff777777);
mMap.getLayers().add(new TileGridLayer(mMap, Color.GRAY, 1.8f, 8));
if (USE_CACHE) { if (USE_CACHE) {
mCache = new TileCache(this, null, mTileSource.getClass().getSimpleName()); mCache = new TileCache(this, null, mTileSource.getClass().getSimpleName());
mCache.setCacheSize(512 * (1 << 10)); mCache.setCacheSize(512 * (1 << 10));

View File

@ -1,7 +1,10 @@
package org.oscim.layers; package org.oscim.layers;
import org.oscim.backend.canvas.Paint.Cap;
import org.oscim.map.Map; import org.oscim.map.Map;
import org.oscim.renderer.GridRenderer; import org.oscim.renderer.GridRenderer;
import org.oscim.theme.styles.Line;
import org.oscim.theme.styles.Text;
public class TileGridLayer extends GenericLayer { public class TileGridLayer extends GenericLayer {
@ -9,4 +12,11 @@ public class TileGridLayer extends GenericLayer {
super(map, new GridRenderer()); super(map, new GridRenderer());
} }
public TileGridLayer(Map map, int color, float width, int repeat) {
super(map, new GridRenderer(repeat, new Line(color, width, Cap.BUTT), null));
}
public TileGridLayer(Map map, int color, float width, Text text, int repeat) {
super(map, new GridRenderer(repeat, new Line(color, width, Cap.BUTT), text));
}
} }