Commit 0c80da45 authored by Björn Richerzhagen's avatar Björn Richerzhagen
Browse files

Removed deprecated `Position`-Interface

parent db566de9
......@@ -270,7 +270,7 @@ public class OSMHotspotStrategy extends StrongWaypointStrategy {
for (int i = 0; i < coordinates.length; i++) {
positionCache[i] = new PositionVector(coordinates[i].x,
coordinates[i].y);
double d = positionCache[i].getDistance(hotspot.position);
double d = positionCache[i].distanceTo(hotspot.position);
if (closestDistance > d || closestDistance == -1) {
closestDistance = d;
......@@ -283,8 +283,8 @@ public class OSMHotspotStrategy extends StrongWaypointStrategy {
PositionVector after = positionCache[closestIdx + 1 == coordinates.length ? 0
: closestIdx + 1];
if (before.getDistance(hotspot.position) < after
.getDistance(hotspot.position)) {
if (before.distanceTo(hotspot.position) < after
.distanceTo(hotspot.position)) {
return new Tuple<PositionVector, PositionVector>(
positionCache[closestIdx].clone(), before);
} else {
......
......@@ -384,7 +384,7 @@ public abstract class AbstractMap implements Map {
Waypoint wp = null;
for (Waypoint w : waypoints) {
double ld = target.getPosition().getDistance(w.getPosition());
double ld = target.getPosition().distanceTo(w.getPosition());
if (ld < d || d == -1) {
d = ld;
......@@ -406,7 +406,8 @@ public abstract class AbstractMap implements Map {
double d = -1;
for (Tuple<Waypoint, Waypoint> wpT : shortestDistances) {
double ld = wpT.getA().getPosition().getDistance(wpT.getB().getPosition());
double ld = wpT.getA().getPosition()
.distanceTo(wpT.getB().getPosition());
if (ld < d || d == -1) {
d = ld;
......
......@@ -4,7 +4,6 @@ import java.util.Map;
import java.util.Random;
import java.util.WeakHashMap;
import de.tud.kom.p2psim.api.common.Position;
import de.tud.kom.p2psim.impl.network.modular.common.GeoToolkit;
import de.tudarmstadt.maki.simonstrator.api.Randoms;
import de.tudarmstadt.maki.simonstrator.api.common.Transmitable;
......@@ -17,7 +16,7 @@ import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location;
*
* @author Andreas Hemel
*/
public class GeoSpherePosition implements Transmitable, Position {
public class GeoSpherePosition implements Transmitable, Location {
/** Latitude in radians */
private final double latitude;
......@@ -131,7 +130,7 @@ public class GeoSpherePosition implements Transmitable, Position {
* @return The distance in meters.
*/
@Override
public double getDistance(Position destination) {
public double distanceTo(Location destination) {
GeoSpherePosition dest = (GeoSpherePosition) destination;
if (enableDistanceCache) {
Double cached = checkDistanceCache(this, dest);
......@@ -163,8 +162,8 @@ public class GeoSpherePosition implements Transmitable, Position {
}
@Override
public double getAngle(Position target) {
return -getBearing(target) + 180;
public float bearingTo(Location target) {
return (float) (-getBearing(target) + 180);
}
/** Calculate the initial bearing to target on a great circle in degrees.
......@@ -177,7 +176,7 @@ public class GeoSpherePosition implements Transmitable, Position {
*
* @return The initial bearing in degrees.
*/
public double getBearing(Position target) {
public double getBearing(Location target) {
return Math.toDegrees(getBearingRad(target));
}
......@@ -188,7 +187,7 @@ public class GeoSpherePosition implements Transmitable, Position {
*
* @return The initial bearing in radians.
*/
public double getBearingRad(Position destination) {
public double getBearingRad(Location destination) {
GeoSpherePosition dest = (GeoSpherePosition) destination;
if (enableBearingCache) {
Double cached = checkBearingCache(this, dest);
......@@ -228,11 +227,6 @@ public class GeoSpherePosition implements Transmitable, Position {
return getDestinationRad(Math.toRadians(bearing), distance);
}
@Override
public GeoSpherePosition getTarget(double distance, double angle) {
return getDestinationRad(angle, distance);
}
/** Calculate the destination position given a bearing and a distance.
*
* The formulae used here assume a spherical Earth, so this calculation has
......@@ -448,14 +442,4 @@ public class GeoSpherePosition implements Transmitable, Position {
public long getAgeOfLocation() {
throw new UnsupportedOperationException();
}
@Override
public double distanceTo(Location dest) {
return getDistance((Position) dest);
}
@Override
public float bearingTo(Location dest) {
return (float) getBearing((Position) dest);
}
}
......@@ -31,7 +31,7 @@ public class WaypointKdTree extends KdTree<Waypoint> {
@Override
protected double pointDist(double[] p1, double[] p2) {
return new PositionVector(p1).getDistance(new PositionVector(p2));
return new PositionVector(p1).distanceTo(new PositionVector(p2));
}
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment