added audio support

This commit is contained in:
Marc Froehlich
2024-01-26 11:09:15 +01:00
parent c2086a73b0
commit 3286a34a08
93 changed files with 78 additions and 0 deletions

View File

@@ -1,5 +1,10 @@
package kst4contest.locatorUtils;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Locale;
/**
* Location class with methods allowing conversion to and from Maidenhead
* locator (grid squares) based off of
@@ -203,6 +208,28 @@ public class Location {
return getDistanceKm(this, loc2);
}
/**
* @param locator1 6 letter location string
* @param locator2 6 letter location string
* @return great circle distance in kilometers
*/
public double getDistanceKmByTwoLocatorStrings(String locator1,String locator2 ) {
Location loc1 = new Location(locator1);
Location loc2 = new Location(locator2);
Locale locale = new Locale("en", "UK");
String pattern = "###.##";
DecimalFormat decimalFormat = (DecimalFormat)
NumberFormat.getNumberInstance(locale);
decimalFormat.applyPattern(pattern);
String format = decimalFormat.format(loc1.getDistanceKm(loc2));
// return df.format(number);
return Double.parseDouble(format);
}
/**
* @param loc2
* second location
@@ -278,6 +305,19 @@ public class Location {
return getBearing(this, loc2);
}
/**
*
* @return bearing in degrees
*/
public double getBearingOfTwoLocatorStrings(String locator1, String locator2) {
Location loc1 = new Location(locator1);
Location loc2 = new Location(locator2);
return getBearing(loc1, loc2);
}
/**
* @param loc1
* source location

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
src/main/resources/sk.mp3 Normal file

Binary file not shown.

View File

@@ -0,0 +1,38 @@
package kst4contest.test;
import kst4contest.locatorUtils.Angle;
import kst4contest.locatorUtils.Latitude;
import kst4contest.locatorUtils.Location;
import kst4contest.locatorUtils.Longitude;
import java.text.DecimalFormat;
public class TestLocatorUtils {
public static void main(String[] args) {
Location location = new Location("JN49FL");
Location location2 = new Location("JO51IJ");
// System.out.println(location.getDistanceKm(location2));
// System.out.println(Location.getBearing(location, location2));
System.out.println(new Location().getDistanceKmByTwoLocatorStrings("JN49FL", "Jo51ij") + "");
// String test = new Location().getDistanceKmByTwoLocatorStrings("JN49FL", "Jo51ij") + "";
//
// DecimalFormat df = new DecimalFormat("#.##");
//
// System.out.println(df.format(Double.parseDouble(test)));
// Angle angle = new Angle();
// Latitude lat = new Latitude();
// Longitude lon = new Longitude();
//
// location.setLatitude(lat);
// location.setLongitude(lon);
}
}