Пример #1
0
 public void run() {
   double[] p;
   try {
     try {
       String[] split = q.split(",");
       p = new double[] {Integer.parseInt(split[0].trim()), Integer.parseInt(split[1].trim())};
     } catch (NumberFormatException e) {
       p = Nominatim.getPoint(q);
     }
     if (p == null) {
       JOptionPane.showMessageDialog(
           appFrame, "Location Not Found.", "", JOptionPane.ERROR_MESSAGE);
     } else {
       View v = wwd.getView();
       if (v != null) {
         v.goTo(Position.fromDegrees(p[0], p[1]), 512 * 30 * 10);
       }
     }
   } catch (MalformedURLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (URISyntaxException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
Пример #2
0
  /**
   * Set the position of the map to the indicated position. If "fly" is true, the map will animate
   * from the current position to the indicated position, otherwise it will jump there immediately.
   *
   * @param pos - desired destination position
   * @param fly - fly if true, jump if false
   */
  public void setPosition(Position pos, boolean fly) {
    View mapView = getWWD().getView();
    if (mapView.isAnimating()) {
      mapView.stopAnimations();
    }

    if (fly) {
      mapView.goTo(pos, pos.getAltitude());
    } else {
      mapView.setEyePosition(pos);
      getWWD().redraw();
    }
  }
    public void doActionOnButton1() {
      Logging.logger().info("Zooming to Matterhorn");

      View view = this.wwd.getView();

      Position matterhorn =
          new Position(LatLon.fromDegrees(45.9763888888889d, 7.65833333333333d), 0d);

      //            Position eyePos = new Position( LatLon.fromDegrees( 46.01066860997058d,
      // 7.633097536001656d ), 3363d );
      //
      //            view.setEyePosition( eyePos );
      //            view.setHeading( Angle.fromDegrees( 156d ));
      //            view.setPitch( Angle.fromDegrees( 89.9d ));

      view.goTo(matterhorn, 5000d);
    }
Пример #4
0
    /**
     * Loads .track file from newTrackFile to trackLDMIO, inits debug run, zooms to newest GpsPoint
     *
     * @param newTrackFile URI to track file
     * @return if loading the trackfile was successful
     */
    private boolean loadNewData(String newTrackFile) {
      LDMIOTrack tmpTrackLDMIO;
      try {
        tmpTrackLDMIO = new LDMIOTrack(newTrackFile);
      } catch (IOException e) {
        return false;
      }

      save();
      trackLDMIO = tmpTrackLDMIO;

      enableSettingsMode(true);
      initDebugRun();

      if (trackLDMIO.getAllGpsPoints().size() > 0) {
        View view = globeMapPanel.wwd.getView();
        view.goTo(new Position(translateToGlobePosition(trackLDMIO.getLastGpsPoint()), 0), 4000);
      }

      slider.setMaximum(
          (trackLDMIO.getAllGpsPoints() == null) ? 0 : trackLDMIO.getAllGpsPoints().size());
      setTitle("testloc.world + " + newTrackFile);
      return true;
    }