Пример #1
0
  /** Set up the status bar, which shows latitude, longitude, altitude, etc. */
  protected void setupStatusBar() {
    StatusBar statusBar =
        new StatusBar() {
          private static final long serialVersionUID = -8334549384792867496L;

          @Override
          protected String makeAngleDescription(String label, Angle angle) {
            String s;
            if (Angle.ANGLE_FORMAT_DMS.equals(getAngleFormat()))
              s = String.format("%s %s", label, angle.toDMSString());
            else s = String.format("%s %,.6f\u00B0", label, angle.degrees);
            return s;
          }

          /** Overridden to capture the current altitude. */
          @Override
          protected String makeEyeAltitudeDescription(double metersAltitude) {
            // System.out.println("metersAltitude: "+ metersAltitude);
            setCurrentAltitude(metersAltitude);
            return super.makeEyeAltitudeDescription(metersAltitude);
          }
        };
    add(statusBar, BorderLayout.PAGE_END);
    statusBar.setEventSource(getWWD());
  }
    public WWPanel(Dimension size) {
      this.wwd = new WorldWindowGLCanvas();
      this.wwd.setSize(size);

      this.wwd.setModel((Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME));

      this.setLayout(new BorderLayout(5, 5));
      this.add(this.wwd, BorderLayout.CENTER);

      StatusBar statusBar = new StatusBar();
      statusBar.setEventSource(wwd);
      this.add(statusBar, BorderLayout.SOUTH);
    }