コード例 #1
0
  protected void onHorizontalTranslateRel(
      Angle forwardChange, Angle sideChange, ViewInputAttributes.ActionAttributes actionAttribs) {
    View view = this.getView();
    if (view == null) // include this test to ensure any derived implementation performs it
    {
      return;
    }

    if (forwardChange.equals(Angle.ZERO) && sideChange.equals(Angle.ZERO)) {
      return;
    }

    if (view instanceof BasicFlyView) {

      Vec4 forward = view.getForwardVector();
      Vec4 up = view.getUpVector();
      Vec4 side = forward.transformBy3(Matrix.fromAxisAngle(Angle.fromDegrees(90), up));

      forward = forward.multiply3(forwardChange.getDegrees());
      side = side.multiply3(sideChange.getDegrees());
      Vec4 eyePoint = view.getEyePoint();
      eyePoint = eyePoint.add3(forward.add3(side));
      Position newPosition = view.getGlobe().computePositionFromPoint(eyePoint);

      this.setEyePosition(this.uiAnimControl, view, newPosition, actionAttribs);
      view.firePropertyChange(AVKey.VIEW, null, view);
    }
  }
コード例 #2
0
  /**
   * Tests the equality of the sectors' angles. Sectors are equal if all of their corresponding
   * angles are equal.
   *
   * @param o the sector to compareTo with <code>this</code>.
   * @return <code>true</code> if the four corresponding angles of each sector are equal, <code>
   *     false</code> otherwise.
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    final gov.nasa.worldwind.geom.Sector sector = (gov.nasa.worldwind.geom.Sector) o;

    if (!maxLatitude.equals(sector.maxLatitude)) {
      return false;
    }
    if (!maxLongitude.equals(sector.maxLongitude)) {
      return false;
    }
    if (!minLatitude.equals(sector.minLatitude)) {
      return false;
    }
    //noinspection RedundantIfStatement
    if (!minLongitude.equals(sector.minLongitude)) {
      return false;
    }

    return true;
  }