Tile grid layer scaling, closes #238
This commit is contained in:
parent
001dbe8447
commit
3584c4be1e
@ -5,8 +5,9 @@
|
||||
- Mapsforge multiple map files [#208](https://github.com/mapsforge/vtm/issues/208)
|
||||
- Polygon label position enhancements [#80](https://github.com/mapsforge/vtm/issues/80)
|
||||
- PathLayer (vtm) fix disappearing segments [#108](https://github.com/mapsforge/vtm/issues/108)
|
||||
- MapFileTileSource zoom level improvements [#219](https://github.com/mapsforge/vtm/issues/219)
|
||||
- Fix house numbers (nodes) visibility [#168](https://github.com/mapsforge/vtm/issues/168)
|
||||
- House numbers (nodes) fix visibility [#168](https://github.com/mapsforge/vtm/issues/168)
|
||||
- MapFileTileSource zoom level API enhancements [#219](https://github.com/mapsforge/vtm/issues/219)
|
||||
- Tile grid layer scaling [#238](https://github.com/mapsforge/vtm/issues/238)
|
||||
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
|
||||
- Many other minor improvements and bug fixes
|
||||
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aissue+is%3Aclosed+milestone%3A0.7.0)
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -21,6 +22,7 @@ import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import org.oscim.android.cache.TileCache;
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.layers.TileGridLayer;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
@ -107,7 +109,7 @@ public class BaseMapActivity extends MapActivity {
|
||||
} else {
|
||||
item.setChecked(true);
|
||||
if (mGridLayer == null)
|
||||
mGridLayer = new TileGridLayer(mMap);
|
||||
mGridLayer = new TileGridLayer(mMap, CanvasAdapter.dpi / 160);
|
||||
|
||||
mMap.layers().add(mGridLayer);
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import android.view.MenuItem;
|
||||
import org.oscim.android.filepicker.FilePicker;
|
||||
import org.oscim.android.filepicker.FilterByFileExtension;
|
||||
import org.oscim.android.filepicker.ValidMapFile;
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.layers.TileGridLayer;
|
||||
@ -92,7 +93,7 @@ public class MapsforgeMapActivity extends MapActivity {
|
||||
} else {
|
||||
item.setChecked(true);
|
||||
if (mGridLayer == null)
|
||||
mGridLayer = new TileGridLayer(mMap);
|
||||
mGridLayer = new TileGridLayer(mMap, CanvasAdapter.dpi / 160);
|
||||
|
||||
mMap.layers().add(mGridLayer);
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.core.GeoPoint;
|
||||
import org.oscim.layers.TileGridLayer;
|
||||
@ -81,7 +82,7 @@ public class MarkerOverlayActivity extends BitmapTileMapActivity
|
||||
|
||||
markerLayer.addItems(pts);
|
||||
|
||||
mMap.layers().add(new TileGridLayer(mMap));
|
||||
mMap.layers().add(new TileGridLayer(mMap, CanvasAdapter.dpi / 160));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,6 +19,7 @@ package org.oscim.android.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.layers.TileGridLayer;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
@ -65,7 +66,7 @@ public class OsmJsonMapActivity extends MapActivity {
|
||||
mMap.layers().add(l);
|
||||
mMap.layers().add(new LabelLayer(mMap, l));
|
||||
|
||||
mMap.layers().add(new TileGridLayer(mMap));
|
||||
mMap.layers().add(new TileGridLayer(mMap, CanvasAdapter.dpi / 160));
|
||||
|
||||
mMap.setMapPosition(53.08, 8.83, Math.pow(2, 16));
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class MainActivity extends AndroidApplication {
|
||||
@Override
|
||||
public void createLayers() {
|
||||
TileSource ts = new OSciMap4TileSource();
|
||||
initDefaultLayers(ts, true, true, true);
|
||||
initDefaultLayers(ts, true, true, true, CanvasAdapter.dpi / 160);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import org.oscim.android.cache.TileCache;
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.layers.GenericLayer;
|
||||
import org.oscim.layers.Layer;
|
||||
import org.oscim.layers.TileGridLayer;
|
||||
@ -154,7 +155,7 @@ public class MapLayers {
|
||||
|
||||
if (enable) {
|
||||
if (mGridOverlay == null)
|
||||
mGridOverlay = new TileGridLayer(App.map);
|
||||
mGridOverlay = new TileGridLayer(App.map, CanvasAdapter.dpi / 160);
|
||||
|
||||
App.map.layers().add(mGridOverlay);
|
||||
} else {
|
||||
|
@ -47,6 +47,11 @@ public abstract class GdxMap implements ApplicationListener {
|
||||
|
||||
protected void initDefaultLayers(TileSource tileSource, boolean tileGrid, boolean labels,
|
||||
boolean buildings) {
|
||||
initDefaultLayers(tileSource, tileGrid, labels, buildings, 1);
|
||||
}
|
||||
|
||||
protected void initDefaultLayers(TileSource tileSource, boolean tileGrid, boolean labels,
|
||||
boolean buildings, float scale) {
|
||||
Layers layers = mMap.layers();
|
||||
|
||||
if (tileSource != null) {
|
||||
@ -61,7 +66,7 @@ public abstract class GdxMap implements ApplicationListener {
|
||||
}
|
||||
|
||||
if (tileGrid)
|
||||
layers.add(new TileGridLayer(mMap));
|
||||
layers.add(new TileGridLayer(mMap, scale));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright 2012 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.layers;
|
||||
|
||||
import org.oscim.backend.canvas.Paint.Cap;
|
||||
@ -12,6 +29,10 @@ public class TileGridLayer extends GenericLayer {
|
||||
super(map, new GridRenderer());
|
||||
}
|
||||
|
||||
public TileGridLayer(Map map, float scale) {
|
||||
super(map, new GridRenderer(scale));
|
||||
}
|
||||
|
||||
public TileGridLayer(Map map, int color, float width, int repeat) {
|
||||
super(map, new GridRenderer(repeat, new LineStyle(color, width, Cap.BUTT), null));
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
package org.oscim.renderer;
|
||||
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.backend.canvas.Paint;
|
||||
import org.oscim.backend.canvas.Paint.Cap;
|
||||
import org.oscim.core.GeometryBuffer;
|
||||
import org.oscim.core.Tile;
|
||||
@ -38,9 +39,14 @@ public class GridRenderer extends BucketRenderer {
|
||||
private int mCurX, mCurY, mCurZ;
|
||||
|
||||
public GridRenderer() {
|
||||
this(1, new LineStyle(Color.LTGRAY, 1.2f, Cap.BUTT),
|
||||
this(1);
|
||||
}
|
||||
|
||||
public GridRenderer(float scale) {
|
||||
this(1, new LineStyle(Color.LTGRAY, 1.2f * scale, Cap.BUTT),
|
||||
TextStyle.builder()
|
||||
.fontSize(22)
|
||||
.fontSize(12 * scale)
|
||||
.fontStyle(Paint.FontStyle.BOLD)
|
||||
.color(Color.RED)
|
||||
.build());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user