Examples of Waypoint


Examples of jaron.gps.Waypoint

    // by default the target course is the current course
    double course = courseOverGround.getValue();

    if (navigationMode == DO_NAVIGATE && waypoints.size() > 0) {
      // get the current target waypoint
      Waypoint waypoint = waypoints.get(currentWaypointIndex);
      // get the distnace to the target waypoint...
      double distance = Navigation.getDistanceInMeters(latitude.getValue(), longitude.getValue(), waypoint.getLatitude(), waypoint.getLongitude());
      // ...and check if the vehicle is within the target waypoint radius
      if (distance <= targetRadius) {
        // switch to the next waypoint
        ++currentWaypointIndex;
      }
      if (currentWaypointIndex < waypoints.size()) {
        // calculate the new target course
        waypoint = waypoints.get(currentWaypointIndex);
        course  = Navigation.getCourseInDegrees(latitude.getValue(), longitude.getValue(), waypoint.getLatitude(), waypoint.getLongitude());
      }
      else {
        // all waypoints are reached -> set mission completed
        navigationMode = missionCompletedAction;
      }
      currentWaypoint.setValue(currentWaypointIndex + 1);
    }
    else if (navigationMode == CIRCLE_AT_HOME) {
      // calculate the new course (inspired by http://tom.pycke.be/mav/101/circle-navigation)
      double tSeconds = 1; // timer for the ahead calculation (in seconds)
      double vAngular = speedOverGround.getValue() / circlingRadius;
      double alpha = Navigation.getCourseInRadians(latitude.getValue(), longitude.getValue(), homeLatitude, homeLongitude) + Math.PI;
      Waypoint dest = Navigation.getDestinationPoint(new Waypoint(homeLatitude, homeLongitude), Math.toDegrees(alpha + (vAngular * tSeconds) * circlingDirection), circlingRadius);
      course = Navigation.getCourseInDegrees(latitude.getValue(), longitude.getValue(), dest.getLatitude(), dest.getLongitude());
    }
    else if (navigationMode == RESTART_MISSION) {
      currentWaypointIndex = 0;
      navigationMode = DO_NAVIGATE;
    }
View Full Code Here

Examples of jaron.gps.Waypoint

    double lon2 = lon1 + Math.atan2(Math.sin(brng) * Math.sin(distance / R) *
                  Math.cos(lat1), Math.cos(distance / R) - Math.sin(lat1) *
                  Math.sin(lat2));
    lon2 = (lon2 + Math.PI) % (2 * Math.PI) - Math.PI;  // normalize to -180...+180
   
    return new Waypoint(Math.toDegrees(lat2), Math.toDegrees(lon2));
  }
View Full Code Here

Examples of net.citizensnpcs.waypoints.Waypoint

                player.sendMessage(ChatColor.GRAY + "Points can't be more than "
                        + StringUtils.wrap(Settings.getDouble("PathfindingRange"), ChatColor.GRAY)
                        + " blocks away from each other.");
                break;
            }
            session.insert(npc.getWaypoints(), new Waypoint(loc));
            event.getPlayer().sendMessage(
                    StringUtils.wrap("Added") + " waypoint at index " + StringUtils.wrap(session.getIndex()) + " ("
                            + StringUtils.wrap(loc.getBlockX()) + ", " + StringUtils.wrap(loc.getBlockY()) + ", "
                            + StringUtils.wrap(loc.getBlockZ()) + ") (" + StringUtils.wrap(npc.getWaypoints().size())
                            + " " + StringUtils.pluralise("waypoint", npc.getWaypoints().size()) + ")");
View Full Code Here

Examples of net.citizensnpcs.waypoints.Waypoint

    }
    player.sendMessage(ChatColor.AQUA
        + StringUtils.listify(StringUtils.wrap(StringUtils
            .capitalise(modifier.name().toLowerCase()))
            + " chat editor" + ChatColor.AQUA));
    Waypoint waypoint = npc.getWaypoints().getLast();
    ConversationUtils.addConverser(player, modifier.create(waypoint));
  }
View Full Code Here

Examples of net.citizensnpcs.waypoints.Waypoint

        }
        String read = profiles.getString(UID + BasicProperties.waypoints);
        if (!read.isEmpty()) {
            for (String str : read.split(";")) {
                String[] split = str.split(",");
                temp.add(new Waypoint(new Location(world, Double.parseDouble(split[0]), Double
                        .parseDouble(split[1]), Double.parseDouble(split[2]))));
            }
            return temp;
        }
        String path = "", root = "";
        WaypointModifier modifier = null;
        for (int key : profiles.getIntegerKeys(UID + BasicProperties.waypoints)) {
            root = UID + BasicProperties.waypoints + "." + key;
            Waypoint waypoint = new Waypoint(LocationUtils.loadLocation(profiles, root, true));

            waypoint.setDelay(profiles.getInt(root + ".delay"));

            if (profiles.keyExists(root + ".modifiers")) {
                root += ".modifiers";
                for (int innerKey : profiles.getIntegerKeys(root)) {
                    path = root + "." + innerKey;
                    modifier = WaypointModifierType.valueOf(profiles.getString(path + ".type")).create(
                            waypoint);
                    modifier.parse(profiles, path);
                    waypoint.addModifier(modifier);
                }
            }
            temp.add(waypoint);
        }
        return temp;
View Full Code Here

Examples of net.sf.myway.gps.datatypes.Waypoint

  public static void main(final String[] args) throws DocumentException, SecurityException,
    NoSuchMethodException, IllegalArgumentException, IllegalAccessException,
    InvocationTargetException, InstantiationException, ClassNotFoundException {
    final byte[] buffer = new byte[4096];
    final Waypoint wp = new Waypoint();
    wp.setIdent("TestWP");
    wp.setPosition(new Position(54.12343, -123.2334));
    wp.setComment("that's it");
    final int len = Mapper.toMessage(buffer, 6, wp, "D100");
    final StringBuilder b = new StringBuilder();
    for (int i = 0; i < len; i++) {
      final byte element = buffer[i];
      b.append(Integer.toHexString(element & 0xff | 0x100).substring(1) + " ");
View Full Code Here

Examples of org.openstreetmap.josm.data.gpx.WayPoint

   *
   * @param geometry
   * @return
   */
  public static WayPoint wktToWayPoint(String geometry) {
    WayPoint resultado = null;

    if (geometry != null) {
      log.trace("Vamos a convertir " + geometry);
      String[] componentes = StringUtils.split(geometry, "(");

      String tipo = componentes[0];
      GeometryType type = null;

      if (tipo.equals("LINESTRING"))
        type = GeometryType.LINESTRING;
      else if (tipo.equals("MULTILINESTRING"))
        type = GeometryType.MULTILINESTRING;
      else if (tipo.equals("POINT"))
        type = GeometryType.POINT;
      else if (tipo.equals("MULTIPOINT"))
        type = GeometryType.MULTIPOINT;
      else if (tipo.equals("POLYGON"))
        type = GeometryType.POLYGON;
      else if (tipo.equals("MULTIPOLYGON"))
        type = GeometryType.MULTIPOLYGON;
      else
        type = GeometryType.UNKNOWN;

      switch (type) {
      case POINT:
        log.trace("Reconocido a POINT");
        if (componentes[1].length() < 1) {
          log.error("componentes erroneas");
        } else {
          String coordenada = componentes[1].substring(0,
              componentes[1].length() - 1);
          if (coordenada.length() == 0)
            log.trace("No hay coordenadas, ¿geometria vacia?");
          log.trace("coordenadas: " + coordenada);
          String[] numeros = StringUtils.split(coordenada, " ");
          if (numeros.length != 2)
            log.error("Numero de dimensiones incorrecto: "
                + numeros.length);
          else {
            try {
              LatLon latlon = extractLatLon(numeros);
              log.trace("LatLon del nuevo marcador: " + latlon);
              resultado = new WayPoint(latlon);
            } catch (Exception e) {
              log.error("Error calculando el nodo", e);
              e.printStackTrace();
            }
          }
View Full Code Here

Examples of org.openstreetmap.josm.data.gpx.WayPoint

    for (Recurso r : allres) {
      HistoricoGPS h = r.getHistoricoGps();
      if (h == null) {
        continue;
      }
      WayPoint w = new WayPoint(new LatLon(h.getPosY(), h.getPosX()));
      String name = r.getNombre();

      if (r.getPatrullas() != null)
        name += " (" + r.getPatrullas().getNombre() + ")";
View Full Code Here

Examples of org.openstreetmap.josm.data.gpx.WayPoint

          final com.vividsolutions.jts.geom.Point centroid = i
              .getGeometria().getCentroid();
          if (centroid != null) {
            LatLon latlon = new LatLon(centroid.getCoordinate().y,
                centroid.getCoordinate().x);
            WayPoint w = new WayPoint(latlon);
            w.attr.put("name",
                i.getTitulo() + " (" + i.getPrioridad() + ")");
            w.attr.put(
                "symbol",
                LogicConstants.get(
View Full Code Here

Examples of org.openstreetmap.josm.data.gpx.WayPoint

          states.push(currentState);
          currentState = State.metadata;
        } else if (qName.equals("wpt")) {
          states.push(currentState);
          currentState = State.wpt;
          currentWayPoint = new WayPoint(parseLatLon(atts));
        } else if (qName.equals("rte")) {
          states.push(currentState);
          currentState = State.rte;
          currentRoute = new GpxRoute();
        } else if (qName.equals("trk")) {
          states.push(currentState);
          currentState = State.trk;
          currentTrack = new ArrayList<Collection<WayPoint>>();
          currentTrackAttr = new HashMap<String, Object>();
        } else if (qName.equals("extensions")) {
          states.push(currentState);
          currentState = State.ext;
        } else if (qName.equals("gpx")
            && atts.getValue("creator") != null
            && atts.getValue("creator").startsWith(
                "Nokia Sports Tracker")) {
          nokiaSportsTrackerBug = true;
        }
        break;
      case author:
        if (qName.equals("link")) {
          states.push(currentState);
          currentState = State.link;
          currentLink = new GpxLink(atts.getValue("href"));
        } else if (qName.equals("email")) {
          currentData.attr.put(GpxData.META_AUTHOR_EMAIL, atts
              .getValue("id")
              + "@" + atts.getValue("domain"));
        }
        break;
      case trk:
        if (qName.equals("trkseg")) {
          states.push(currentState);
          currentState = State.trkseg;
          currentTrackSeg = new ArrayList<WayPoint>();
        } else if (qName.equals("link")) {
          states.push(currentState);
          currentState = State.link;
          currentLink = new GpxLink(atts.getValue("href"));
        } else if (qName.equals("extensions")) {
          states.push(currentState);
          currentState = State.ext;
        }
        break;
      case metadata:
        if (qName.equals("author")) {
          states.push(currentState);
          currentState = State.author;
        } else if (qName.equals("extensions")) {
          states.push(currentState);
          currentState = State.ext;
        } else if (qName.equals("copyright")) {
          states.push(currentState);
          currentState = State.copyright;
          currentData.attr.put(GpxData.META_COPYRIGHT_AUTHOR, atts
              .getValue("author"));
        } else if (qName.equals("link")) {
          states.push(currentState);
          currentState = State.link;
          currentLink = new GpxLink(atts.getValue("href"));
        }
        break;
      case trkseg:
        if (qName.equals("trkpt")) {
          states.push(currentState);
          currentState = State.wpt;
          currentWayPoint = new WayPoint(parseLatLon(atts));
        }
        break;
      case wpt:
        if (qName.equals("link")) {
          states.push(currentState);
          currentState = State.link;
          currentLink = new GpxLink(atts.getValue("href"));
        } else if (qName.equals("extensions")) {
          states.push(currentState);
          currentState = State.ext;
        }
        break;
      case rte:
        if (qName.equals("link")) {
          states.push(currentState);
          currentState = State.link;
          currentLink = new GpxLink(atts.getValue("href"));
        } else if (qName.equals("rtept")) {
          states.push(currentState);
          currentState = State.wpt;
          currentWayPoint = new WayPoint(parseLatLon(atts));
        } else if (qName.equals("extensions")) {
          states.push(currentState);
          currentState = State.ext;
        }
        break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.