Samples: update with scaled tile size #183
This commit is contained in:
parent
c991666d97
commit
2a2b30f9fc
@ -21,6 +21,7 @@ import android.os.Bundle;
|
||||
|
||||
import org.oscim.android.MapPreferences;
|
||||
import org.oscim.android.MapView;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.map.Map;
|
||||
|
||||
public class MapActivity extends Activity {
|
||||
@ -40,6 +41,7 @@ public class MapActivity extends Activity {
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Tile.SIZE = Tile.calculateTileSize(getResources().getDisplayMetrics().scaledDensity);
|
||||
setContentView(mContentView);
|
||||
|
||||
setTitle(getClass().getSimpleName());
|
||||
|
@ -40,10 +40,10 @@ public class MainActivity extends AndroidApplication {
|
||||
AndroidGraphics.init();
|
||||
GdxAssets.init("");
|
||||
GLAdapter.init(new AndroidGL());
|
||||
Tile.SIZE = 400;
|
||||
|
||||
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
||||
CanvasAdapter.dpi = (int) Math.max(metrics.xdpi, metrics.ydpi);
|
||||
Tile.SIZE = Tile.calculateTileSize(metrics.scaledDensity);
|
||||
|
||||
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
|
||||
cfg.stencil = 8;
|
||||
|
@ -21,6 +21,8 @@ import android.os.Bundle;
|
||||
|
||||
import org.oscim.android.MapPreferences;
|
||||
import org.oscim.android.MapView;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.layers.TileGridLayer;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
@ -34,6 +36,7 @@ public class TestActivity extends Activity {
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Tile.SIZE = Tile.calculateTileSize(getResources().getDisplayMetrics().scaledDensity);
|
||||
setContentView(R.layout.activity_map);
|
||||
|
||||
mMapView = (MapView) findViewById(R.id.mapView);
|
||||
@ -43,6 +46,7 @@ public class TestActivity extends Activity {
|
||||
VectorTileLayer baseLayer = map.setBaseMap(new OSciMap4TileSource());
|
||||
map.layers().add(new BuildingLayer(map, baseLayer));
|
||||
map.layers().add(new LabelLayer(map, baseLayer));
|
||||
map.layers().add(new TileGridLayer(map));
|
||||
map.setTheme(VtmThemes.DEFAULT);
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@ import org.oscim.app.location.LocationDialog;
|
||||
import org.oscim.app.location.LocationHandler;
|
||||
import org.oscim.app.preferences.EditPreferences;
|
||||
import org.oscim.core.GeoPoint;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.overlay.DistanceTouchOverlay;
|
||||
import org.osmdroid.location.POI;
|
||||
import org.osmdroid.overlays.MapEventsReceiver;
|
||||
@ -73,6 +74,7 @@ public class TileMap extends MapActivity implements MapEventsReceiver {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Tile.SIZE = Tile.calculateTileSize(getResources().getDisplayMetrics().scaledDensity);
|
||||
setContentView(R.layout.activity_tilemap);
|
||||
App.view = (MapView) findViewById(R.id.mapView);
|
||||
registerMapView(App.view);
|
||||
|
@ -45,21 +45,20 @@ public class GdxMapApp extends GdxMap {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Tile.SIZE = 360;
|
||||
init();
|
||||
new LwjglApplication(new GdxMapApp(), getConfig());
|
||||
}
|
||||
|
||||
public static void run(GdxMap map) {
|
||||
run(map, null, Tile.SIZE);
|
||||
}
|
||||
|
||||
public static void run(GdxMap map, LwjglApplicationConfiguration config, int tileSize) {
|
||||
Tile.SIZE = FastMath.clamp(tileSize, 128, 512);
|
||||
|
||||
new LwjglApplication(map, (config == null ? getConfig() : config));
|
||||
}
|
||||
|
||||
public static void run(LwjglApplicationConfiguration config, int tileSize, GdxMap map) {
|
||||
run(map, config, tileSize);
|
||||
}
|
||||
|
||||
static protected LwjglApplicationConfiguration getConfig() {
|
||||
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
|
||||
cfg.title = "vtm-gdx";
|
||||
|
@ -70,6 +70,6 @@ public class MapzenTest extends GdxMap {
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new MapzenTest(), null, 400);
|
||||
GdxMapApp.run(new MapzenTest());
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
import org.oscim.backend.canvas.Color;
|
||||
@ -109,7 +125,7 @@ public class HairLineTest extends GdxMap {
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new HairLineTest(), null, 400);
|
||||
GdxMapApp.run(new HairLineTest());
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -120,6 +120,6 @@ public class LineTexTest extends GdxMapApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new LineTexTest(), null, 400);
|
||||
GdxMapApp.run(new LineTexTest());
|
||||
}
|
||||
}
|
||||
|
@ -63,6 +63,6 @@ public class MapTest extends GdxMapApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new MapTest(), null, 400);
|
||||
GdxMapApp.run(new MapTest());
|
||||
}
|
||||
}
|
||||
|
@ -71,6 +71,6 @@ public class MapsforgeTest extends GdxMap {
|
||||
mapFile = getMapFile(args);
|
||||
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new MapsforgeTest(), null, 400);
|
||||
GdxMapApp.run(new MapsforgeTest());
|
||||
}
|
||||
}
|
||||
|
@ -87,6 +87,6 @@ public class MarkerLayerTest extends GdxMapApp implements ItemizedLayer.OnItemGe
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new MarkerLayerTest(), null, 400);
|
||||
GdxMapApp.run(new MarkerLayerTest());
|
||||
}
|
||||
}
|
||||
|
@ -102,6 +102,6 @@ public class PathLayerTest extends GdxMapApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new PathLayerTest(), null, 400);
|
||||
GdxMapApp.run(new PathLayerTest());
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
import com.badlogic.gdx.Input;
|
||||
@ -73,7 +89,7 @@ public class RuleVisitorTest extends GdxMap {
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new RuleVisitorTest(), null, 400);
|
||||
GdxMapApp.run(new RuleVisitorTest());
|
||||
}
|
||||
|
||||
static class SaturateLineStyles extends RuleVisitor {
|
||||
|
@ -43,6 +43,6 @@ public class S3DBLayerTest extends GdxMapApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
init();
|
||||
run(new S3DBLayerTest(), null, 400);
|
||||
run(new S3DBLayerTest());
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
import org.oscim.backend.canvas.Color;
|
||||
@ -56,6 +72,6 @@ public class ThemeBuilderTest extends GdxMap {
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new ThemeBuilderTest(), null, 400);
|
||||
GdxMapApp.run(new ThemeBuilderTest());
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
import org.oscim.backend.canvas.Color;
|
||||
@ -197,6 +213,6 @@ public class TileRenderTest extends GdxMapApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new TileRenderTest(), null, 512);
|
||||
GdxMapApp.run(new TileRenderTest());
|
||||
}
|
||||
}
|
||||
|
@ -91,6 +91,6 @@ public class VectorLayerTest extends GdxMapApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new VectorLayerTest(), null, 400);
|
||||
GdxMapApp.run(new VectorLayerTest());
|
||||
}
|
||||
}
|
||||
|
@ -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.gdx.poi3d;
|
||||
|
||||
import org.oscim.gdx.GdxMap;
|
||||
@ -43,6 +59,6 @@ public class Gdx3DTest extends GdxMap {
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new Gdx3DTest(), null, 320);
|
||||
GdxMapApp.run(new Gdx3DTest());
|
||||
}
|
||||
}
|
||||
|
@ -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.renderer;
|
||||
|
||||
import org.oscim.backend.canvas.Color;
|
||||
@ -30,7 +46,7 @@ public class AtlasTest extends GdxMap {
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new AtlasTest(), null, 400);
|
||||
GdxMapApp.run(new AtlasTest());
|
||||
}
|
||||
|
||||
static class AtlasRenderLayer extends BucketRenderer {
|
||||
|
@ -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.renderer;
|
||||
|
||||
import org.oscim.backend.canvas.Color;
|
||||
@ -23,7 +39,7 @@ public class BezierTest extends GdxMap {
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new BezierTest(), null, 400);
|
||||
GdxMapApp.run(new BezierTest());
|
||||
}
|
||||
|
||||
static class BezierPathLayer extends BucketRenderer {
|
||||
|
@ -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.renderer;
|
||||
|
||||
import org.oscim.backend.GL;
|
||||
@ -28,7 +44,7 @@ public class HexagonRenderTest extends GdxMap {
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new HexagonRenderTest(), null, 400);
|
||||
GdxMapApp.run(new HexagonRenderTest());
|
||||
}
|
||||
|
||||
/* This is an example how to integrate custom OpenGL drawing routines as map
|
||||
|
Loading…
x
Reference in New Issue
Block a user