Samples: various improvements, #32
This commit is contained in:
parent
37ace257cf
commit
915046fb9a
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* 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.test;
|
package org.oscim.test;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -9,13 +25,16 @@ import org.oscim.core.MapPosition;
|
|||||||
import org.oscim.event.Event;
|
import org.oscim.event.Event;
|
||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.layers.JtsPathLayer;
|
import org.oscim.layers.JtsPathLayer;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||||
import org.oscim.map.Map.UpdateListener;
|
import org.oscim.map.Map.UpdateListener;
|
||||||
|
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||||
|
|
||||||
public class PathLayerTest extends GdxMapApp {
|
public class PathLayerTest extends GdxMapApp {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createLayers() {
|
public void createLayers() {
|
||||||
|
mMap.setBaseMap(new BitmapTileLayer(mMap, DefaultSources.STAMEN_TONER.build()));
|
||||||
|
|
||||||
createLayers(1, true);
|
createLayers(1, true);
|
||||||
|
|
||||||
mMap.setMapPosition(0, 0, 1 << 2);
|
mMap.setMapPosition(0, 0, 1 << 2);
|
||||||
@ -23,24 +42,24 @@ public class PathLayerTest extends GdxMapApp {
|
|||||||
mMap.events.bind(new UpdateListener() {
|
mMap.events.bind(new UpdateListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onMapEvent(Event e, MapPosition mapPosition) {
|
public void onMapEvent(Event e, MapPosition mapPosition) {
|
||||||
if (e == Map.UPDATE_EVENT) {
|
//if (e == Map.UPDATE_EVENT) {
|
||||||
long t = System.currentTimeMillis();
|
long t = System.currentTimeMillis();
|
||||||
float pos = t % 20000 / 10000f - 1f;
|
float pos = t % 20000 / 10000f - 1f;
|
||||||
createLayers(pos, false);
|
createLayers(pos, false);
|
||||||
mMap.updateMap(true);
|
mMap.updateMap(true);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<JtsPathLayer> mPathLayers = new ArrayList<JtsPathLayer>();
|
ArrayList<JtsPathLayer> mPathLayers = new ArrayList<>();
|
||||||
|
|
||||||
void createLayers(float pos, boolean init) {
|
void createLayers(float pos, boolean init) {
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (double lat = -90; lat <= 90; lat += 5) {
|
for (double lat = -90; lat <= 90; lat += 5) {
|
||||||
List<GeoPoint> pts = new ArrayList<GeoPoint>();
|
List<GeoPoint> pts = new ArrayList<>();
|
||||||
|
|
||||||
for (double lon = -180; lon <= 180; lon += 2) {
|
for (double lon = -180; lon <= 180; lon += 2) {
|
||||||
//pts.add(new GeoPoint(lat, lon));
|
//pts.add(new GeoPoint(lat, lon));
|
||||||
|
@ -1,21 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* 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.test;
|
package org.oscim.test;
|
||||||
|
|
||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
|
||||||
import org.oscim.layers.tile.buildings.S3DBLayer;
|
import org.oscim.layers.tile.buildings.S3DBLayer;
|
||||||
|
import org.oscim.theme.VtmThemes;
|
||||||
import org.oscim.tiling.TileSource;
|
import org.oscim.tiling.TileSource;
|
||||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
|
||||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
|
||||||
public class S3DBLayerTest extends GdxMapApp {
|
public class S3DBLayerTest extends GdxMapApp {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createLayers() {
|
public void createLayers() {
|
||||||
|
mMap.setBaseMap(new OSciMap4TileSource());
|
||||||
//VectorTileLayer l = mMap.setBaseMap(new OSciMap4TileSource());
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
//mMap.setTheme(VtmThemes.DEFAULT);
|
|
||||||
|
|
||||||
mMap.setBaseMap(new BitmapTileLayer(mMap, DefaultSources.STAMEN_TONER.build()));
|
|
||||||
|
|
||||||
TileSource ts = OSciMap4TileSource
|
TileSource ts = OSciMap4TileSource
|
||||||
.builder()
|
.builder()
|
||||||
|
@ -1,22 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* 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.test;
|
package org.oscim.test;
|
||||||
|
|
||||||
import org.oscim.backend.canvas.Color;
|
import org.oscim.backend.canvas.Color;
|
||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
|
import org.oscim.layers.TileGridLayer;
|
||||||
import org.oscim.layers.vector.VectorLayer;
|
import org.oscim.layers.vector.VectorLayer;
|
||||||
import org.oscim.layers.vector.geometries.PointDrawable;
|
import org.oscim.layers.vector.geometries.PointDrawable;
|
||||||
import org.oscim.layers.vector.geometries.Style;
|
import org.oscim.layers.vector.geometries.Style;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.theme.VtmThemes;
|
||||||
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
import org.oscim.utils.ColorUtil;
|
import org.oscim.utils.ColorUtil;
|
||||||
|
|
||||||
public class VectorLayerTest extends GdxMapApp {
|
public class VectorLayerTest extends GdxMapApp {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createLayers() {
|
public void createLayers() {
|
||||||
Map map = getMap();
|
mMap.setBaseMap(new OSciMap4TileSource());
|
||||||
|
mMap.setTheme(VtmThemes.DEFAULT);
|
||||||
|
|
||||||
//VectorTileLayer tileLayer = map.setBaseMap(new OSciMap4TileSource());
|
VectorLayer vectorLayer = new VectorLayer(mMap);
|
||||||
|
|
||||||
VectorLayer vectorLayer = new VectorLayer(map);
|
|
||||||
|
|
||||||
// vectorLayer.add(new PointDrawable(0, 180, Style.builder()
|
// vectorLayer.add(new PointDrawable(0, 180, Style.builder()
|
||||||
// .setBuffer(10)
|
// .setBuffer(10)
|
||||||
@ -38,8 +55,6 @@ public class VectorLayerTest extends GdxMapApp {
|
|||||||
.fillColor(Color.RED)
|
.fillColor(Color.RED)
|
||||||
.fillAlpha(0.2);
|
.fillAlpha(0.2);
|
||||||
|
|
||||||
Style style = sb.fillAlpha(0.2).build();
|
|
||||||
|
|
||||||
// int tileSize = 5;
|
// int tileSize = 5;
|
||||||
// for (int x = -180; x < 200; x += tileSize) {
|
// for (int x = -180; x < 200; x += tileSize) {
|
||||||
// for (int y = -90; y < 90; y += tileSize) {
|
// for (int y = -90; y < 90; y += tileSize) {
|
||||||
@ -54,7 +69,7 @@ public class VectorLayerTest extends GdxMapApp {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
for (int i = 0; i < 1000; i++) {
|
for (int i = 0; i < 1000; i++) {
|
||||||
style = sb.buffer(Math.random() * 1)
|
Style style = sb.buffer(Math.random() * 1)
|
||||||
.fillColor(ColorUtil.setHue(Color.RED,
|
.fillColor(ColorUtil.setHue(Color.RED,
|
||||||
Math.random()))
|
Math.random()))
|
||||||
.fillAlpha(0.5)
|
.fillAlpha(0.5)
|
||||||
@ -66,12 +81,10 @@ public class VectorLayerTest extends GdxMapApp {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
map.layers().add(vectorLayer);
|
mMap.layers().add(vectorLayer);
|
||||||
|
mMap.layers().add(new TileGridLayer(mMap, 0xff222222, 1.2f, 1));
|
||||||
|
|
||||||
//map.layers().add(new LabelLayer(map, tileLayer));
|
mMap.setMapPosition(0, 0, 1 << 2);
|
||||||
//map.setTheme(VtmThemes.DEFAULT);
|
|
||||||
|
|
||||||
map.setMapPosition(0, 0, 1 << 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user