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 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); } }