Skip to content

Commit

Permalink
add javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
bailuk committed Apr 6, 2021
1 parent c8cc925 commit 16e2931
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
27 changes: 23 additions & 4 deletions app/src/main/java/ch/bailu/aat/coordinates/MeterCoordinates.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,33 @@
import org.mapsforge.core.model.LatLong;

public abstract class MeterCoordinates extends Coordinates {
/**
*
* @return northing part of coordinate in meters
*/
public abstract int getNorthing();


/**
*
* @return easting part of coordinate in meters
*/
public abstract int getEasting();
//public abstract GeoPoint toLatLongE6();

/**
*
* @return WGS84 Latitude / Longitude representation of coordinate
*/
public abstract LatLong toLatLong();
public abstract void round(int c);

public static int round(int v, int c) {
return c * Math.round(((float)v)/((float)c));
/**
* round northing and easting to decimal place
* @param dec decimal place to round to
*/
public abstract void round(int dec);

public static int round(int v, int dec) {
return dec * Math.round(((float)v)/((float)dec));
}


Expand Down
16 changes: 13 additions & 3 deletions app/src/main/java/ch/bailu/aat/coordinates/UTMCoordinates.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ private static class NorthingZones {
private final static double WIDTH_DEG=8d;

private static final char[] zonesSouth = {'M', 'L', 'K', 'J', 'H', 'G', 'F', 'E', 'D', 'C'};
//new char[] {'C','D','E','F','G','H','J','K','L','M'};

private static final char[] zonesNorth =
new char[] {'N','P','Q','R','S','T','U','V','W','X'};
Expand Down Expand Up @@ -106,8 +105,14 @@ public UTMCoordinates(LatLongE6Interface point) {
}



public UTMCoordinates(String code) {
/**
* Parse string for a valid UTM coordinate to initialize this object
* @param code string of the format "18T 612284 5040357"
* (easting zone as number, northing zone as letter, easting in meters, northing in meters)
*
* @throws IllegalArgumentException if string can't be parsed
*/
public UTMCoordinates(String code) throws IllegalArgumentException {

String[] parts = code.split(" ");

Expand All @@ -131,6 +136,7 @@ public UTMCoordinates(String code) {
}
}


public void round(int c) {
easting=round((int)easting,c);
northing=round((int)northing,c);
Expand All @@ -144,6 +150,10 @@ public boolean isInSouthernHemnisphere() {
return NorthingZones.isInSouthernHemnisphere(nzone);
}

/**
*
* @return character representating northing zone of this coordinate
*/
public char getNorthingZone() {
return nzone;
}
Expand Down

0 comments on commit 16e2931

Please sign in to comment.