Package aimax.osm.data.entities

Examples of aimax.osm.data.entities.Track


  }

  /** {@inheritDoc} */
  @Override
  public void clearTrack(String trackName) {
    Track track = getTrack(trackName);
    if (track != null) {
      tracks.remove(track);
      fireMapDataEvent(new MapEvent(this, MapEvent.Type.MAP_MODIFIED));
    }
  }
View Full Code Here


  /** {@inheritDoc} */
  @Override
  public void createTrack(String trackName, List<Position> positions) {
    clearTrack(trackName);
    Track track = new DefaultTrack(nextTrackId++, trackName, trackName);
    updateEntityViewInfo(track, false);
    tracks.add(track);
    for (Position pos : positions)
      track.addNode(pos);
    fireMapDataEvent(new MapEvent(this, MapEvent.Type.TRACK_MODIFIED, track
        .getId()));
  }
View Full Code Here

  }

  /** {@inheritDoc} */
  @Override
  public void addToTrack(String trackName, Position pos) {
    Track track = getTrack(trackName);
    if (track == null) {
      track = new DefaultTrack(nextTrackId++, trackName, trackName);
      updateEntityViewInfo(track, false);
      tracks.add(track);
    }
    track.addNode(pos);
    fireMapDataEvent(new MapEvent(this, MapEvent.Type.TRACK_MODIFIED, track
        .getId()));
  }
View Full Code Here

  class MyGpsPositionListener implements GpsPositionListener {
    @Override
    public void positionUpdated(GpsFix pos) {
      if (pos.isPosOk()) {
        OsmMap mapData = frame.getMap();
        Track track = mapData.getTrack(GPS_TRACK_NAME);
        MapNode node = null;
        if (track != null)
          node = track.getLastNode();
        if (node == null || pos.getDistKM(node) > 0.01) {
          mapData.addToTrack(GPS_TRACK_NAME, pos);
          if (gpsCombo.getSelectedIndex() == 2
              || gpsCombo.getSelectedIndex() == 3)
            frame.getView().adjustToCenter(pos.getLat(),
View Full Code Here

        routingThread.cancel();
      } else {
        List<MapNode> markers = getMap().getMarkers();
        if (!markers.isEmpty()) {
          List<MapNode> routeMarkers = new ArrayList<MapNode>();
          Track gpsTrack = getMap().getTrack(GPS_TRACK_NAME);
          if (gpsTrack != null) {
            routeMarkers.add(gpsTrack.getLastNode());
            routeMarkers.add(markers.get(0));
          } else {
            routeMarkers.addAll(markers);
          }
          routingThread = new RoutingThread(routeMarkers);
View Full Code Here

        MapNode mark = nodes.get(nodes.size() - 1);
        infoField.setText("Marker " + mark.getName() + ": Lat "
            + f1.format(mark.getLat()) + "; Lon "
            + f1.format(mark.getLon()));
      } else if (event.getType() == MapEvent.Type.TRACK_MODIFIED) {
        Track track = map.getTrack(event.getObjId());
        if (track != null) {
          List<MapNode> nodes = track.getNodes();
          DecimalFormat f1 = new DecimalFormat("#0.00");
          double km = Position.getTrackLengthKM(nodes);
          String info = track.getName() + ": Total Length " + f1.format(km)
              + " km";
          if (nodes.size() > 1) {
            DecimalFormat f2 = new DecimalFormat("#000");
            MapNode m1 = nodes.get(nodes.size() - 2);
            MapNode m2 = nodes.get(nodes.size() - 1);
View Full Code Here

TOP

Related Classes of aimax.osm.data.entities.Track

Copyright © 2018 www.massapicom. 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.