summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--altosdroid/AndroidManifest.xml.in2
-rw-r--r--altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java1
-rw-r--r--altoslib/AltosMapStore.java46
-rw-r--r--altoslib/AltosVersion.java.in6
-rw-r--r--altosuilib/AltosUIConfigure.java5
-rw-r--r--configure.ac14
6 files changed, 23 insertions, 51 deletions
diff --git a/altosdroid/AndroidManifest.xml.in b/altosdroid/AndroidManifest.xml.in
index 3f17188e..43a0787e 100644
--- a/altosdroid/AndroidManifest.xml.in
+++ b/altosdroid/AndroidManifest.xml.in
@@ -107,8 +107,6 @@
<service android:name=".TelemetryService" />
- <meta-data android:name="com.google.android.maps.v2.API_KEY"
- android:value="@GOOGLEKEY@"/>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java
index 453e898e..1bcb67ef 100644
--- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java
+++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java
@@ -678,7 +678,6 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener,
// Display the Version
mVersion = (TextView) findViewById(R.id.version);
mVersion.setText("Version: " + BuildInfo.version +
- (AltosVersion.has_google_maps_api_key() ? " maps" : "") +
" Built: " + BuildInfo.builddate + " " + BuildInfo.buildtime + " " + BuildInfo.buildtz +
" (" + BuildInfo.branch + "-" + BuildInfo.commitnum + "-" + BuildInfo.commithash + ")");
diff --git a/altoslib/AltosMapStore.java b/altoslib/AltosMapStore.java
index b1cfcbd7..abd8c240 100644
--- a/altoslib/AltosMapStore.java
+++ b/altoslib/AltosMapStore.java
@@ -48,9 +48,21 @@ public class AltosMapStore {
chlat, lat, chlon, lon, maptype_string, zoom, scale == 1 ? "" : String.format("-%d", scale), format_string));
}
+ public static String google_maps_api_key = null;
+
+ private static String google_map_url(AltosLatLon center, int zoom, int maptype, int px_size, int scale, String format_string) {
+ return String.format("http://maps.google.com/maps/api/staticmap?center=%.6f,%.6f&zoom=%d&size=%dx%d&scale=%d&sensor=false&maptype=%s&format=%s&key=%s",
+ center.lat, center.lon, zoom, px_size, px_size, scale,
+ AltosMap.maptype_names[maptype], format_string, google_maps_api_key);
+ }
+
+ private static String altos_map_url(AltosLatLon center, int zoom, int maptype, int px_size, int scale, String format_string) {
+ return String.format("https://maps.altusmetrum.org/altos-map?center=%.6f,%.6f&zoom=%d",
+ center.lat, center.lon, zoom);
+ }
+
private static String map_url(AltosLatLon center, int zoom, int maptype, int px_size, int scale) {
String format_string;
- int z = zoom;
if (maptype == AltosMap.maptype_hybrid || maptype == AltosMap.maptype_satellite || maptype == AltosMap.maptype_terrain)
format_string = "jpg";
@@ -58,14 +70,14 @@ public class AltosMapStore {
format_string = "png32";
for (int s = 1; s < scale; s <<= 1)
- z--;
+ zoom--;
- if (AltosVersion.has_google_maps_api_key())
- return String.format("http://maps.google.com/maps/api/staticmap?center=%.6f,%.6f&zoom=%d&size=%dx%d&scale=%d&sensor=false&maptype=%s&format=%s&key=%s",
- center.lat, center.lon, z, px_size/scale, px_size/scale, scale, AltosMap.maptype_names[maptype], format_string, AltosVersion.google_maps_api_key);
+ px_size /= scale;
+
+ if (google_maps_api_key != null)
+ return google_map_url(center, zoom, maptype, px_size, scale, format_string);
else
- return String.format("http://maps.google.com/maps/api/staticmap?center=%.6f,%.6f&zoom=%d&size=%dx%d&scale=%d&sensor=false&maptype=%s&format=%s",
- center.lat, center.lon, z, px_size/scale, px_size/scale, AltosMap.maptype_names[maptype], format_string);
+ return altos_map_url(center, zoom, maptype, px_size, scale, format_string);
}
public synchronized int status() {
@@ -209,24 +221,8 @@ public class AltosMapStore {
int new_status;
- if (!AltosVersion.has_google_maps_api_key()) {
- synchronized (fetch_lock) {
- long startTime = System.nanoTime();
- new_status = fetch_url();
- if (new_status == AltosMapTile.fetched) {
- long duration_ms = (System.nanoTime() - startTime) / 1000000;
- if (duration_ms < google_maps_ratelimit_ms) {
- try {
- Thread.sleep(google_maps_ratelimit_ms - duration_ms);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
- }
- }
- }
- } else {
- new_status = fetch_url();
- }
+ new_status = fetch_url();
+
notify_listeners(new_status);
} finally {
finish_fetcher();
diff --git a/altoslib/AltosVersion.java.in b/altoslib/AltosVersion.java.in
index fd9256aa..6b660bb5 100644
--- a/altoslib/AltosVersion.java.in
+++ b/altoslib/AltosVersion.java.in
@@ -20,10 +20,4 @@ package org.altusmetrum.altoslib_13;
public class AltosVersion {
public final static String version = "@VERSION@";
-
- public final static String google_maps_api_key = "@GOOGLEKEY@";
-
- public static boolean has_google_maps_api_key() {
- return google_maps_api_key != null && google_maps_api_key.length() > 1;
- }
}
diff --git a/altosuilib/AltosUIConfigure.java b/altosuilib/AltosUIConfigure.java
index e466f8b2..e61b5d52 100644
--- a/altosuilib/AltosUIConfigure.java
+++ b/altosuilib/AltosUIConfigure.java
@@ -270,9 +270,8 @@ public class AltosUIConfigure
constraints(0, 3));
row++;
- pane.add(new JLabel (String.format("AltOS version %s (%smaps key)",
- AltosVersion.version,
- AltosVersion.has_google_maps_api_key() ? "" : "no ")),
+ pane.add(new JLabel (String.format("AltOS version %s",
+ AltosVersion.version)),
constraints(0, 3));
row++;
diff --git a/configure.ac b/configure.ac
index 1705745d..741fa013 100644
--- a/configure.ac
+++ b/configure.ac
@@ -172,26 +172,12 @@ AM_CONDITIONAL(FATINSTALL, [test "x$FATDIR" != "xnone"])
AC_SUBST(FATDIR)
-AC_ARG_WITH(google-key, AS_HELP_STRING([--with-google-key=PATH],
- [Set the file to read the google maps API key from (defaults to ~/altusmetrumllc/google-maps-api-key)]),
- [GOOGLEKEYFILE=$withval], [GOOGLEKEYFILE=$HOME/altusmetrumllc/google-maps-api-key])
-
-if test -r "$GOOGLEKEYFILE" -a -s "$GOOGLEKEYFILE"; then
- GOOGLEKEY=`cat "$GOOGLEKEYFILE"`
- HAVE_GOOGLE_KEY="yes"
-else
- GOOGLEKEY='null'
- HAVE_GOOGLE_KEY="no"
-fi
-
AC_ARG_ENABLE(faketime, AS_HELP_STRING([--enable-faketime],
[Use faketime program to ensure pdf files are reproducible (default=no)]),
[FAKETIME=$enableval], [FAKETIME=no])
AM_CONDITIONAL(FAKETIME, [test x$FAKETIME = xyes])
-AC_SUBST(GOOGLEKEY)
-
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S