add list screen for examples
This commit is contained in:
parent
e33a863d3b
commit
153c9b3ec5
@ -4,24 +4,35 @@
|
|||||||
android:versionName="1.0" >
|
android:versionName="1.0" >
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="10"
|
android:minSdkVersion="10"
|
||||||
android:targetSdkVersion="15" />
|
android:targetSdkVersion="18" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name" >
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
|
||||||
android:debuggable="true">
|
<!-- android:theme="@android:style/Theme.NoTitleBar.Fullscreen" -->
|
||||||
<activity
|
<activity
|
||||||
android:name="org.oscim.android.test.MapActivity"
|
android:name="org.oscim.android.test.Samples"
|
||||||
android:label="@string/title_activity_map" >
|
android:label="Samples" >
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="org.oscim.android.test.SimpleMapActivity"
|
||||||
|
android:label="@string/title_activity_map" >
|
||||||
|
</activity>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
7
vtm-android-example/res/layout/activity_samples.xml
Normal file
7
vtm-android-example/res/layout/activity_samples.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="fill_parent">
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/samples" android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical" android:gravity="center_horizontal" />
|
||||||
|
</ScrollView>
|
@ -0,0 +1,35 @@
|
|||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import org.oscim.android.MapActivity;
|
||||||
|
import org.oscim.android.MapView;
|
||||||
|
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||||
|
import org.oscim.tiling.source.TileSource;
|
||||||
|
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.Menu;
|
||||||
|
|
||||||
|
public class BaseMapActivity extends MapActivity {
|
||||||
|
|
||||||
|
MapView mMapView;
|
||||||
|
VectorTileLayer mBaseLayer;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_map);
|
||||||
|
|
||||||
|
mMapView = (MapView) findViewById(R.id.mapView);
|
||||||
|
|
||||||
|
TileSource tileSource = new OSciMap4TileSource();
|
||||||
|
tileSource.setOption("url", "http://opensciencemap.org/tiles/vtm");
|
||||||
|
|
||||||
|
mBaseLayer = mMap.setBaseMap(tileSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
getMenuInflater().inflate(R.menu.activity_map, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -1,79 +0,0 @@
|
|||||||
package org.oscim.android.test;
|
|
||||||
|
|
||||||
import org.oscim.android.MapView;
|
|
||||||
import org.oscim.core.MapPosition;
|
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
|
||||||
import org.oscim.theme.InternalRenderTheme;
|
|
||||||
import org.oscim.tiling.source.TileSource;
|
|
||||||
import org.oscim.tiling.source.mapfile.MapFileTileSource;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Environment;
|
|
||||||
import android.view.Menu;
|
|
||||||
|
|
||||||
public class MapActivity extends org.oscim.android.MapActivity {
|
|
||||||
|
|
||||||
private MapView mMapView;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_map);
|
|
||||||
|
|
||||||
mMapView = (MapView) findViewById(R.id.mapView);
|
|
||||||
|
|
||||||
//mMap = mMap.getMap();
|
|
||||||
//TileSource tileSource = new OSciMap2TileSource();
|
|
||||||
//tileSource.setOption("url", "http://opensciencemap.org/osci/map-live");
|
|
||||||
|
|
||||||
//TileSource tileSource = new OSciMap4TileSource();
|
|
||||||
//tileSource.setOption("url", "http://opensciencemap.org/tiles/vtm");
|
|
||||||
|
|
||||||
TileSource tileSource = new MapFileTileSource();
|
|
||||||
tileSource.setOption("file", Environment.getExternalStorageDirectory() + "/germany.map");
|
|
||||||
|
|
||||||
//GarminImgTileSource tileSource = new GarminImgTileSource();
|
|
||||||
//tileSource.setMapFile(Environment.getExternalStorageDirectory() + "/62760103.img");
|
|
||||||
|
|
||||||
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
|
||||||
|
|
||||||
//mMap.getLayers().add(new BuildingLayer(mMap, l.getTileLayer()));
|
|
||||||
mMap.getLayers().add(new LabelLayer(mMap, l.getTileLayer()));
|
|
||||||
|
|
||||||
//mMap.setTheme(InternalRenderTheme.DEFAULT);
|
|
||||||
//mMap.setTheme(InternalRenderTheme.TRONRENDER);
|
|
||||||
mMap.setTheme(InternalRenderTheme.OSMARENDER);
|
|
||||||
|
|
||||||
// try {
|
|
||||||
// IRenderTheme theme = ThemeLoader.load("freizeitkarte/theme.xml");
|
|
||||||
// l.setRenderTheme(theme);
|
|
||||||
// MapRenderer.setBackgroundColor(theme.getMapBackground());
|
|
||||||
// } catch (FileNotFoundException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
|
|
||||||
//mMap.getLayers().add(new BitmapTileLayer(mMap, HillShadeTiles.INSTANCE));
|
|
||||||
|
|
||||||
//mMap.setBackgroundMap(new BitmapTileLayer(mMap, StamenWaterTiles.INSTANCE));
|
|
||||||
//mMap.setBackgroundMap(new BitmapTileLayer(mMap, MapQuestAerial.INSTANCE));
|
|
||||||
|
|
||||||
//mMap.getLayers().add(new GenericLayer(mMap, new GridRenderer()));
|
|
||||||
|
|
||||||
//mMap.getLayers().add(new JeoMapLayer(mMap));
|
|
||||||
|
|
||||||
MapPosition p = new MapPosition();
|
|
||||||
p.setZoomLevel(14);
|
|
||||||
p.setPosition(53.08, 8.83);
|
|
||||||
mMap.setMapPosition(p);
|
|
||||||
|
|
||||||
mMapView.setClickable(true);
|
|
||||||
mMapView.setFocusable(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
getMenuInflater().inflate(R.menu.activity_map, menu);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
57
vtm-android-example/src/org/oscim/android/test/Samples.java
Normal file
57
vtm-android-example/src/org/oscim/android/test/Samples.java
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010, 2011, 2012, 2013 mapsforge.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.android.test;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple start screen for the sample activities.
|
||||||
|
*/
|
||||||
|
public class Samples extends Activity {
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
setContentView(R.layout.activity_samples);
|
||||||
|
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.samples);
|
||||||
|
linearLayout.addView(createButton(SimpleMapActivity.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Button createButton(final Class<?> clazz) {
|
||||||
|
return this.createButton(clazz, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Button createButton(final Class<?> clazz, String text) {
|
||||||
|
Button button = new Button(this);
|
||||||
|
if (text == null) {
|
||||||
|
button.setText(clazz.getSimpleName());
|
||||||
|
} else {
|
||||||
|
button.setText(text);
|
||||||
|
}
|
||||||
|
button.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
startActivity(new Intent(Samples.this, clazz));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return button;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package org.oscim.android.test;
|
||||||
|
|
||||||
|
import org.oscim.layers.tile.vector.BuildingLayer;
|
||||||
|
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||||
|
import org.oscim.theme.InternalRenderTheme;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
public class SimpleMapActivity extends BaseMapActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
mMap.getLayers().add(new BuildingLayer(mMap, mBaseLayer.getTileLayer()));
|
||||||
|
mMap.getLayers().add(new LabelLayer(mMap, mBaseLayer.getTileLayer()));
|
||||||
|
|
||||||
|
//mMap.getLayers().add(new GenericLayer(mMap, new GridRenderer()));
|
||||||
|
|
||||||
|
mMap.setTheme(InternalRenderTheme.DEFAULT);
|
||||||
|
//mMap.setTheme(InternalRenderTheme.TRONRENDER);
|
||||||
|
//mMap.setTheme(InternalRenderTheme.OSMARENDER);
|
||||||
|
|
||||||
|
mMap.setMapPosition(53.08, 8.83, Math.pow(2, 14));
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user