Example #1
0
        /**
         * Create an animator to animate heading, pitch, and roll.
         *
         * @param view         View to animate
         * @param beginHeading staring heading
         * @param endHeading   final heading
         * @param beginPitch   starting pitch
         * @param endPitch     final pitch
         * @param beginRoll    starting roll
         * @param endRoll      final roll
         *
         * @return A CompoundAnimator to animate heading, pitch, and roll.
         */
        public static CompoundAnimator createHeadingPitchRollAnimator(View view, Angle beginHeading, Angle endHeading,
                                                                      Angle beginPitch, Angle endPitch, Angle beginRoll, Angle endRoll)
        {
            if (beginHeading == null || endHeading == null || beginPitch == null || endPitch == null || beginRoll == null ||
                endRoll == null)
            {
                String message = Logging.getMessage("nullValue.AngleIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            const long MIN_LENGTH_MILLIS   = 500;
            const long MAX_LENGTH_MILLIS   = 3000;
            long       headingLengthMillis = AnimationSupport.getScaledTimeMillisecs(
                beginHeading, endHeading, Angle.POS180,
                MIN_LENGTH_MILLIS, MAX_LENGTH_MILLIS);
            long pitchLengthMillis = AnimationSupport.getScaledTimeMillisecs(
                beginPitch, endPitch, Angle.POS90,
                MIN_LENGTH_MILLIS, MAX_LENGTH_MILLIS / 2L);
            long rollLengthMillis = AnimationSupport.getScaledTimeMillisecs(
                beginRoll, endRoll, Angle.POS90,
                MIN_LENGTH_MILLIS, MAX_LENGTH_MILLIS / 2L);
            long lengthMillis = headingLengthMillis + pitchLengthMillis + rollLengthMillis;

            AngleAnimator headingAnimator = createHeadingAnimator(view, beginHeading, endHeading);
            AngleAnimator pitchAnimator   = createPitchAnimator(view, beginPitch, endPitch);
            AngleAnimator rollAnimator    = createRollAnimator(view, beginRoll, endRoll);

            CompoundAnimator headingPitchAnimator = new CompoundAnimator(new ScheduledInterpolator(lengthMillis),
                                                                         headingAnimator, pitchAnimator, rollAnimator);

            return(headingPitchAnimator);
        }
Example #2
0
 public FlyToOrbitViewAnimator(OrbitView orbitView, Interpolator interpolator, int altitudeMode,
                               PositionAnimator centerAnimator, DoubleAnimator zoomAnimator,
                               AngleAnimator headingAnimator, AngleAnimator pitchAnimator, AngleAnimator rollAnimator) :
     base(interpolator, centerAnimator, zoomAnimator, headingAnimator, pitchAnimator, rollAnimator)
 {
     this.orbitView       = (BasicOrbitView)orbitView;
     this.centerAnimator  = centerAnimator;
     this.zoomAnimator    = (ViewElevationAnimator)zoomAnimator;
     this.headingAnimator = headingAnimator;
     this.pitchAnimator   = pitchAnimator;
     this.rollAnimator    = rollAnimator;
     if (interpolator == null)
     {
         this.interpolator = new ScheduledInterpolator(10000);
     }
     this.altitudeMode = altitudeMode;
 }
Example #3
0
        public static FlyToOrbitViewAnimator createFlyToOrbitViewAnimator(
            OrbitView orbitView,
            Position beginCenterPos, Position endCenterPos,
            Angle beginHeading, Angle endHeading,
            Angle beginPitch, Angle endPitch,
            double beginZoom, double endZoom, long timeToMove, int altitudeMode)
        {
            OnSurfacePositionAnimator centerAnimator = new OnSurfacePositionAnimator(orbitView.getGlobe(),
                                                                                     new ScheduledInterpolator(timeToMove),
                                                                                     beginCenterPos, endCenterPos,
                                                                                     OrbitViewPropertyAccessor.createCenterPositionAccessor(
                                                                                         orbitView), altitudeMode);

            // Create an elevation animator with ABSOLUTE altitude mode because the OrbitView altitude mode applies to the
            // center position, not the zoom.
            ViewElevationAnimator zoomAnimator = new ViewElevationAnimator(orbitView.getGlobe(),
                                                                           beginZoom, endZoom, beginCenterPos, endCenterPos, WorldWind.ABSOLUTE,
                                                                           OrbitViewPropertyAccessor.createZoomAccessor(orbitView));

            centerAnimator.useMidZoom = zoomAnimator.getUseMidZoom();

            AngleAnimator headingAnimator = new AngleAnimator(
                new ScheduledInterpolator(timeToMove),
                beginHeading, endHeading,
                ViewPropertyAccessor.createHeadingAccessor(orbitView));

            AngleAnimator pitchAnimator = new AngleAnimator(
                new ScheduledInterpolator(timeToMove),
                beginPitch, endPitch,
                ViewPropertyAccessor.createPitchAccessor(orbitView));

            FlyToOrbitViewAnimator panAnimator = new FlyToOrbitViewAnimator(orbitView,
                                                                            new ScheduledInterpolator(timeToMove), altitudeMode, centerAnimator,
                                                                            zoomAnimator, headingAnimator, pitchAnimator, null);

            return(panAnimator);
        }