jeo: desktop indoor example
This commit is contained in:
parent
5aefd7f5cb
commit
397dd27649
@ -1,23 +1,65 @@
|
|||||||
package org.oscim.jeo.test;
|
package org.oscim.jeo.test;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
|
||||||
import org.jeo.data.VectorDataset;
|
import org.jeo.data.VectorDataset;
|
||||||
import org.jeo.map.Style;
|
import org.jeo.map.Style;
|
||||||
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.TileGridLayer;
|
||||||
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.test.JeoTest;
|
import org.oscim.test.JeoTest;
|
||||||
|
import org.oscim.tiling.source.bitmap.DefaultSources.StamenToner;
|
||||||
|
|
||||||
public class LayerTest extends GdxMap {
|
public class LayerTest extends GdxMap {
|
||||||
|
|
||||||
|
String PATH = "https://gist.github.com/anonymous/8960337/raw/overpass.geojson";
|
||||||
|
|
||||||
|
OSMIndoorLayer mIndoorLayer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createLayers() {
|
public void createLayers() {
|
||||||
//JeoTest.indoorSketch(mMap, "osmindoor.json");
|
mMap.setBackgroundMap(new BitmapTileLayer(mMap, new StamenToner()));
|
||||||
//mMap.setMapPosition(49.417, 8.673, 1 << 17);
|
mMap.layers().add(new TileGridLayer(mMap));
|
||||||
|
|
||||||
VectorDataset data = (VectorDataset) JeoTest.getJsonData("states.json", true);
|
mMap.addTask(new Runnable() {
|
||||||
Style style = JeoTest.getStyle();
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
URL url = new URL(PATH);
|
||||||
|
URLConnection conn = url.openConnection();
|
||||||
|
InputStream is = conn.getInputStream();
|
||||||
|
|
||||||
|
VectorDataset data = JeoTest.readGeoJson(is);
|
||||||
|
Style style = JeoTest.getStyle();
|
||||||
|
mIndoorLayer = new OSMIndoorLayer(mMap, data, style);
|
||||||
|
mIndoorLayer.activeLevels[0] = true;
|
||||||
|
mIndoorLayer.activeLevels[1] = true;
|
||||||
|
mIndoorLayer.activeLevels[2] = true;
|
||||||
|
mIndoorLayer.activeLevels[3] = true;
|
||||||
|
|
||||||
|
mMap.layers().add(new JeoVectorLayer(mMap, data, style));
|
||||||
|
mMap.layers().add(mIndoorLayer);
|
||||||
|
|
||||||
|
mMap.updateMap(true);
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16);
|
||||||
|
|
||||||
|
//VectorDataset data = (VectorDataset) JeoTest.getJsonData("states.json", true);
|
||||||
|
//Style style = JeoTest.getStyle();
|
||||||
|
//mMap.layers().add(new JeoVectorLayer(mMap, data, style));
|
||||||
|
|
||||||
mMap.layers().add(new JeoVectorLayer(mMap, data, style));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user