Example #1
0
        private void playFromPosition(Timeline timeline, double time,
                                      ViewDirection pvd, ViewDirection nvd)
        {
            if (pvd != null && nvd != null)
            {
                double alpha = ScriptPlayer.ComputeAlpha(time - pvd.Time, pvd, nvd);
                double span  = (nvd.Longitude - pvd.Longitude) % 360;
                if (span >= 180)
                {
                    span -= 360;
                }
                else if (span < -180)
                {
                    span += 360;
                }

                double lon = pvd.Longitude + alpha * span;
                double lat = pvd.Latitude + alpha * (nvd.Latitude - pvd.Latitude);
                double ele = pvd.Elevation + alpha * (nvd.Elevation - pvd.Elevation);

                this.globe.SetViewDirection(pvd.SpecForm, lat, lon, ele);
            }
            else if (pvd != null)
            {
                this.globe.SetViewDirection(pvd.SpecForm, pvd.Latitude,
                                            pvd.Longitude, pvd.Elevation);
            }
        }
Example #2
0
        override public void OnPulse(Timeline timeline, double time)
        {
            ViewPosition pvp = timeline.GetMostPreviousInTime(time) as ViewPosition;
            ViewPosition nvp = timeline.GetNextInTime(time) as ViewPosition;

            if (pvp != null && nvp != null)
            {
                double alpha = ScriptPlayer.ComputeAlpha(time - pvp.Time, pvp, nvp);
                double span  = (nvp.Longitude - pvp.Longitude) % 360;
                if (span >= 180)
                {
                    span -= 360;
                }
                else if (span < -180)
                {
                    span += 360;
                }

                double lon = pvp.Longitude + alpha * span;
                double lat = pvp.Latitude + alpha * (nvp.Latitude - pvp.Latitude);
                double ele = pvp.Elevation + alpha * (nvp.Elevation - pvp.Elevation);

                this.globe.SetViewPosition(lat, lon, ele);
            }
            else if (pvp != null)
            {
                this.globe.SetViewPosition(pvp.Latitude, pvp.Longitude, pvp.Elevation);
            }
        }
        override public void OnPulse(Timeline timeline, double time)
        {
            VerticalExaggeration pve =
                timeline.GetMostPreviousInTime(time) as VerticalExaggeration;
            VerticalExaggeration nve =
                timeline.GetNextInTime(time) as VerticalExaggeration;

            if (pve != null && nve != null)
            {
                double alpha = ScriptPlayer.ComputeAlpha(time - pve.Time, pve, nve);
                double span  = nve.Exaggeration - pve.Exaggeration;
                double ve    = pve.Exaggeration + alpha * span;

                this.globe.SetVerticalExaggeration(ve);
            }
            else if (pve != null)
            {
                this.globe.SetVerticalExaggeration(pve.Exaggeration);
            }
        }
Example #4
0
        private void playFromAngles(Timeline timeline, double time,
                                    ViewDirection pvd, ViewDirection nvd)
        {
            if (pvd != null && nvd != null && pvd.SpecForm.Equals(nvd.SpecForm))
            {
                double alpha = ScriptPlayer.ComputeAlpha(time - pvd.Time, pvd, nvd);
                double hSpan = nvd.HorizontalAngle - pvd.HorizontalAngle;
                double vSpan = nvd.VerticalAngle - pvd.VerticalAngle;

                double horizontal = pvd.HorizontalAngle + alpha * hSpan;
                double vertical   = pvd.VerticalAngle + alpha * vSpan;

                this.globe.SetViewDirection(pvd.SpecForm, horizontal, vertical, 0);
            }
            else if (pvd != null)
            {
                this.globe.SetViewDirection(pvd.SpecForm, pvd.HorizontalAngle,
                                            pvd.VerticalAngle, 0);
            }
        }