protected static boolean isTileVisible(
      DrawContext dc, Tile tile, double minDistanceSquared, double maxDistanceSquared) {
    if (!tile.getSector().intersects(dc.getVisibleSector())) return false;

    View view = dc.getView();
    Position eyePos = view.getEyePosition();
    if (eyePos == null) return false;

    Angle lat =
        clampAngle(
            eyePos.getLatitude(),
            tile.getSector().getMinLatitude(),
            tile.getSector().getMaxLatitude());
    Angle lon =
        clampAngle(
            eyePos.getLongitude(),
            tile.getSector().getMinLongitude(),
            tile.getSector().getMaxLongitude());
    Vec4 p = dc.getGlobe().computePointFromPosition(lat, lon, 0d);
    double distSquared = dc.getView().getEyePoint().distanceToSquared3(p);
    //noinspection RedundantIfStatement
    if (minDistanceSquared > distSquared || maxDistanceSquared < distSquared) return false;

    return true;
  }
  protected void setEyePosition(
      AnimationController animControl,
      View view,
      Position position,
      ViewInputAttributes.ActionAttributes attrib) {

    MoveToPositionAnimator posAnimator =
        (MoveToPositionAnimator) animControl.get(VIEW_ANIM_POSITION);

    double smoothing = attrib.getSmoothingValue();
    if (!(attrib.isEnableSmoothing() && this.isEnableSmoothing())) smoothing = 0.0;

    if (smoothing != 0.0) {

      double elevation =
          ((FlyViewLimits) view.getViewPropertyLimits())
              .limitEyeElevation(position, view.getGlobe());
      if (elevation != position.getElevation()) {
        position = new Position(position, elevation);
      }
      if (posAnimator == null) {
        posAnimator =
            new MoveToPositionAnimator(
                view.getEyePosition(),
                position,
                smoothing,
                OrbitViewPropertyAccessor.createEyePositionAccessor(view));
        animControl.put(VIEW_ANIM_POSITION, posAnimator);
      } else {
        posAnimator.setEnd(position);
        posAnimator.start();
      }
    }
    view.firePropertyChange(AVKey.VIEW, null, view);
  }
  protected void onVerticalTranslate(
      double translateChange,
      double totalTranslateChange,
      ViewInputAttributes.DeviceAttributes deviceAttributes,
      ViewInputAttributes.ActionAttributes actionAttribs) {
    this.stopGoToAnimators();
    double elevChange =
        -(totalTranslateChange * getScaleValueElevation(deviceAttributes, actionAttribs));
    View view = this.getView();
    Position position = view.getEyePosition();
    Position newPos = new Position(position, position.getElevation() + (elevChange));
    this.setEyePosition(uiAnimControl, view, newPos, actionAttribs);

    view.firePropertyChange(AVKey.VIEW, null, view);
  }
    protected boolean isNavSectorVisible(
        DrawContext dc, double minDistanceSquared, double maxDistanceSquared) {
      if (!navSector.intersects(dc.getVisibleSector())) return false;

      View view = dc.getView();
      Position eyePos = view.getEyePosition();
      if (eyePos == null) return false;

      // check for eyePos over globe
      if (Double.isNaN(eyePos.getLatitude().getDegrees())
          || Double.isNaN(eyePos.getLongitude().getDegrees())) return false;

      Angle lat =
          clampAngle(eyePos.getLatitude(), navSector.getMinLatitude(), navSector.getMaxLatitude());
      Angle lon =
          clampAngle(
              eyePos.getLongitude(), navSector.getMinLongitude(), navSector.getMaxLongitude());
      Vec4 p = dc.getGlobe().computePointFromPosition(lat, lon, 0d);
      double distSquared = dc.getView().getEyePoint().distanceToSquared3(p);
      //noinspection RedundantIfStatement
      if (minDistanceSquared > distSquared || maxDistanceSquared < distSquared) return false;

      return true;
    }
Exemple #5
0
 public Double getCurrentAltitude() {
   View view = this.getWWd().getView();
   return view != null ? view.getEyePosition().getElevation() : null;
 }