From f571c8f31784347de6f6330c86312e6a917fbd84 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 18 Sep 2011 12:01:12 +0200 Subject: [PATCH] Replace LF by CRLF --- DataExtractionOSM/.classpath | 28 ++-- DataExtractionOSM/OsmAndMapCreator.launch | 32 ++--- OsmAnd/src/net/osmand/LatLonUtils.java | 68 ++++----- .../plus/activities/RouteAnimation.java | 130 +++++++++--------- 4 files changed, 129 insertions(+), 129 deletions(-) diff --git a/DataExtractionOSM/.classpath b/DataExtractionOSM/.classpath index c9586f09ca..213c2a9a0c 100644 --- a/DataExtractionOSM/.classpath +++ b/DataExtractionOSM/.classpath @@ -1,14 +1,14 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/DataExtractionOSM/OsmAndMapCreator.launch b/DataExtractionOSM/OsmAndMapCreator.launch index c7a3cba55a..c2f01cfa4e 100644 --- a/DataExtractionOSM/OsmAndMapCreator.launch +++ b/DataExtractionOSM/OsmAndMapCreator.launch @@ -1,16 +1,16 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/OsmAnd/src/net/osmand/LatLonUtils.java b/OsmAnd/src/net/osmand/LatLonUtils.java index 91153e9d8a..5b35bf718a 100644 --- a/OsmAnd/src/net/osmand/LatLonUtils.java +++ b/OsmAnd/src/net/osmand/LatLonUtils.java @@ -1,34 +1,34 @@ -package net.osmand; - -import android.location.Location; - -public class LatLonUtils { - - public static Location middleLocation(Location start, Location end, - float meters) { - double lat1 = toRad(start.getLatitude()); - double lon1 = toRad(start.getLongitude()); - double R = 6371; // radius of earth in km - double d = meters / 1000; // in km - float brng = (float) (toRad(start.bearingTo(end))); - double lat2 = Math.asin(Math.sin(lat1) * Math.cos(d / R) - + Math.cos(lat1) * Math.sin(d / R) * Math.cos(brng)); - double lon2 = lon1 - + Math.atan2(Math.sin(brng) * Math.sin(d / R) * Math.cos(lat1), - Math.cos(d / R) - Math.sin(lat1) * Math.sin(lat2)); - Location nl = new Location(start); - nl.setLatitude(toDegree(lat2)); - nl.setLongitude(toDegree(lon2)); - nl.setBearing(brng); - return nl; - } - - private static double toDegree(double radians) { - return radians * 180 / Math.PI; - } - - private static double toRad(double degree) { - return degree * Math.PI / 180; - } - -} +package net.osmand; + +import android.location.Location; + +public class LatLonUtils { + + public static Location middleLocation(Location start, Location end, + float meters) { + double lat1 = toRad(start.getLatitude()); + double lon1 = toRad(start.getLongitude()); + double R = 6371; // radius of earth in km + double d = meters / 1000; // in km + float brng = (float) (toRad(start.bearingTo(end))); + double lat2 = Math.asin(Math.sin(lat1) * Math.cos(d / R) + + Math.cos(lat1) * Math.sin(d / R) * Math.cos(brng)); + double lon2 = lon1 + + Math.atan2(Math.sin(brng) * Math.sin(d / R) * Math.cos(lat1), + Math.cos(d / R) - Math.sin(lat1) * Math.sin(lat2)); + Location nl = new Location(start); + nl.setLatitude(toDegree(lat2)); + nl.setLongitude(toDegree(lon2)); + nl.setBearing(brng); + return nl; + } + + private static double toDegree(double radians) { + return radians * 180 / Math.PI; + } + + private static double toRad(double degree) { + return degree * Math.PI / 180; + } + +} diff --git a/OsmAnd/src/net/osmand/plus/activities/RouteAnimation.java b/OsmAnd/src/net/osmand/plus/activities/RouteAnimation.java index 17dc8467a5..2ff4add488 100644 --- a/OsmAnd/src/net/osmand/plus/activities/RouteAnimation.java +++ b/OsmAnd/src/net/osmand/plus/activities/RouteAnimation.java @@ -1,65 +1,65 @@ -package net.osmand.plus.activities; - -import java.util.ArrayList; -import java.util.List; - -import net.osmand.LatLonUtils; -import android.location.Location; - -public class RouteAnimation { - - private Thread routeAnimation; - - public boolean isRouteAnimating() { - return routeAnimation != null; - } - - public void startStopRouteAnimation(final RoutingHelper routingHelper, - final MapActivity ma) { - if (!isRouteAnimating()) { - routeAnimation = new Thread() { - public void run() { - final List directions = new ArrayList( - routingHelper.getCurrentRoute()); - Location current = null; - float meters = 20.0f; - while (!directions.isEmpty() && routeAnimation != null) { - if (current == null) { - current = new Location(directions.remove(0)); - } else { - if (current.distanceTo(directions.get(0)) > meters) { - current = LatLonUtils.middleLocation(current, - directions.get(0), meters); - } else { - current = new Location(directions.remove(0)); - } - } - current.setSpeed(meters); - current.setTime(System.currentTimeMillis()); - ma.setLocation(current); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // do nothing - } - } - RouteAnimation.this.stop(); - }; - }; - routeAnimation.start(); - } else { - // stop the animation - stop(); - } - } - - private void stop() { - routeAnimation = null; - } - - public void close() { - if (isRouteAnimating()) { - stop(); - } - } -} +package net.osmand.plus.activities; + +import java.util.ArrayList; +import java.util.List; + +import net.osmand.LatLonUtils; +import android.location.Location; + +public class RouteAnimation { + + private Thread routeAnimation; + + public boolean isRouteAnimating() { + return routeAnimation != null; + } + + public void startStopRouteAnimation(final RoutingHelper routingHelper, + final MapActivity ma) { + if (!isRouteAnimating()) { + routeAnimation = new Thread() { + public void run() { + final List directions = new ArrayList( + routingHelper.getCurrentRoute()); + Location current = null; + float meters = 20.0f; + while (!directions.isEmpty() && routeAnimation != null) { + if (current == null) { + current = new Location(directions.remove(0)); + } else { + if (current.distanceTo(directions.get(0)) > meters) { + current = LatLonUtils.middleLocation(current, + directions.get(0), meters); + } else { + current = new Location(directions.remove(0)); + } + } + current.setSpeed(meters); + current.setTime(System.currentTimeMillis()); + ma.setLocation(current); + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + // do nothing + } + } + RouteAnimation.this.stop(); + }; + }; + routeAnimation.start(); + } else { + // stop the animation + stop(); + } + } + + private void stop() { + routeAnimation = null; + } + + public void close() { + if (isRouteAnimating()) { + stop(); + } + } +}