Example #1
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 #2
0
        public bool isColliding(OrbitView orbitView, double nearDistance, DrawContext dc)
        {
            if (orbitView == null)
            {
                String message = Logging.getMessage("nullValue.OrbitViewIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }
            if (nearDistance < 0)
            {
                String message = Logging.getMessage("generic.ArgumentOutOfRange", nearDistance);
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }
            if (dc == null)
            {
                String message = Logging.getMessage("nullValue.DrawContextIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }
            Globe globe = dc.getGlobe();

            if (globe == null)
            {
                String message = Logging.getMessage("nullValue.DrawingContextGlobeIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            Matrix modelviewInv = getModelviewInverse(globe,
                                                      orbitView.getCenterPosition(), orbitView.getHeading(), orbitView.getPitch(), orbitView.getRoll(),
                                                      orbitView.getZoom());

            if (modelviewInv != null)
            {
                // OrbitView is colliding when its eye point is below the collision threshold.
                double heightAboveSurface = computeViewHeightAboveSurface(dc, modelviewInv,
                                                                          orbitView.getFieldOfView(), orbitView.getViewport(), nearDistance);
                return(heightAboveSurface < this.collisionThreshold);
            }

            return(false);
        }
        /**
         * Applies the orbit view property limits to the specified view.
         *
         * @param view       the view that receives the property limits.
         * @param viewLimits defines the view property limits.
         *
         * @throws ArgumentException if any argument is null.
         * @deprecated Use methods that limit individual view properties directly: {@link #limitCenterPosition(gov.nasa.worldwind.View,
         *             SharpEarth.geom.Position)}, {@link #limitHeading(gov.nasa.worldwind.View,
         *             SharpEarth.geom.Angle)}, etc.
         */
        public static void applyLimits(OrbitView view, OrbitViewLimits viewLimits)
        {
            if (view == null)
            {
                String message = Logging.getMessage("nullValue.ViewIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }
            if (viewLimits == null)
            {
                String message = Logging.getMessage("nullValue.ViewLimitsIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            view.setCenterPosition(limitCenterPosition(view.getCenterPosition(), viewLimits));
            view.setHeading(limitHeading(view.getHeading(), viewLimits));
            view.setPitch(limitPitch(view.getPitch(), viewLimits));
            view.setZoom(limitZoom(view.getZoom(), viewLimits));
        }
Example #4
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);
        }
 public ZoomAccessor(OrbitView orbitView)
 {
     this.orbitView = orbitView;
 }
 public CenterPositionAccessor(OrbitView view)
 {
     orbitView = view;
 }
 public static PropertyAccessor.DoubleAccessor createZoomAccessor(OrbitView view)
 {
     return(new ZoomAccessor(view));
 }
 public static PropertyAccessor.PositionAccessor createCenterPositionAccessor(OrbitView view)
 {
     return(new CenterPositionAccessor(view));
 }