Tidied code, added MidPoint to CompoundMark class

Compound Mark class is now constructed with a list of marks.
A mid point is created on its construction for use in Geo Calculations

#story[1124] #pair[wmu16, hyi25]
This commit is contained in:
William Muir
2017-08-10 13:58:32 +12:00
parent abb15f6edf
commit 9c79897e01
6 changed files with 87 additions and 113 deletions
@@ -45,6 +45,19 @@ public class GeoUtility {
return (Math.toDegrees(getBearingRad(p1, p2)) + 360.0) % 360.0;
}
/**
* WARNING: this function DOES NOT account for wrapping around on lats / longs etc.
* SO BE CAREFUL IN USING THIS FUNCTION
*
* @param p1 GeoPoint 1
* @param p2 GeoPoint 2
* @return GeoPoint midPoint
*/
public static GeoPoint getDirtyMidPoint(GeoPoint p1, GeoPoint p2) {
return new GeoPoint((p1.getLat() + p2.getLat()) / 2, (p1.getLng() + p2.getLng()) / 2);
}
/**
* Calculates the angle between to angular co-ordinates on a sphere in radians.
*
@@ -256,9 +256,9 @@ public class XMLParser {
if (cMarkNode.getNodeName().equals("CompoundMark")) {
cMark = new CompoundMark(
XMLParser.getNodeAttributeInt(cMarkNode, "CompoundMarkID"),
XMLParser.getNodeAttributeString(cMarkNode, "Name")
XMLParser.getNodeAttributeString(cMarkNode, "Name"),
createMarks(cMarkNode)
);
cMark.addSubMarks(createMarks(cMarkNode));
allMarks.add(cMark);
}
}