Update samples
This commit is contained in:
parent
2cf9a4a472
commit
e6137163b9
@ -21,15 +21,9 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".AtlasMarkerOverlayActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".AtlasMultiTextureActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".AtlasThemeActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".BitmapTileActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
@ -48,9 +42,6 @@
|
||||
<activity
|
||||
android:name=".JeoIndoorActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".LayerGroupActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".LineTexActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
@ -60,9 +51,6 @@
|
||||
<activity
|
||||
android:name=".LocationTextureActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".MapEventLayer2Activity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".MapilionMvtActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
@ -93,9 +81,6 @@
|
||||
<activity
|
||||
android:name=".MBTilesBitmapTileActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".MultiMapViewActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".NextzenGeojsonActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
@ -105,9 +90,6 @@
|
||||
<activity
|
||||
android:name=".OpenMapTilesMvtActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".OSciMapS3DBActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".OverpassActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
@ -120,15 +102,9 @@
|
||||
<activity
|
||||
android:name=".PoiSearchActivity$PoiFilePicker"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".POTTextureActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".ReverseGeocodeActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".RotateMarkerOverlayActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
<activity
|
||||
android:name=".ShadowActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||
|
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2017 Longri
|
||||
*
|
||||
* 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.android.test;
|
||||
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.core.GeoPoint;
|
||||
import org.oscim.layers.marker.ItemizedLayer;
|
||||
import org.oscim.layers.marker.MarkerItem;
|
||||
import org.oscim.layers.marker.MarkerSymbol;
|
||||
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.renderer.atlas.TextureAtlas;
|
||||
import org.oscim.renderer.atlas.TextureRegion;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
import org.oscim.utils.TextureAtlasUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static org.oscim.android.canvas.AndroidGraphics.drawableToBitmap;
|
||||
|
||||
public class AtlasMarkerOverlayActivity extends MarkerOverlayActivity {
|
||||
|
||||
@Override
|
||||
void createLayers() {
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||
|
||||
Bitmap bitmapPoi = drawableToBitmap(getResources().getDrawable(R.drawable.marker_poi));
|
||||
Bitmap bitmapFocus = drawableToBitmap(getResources().getDrawable(R.drawable.marker_focus));
|
||||
|
||||
// Create Atlas from Bitmaps
|
||||
java.util.Map<Object, Bitmap> inputMap = new LinkedHashMap<>();
|
||||
java.util.Map<Object, TextureRegion> regionsMap = new LinkedHashMap<>();
|
||||
List<TextureAtlas> atlasList = new ArrayList<>();
|
||||
|
||||
inputMap.put("poi", bitmapPoi);
|
||||
inputMap.put("focus", bitmapFocus);
|
||||
|
||||
// Bitmaps will never used any more
|
||||
// With iOS we must flip the Y-Axis
|
||||
TextureAtlasUtils.createTextureRegions(inputMap, regionsMap, atlasList, true, false);
|
||||
|
||||
MarkerSymbol symbol;
|
||||
if (BILLBOARDS)
|
||||
symbol = new MarkerSymbol(regionsMap.get("poi"), HotspotPlace.BOTTOM_CENTER);
|
||||
else
|
||||
symbol = new MarkerSymbol(regionsMap.get("poi"), HotspotPlace.CENTER, false);
|
||||
|
||||
if (BILLBOARDS)
|
||||
mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.BOTTOM_CENTER);
|
||||
else
|
||||
mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.CENTER, false);
|
||||
|
||||
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
|
||||
mMap.layers().add(mMarkerLayer);
|
||||
|
||||
List<MarkerItem> pts = new ArrayList<>();
|
||||
|
||||
for (double lat = -90; lat <= 90; lat += 5) {
|
||||
for (double lon = -180; lon <= 180; lon += 5)
|
||||
pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon)));
|
||||
}
|
||||
|
||||
mMarkerLayer.addItems(pts);
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 Longri
|
||||
* Copyright 2017-2018 devemux86
|
||||
*
|
||||
* 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.os.Bundle;
|
||||
|
||||
import org.oscim.utils.Parameters;
|
||||
|
||||
public class AtlasThemeActivity extends SimpleMapActivity {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
Parameters.TEXTURE_ATLAS = true;
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
Parameters.TEXTURE_ATLAS = false;
|
||||
}
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016 Andrey Novikov
|
||||
*
|
||||
* 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.android.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.map.Layers;
|
||||
import org.oscim.renderer.BitmapRenderer;
|
||||
import org.oscim.renderer.GLViewport;
|
||||
import org.oscim.scalebar.DefaultMapScaleBar;
|
||||
import org.oscim.scalebar.ImperialUnitAdapter;
|
||||
import org.oscim.scalebar.MapScaleBar;
|
||||
import org.oscim.scalebar.MapScaleBarLayer;
|
||||
import org.oscim.scalebar.MetricUnitAdapter;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
|
||||
public class LayerGroupActivity extends BaseMapActivity {
|
||||
|
||||
private static final int GROUP_3D_OBJECTS = 1;
|
||||
private static final int GROUP_LABELS = 2;
|
||||
private static final int GROUP_OVERLAYS = 3;
|
||||
|
||||
private DefaultMapScaleBar mapScaleBar;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Layers layers = mMap.layers();
|
||||
|
||||
layers.addGroup(GROUP_3D_OBJECTS);
|
||||
layers.add(new BuildingLayer(mMap, mBaseLayer), GROUP_3D_OBJECTS);
|
||||
|
||||
layers.addGroup(GROUP_LABELS);
|
||||
layers.add(new LabelLayer(mMap, mBaseLayer), GROUP_LABELS);
|
||||
|
||||
mapScaleBar = new DefaultMapScaleBar(mMap);
|
||||
mapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
|
||||
mapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
|
||||
mapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
|
||||
mapScaleBar.setScaleBarPosition(MapScaleBar.ScaleBarPosition.BOTTOM_LEFT);
|
||||
|
||||
MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mMap, mapScaleBar);
|
||||
BitmapRenderer renderer = mapScaleBarLayer.getRenderer();
|
||||
renderer.setPosition(GLViewport.Position.BOTTOM_LEFT);
|
||||
renderer.setOffset(5 * CanvasAdapter.getScale(), 0);
|
||||
|
||||
layers.addGroup(GROUP_OVERLAYS);
|
||||
layers.add(mapScaleBarLayer, GROUP_OVERLAYS);
|
||||
|
||||
mMap.setTheme(VtmThemes.DEFAULT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mapScaleBar != null)
|
||||
mapScaleBar.destroy();
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016-2019 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -18,7 +18,6 @@
|
||||
package org.oscim.android.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.core.MapPosition;
|
||||
@ -38,7 +37,7 @@ import java.util.List;
|
||||
*/
|
||||
public class LineTexActivity extends BitmapTileActivity {
|
||||
|
||||
private static final boolean ANIMATION = false;
|
||||
private static final boolean ANIMATION = true;
|
||||
|
||||
private List<PathLayer> mPathLayers = new ArrayList<>();
|
||||
|
||||
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* 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 org.oscim.utils.Parameters;
|
||||
|
||||
public class MapEventLayer2Activity extends MarkerOverlayActivity {
|
||||
|
||||
public MapEventLayer2Activity() {
|
||||
super();
|
||||
Parameters.MAP_EVENT_LAYER2 = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
Parameters.MAP_EVENT_LAYER2 = false;
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 Marvin W
|
||||
* Copyright 2016-2017 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.android.test;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.android.MapPreferences;
|
||||
import org.oscim.android.MapView;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
|
||||
public class MultiMapViewActivity extends Activity {
|
||||
private MapView mMapView1, mMapView2;
|
||||
private MapPreferences mPrefs1, mPrefs2;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_map_multi);
|
||||
|
||||
setTitle(getClass().getSimpleName());
|
||||
|
||||
// 1st map view
|
||||
mMapView1 = (MapView) findViewById(R.id.mapView1);
|
||||
Map map1 = mMapView1.map();
|
||||
mPrefs1 = new MapPreferences(MultiMapViewActivity.class.getName() + "1", this);
|
||||
TileSource tileSource1 = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
VectorTileLayer baseLayer1 = map1.setBaseMap(tileSource1);
|
||||
map1.layers().add(new BuildingLayer(map1, baseLayer1));
|
||||
map1.layers().add(new LabelLayer(map1, baseLayer1));
|
||||
map1.setTheme(VtmThemes.DEFAULT);
|
||||
|
||||
// 2nd map view
|
||||
mMapView2 = (MapView) findViewById(R.id.mapView2);
|
||||
Map map2 = mMapView2.map();
|
||||
mPrefs2 = new MapPreferences(MultiMapViewActivity.class.getName() + "2", this);
|
||||
TileSource tileSource2 = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
VectorTileLayer baseLayer2 = map2.setBaseMap(tileSource2);
|
||||
map2.layers().add(new BuildingLayer(map2, baseLayer2));
|
||||
map2.layers().add(new LabelLayer(map2, baseLayer2));
|
||||
map2.setTheme(VtmThemes.DEFAULT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
mPrefs1.load(mMapView1.map());
|
||||
mMapView1.onResume();
|
||||
|
||||
mPrefs2.load(mMapView2.map());
|
||||
mMapView2.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
mMapView1.onPause();
|
||||
mPrefs1.save(mMapView1.map());
|
||||
|
||||
mMapView2.onPause();
|
||||
mPrefs2.save(mMapView2.map());
|
||||
}
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2017 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.android.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.android.cache.TileCache;
|
||||
import org.oscim.layers.tile.TileLayer;
|
||||
import org.oscim.layers.tile.buildings.S3DBTileLayer;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
|
||||
public class OSciMapS3DBActivity extends BaseMapActivity {
|
||||
|
||||
TileCache mS3dbCache;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mMap.setTheme(VtmThemes.DEFAULT);
|
||||
|
||||
TileSource ts = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.url("http://opensciencemap.org/tiles/s3db")
|
||||
.zoomMin(16)
|
||||
.zoomMax(16)
|
||||
.build();
|
||||
|
||||
if (USE_CACHE) {
|
||||
mS3dbCache = new TileCache(this, null, "s3db.db");
|
||||
mS3dbCache.setCacheSize(512 * (1 << 10));
|
||||
ts.setCache(mS3dbCache);
|
||||
}
|
||||
TileLayer tl = new S3DBTileLayer(mMap, ts, true, false);
|
||||
mMap.layers().add(tl);
|
||||
mMap.layers().add(new LabelLayer(mMap, mBaseLayer));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
if (mS3dbCache != null)
|
||||
mS3dbCache.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
/* ignore saved position */
|
||||
mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16);
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017-2018 devemux86
|
||||
*
|
||||
* 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.os.Bundle;
|
||||
|
||||
import org.oscim.utils.Parameters;
|
||||
|
||||
public class POTTextureActivity extends SimpleMapActivity {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
Parameters.POT_TEXTURES = true;
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
Parameters.POT_TEXTURES = false;
|
||||
}
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016-2017 devemux86
|
||||
* Copyright 2017 Longri
|
||||
*
|
||||
* 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.android.test;
|
||||
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.oscim.layers.marker.MarkerItem;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class RotateMarkerOverlayActivity extends MarkerOverlayActivity {
|
||||
|
||||
private Timer timer;
|
||||
private int markerCount = 0;
|
||||
|
||||
private void itemEvent(final MarkerItem item) {
|
||||
if (item.getMarker() == null) {
|
||||
item.setMarker(mFocusMarker);
|
||||
markerCount++;
|
||||
final AtomicInteger rotValue = new AtomicInteger(0);
|
||||
if (timer != null)
|
||||
timer.cancel();
|
||||
timer = new Timer();
|
||||
TimerTask timerTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
float value = (float) (rotValue.incrementAndGet() * 10);
|
||||
item.setRotation(value);
|
||||
if (rotValue.get() > 36)
|
||||
rotValue.set(0);
|
||||
mMarkerLayer.update();
|
||||
mMap.updateMap(true);
|
||||
}
|
||||
};
|
||||
timer.schedule(timerTask, 1000, 1000);
|
||||
|
||||
} else {
|
||||
item.setMarker(null);
|
||||
markerCount--;
|
||||
if (timer != null && markerCount == 0)
|
||||
timer.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemSingleTapUp(int index, MarkerItem item) {
|
||||
itemEvent(item);
|
||||
|
||||
Toast.makeText(this, "Marker tap\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemLongPress(int index, MarkerItem item) {
|
||||
itemEvent(item);
|
||||
|
||||
Toast.makeText(this, "Marker long press\n" + item.getTitle(), Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
}
|
@ -90,10 +90,10 @@ public class Samples extends Activity {
|
||||
linearLayout.addView(createButton(MapsforgeActivity.class));
|
||||
linearLayout.addView(createButton(MapilionMvtActivity.class));
|
||||
/*linearLayout.addView(createButton(MapzenMvtActivity.class));
|
||||
linearLayout.addView(createButton(MapzenGeojsonActivity.class));*/
|
||||
linearLayout.addView(createButton(MapzenGeojsonActivity.class));
|
||||
linearLayout.addView(createButton(NextzenMvtActivity.class));
|
||||
linearLayout.addView(createButton(NextzenGeojsonActivity.class));
|
||||
linearLayout.addView(createButton(OpenMapTilesMvtActivity.class));
|
||||
linearLayout.addView(createButton(OpenMapTilesMvtActivity.class));*/
|
||||
linearLayout.addView(createButton(GdxActivity.class));
|
||||
|
||||
linearLayout.addView(createLabel("Features"));
|
||||
@ -110,8 +110,6 @@ public class Samples extends Activity {
|
||||
linearLayout.addView(createLabel("Vector Features"));
|
||||
linearLayout.addView(createButton(MapsforgeStyleActivity.class));
|
||||
linearLayout.addView(createButton(MapsforgeS3DBActivity.class));
|
||||
linearLayout.addView(createButton(AtlasThemeActivity.class));
|
||||
linearLayout.addView(createButton(POTTextureActivity.class));
|
||||
linearLayout.addView(createButton(ShadowActivity.class));
|
||||
|
||||
linearLayout.addView(createLabel("Raster Maps"));
|
||||
@ -120,27 +118,17 @@ public class Samples extends Activity {
|
||||
|
||||
linearLayout.addView(createLabel("Overlays"));
|
||||
linearLayout.addView(createButton(MarkerOverlayActivity.class));
|
||||
linearLayout.addView(createButton(RotateMarkerOverlayActivity.class));
|
||||
linearLayout.addView(createButton(AtlasMarkerOverlayActivity.class));
|
||||
linearLayout.addView(createButton(AtlasMultiTextureActivity.class));
|
||||
linearLayout.addView(createButton(ClusterMarkerOverlayActivity.class));
|
||||
linearLayout.addView(createButton(PathOverlayActivity.class));
|
||||
linearLayout.addView(createButton(LineTexActivity.class));
|
||||
linearLayout.addView(createButton(VectorLayerActivity.class));
|
||||
|
||||
linearLayout.addView(createLabel("User Interaction"));
|
||||
linearLayout.addView(createButton(MapEventLayer2Activity.class));
|
||||
linearLayout.addView(createButton(LayerGroupActivity.class));
|
||||
|
||||
linearLayout.addView(createLabel("Dual Map Views"));
|
||||
linearLayout.addView(createButton(MultiMapViewActivity.class));
|
||||
linearLayout.addView(createButton(AtlasMultiTextureActivity.class));
|
||||
|
||||
linearLayout.addView(createLabel("Experiments"));
|
||||
linearLayout.addView(createButton(ReverseGeocodeActivity.class));
|
||||
linearLayout.addView(createButton(OSciMapS3DBActivity.class));
|
||||
linearLayout.addView(createButton(ThemeStylerActivity.class));
|
||||
linearLayout.addView(createButton(JeoIndoorActivity.class));
|
||||
linearLayout.addView(createButton(GdxPoi3DActivity.class));
|
||||
linearLayout.addView(createButton(OverpassActivity.class));
|
||||
linearLayout.addView(createButton(ClusterMarkerOverlayActivity.class));
|
||||
}
|
||||
}
|
||||
|
@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2017 Longri
|
||||
*
|
||||
* 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.CanvasAdapter;
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.core.GeoPoint;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.marker.ItemizedLayer;
|
||||
import org.oscim.layers.marker.MarkerItem;
|
||||
import org.oscim.layers.marker.MarkerSymbol;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.renderer.atlas.TextureAtlas;
|
||||
import org.oscim.renderer.atlas.TextureRegion;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
import org.oscim.utils.TextureAtlasUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||
|
||||
public class AtlasMarkerLayerTest extends MarkerLayerTest {
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
try {
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||
|
||||
mMap.setMapPosition(0, 0, 1 << 2);
|
||||
|
||||
Bitmap bitmapPoi = CanvasAdapter.decodeBitmap(getClass().getResourceAsStream("/res/marker_poi.png"));
|
||||
Bitmap bitmapFocus = CanvasAdapter.decodeBitmap(getClass().getResourceAsStream("/res/marker_focus.png"));
|
||||
|
||||
// Create Atlas from Bitmaps
|
||||
java.util.Map<Object, Bitmap> inputMap = new LinkedHashMap<>();
|
||||
java.util.Map<Object, TextureRegion> regionsMap = new LinkedHashMap<>();
|
||||
List<TextureAtlas> atlasList = new ArrayList<>();
|
||||
|
||||
inputMap.put("poi", bitmapPoi);
|
||||
inputMap.put("focus", bitmapFocus);
|
||||
|
||||
// Bitmaps will never used any more
|
||||
// With iOS we must flip the Y-Axis
|
||||
TextureAtlasUtils.createTextureRegions(inputMap, regionsMap, atlasList, true, false);
|
||||
|
||||
MarkerSymbol symbol;
|
||||
if (BILLBOARDS)
|
||||
symbol = new MarkerSymbol(regionsMap.get("poi"), HotspotPlace.BOTTOM_CENTER);
|
||||
else
|
||||
symbol = new MarkerSymbol(regionsMap.get("poi"), HotspotPlace.CENTER, false);
|
||||
|
||||
if (BILLBOARDS)
|
||||
mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.BOTTOM_CENTER);
|
||||
else
|
||||
mFocusMarker = new MarkerSymbol(regionsMap.get("focus"), HotspotPlace.CENTER, false);
|
||||
|
||||
mMarkerLayer = new ItemizedLayer<>(mMap, new ArrayList<MarkerItem>(), symbol, this);
|
||||
mMap.layers().add(mMarkerLayer);
|
||||
|
||||
List<MarkerItem> pts = new ArrayList<>();
|
||||
for (double lat = -90; lat <= 90; lat += 5) {
|
||||
for (double lon = -180; lon <= 180; lon += 5)
|
||||
pts.add(new MarkerItem(lat + "/" + lon, "", new GeoPoint(lat, lon)));
|
||||
}
|
||||
mMarkerLayer.addItems(pts);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new AtlasMarkerLayerTest());
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 Longri
|
||||
* Copyright 2017 devemux86
|
||||
*
|
||||
* 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.gdx.GdxMapApp;
|
||||
import org.oscim.utils.Parameters;
|
||||
|
||||
public class AtlasThemeTest extends SimpleMapTest {
|
||||
|
||||
private AtlasThemeTest() {
|
||||
Parameters.TEXTURE_ATLAS = true;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new AtlasThemeTest());
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016-2019 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -38,7 +38,7 @@ import java.util.List;
|
||||
|
||||
public class LineTexTest extends GdxMapApp {
|
||||
|
||||
private static final boolean ANIMATION = false;
|
||||
private static final boolean ANIMATION = true;
|
||||
|
||||
private List<PathLayer> mPathLayers = new ArrayList<>();
|
||||
private TextureItem tex;
|
||||
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2017 devemux86
|
||||
*
|
||||
* 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.gdx.GdxMapApp;
|
||||
import org.oscim.utils.Parameters;
|
||||
|
||||
public class MapEventLayer2Test extends MarkerLayerTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Parameters.MAP_EVENT_LAYER2 = true;
|
||||
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new MapEventLayer2Test());
|
||||
}
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2018 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.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.buildings.S3DBTileLayer;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer;
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
|
||||
public class OSciMapS3DBTest extends GdxMapApp {
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
TileSource tileSource = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||
mMap.setTheme(VtmThemes.DEFAULT);
|
||||
|
||||
TileSource ts = OSciMap4TileSource.builder()
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.url("http://opensciencemap.org/tiles/s3db")
|
||||
.zoomMin(16)
|
||||
.zoomMax(16)
|
||||
.build();
|
||||
|
||||
S3DBTileLayer tl = new S3DBTileLayer(mMap, ts);
|
||||
mMap.layers().add(tl);
|
||||
mMap.layers().add(new LabelLayer(mMap, l));
|
||||
|
||||
mMap.setMapPosition(53.08, 8.82, 1 << 17);
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
init();
|
||||
run(new OSciMapS3DBTest());
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 Longri
|
||||
* Copyright 2017 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.gdx.GdxMapApp;
|
||||
import org.oscim.utils.Parameters;
|
||||
|
||||
public class POTTextureTest extends SimpleMapTest {
|
||||
|
||||
private POTTextureTest() {
|
||||
Parameters.POT_TEXTURES = true;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new POTTextureTest());
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2017 devemux86
|
||||
* Copyright 2017 Longri
|
||||
*
|
||||
* 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.gdx.GdxMapApp;
|
||||
import org.oscim.layers.marker.MarkerItem;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class RotateMarkerLayerTest extends MarkerLayerTest {
|
||||
|
||||
private Timer timer;
|
||||
private int markerCount = 0;
|
||||
|
||||
private void itemEvent(final MarkerItem item) {
|
||||
if (item.getMarker() == null) {
|
||||
item.setMarker(mFocusMarker);
|
||||
markerCount++;
|
||||
final AtomicInteger rotValue = new AtomicInteger(0);
|
||||
if (timer != null)
|
||||
timer.cancel();
|
||||
timer = new Timer();
|
||||
TimerTask timerTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
float value = (float) (rotValue.incrementAndGet() * 10);
|
||||
item.setRotation(value);
|
||||
if (rotValue.get() > 36)
|
||||
rotValue.set(0);
|
||||
mMarkerLayer.update();
|
||||
mMap.updateMap(true);
|
||||
}
|
||||
};
|
||||
timer.schedule(timerTask, 1000, 1000);
|
||||
|
||||
} else {
|
||||
item.setMarker(null);
|
||||
markerCount--;
|
||||
if (timer != null && markerCount == 0)
|
||||
timer.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemSingleTapUp(int index, MarkerItem item) {
|
||||
itemEvent(item);
|
||||
|
||||
System.out.println("Marker tap " + item.getTitle());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemLongPress(int index, MarkerItem item) {
|
||||
itemEvent(item);
|
||||
|
||||
System.out.println("Marker long press " + item.getTitle());
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
GdxMapApp.init();
|
||||
GdxMapApp.run(new RotateMarkerLayerTest());
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user