Scale factor for short vertices calculation, fix #537
This commit is contained in:
parent
3a67bbce84
commit
516b18bdef
@ -13,6 +13,8 @@
|
||||
- Map view roll [#474](https://github.com/mapsforge/vtm/pull/474)
|
||||
- Physical fling and fling on rotation / scale [#497](https://github.com/mapsforge/vtm/pull/497) [#499](https://github.com/mapsforge/vtm/pull/499)
|
||||
- `Parameters.ANIMATOR2 = true;`
|
||||
- Scale factor for short vertices calculation [#537](https://github.com/mapsforge/vtm/issues/537)
|
||||
- `Parameters.CUSTOM_COORD_SCALE = false;`
|
||||
- Polygon symbols default disabled [#405](https://github.com/mapsforge/vtm/issues/405)
|
||||
- `Parameters.POLY_SYMBOL = true;`
|
||||
- Map fractional zoom [#487](https://github.com/mapsforge/vtm/issues/487)
|
||||
@ -137,7 +139,7 @@
|
||||
- Location renderer and layer [#171](https://github.com/mapsforge/vtm/issues/171)
|
||||
- Map scale bar [#84](https://github.com/mapsforge/vtm/issues/84)
|
||||
- Tile size based on scale factor [#183](https://github.com/mapsforge/vtm/issues/183)
|
||||
- `Parameters.CUSTOM_TILE_SIZE = true;`
|
||||
- `Parameters.CUSTOM_TILE_SIZE = false;`
|
||||
- libGDX layer gestures [#151](https://github.com/mapsforge/vtm/issues/151)
|
||||
- Render theme area tessellation option [#37](https://github.com/mapsforge/vtm/issues/37)
|
||||
- Render theme resources optional location prefixes [#66](https://github.com/mapsforge/vtm/issues/66)
|
||||
|
||||
@ -31,6 +31,7 @@ import org.oscim.core.Tile;
|
||||
import org.oscim.gdx.AndroidGL;
|
||||
import org.oscim.gdx.GdxAssets;
|
||||
import org.oscim.gdx.GdxMap;
|
||||
import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
@ -48,6 +49,7 @@ public class GdxActivity extends AndroidApplication {
|
||||
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
||||
CanvasAdapter.dpi = (int) (metrics.scaledDensity * CanvasAdapter.DEFAULT_DPI);
|
||||
Tile.SIZE = Tile.calculateTileSize();
|
||||
MapRenderer.COORD_SCALE = MapRenderer.calculateCoordScale();
|
||||
|
||||
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
|
||||
cfg.stencil = 8;
|
||||
|
||||
@ -39,6 +39,7 @@ import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.utils.Parameters;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -92,6 +93,8 @@ public class MapView extends GLSurfaceView {
|
||||
CanvasAdapter.dpi = (int) (metrics.scaledDensity * CanvasAdapter.DEFAULT_DPI);
|
||||
if (!Parameters.CUSTOM_TILE_SIZE)
|
||||
Tile.SIZE = Tile.calculateTileSize();
|
||||
if (!Parameters.CUSTOM_COORD_SCALE)
|
||||
MapRenderer.COORD_SCALE = MapRenderer.calculateCoordScale();
|
||||
|
||||
/* Initialize the Map */
|
||||
mMap = new AndroidMap(this);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2012, 2013 Hannes Janetzek
|
||||
* Copyright 2016 Longri
|
||||
* Copyright 2018 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -17,6 +18,7 @@
|
||||
*/
|
||||
package org.oscim.renderer;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.backend.canvas.Color;
|
||||
@ -75,6 +77,17 @@ public class MapRenderer {
|
||||
setBackgroundColor(Color.DKGRAY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate scale factor for short vertices.
|
||||
* <p>
|
||||
* CanvasAdapter.dpi must be set before!
|
||||
*/
|
||||
public static float calculateCoordScale() {
|
||||
if (CanvasAdapter.dpi > 420)
|
||||
return 4.0f;
|
||||
return 8.0f;
|
||||
}
|
||||
|
||||
public static void setBackgroundColor(int color) {
|
||||
mClearColor = GLUtils.colorToFloat(color);
|
||||
}
|
||||
|
||||
@ -21,6 +21,11 @@ public final class Parameters {
|
||||
*/
|
||||
public static boolean ANIMATOR2 = false;
|
||||
|
||||
/**
|
||||
* Allow custom scale factor for short vertices instead of the calculated one.
|
||||
*/
|
||||
public static boolean CUSTOM_COORD_SCALE = false;
|
||||
|
||||
/**
|
||||
* Allow custom tile size instead of the calculated one.
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user