aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/geopoint/Geopoint.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/geopoint/Geopoint.java')
-rw-r--r--main/src/cgeo/geocaching/geopoint/Geopoint.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/geopoint/Geopoint.java b/main/src/cgeo/geocaching/geopoint/Geopoint.java
index c03a2bc..dbe0aa4 100644
--- a/main/src/cgeo/geocaching/geopoint/Geopoint.java
+++ b/main/src/cgeo/geocaching/geopoint/Geopoint.java
@@ -173,6 +173,16 @@ public final class Geopoint implements ICoordinates, Parcelable {
return longitude;
}
+ /*
+ * Return a waypoint which is the copy of this one rounded to the given limit.
+ * For example, to get a waypoint adapter to a display with 3 digits after the
+ * seconds decimal point, a rounding factor of 3600*1000 would be appropriate.
+ */
+ Geopoint roundedAt(final long factor) {
+ return new Geopoint(((double) Math.round(latitude * factor)) / factor,
+ ((double) Math.round(longitude * factor)) / factor);
+ }
+
/**
* Get longitude in microdegree.
*