10 Commits

Author SHA1 Message Date
Emux
a322768f8a 0.6.0 2016-10-28 12:26:13 +03:00
Emux
fc7bb2df9b 0.6.0-rc3 2016-10-22 13:22:34 +03:00
Emux
062bb8d573 Update Android and Gradle plugin versions 2016-10-21 20:08:17 +03:00
szantai78
ccdea3b663 LocationRenderer: revert shader precision from high to medium #209, fixes #207 2016-10-21 19:18:19 +03:00
Emux
985bbc3f36 0.6.0-rc2 2016-10-16 15:55:30 +03:00
Emux
aa5fc79681 libGDX desktop: disable OpenAL 2016-10-15 19:05:03 +03:00
Emux
58095f31a4 Enable location layer rendering when needed #171 2016-10-14 19:39:43 +03:00
Emux
e53523b82a Add location layer and Samples example #171 2016-10-14 11:36:34 +03:00
Emux
e5c62c9bc4 Gradle: update Android plugin 2016-10-11 09:09:54 +03:00
Emux
3c1091d8e0 BoundingBox: fix longitude span #200 2016-10-09 21:12:47 +03:00
13 changed files with 179 additions and 45 deletions

View File

@@ -6,9 +6,8 @@ android:
components: components:
- platform-tools - platform-tools
- tools - tools
- build-tools-24.0.3 - build-tools-25.0.0
- android-24 - android-25
- extra-android-m2repository
env: env:
global: global:
- GRADLE_OPTS="-Xmx2048m" - GRADLE_OPTS="-Xmx2048m"

View File

@@ -4,7 +4,7 @@
# V™ # V™
VTM was developed within the [OpenScienceMap](http://opensciencemap.org) project. VTM was developed within the [OpenScienceMap](https://github.com/opensciencemap) project.
**This fork continues VTM development. And provides compatibility with latest [Mapsforge](https://github.com/mapsforge/mapsforge).** **This fork continues VTM development. And provides compatibility with latest [Mapsforge](https://github.com/mapsforge/mapsforge).**

View File

@@ -3,7 +3,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.2.0' classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
} }
} }
@@ -13,7 +13,7 @@ allprojects {
version = 'master-SNAPSHOT' version = 'master-SNAPSHOT'
ext.isReleaseVersion = !version.endsWith("SNAPSHOT") ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
ext.androidBuildVersionTools = "24.0.3" ext.androidBuildVersionTools = "25.0.0"
ext.gdxVersion = "1.9.4" ext.gdxVersion = "1.9.4"
if (JavaVersion.current().isJava8Compatible()) { if (JavaVersion.current().isJava8Compatible()) {
@@ -25,7 +25,7 @@ allprojects {
} }
} }
def androidCompileSdk() { return 24 } def androidCompileSdk() { return 25 }
def androidMinSdk() { return 10 } def androidMinSdk() { return 10 }

View File

@@ -2,9 +2,20 @@
## Version 0.6.X ## Version 0.6.X
**Version 0.6.0-rc1 (2016-10-08)** ### Version 0.6.0 (2016-10-28) -- VTM revive
**Revive of VTM vector map library** - Same as 0.6.0-rc3
#### Version 0.6.0-rc3 (2016-10-22)
- Minor improvements and bug fixes
#### Version 0.6.0-rc2 (2016-10-16)
- Location layer [#171](https://github.com/mapsforge/vtm/issues/171)
- Minor improvements and bug fixes
#### Version 0.6.0-rc1 (2016-10-08)
- Render theme SVG resources [#60](https://github.com/mapsforge/vtm/issues/60) - Render theme SVG resources [#60](https://github.com/mapsforge/vtm/issues/60)
- Mapsforge multilingual maps [#34](https://github.com/mapsforge/vtm/issues/34) - Mapsforge multilingual maps [#34](https://github.com/mapsforge/vtm/issues/34)

View File

@@ -38,6 +38,9 @@
<activity <activity
android:name=".LineTexActivity" android:name=".LineTexActivity"
android:configChanges="keyboardHidden|orientation|screenSize" /> android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".LocationActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity <activity
android:name=".MapsforgeMapActivity" android:name=".MapsforgeMapActivity"
android:configChanges="keyboardHidden|orientation|screenSize" /> android:configChanges="keyboardHidden|orientation|screenSize" />

View File

@@ -0,0 +1,89 @@
/*
* Copyright 2016 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.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import org.oscim.core.MapPosition;
import org.oscim.layers.LocationLayer;
public class LocationActivity extends SimpleMapActivity implements LocationListener {
private LocationLayer locationLayer;
private LocationManager locationManager;
private final MapPosition mapPosition = new MapPosition();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationLayer = new LocationLayer(mMap);
mMap.layers().add(locationLayer);
}
@Override
protected void onResume() {
super.onResume();
enableAvailableProviders();
locationLayer.setEnabled(true);
}
@Override
protected void onPause() {
super.onPause();
locationManager.removeUpdates(this);
locationLayer.setEnabled(false);
}
@Override
public void onLocationChanged(Location location) {
locationLayer.setPosition(location.getLatitude(), location.getLongitude(), location.getAccuracy());
// Follow location
mMap.getMapPosition(mapPosition);
mapPosition.setPosition(location.getLatitude(), location.getLongitude());
mMap.setMapPosition(mapPosition);
}
@Override
public void onProviderDisabled(String provider) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
private void enableAvailableProviders() {
locationManager.removeUpdates(this);
for (String provider : locationManager.getProviders(true)) {
if (LocationManager.GPS_PROVIDER.equals(provider)
|| LocationManager.NETWORK_PROVIDER.equals(provider)) {
locationManager.requestLocationUpdates(provider, 0, 0, this);
}
}
}
}

View File

@@ -26,14 +26,10 @@ import android.view.View.OnClickListener;
import android.widget.Button; import android.widget.Button;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* A simple start screen for the sample activities. * A simple start screen for the sample activities.
*/ */
public class Samples extends Activity { public class Samples extends Activity {
public static Logger log = LoggerFactory.getLogger(Samples.class);
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@@ -48,6 +44,7 @@ public class Samples extends Activity {
linearLayout.addView(createButton(PathOverlayActivity.class)); linearLayout.addView(createButton(PathOverlayActivity.class));
linearLayout.addView(createButton(LineTexActivity.class)); linearLayout.addView(createButton(LineTexActivity.class));
linearLayout.addView(createButton(LayerGroupActivity.class)); linearLayout.addView(createButton(LayerGroupActivity.class));
linearLayout.addView(createButton(LocationActivity.class));
linearLayout.addView(createButton(ThemeStylerActivity.class)); linearLayout.addView(createButton(ThemeStylerActivity.class));
linearLayout.addView(createButton(S3DBMapActivity.class)); linearLayout.addView(createButton(S3DBMapActivity.class));
linearLayout.addView(createButton(JeoIndoorMapActivity.class)); linearLayout.addView(createButton(JeoIndoorMapActivity.class));

View File

@@ -2,6 +2,7 @@
* Copyright 2010, 2011, 2012 mapsforge.org * Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2013 Hannes Janetzek * Copyright 2013 Hannes Janetzek
* Copyright 2013 Ahmad Al-saleem * Copyright 2013 Ahmad Al-saleem
* Copyright 2016 devemux86
* *
* This program is free software: you can redistribute it and/or modify it under the * 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 * terms of the GNU Lesser General Public License as published by the Free Software
@@ -31,7 +32,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class LocationHandler implements LocationListener { public class LocationHandler implements LocationListener {
final static Logger log = LoggerFactory.getLogger(LocationHandler.class); private final static Logger log = LoggerFactory.getLogger(LocationHandler.class);
public enum Mode { public enum Mode {
OFF, OFF,
@@ -43,7 +44,7 @@ public class LocationHandler implements LocationListener {
private final static int SHOW_LOCATION_ZOOM = 14; private final static int SHOW_LOCATION_ZOOM = 14;
private final LocationManager mLocationManager; private final LocationManager mLocationManager;
private final LocationOverlay mLocationOverlay; private final LocationLayerImpl mLocationLayer;
private Mode mMode = Mode.OFF; private Mode mMode = Mode.OFF;
@@ -54,7 +55,7 @@ public class LocationHandler implements LocationListener {
mLocationManager = (LocationManager) tileMap mLocationManager = (LocationManager) tileMap
.getSystemService(Context.LOCATION_SERVICE); .getSystemService(Context.LOCATION_SERVICE);
mLocationOverlay = new LocationOverlay(App.map, compass); mLocationLayer = new LocationLayerImpl(App.map, compass);
mMapPosition = new MapPosition(); mMapPosition = new MapPosition();
} }
@@ -115,13 +116,13 @@ public class LocationHandler implements LocationListener {
if (location == null) if (location == null)
return false; return false;
mLocationOverlay.setEnabled(true); mLocationLayer.setEnabled(true);
mLocationOverlay.setPosition(location.getLatitude(), mLocationLayer.setPosition(location.getLatitude(),
location.getLongitude(), location.getLongitude(),
location.getAccuracy()); location.getAccuracy());
// FIXME -> implement LayerGroup // FIXME -> implement LayerGroup
App.map.layers().add(4, mLocationOverlay); App.map.layers().add(4, mLocationLayer);
App.map.updateMap(true); App.map.updateMap(true);
return true; return true;
@@ -133,9 +134,9 @@ public class LocationHandler implements LocationListener {
private boolean disableShowMyLocation() { private boolean disableShowMyLocation() {
mLocationManager.removeUpdates(this); mLocationManager.removeUpdates(this);
mLocationOverlay.setEnabled(false); mLocationLayer.setEnabled(false);
App.map.layers().remove(mLocationOverlay); App.map.layers().remove(mLocationLayer);
App.map.updateMap(true); App.map.updateMap(true);
return true; return true;
@@ -199,7 +200,7 @@ public class LocationHandler implements LocationListener {
App.map.setMapPosition(mMapPosition); App.map.setMapPosition(mMapPosition);
} }
mLocationOverlay.setPosition(lat, lon, location.getAccuracy()); mLocationLayer.setPosition(lat, lon, location.getAccuracy());
} }
@Override @Override

View File

@@ -0,0 +1,38 @@
/*
* Copyright 2013 Ahmad Saleem
* Copyright 2013 Hannes Janetzek
* Copyright 2016 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.app.location;
import org.oscim.layers.LocationLayer;
import org.oscim.map.Map;
class LocationLayerImpl extends LocationLayer {
private final Compass mCompass;
LocationLayerImpl(Map map, Compass compass) {
super(map);
mCompass = compass;
locationRenderer.setCallback(compass);
}
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
mCompass.setEnabled(enabled);
}
}

View File

@@ -60,6 +60,7 @@ public class GdxMapApp extends GdxMap {
} }
static protected LwjglApplicationConfiguration getConfig() { static protected LwjglApplicationConfiguration getConfig() {
LwjglApplicationConfiguration.disableAudio = true;
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration(); LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.title = "vtm-gdx"; cfg.title = "vtm-gdx";
cfg.width = 800; cfg.width = 800;

View File

@@ -267,7 +267,7 @@ public class BoundingBox {
* @return the longitude span of this BoundingBox in degrees. * @return the longitude span of this BoundingBox in degrees.
*/ */
public double getLongitudeSpan() { public double getLongitudeSpan() {
return getMaxLongitude() - getMinLatitude(); return getMaxLongitude() - getMinLongitude();
} }
/** /**

View File

@@ -14,31 +14,19 @@
* You should have received a copy of the GNU Lesser General Public License along with * 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/>. * this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package org.oscim.app.location; package org.oscim.layers;
import org.oscim.core.MercatorProjection; import org.oscim.core.MercatorProjection;
import org.oscim.layers.Layer;
import org.oscim.map.Map; import org.oscim.map.Map;
import org.oscim.renderer.LocationRenderer; import org.oscim.renderer.LocationRenderer;
public class LocationOverlay extends Layer { public class LocationLayer extends Layer {
private final Compass mCompass; public final LocationRenderer locationRenderer;
private final LocationRenderer mLocationRenderer;
public LocationOverlay(Map map, Compass compass) { public LocationLayer(Map map) {
super(map); super(map);
mCompass = compass;
mRenderer = mLocationRenderer = new LocationRenderer(mMap, this); mRenderer = locationRenderer = new LocationRenderer(mMap, this);
mLocationRenderer.setCallback(compass);
}
public void setPosition(double latitude, double longitude, double accuracy) {
double x = MercatorProjection.longitudeToX(longitude);
double y = MercatorProjection.latitudeToY(latitude);
double radius = accuracy / MercatorProjection.groundResolution(latitude, 1);
mLocationRenderer.setLocation(x, y, radius);
mLocationRenderer.animate(true);
} }
@Override @Override
@@ -49,8 +37,14 @@ public class LocationOverlay extends Layer {
super.setEnabled(enabled); super.setEnabled(enabled);
if (!enabled) if (!enabled)
mLocationRenderer.animate(false); locationRenderer.animate(false);
}
mCompass.setEnabled(enabled); public void setPosition(double latitude, double longitude, double accuracy) {
double x = MercatorProjection.longitudeToX(longitude);
double y = MercatorProjection.latitudeToY(latitude);
double radius = accuracy / MercatorProjection.groundResolution(latitude, 1);
locationRenderer.setLocation(x, y, radius);
locationRenderer.animate(true);
} }
} }

View File

@@ -2,6 +2,7 @@
* Copyright 2013 Ahmad Saleem * Copyright 2013 Ahmad Saleem
* Copyright 2013 Hannes Janetzek * Copyright 2013 Hannes Janetzek
* Copyright 2016 devemux86 * Copyright 2016 devemux86
* Copyright 2016 ocsike
* *
* This program is free software: you can redistribute it and/or modify it under the * 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 * terms of the GNU Lesser General Public License as published by the Free Software
@@ -265,7 +266,7 @@ public class LocationRenderer extends LayerRenderer {
} }
private static final String vShaderStr = "" private static final String vShaderStr = ""
+ "precision highp float;" + "precision mediump float;"
+ "uniform mat4 u_mvp;" + "uniform mat4 u_mvp;"
+ "uniform float u_phase;" + "uniform float u_phase;"
+ "uniform float u_scale;" + "uniform float u_scale;"
@@ -277,7 +278,7 @@ public class LocationRenderer extends LayerRenderer {
+ "}"; + "}";
private static final String fShaderStr1 = "" private static final String fShaderStr1 = ""
+ "precision highp float;" + "precision mediump float;"
+ "varying vec2 v_tex;" + "varying vec2 v_tex;"
+ "uniform float u_scale;" + "uniform float u_scale;"
+ "uniform float u_phase;" + "uniform float u_phase;"
@@ -306,7 +307,7 @@ public class LocationRenderer extends LayerRenderer {
+ "}}"; + "}}";
private static final String fShaderStr2 = "" private static final String fShaderStr2 = ""
+ "precision highp float;" + "precision mediump float;"
+ "varying vec2 v_tex;" + "varying vec2 v_tex;"
+ "uniform float u_scale;" + "uniform float u_scale;"
+ "uniform float u_phase;" + "uniform float u_phase;"