OSM indoor layer: allow setting text style #366
This commit is contained in:
@@ -25,11 +25,13 @@ import android.widget.ToggleButton;
|
|||||||
|
|
||||||
import org.jeo.map.Style;
|
import org.jeo.map.Style;
|
||||||
import org.jeo.vector.VectorDataset;
|
import org.jeo.vector.VectorDataset;
|
||||||
|
import org.oscim.backend.canvas.Color;
|
||||||
import org.oscim.layers.OSMIndoorLayer;
|
import org.oscim.layers.OSMIndoorLayer;
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
import org.oscim.test.JeoTest;
|
import org.oscim.test.JeoTest;
|
||||||
import org.oscim.theme.VtmThemes;
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.theme.styles.TextStyle;
|
||||||
import org.oscim.utils.IOUtils;
|
import org.oscim.utils.IOUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -94,7 +96,13 @@ public class JeoIndoorMapActivity extends BaseMapActivity {
|
|||||||
|
|
||||||
VectorDataset data = JeoTest.readGeoJson(is);
|
VectorDataset data = JeoTest.readGeoJson(is);
|
||||||
Style style = JeoTest.getStyle();
|
Style style = JeoTest.getStyle();
|
||||||
mIndoorLayer = new OSMIndoorLayer(mMap, data, style, getResources().getDisplayMetrics().density);
|
float scale = getResources().getDisplayMetrics().density;
|
||||||
|
TextStyle textStyle = TextStyle.builder()
|
||||||
|
.isCaption(true)
|
||||||
|
.fontSize(16 * scale).color(Color.BLACK)
|
||||||
|
.strokeWidth(2.2f * scale).strokeColor(Color.WHITE)
|
||||||
|
.build();
|
||||||
|
mIndoorLayer = new OSMIndoorLayer(mMap, data, style, textStyle);
|
||||||
mMap.layers().add(mIndoorLayer);
|
mMap.layers().add(mIndoorLayer);
|
||||||
|
|
||||||
showToast("data ready");
|
showToast("data ready");
|
||||||
|
|||||||
@@ -46,17 +46,9 @@ public class OSMIndoorLayer extends JeoVectorLayer {
|
|||||||
protected TextBucket mTextLayer;
|
protected TextBucket mTextLayer;
|
||||||
protected TextStyle mText;
|
protected TextStyle mText;
|
||||||
|
|
||||||
public OSMIndoorLayer(Map map, VectorDataset data, Style style) {
|
public OSMIndoorLayer(Map map, VectorDataset data, Style style, TextStyle textStyle) {
|
||||||
this(map, data, style, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OSMIndoorLayer(Map map, VectorDataset data, Style style, float scale) {
|
|
||||||
super(map, data, style);
|
super(map, data, style);
|
||||||
|
mText = textStyle;
|
||||||
mText = TextStyle.builder()
|
|
||||||
.fontSize(16 * scale).color(Color.BLACK)
|
|
||||||
.strokeWidth(2.2f * scale).strokeColor(Color.WHITE)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean[] activeLevels = new boolean[10];
|
public boolean[] activeLevels = new boolean[10];
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2014 Hannes Janetzek
|
||||||
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@@ -32,11 +33,13 @@ import org.jeo.vector.Schema;
|
|||||||
import org.jeo.vector.SchemaBuilder;
|
import org.jeo.vector.SchemaBuilder;
|
||||||
import org.jeo.vector.VectorDataset;
|
import org.jeo.vector.VectorDataset;
|
||||||
import org.jeo.vector.VectorQuery;
|
import org.jeo.vector.VectorQuery;
|
||||||
|
import org.oscim.backend.canvas.Color;
|
||||||
import org.oscim.layers.OSMIndoorLayer;
|
import org.oscim.layers.OSMIndoorLayer;
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
import org.oscim.renderer.MapRenderer;
|
import org.oscim.renderer.MapRenderer;
|
||||||
|
import org.oscim.theme.styles.TextStyle;
|
||||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -60,7 +63,12 @@ public class JeoTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Style style = JeoTest.getStyle();
|
Style style = JeoTest.getStyle();
|
||||||
map.layers().add(new OSMIndoorLayer(map, data, style));
|
TextStyle textStyle = TextStyle.builder()
|
||||||
|
.isCaption(true)
|
||||||
|
.fontSize(16).color(Color.BLACK)
|
||||||
|
.strokeWidth(2.2f).strokeColor(Color.WHITE)
|
||||||
|
.build();
|
||||||
|
map.layers().add(new OSMIndoorLayer(map, data, style, textStyle));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Style getStyle() {
|
public static Style getStyle() {
|
||||||
|
|||||||
@@ -19,12 +19,14 @@ package org.oscim.test.jeo;
|
|||||||
|
|
||||||
import org.jeo.map.Style;
|
import org.jeo.map.Style;
|
||||||
import org.jeo.vector.VectorDataset;
|
import org.jeo.vector.VectorDataset;
|
||||||
|
import org.oscim.backend.canvas.Color;
|
||||||
import org.oscim.gdx.GdxMap;
|
import org.oscim.gdx.GdxMap;
|
||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.layers.JeoVectorLayer;
|
import org.oscim.layers.JeoVectorLayer;
|
||||||
import org.oscim.layers.OSMIndoorLayer;
|
import org.oscim.layers.OSMIndoorLayer;
|
||||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.test.JeoTest;
|
import org.oscim.test.JeoTest;
|
||||||
|
import org.oscim.theme.styles.TextStyle;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -54,7 +56,12 @@ public class LayerTest extends GdxMap {
|
|||||||
|
|
||||||
VectorDataset data = JeoTest.readGeoJson(is);
|
VectorDataset data = JeoTest.readGeoJson(is);
|
||||||
Style style = JeoTest.getStyle();
|
Style style = JeoTest.getStyle();
|
||||||
mIndoorLayer = new OSMIndoorLayer(mMap, data, style);
|
TextStyle textStyle = TextStyle.builder()
|
||||||
|
.isCaption(true)
|
||||||
|
.fontSize(16).color(Color.BLACK)
|
||||||
|
.strokeWidth(2.2f).strokeColor(Color.WHITE)
|
||||||
|
.build();
|
||||||
|
mIndoorLayer = new OSMIndoorLayer(mMap, data, style, textStyle);
|
||||||
mIndoorLayer.activeLevels[0] = true;
|
mIndoorLayer.activeLevels[0] = true;
|
||||||
mIndoorLayer.activeLevels[1] = true;
|
mIndoorLayer.activeLevels[1] = true;
|
||||||
mIndoorLayer.activeLevels[2] = true;
|
mIndoorLayer.activeLevels[2] = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user