Ejemplo n.º 1
0
 public void calculate() {
   if (!isDone) {
     if (distance() < 0.003) {
       lon = nextStation.getCoordinatePoint().getLon();
       lat = nextStation.getCoordinatePoint().getLat();
       prStation = nextStation;
       route.getRoute().remove(0);
       if (prStation == fStation) {
         done();
       } else {
         nextStation = route.getRoute().get(1);
       }
     }
   }
   destination = nextStation.getCoordinatePoint();
 }
Ejemplo n.º 2
0
 public Emulation(Route r) {
   route = r;
   sStation = route.getRoute().get(0);
   fStation = route.getRoute().get(route.getRoute().size() - 1);
   lon = sStation.getCoordinatePoint().getLon();
   lat = sStation.getCoordinatePoint().getLat();
   prStation = sStation;
   nextStation = route.getRoute().get(1);
 }
Ejemplo n.º 3
0
 public void Emulate() {
   if (!isDone) {
     if (distance() < 0.003) {
       calculate();
     } else {
       lon +=
           0.002
               * Math.cos(
                   Math.atan2(
                       (nextStation.getCoordinatePoint().getLat()
                           - prStation.getCoordinatePoint().getLat()),
                       (nextStation.getCoordinatePoint().getLon()
                           - prStation.getCoordinatePoint().getLon())));
       lat +=
           0.002
               * Math.sin(
                   Math.atan2(
                       (nextStation.getCoordinatePoint().getLat()
                           - prStation.getCoordinatePoint().getLat()),
                       (nextStation.getCoordinatePoint().getLon()
                           - prStation.getCoordinatePoint().getLon())));
     }
   }
 }
Ejemplo n.º 4
0
 public double distance() {
   return (Math.sqrt(
       Math.pow((nextStation.getCoordinatePoint().getLat() - lat), 2)
           + Math.pow((nextStation.getCoordinatePoint().getLon() - lon), 2)));
 }