Mapbox (Mapzen): locale option

This commit is contained in:
Emux 2016-12-29 17:56:23 +02:00
parent 88f3283878
commit 15bc23cadf
3 changed files with 14 additions and 6 deletions
vtm-android-example/src/org/oscim/android/test
vtm-playground/src/org/oscim/test
vtm/src/org/oscim/tiling/source/mvt

@ -22,6 +22,7 @@ import org.oscim.layers.tile.vector.labeling.LabelLayer;
import org.oscim.theme.VtmThemes;
import org.oscim.tiling.source.UrlTileSource;
import org.oscim.tiling.source.mvt.MapboxTileSource;
import org.oscim.tiling.source.mvt.TileDecoder;
public class MapboxMapActivity extends MapActivity {
@ -29,6 +30,7 @@ public class MapboxMapActivity extends MapActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TileDecoder.LOCALE = "en";
UrlTileSource tileSource = MapboxTileSource.builder()
.apiKey("mapzen-xxxxxxx") // Put a proper API key
.build();

@ -21,11 +21,13 @@ import org.oscim.layers.tile.vector.labeling.LabelLayer;
import org.oscim.theme.VtmThemes;
import org.oscim.tiling.source.UrlTileSource;
import org.oscim.tiling.source.mvt.MapboxTileSource;
import org.oscim.tiling.source.mvt.TileDecoder;
public class MapboxTest extends GdxMapApp {
@Override
public void createLayers() {
TileDecoder.LOCALE = "en";
UrlTileSource tileSource = MapboxTileSource.builder()
.apiKey("mapzen-xxxxxxx") // Put a proper API key
.build();

@ -33,7 +33,12 @@ import java.io.InputStream;
import java.util.ArrayList;
public class TileDecoder extends PbfDecoder {
static final Logger log = LoggerFactory.getLogger(TileDecoder.class);
private static final Logger log = LoggerFactory.getLogger(TileDecoder.class);
/**
* Use default locale.
*/
public static String LOCALE = "";
private static final int TAG_TILE_LAYERS = 3;
@ -65,7 +70,6 @@ public class TileDecoder extends PbfDecoder {
private short[] mTmpTags = new short[1024];
private Tile mTile;
private final String mLocale = "en";
private ITileDataSink mMapDataCallback;
private final static float REF_TILE_SIZE = 4096.0f;
@ -115,12 +119,12 @@ public class TileDecoder extends PbfDecoder {
int bytes = decodeVarint32();
ArrayList<String> keys = new ArrayList<String>();
ArrayList<String> values = new ArrayList<String>();
ArrayList<String> keys = new ArrayList<>();
ArrayList<String> values = new ArrayList<>();
String name = null;
int numFeatures = 0;
ArrayList<Feature> features = new ArrayList<Feature>();
ArrayList<Feature> features = new ArrayList<>();
int end = position() + bytes;
while (position() < end) {
@ -193,7 +197,7 @@ public class TileDecoder extends PbfDecoder {
continue;
}
if (mLocale.equals(key.substring(5))) {
if (LOCALE.equals(key.substring(5))) {
//log.debug("found local " + key);
matchedLocal = i;
} //else