Fix bearing

This commit is contained in:
Victor Shcherb 2019-04-26 13:20:02 +03:00
parent 3d60921184
commit ce2c219352
4 changed files with 17 additions and 20 deletions

View file

@ -1,14 +0,0 @@
language: android
# Work in progress. Repo should be used for initial checkout https://github.com/osmandapp/OsmAnd-manifest/blob/master/android_build.xml
android:
components:
- tools
- platform-tools
# The BuildTools version used by your project
- build-tools-27.0.3
- android-27
script: ./gradlew test

View file

@ -1,5 +1,5 @@
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'maven-publish'
configurations { configurations {
android android
@ -77,6 +77,14 @@ artifacts {
android androidJar android androidJar
} }
publishing {
publications {
maven(MavenPublication) {
artifactId "osmand-base"
from components.java
}
}
}
dependencies { dependencies {
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'

View file

@ -168,12 +168,13 @@ public class OsmAndFormatter {
} }
public static String getFormattedAzimuth(float bearing, OsmandApplication app) { public static String getFormattedAzimuth(float bearing, OsmandApplication app) {
int azimuth; while(bearing < -180.0) {
if (bearing < 0.0) { bearing += 360;
azimuth = (int) (360 + bearing);
} else {
azimuth = (int) bearing;
} }
while(bearing > 360.0) {
bearing -= 360;
}
int azimuth = (int) bearing;
if (app.getSettings().ANGULAR_UNITS.get() == AngularConstants.MILLIRADS) { if (app.getSettings().ANGULAR_UNITS.get() == AngularConstants.MILLIRADS) {
return (int) (azimuth * 17.4533) + " " + AngularConstants.MILLIRADS.getUnitSymbol(); return (int) (azimuth * 17.4533) + " " + AngularConstants.MILLIRADS.getUnitSymbol();

View file

@ -14,6 +14,8 @@ buildscript {
} }
allprojects { allprojects {
group "net.osmand"
version "1.0"
repositories { repositories {
ivy { ivy {