コード例 #1
0
 void tourStopList_ItemClicked(object sender, TourStop e)
 {
     id = e.Id;
     LinkToSlideCheckbox.Checked    = true;
     LinkToNextCheckbox.Checked     = false;
     ReturnToCallerCheckbox.Checked = false;
 }
コード例 #2
0
        private void PlayMasterForCurrent()
        {
            if (!tour.CurrentTourStop.MasterSlide)
            {
                MasterTime currentMaster = tour.ElapsedTimeSinceLastMaster(tour.CurrentTourstopIndex);

                if (currentMaster != null && currentMasterSlide != null)
                {
                    double elapsed = currentMaster.Durration;
                    currentMasterSlide = currentMaster.Master;

                    if (currentMasterSlide.MusicTrack != null)
                    {
                        currentMasterSlide.MusicTrack.Play();
                        currentMasterSlide.MusicTrack.Seek(elapsed);
                    }

                    if (currentMasterSlide.VoiceTrack != null)
                    {
                        currentMasterSlide.VoiceTrack.Play();
                        currentMasterSlide.VoiceTrack.Seek(elapsed);
                    }

                    foreach (Overlay overlay in currentMasterSlide.Overlays)
                    {
                        overlay.Play();
                        overlay.Seek(elapsed);
                    }
                }
            }
        }
コード例 #3
0
ファイル: Tour.cs プロジェクト: hxhlb/wwt-windows-client
        public void AddTourStop(TourStop ts)
        {
            ts.Owner = this;

            TourStops.Add(ts);
            currentTourstopIndex = tourStops.Count - 1;
            TourDirty            = true;
        }
コード例 #4
0
 public void RemoveTourStop(TourStop ts)
 {
     tourStops.Remove(ts);
     if (currentTourstopIndex > tourStops.Count - 1)
     {
         currentTourstopIndex--;
     }
     TourDirty = true;
 }
コード例 #5
0
 private void PlayFromTourstop(TourStop tourStop)
 {
     Stop(true);
     tour.CurrentTourStop = tourStop;
     WWTControl.Singleton.GotoTarget(tour.CurrentTourStop.Target, false, true, false);
     SpaceTimeController.Now         = tour.CurrentTourStop.StartTime;
     SpaceTimeController.SyncToClock = false;
     Play();
 }
コード例 #6
0
 public int FindItem(TourStop ts)
 {
     for (int i = 0; i < Items.Count; i++)
     {
         if (Items[i] == ts)
         {
             return(i);
         }
     }
     return(-1);
 }
コード例 #7
0
        public MasterTime ElapsedTimeSinceLastMaster(int index)
        {
            TourStop masterOut = null;

            if (index == 0 && index >= tourStops.Count)
            {
                return(null);
            }
            double totalTime = 0.0;

            for (int i = 0; i < index; i++)
            {
                if (tourStops[i].MasterSlide)
                {
                    totalTime = 0;
                    masterOut = tourStops[i];
                }

                totalTime += (double)(tourStops[i].Duration);
                if (i > 0)
                {
                    switch (tourStops[i].Transition)
                    {
                    case TransitionType.Slew:
                        CameraParameters start = tourStops[i - 1].EndTarget == null ? tourStops[i - 1].Target.CamParams : tourStops[i - 1].EndTarget.CamParams;
                        if (tourStops[i - 1].Target.BackgroundImageset.DataSetType == tourStops[i].Target.BackgroundImageset.DataSetType &&
                            ((tourStops[i - 1].Target.BackgroundImageset.DataSetType != ImageSetType.SolarSystem) || (tourStops[i - 1].Target.Target == tourStops[i].Target.Target)))
                        {
                            ViewMoverSlew slew = ViewMoverSlew.Create(start, tourStops[i].Target.CamParams);
                            totalTime += slew.MoveTime * 1000;
                        }
                        break;

                    case TransitionType.Instant:
                        break;

                    case TransitionType.CrossFade:
                        break;

                    case TransitionType.FadeToBlack:
                        break;

                    default:
                        break;
                    }
                }
            }


            return(new MasterTime(masterOut, totalTime / 1000));
        }
コード例 #8
0
ファイル: Overlay.cs プロジェクト: itguy327/wwt-web-client
        //public static BitmapOverlay(RenderContext renderContext, TourStop owner, string filename)
        //{
        //    this.Owner = owner;
        //    this.filename = Guid.NewGuid().ToString() + ".png";

        //    this.Name = filename.Substr(filename.LastIndexOf('\\'));

        //    X = 0;
        //    Y = 0;
        //}


        public static BitmapOverlay Create(RenderContext renderContext, TourStop owner, ImageElement image)
        {
            BitmapOverlay temp = new BitmapOverlay();

            temp.Owner = owner;
            // to make directory and guid filename in tour temp dir.
            temp.filename = (NextId++).ToString() + ".png";

            temp.Name = owner.GetNextDefaultName("Image");
            temp.X    = 0;
            temp.Y    = 0;

            return(temp);
        }
コード例 #9
0
 public void InsertAfterTourStop(TourStop ts)
 {
     ts.Owner = this;
     if (currentTourstopIndex > -1 || currentTourstopIndex < TourStops.Count)
     {
         TourStops.Insert(currentTourstopIndex + 1, ts);
     }
     else
     {
         TourStops.Add(ts);
         currentTourstopIndex = tourStops.Count - 1;
     }
     TourDirty = true;
 }
コード例 #10
0
ファイル: Tour.cs プロジェクト: hxhlb/wwt-windows-client
        public double ElapsedTimeSinceLastMaster(int index, out TourStop masterOut)
        {
            masterOut = null;
            if (index == 0 && index >= tourStops.Count)
            {
                return(0);
            }
            double totalTime = 0.0;

            for (int i = 0; i < index; i++)
            {
                if (tourStops[i].MasterSlide)
                {
                    totalTime = 0;
                    masterOut = tourStops[i];
                }

                totalTime += (double)(tourStops[i].Duration.TotalMilliseconds / 1000);
                if (i > 0 && !tourStops[i].MasterSlide)
                {
                    switch (tourStops[i].Transition)
                    {
                    case TransitionType.Slew:
                        CameraParameters start = tourStops[i - 1].EndTarget == null ? tourStops[i - 1].Target.CamParams : tourStops[i - 1].EndTarget.CamParams;
                        if (tourStops[i - 1].Target.BackgroundImageSet.DataSetType == tourStops[i].Target.BackgroundImageSet.DataSetType &&
                            ((tourStops[i - 1].Target.BackgroundImageSet.DataSetType != ImageSetType.SolarSystem) || (tourStops[i - 1].Target.Target == tourStops[i].Target.Target)))
                        {
                            ViewMoverSlew slew = new ViewMoverSlew(start, tourStops[i].Target.CamParams);
                            totalTime += slew.MoveTime;
                        }
                        break;

                    case TransitionType.CrossCut:
                        break;

                    case TransitionType.CrossFade:
                        break;

                    case TransitionType.FadeOut:
                        break;

                    default:
                        break;
                    }
                }
            }
            return(totalTime);
        }
コード例 #11
0
ファイル: Overlay.cs プロジェクト: itguy327/wwt-web-client
        internal static Overlay FromXml(TourStop owner, XmlNode overlay)
        {
            if (overlay.Attributes == null)
            {
                return(null);
            }

            if (overlay.Attributes.GetNamedItem("Type") == null)
            {
                return(null);
            }
            string overlayClassName = overlay.Attributes.GetNamedItem("Type").Value.ToString();

            //Type overLayType = Type.GetType(overlayClassName.Replace("TerraViewer.",""));
            string  overLayType = overlayClassName.Replace("TerraViewer.", "");
            Overlay newOverlay  = null;

            //Overlay newOverlay = (Overlay)System.Activator.CreateInstance(overLayType);
            switch (overLayType)
            {
            case "AudioOverlay":
                newOverlay = new AudioOverlay();
                break;

            case "BitmapOverlay":
                newOverlay = new BitmapOverlay();
                break;

            case "FlipBookOverlay":
                newOverlay = new FlipbookOverlay();
                break;

            case "ShapeOverlay":
                newOverlay = new ShapeOverlay();
                break;

            case "TextOverlay":
                newOverlay = new TextOverlay();
                break;

            default:
                return(null);
            }

            newOverlay.owner = owner;
            newOverlay.InitOverlayFromXml(overlay);
            return(newOverlay);
        }
コード例 #12
0
ファイル: Overlay.cs プロジェクト: itguy327/wwt-web-client
        public BitmapOverlay Copy(TourStop owner)
        {
            BitmapOverlay newBmpOverlay = new BitmapOverlay();

            newBmpOverlay.Owner         = owner;
            newBmpOverlay.filename      = this.filename;
            newBmpOverlay.X             = this.X;
            newBmpOverlay.Y             = this.Y;
            newBmpOverlay.Width         = this.Width;
            newBmpOverlay.Height        = this.Height;
            newBmpOverlay.Color         = this.Color;
            newBmpOverlay.Opacity       = this.Opacity;
            newBmpOverlay.RotationAngle = this.RotationAngle;
            newBmpOverlay.Name          = this.Name + " - Copy";

            return(newBmpOverlay);
        }
コード例 #13
0
 public static void UpdateOverlayList(TourStop tourStop, Selection selection)
 {
     if (master != null)
     {
         master.ItemList.Nodes.Clear();
         if (tourStop != null)
         {
             foreach (Overlay overlay in tourStop.Overlays)
             {
                 TreeNode item = new TreeNode(overlay.Name);
                 item.Tag     = overlay;
                 item.Checked = selection.IsOverlaySelected(overlay);
                 master.ItemList.Nodes.Add(item);
             }
         }
     }
     // Hack to update Keyframer UI
     TimeLine.RefreshUi();
 }
コード例 #14
0
        private void StopCurrentMaster()
        {
            if (currentMasterSlide != null)
            {
                if (currentMasterSlide.MusicTrack != null)
                {
                    currentMasterSlide.MusicTrack.Stop();
                }

                if (currentMasterSlide.VoiceTrack != null)
                {
                    currentMasterSlide.VoiceTrack.Stop();
                }

                foreach (Overlay overlay in currentMasterSlide.Overlays)
                {
                    overlay.Stop();
                }
                currentMasterSlide = null;
            }
        }
コード例 #15
0
ファイル: Overlay.cs プロジェクト: itguy327/wwt-web-client
        //public FlipbookOverlay(RenderContext renderContext, TourStop owner, string filename)
        //{
        //    this.Owner = owner;


        //    string extension = filename.Substr(filename.LastIndexOf("."));

        //    this.filename = Guid.NewGuid().ToString() + extension;

        //    this.Name = filename.Substr(filename.LastIndexOf('\\'));
        //    //File.Copy(filename, Owner.Owner.WorkingDirectory + this.filename);

        //    //Bitmap bmp = new Bitmap(Owner.Owner.WorkingDirectory + this.filename);
        //    Width = 256;
        //    Height = 256;
        //    //bmp.Dispose();
        //    //bmp = null;
        //    X = 0;
        //    Y = 0;
        //}


        //public FlipbookOverlay(RenderContext renderContext, TourStop owner, Image image)
        //{
        //    this.Owner = owner;
        //    this.canvas = canvas;
        //    // to make directory and guid filename in tour temp dir.
        //    this.filename = Guid.NewGuid().ToString() + ".png";

        //    this.Name = owner.GetNextDefaultName("Image");
        //    X = 0;
        //    Y = 0;
        //    //image.Save(Owner.Owner.WorkingDirectory + filename, ImageFormat.Png);
        //    Width = 256;
        //    Height = 256;
        //}

        public FlipbookOverlay Copy(TourStop owner)
        {
            //todo fix this
            FlipbookOverlay newFlipbookOverlay = new FlipbookOverlay();

            newFlipbookOverlay.Owner         = owner;
            newFlipbookOverlay.filename      = this.filename;
            newFlipbookOverlay.X             = this.X;
            newFlipbookOverlay.Y             = this.Y;
            newFlipbookOverlay.Width         = this.Width;
            newFlipbookOverlay.Height        = this.Height;
            newFlipbookOverlay.Color         = this.Color;
            newFlipbookOverlay.Opacity       = this.Opacity;
            newFlipbookOverlay.RotationAngle = this.RotationAngle;
            newFlipbookOverlay.Name          = this.Name + " - Copy";
            newFlipbookOverlay.StartFrame    = this.StartFrame;
            newFlipbookOverlay.Frames        = this.Frames;
            newFlipbookOverlay.LoopType      = this.LoopType;
            newFlipbookOverlay.FrameSequence = this.FrameSequence;
            newFlipbookOverlay.FramesX       = this.FramesX;
            newFlipbookOverlay.FramesY       = this.FramesY;

            return(newFlipbookOverlay);
        }
コード例 #16
0
        public void NextSlide()
        {
            // Stop any existing current Slide
            if (tour.CurrentTourStop != null)
            {
                if (!tour.CurrentTourStop.MasterSlide)
                {
                    if (tour.CurrentTourStop.MusicTrack != null)
                    {
                        tour.CurrentTourStop.MusicTrack.Stop();
                    }

                    if (tour.CurrentTourStop.VoiceTrack != null)
                    {
                        tour.CurrentTourStop.VoiceTrack.Stop();
                    }

                    foreach (Overlay overlay in tour.CurrentTourStop.Overlays)
                    {
                        overlay.Stop();
                    }
                }
                else
                {
                    currentMasterSlide = tour.CurrentTourStop;
                }
            }
            // Check if this is the last slide in the deck
            if ((tour.CurrentTourstopIndex < (tour.TourStops.Count - 1)) || tour.CurrentTourStop.IsLinked)
            {
                // If there are more slides then move on..
                if (tour.CurrentTourStop.EndTarget != null)
                {
                    Earth3d.MainWindow.GotoTarget(false, true, tour.CurrentTourStop.EndTarget.CamParams, tour.CurrentTourStop.Target.StudyImageset, tour.CurrentTourStop.Target.BackgroundImageSet);
                    Earth3d.MainWindow.Mover = null;
                }
                onTarget = false;


                if (tour.CurrentTourStop.IsLinked && !PreRoll)
                {
                    try
                    {
                        switch (tour.CurrentTourStop.NextSlide)
                        {
                        case "Return":
                            if (callStack.Count > 0)
                            {
                                Earth3d.MainWindow.TourEdit.PlayFromTourstop(tour.TourStops[callStack.Pop()]);
                            }
                            else
                            {
                                tour.CurrentTourstopIndex = tour.TourStops.Count - 1;
                            }
                            break;

                        default:
                            Earth3d.MainWindow.TourEdit.PlayFromTourstop(tour.TourStops[tour.GetTourStopIndexByID(tour.CurrentTourStop.NextSlide)]);
                            break;
                        }
                    }
                    catch
                    {
                        if ((tour.CurrentTourstopIndex < (tour.TourStops.Count - 1)))
                        {
                            tour.CurrentTourstopIndex++;
                        }
                    }
                }
                else
                {
                    tour.CurrentTourstopIndex++;
                }

                Earth3d.MainWindow.TourEdit.EnsureSelectedVisible();


                if (currentMasterSlide != null && tour.CurrentTourStop.MasterSlide)
                {
                    StopCurrentMaster();
                }

                bool instant = false;
                switch (tour.CurrentTourStop.Transition)
                {
                case TransitionType.Slew:
                    break;

                case TransitionType.CrossFade:
                    instant = true;
                    break;

                case TransitionType.CrossCut:
                    instant = true;
                    break;

                case TransitionType.FadeOutIn:
                    instant = true;
                    break;

                case TransitionType.FadeOut:
                    instant = true;
                    break;

                case TransitionType.FadeIn:
                    instant = true;
                    break;

                default:
                    break;
                }

                if (PreRoll)
                {
                    if (instant)
                    {
                        PreRollTime = 2;
                    }
                    else
                    {
                        PreRollTime = .2;
                    }
                    instant = true;
                }

                Earth3d.MainWindow.GotoTarget(tour.CurrentTourStop.Target, false, Earth3d.NoUi ? true : instant, false);

                slideStartTime = SpaceTimeController.MetaNow;
                // Move to new settings
                Settings.TourSettings           = tour.CurrentTourStop;
                SpaceTimeController.Now         = tour.CurrentTourStop.StartTime;
                SpaceTimeController.SyncToClock = false;
            }
            else
            {
                StopCurrentMaster();

                playing = false;

                if (PreRoll)
                {
                    PreRoll = false;
                    tour.CurrentTourstopIndex = -1;
                    Play();
                    return;
                }

                if (Properties.Settings.Default.AutoRepeatTour && !tour.EditMode)
                {
                    tour.CurrentTourstopIndex = -1;
                    Play();
                }
                else
                {
                    Earth3d.MainWindow.FreezeView();
                    if (TourEnded != null)
                    {
                        TourEnded.Invoke(this, new EventArgs());
                    }
                }
            }
        }
コード例 #17
0
        public void NextSlide()
        {
            if (tour.CurrentTourStop != null)
            {
                if (!tour.CurrentTourStop.MasterSlide)
                {
                    if (tour.CurrentTourStop.MusicTrack != null)
                    {
                        tour.CurrentTourStop.MusicTrack.Stop();
                    }

                    if (tour.CurrentTourStop.VoiceTrack != null)
                    {
                        tour.CurrentTourStop.VoiceTrack.Stop();
                    }

                    foreach (Overlay overlay in tour.CurrentTourStop.Overlays)
                    {
                        overlay.Stop();
                    }
                }
                else
                {
                    currentMasterSlide = tour.CurrentTourStop;
                }
            }

            if (tour.CurrentTourstopIndex < (tour.TourStops.Count - 1) || tour.CurrentTourStop.IsLinked)
            {
                if (tour.CurrentTourStop.EndTarget != null)
                {
                    WWTControl.Singleton.GotoTargetFull(false, true, tour.CurrentTourStop.EndTarget.CamParams, tour.CurrentTourStop.Target.StudyImageset, tour.CurrentTourStop.Target.BackgroundImageset);
                    WWTControl.Singleton.Mover = null;
                }
                onTarget = false;
                if (tour.CurrentTourStop.IsLinked)
                {
                    try
                    {
                        switch (tour.CurrentTourStop.NextSlide)
                        {
                        case "Return":
                            if (callStack.Count > 0)
                            {
                                PlayFromTourstop(tour.TourStops[callStack.Pop()]);
                            }
                            else
                            {
                                tour.CurrentTourstopIndex = tour.TourStops.Count - 1;
                            }
                            break;

                        default:
                            PlayFromTourstop(tour.TourStops[tour.GetTourStopIndexByID(tour.CurrentTourStop.NextSlide)]);
                            break;
                        }
                    }
                    catch
                    {
                        if ((tour.CurrentTourstopIndex < (tour.TourStops.Count - 1)))
                        {
                            tour.CurrentTourstopIndex++;
                        }
                    }
                }
                else
                {
                    tour.CurrentTourstopIndex++;
                }

                if (currentMasterSlide != null && tour.CurrentTourStop.MasterSlide)
                {
                    StopCurrentMaster();
                }

                bool instant = false;
                switch (tour.CurrentTourStop.Transition)
                {
                case TransitionType.Slew:
                    break;

                case TransitionType.CrossFade:
                    instant = true;
                    break;

                case TransitionType.CrossCut:
                    instant = true;
                    break;

                case TransitionType.FadeOutIn:
                    instant = true;
                    break;

                case TransitionType.FadeOut:
                    instant = true;
                    break;

                case TransitionType.FadeIn:
                    instant = true;
                    break;

                default:
                    break;
                }

                WWTControl.Singleton.GotoTarget(tour.CurrentTourStop.Target, false, instant, false);

                slideStartTime = Date.Now;
                // Move to new settings
                Settings.TourSettings           = tour.CurrentTourStop;
                SpaceTimeController.Now         = tour.CurrentTourStop.StartTime;
                SpaceTimeController.SyncToClock = false;
            }
            else
            {
                StopCurrentMaster();
                playing = false;
                if (Settings.Current.AutoRepeatTour)
                {
                    tour.CurrentTourstopIndex = -1;
                    Play();
                }
                else
                {
                    WWTControl.Singleton.FreezeView();
                    if (TourEnded != null)
                    {
                        TourEnded.Invoke(this, new EventArgs());
                    }

                    ShowEndTourPopup();
                    WWTControl.Singleton.HideUI(false);
                    WWTControl.scriptInterface.FireTourEnded();
                }
            }
        }
コード例 #18
0
 public MasterTime(TourStop master, double durration)
 {
     Master    = master;
     Durration = durration;
 }
コード例 #19
0
        public void FromXml(XmlDocument doc)
        {
            XmlNode root = Util.SelectSingleNode(doc, "Tour");


            id     = root.Attributes.GetNamedItem("ID").Value.ToString();
            Title  = root.Attributes.GetNamedItem("Title").Value.ToString();
            Author = root.Attributes.GetNamedItem("Author").Value.ToString();

            if (root.Attributes.GetNamedItem("Descirption") != null)
            {
                Description = root.Attributes.GetNamedItem("Descirption").Value;
            }

            if (root.Attributes.GetNamedItem("AuthorEmail") != null)
            {
                authorEmail = root.Attributes.GetNamedItem("AuthorEmail").Value;
            }

            if (root.Attributes.GetNamedItem("Keywords") != null)
            {
                Keywords = root.Attributes.GetNamedItem("Keywords").Value;
            }

            if (root.Attributes.GetNamedItem("OrganizationName") != null)
            {
                OrgName = root.Attributes.GetNamedItem("OrganizationName").Value;
            }

            organizationUrl = root.Attributes.GetNamedItem("OrganizationUrl").Value.ToString();

            switch (root.Attributes.GetNamedItem("UserLevel").Value)
            {
            case "Beginner":
                level = UserLevel.Beginner;
                break;

            case "Intermediate":
                level = UserLevel.Intermediate;
                break;

            case "Advanced":
                level = UserLevel.Advanced;
                break;

            case "Educator":
                level = UserLevel.Educator;
                break;

            case "Professional":
                level = UserLevel.Professional;
                break;

            default:
                break;
            }


            switch (root.Attributes.GetNamedItem("Classification").Value)
            {
            case "Star":
                type = Classification.Star;
                break;

            case "Supernova":
                type = Classification.Supernova;
                break;

            case "BlackHole":
                type = Classification.BlackHole;
                break;

            case "NeutronStar":
                type = Classification.NeutronStar;
                break;

            case "DoubleStar":
                type = Classification.DoubleStar;
                break;

            case "MultipleStars":
                type = Classification.MultipleStars;
                break;

            case "Asterism":
                type = Classification.Asterism;
                break;

            case "Constellation":
                type = Classification.Constellation;
                break;

            case "OpenCluster":
                type = Classification.OpenCluster;
                break;

            case "GlobularCluster":
                type = Classification.GlobularCluster;
                break;

            case "NebulousCluster":
                type = Classification.NebulousCluster;
                break;

            case "Nebula":
                type = Classification.Nebula;
                break;

            case "EmissionNebula":
                type = Classification.EmissionNebula;
                break;

            case "PlanetaryNebula":
                type = Classification.PlanetaryNebula;
                break;

            case "ReflectionNebula":
                type = Classification.ReflectionNebula;
                break;

            case "DarkNebula":
                type = Classification.DarkNebula;
                break;

            case "GiantMolecularCloud":
                type = Classification.GiantMolecularCloud;
                break;

            case "SupernovaRemnant":
                type = Classification.SupernovaRemnant;
                break;

            case "InterstellarDust":
                type = Classification.InterstellarDust;
                break;

            case "Quasar":
                type = Classification.Quasar;
                break;

            case "Galaxy":
                type = Classification.Galaxy;
                break;

            case "SpiralGalaxy":
                type = Classification.SpiralGalaxy;
                break;

            case "IrregularGalaxy":
                type = Classification.IrregularGalaxy;
                break;

            case "EllipticalGalaxy":
                type = Classification.EllipticalGalaxy;
                break;

            case "Knot":
                type = Classification.Knot;
                break;

            case "PlateDefect":
                type = Classification.PlateDefect;
                break;

            case "ClusterOfGalaxies":
                type = Classification.ClusterOfGalaxies;
                break;

            case "OtherNGC":
                type = Classification.OtherNGC;
                break;

            case "Unidentified":
                type = Classification.Unidentified;
                break;

            case "SolarSystem":
                type = Classification.SolarSystem;
                break;

            case "Unfiltered":
                type = Classification.Unfiltered;
                break;

            case "Stellar":
                type = Classification.Stellar;
                break;

            case "StellarGroupings":
                type = Classification.StellarGroupings;
                break;

            case "Nebulae":
                type = Classification.Nebulae;
                break;

            case "Galactic":
                type = Classification.Galactic;
                break;

            case "Other":
                type = Classification.Other;
                break;

            default:
                break;
            }

            taxonomy = root.Attributes.GetNamedItem("Taxonomy").Value.ToString();
            XmlNode TourStops = Util.SelectSingleNode(root, "TourStops");

            foreach (XmlNode tourStop in TourStops.ChildNodes)
            {
                if (tourStop.Name == "TourStop")
                {
                    AddTourStop(TourStop.FromXml(this, tourStop));
                }
            }

            XmlNode Frames = Util.SelectSingleNode(root, "ReferenceFrames");

            if (Frames != null)
            {
                foreach (XmlNode frame in Frames.ChildNodes)
                {
                    if (frame.Name == "ReferenceFrame")
                    {
                        ReferenceFrame newFrame = new ReferenceFrame();
                        newFrame.InitializeFromXml(frame);
                        if (!LayerManager.AllMaps.ContainsKey(newFrame.Name))
                        {
                            LayerMap map = new LayerMap(newFrame.Name, ReferenceFrames.Custom);
                            map.Frame          = newFrame;
                            map.LoadedFromTour = true;
                            LayerManager.AllMaps[newFrame.Name] = map;
                        }
                    }
                }
                LayerManager.ConnectAllChildren();
                LayerManager.LoadTree();
            }

            XmlNode Layers = Util.SelectSingleNode(root, "Layers");

            if (Layers != null)
            {
                foreach (XmlNode layer in Layers.ChildNodes)
                {
                    if (layer.Name == "Layer")
                    {
                        Layer newLayer = new Layer().FromXml(layer, true);//.Layer.FromXml(layer, true);
                        if (newLayer != null)
                        {
                            string fileName = string.Format("{0}.txt", newLayer.ID.ToString());
                            if (LayerManager.LayerList.ContainsKey(newLayer.ID)) // && newLayer.ID != ISSLayer.ISSGuid)
                            {
                                //if (!CollisionChecked)
                                //{
                                //    if (UiTools.ShowMessageBox(Language.GetLocalizedText(958, "There are layers with the same name. Overwrite existing layers?"), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope"), System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                                //    {
                                //        OverWrite = true;
                                //    }
                                //    else
                                //    {
                                //        OverWrite = false;

                                //    }
                                //    CollisionChecked = true;
                                //}

                                //if (OverWrite)
                                //{
                                LayerManager.DeleteLayerByID(newLayer.ID, true, false);
                                //}
                            }
                            try
                            {
                                newLayer.LoadedFromTour = true;
                                newLayer.LoadData(GetFileStream(fileName));
                                LayerManager.Add(newLayer, false);
                            }
                            catch
                            {
                            }
                        }
                    }
                }
                LayerManager.LoadTree();
            }

            //todo author
            //if (File.Exists(WorkingDirectory + "Author.png"))
            //{
            //    authorImage = UiTools.LoadBitmap(WorkingDirectory + "Author.png");
            //}

            tourDirty = 0;
        }
コード例 #20
0
ファイル: Tour.cs プロジェクト: hxhlb/wwt-windows-client
        public void MergeTourStopsFromXml(string filename)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(filename);


            XmlNode root = doc["Tour"];


            bool timeLineTour = false;

            if (root.Attributes["TimeLineTour"] != null)
            {
                timeLineTour = bool.Parse(root.Attributes["TimeLineTour"].Value);
            }


            XmlNode TourStops = null;

            if (timeLineTour)
            {
                TourStops = root["TimeLineTourStops"];
            }
            else
            {
                TourStops = root["TourStops"];
            }

            foreach (XmlNode tourStop in TourStops)
            {
                currentTourstopIndex++;
                InsertTourStop(TourStop.FromXml(this, tourStop));
            }

            XmlNode Frames = root["ReferenceFrames"];

            if (Frames != null)
            {
                foreach (XmlNode frame in Frames)
                {
                    ReferenceFrame newFrame = new ReferenceFrame();
                    newFrame.InitializeFromXml(frame);
                    if (!LayerManager.AllMaps.ContainsKey(newFrame.Name))
                    {
                        LayerMap map = new LayerMap(newFrame.Name, ReferenceFrames.Custom);
                        map.Frame = newFrame;
                        LayerManager.AllMaps.Add(newFrame.Name, map);
                    }
                }
                LayerManager.ConnectAllChildren();
                LayerManager.LoadTree();
            }



            XmlNode Layers = root["Layers"];

            if (Layers != null)
            {
                foreach (XmlNode layer in Layers)
                {
                    Layer  newLayer = Layer.FromXml(layer, true);
                    string fileName = WorkingDirectory + string.Format("{0}.txt", newLayer.ID.ToString());

                    newLayer.LoadData(fileName);
                    LayerManager.Add(newLayer, false);
                }
                LayerManager.LoadTree();
            }
        }
コード例 #21
0
ファイル: Tour.cs プロジェクト: hxhlb/wwt-windows-client
        public static TourDocument FromXml(string filename)
        {
            TourDocument newTour = new TourDocument();

            newTour.filename = filename;
            XmlDocument doc = new XmlDocument();

            doc.Load(filename);


            XmlNode root = doc["Tour"];


            newTour.id     = root.Attributes["ID"].Value.ToString();
            newTour.Title  = root.Attributes["Title"].Value.ToString();
            newTour.Author = root.Attributes["Author"].Value.ToString();

            if (root.Attributes["Descirption"] != null)
            {
                newTour.Description = root.Attributes["Descirption"].Value;
            }

            if (root.Attributes["Description"] != null)
            {
                newTour.Description = root.Attributes["Description"].Value;
            }

            if (root.Attributes["AuthorEmail"] != null)
            {
                newTour.authorEmail = root.Attributes["AuthorEmail"].Value;
            }

            if (root.Attributes["Keywords"] != null)
            {
                newTour.Keywords = root.Attributes["Keywords"].Value;
            }

            if (root.Attributes["OrganizationName"] != null)
            {
                newTour.OrgName = root.Attributes["OrganizationName"].Value;
            }

            if (root.Attributes["DomeMode"] != null)
            {
                newTour.DomeMode = bool.Parse(root.Attributes["DomeMode"].Value);
            }

            newTour.organizationUrl = root.Attributes["OrganizationUrl"].Value.ToString();
            newTour.level           = (UserLevel)Enum.Parse(typeof(UserLevel), root.Attributes["UserLevel"].Value.ToString());
            newTour.type            = (Classification)Enum.Parse(typeof(Classification), root.Attributes["Classification"].Value.ToString());
            newTour.taxonomy        = root.Attributes["Taxonomy"].Value.ToString();

            bool timeLineTour = false;

            if (root.Attributes["TimeLineTour"] != null)
            {
                timeLineTour = bool.Parse(root.Attributes["TimeLineTour"].Value);
            }


            XmlNode TourStops = null;

            if (timeLineTour)
            {
                TourStops = root["TimeLineTourStops"];
            }
            else
            {
                TourStops = root["TourStops"];
            }


            foreach (XmlNode tourStop in TourStops)
            {
                newTour.AddTourStop(TourStop.FromXml(newTour, tourStop));
            }

            XmlNode Frames = root["ReferenceFrames"];

            if (Frames != null)
            {
                foreach (XmlNode frame in Frames)
                {
                    ReferenceFrame newFrame = new ReferenceFrame();
                    newFrame.InitializeFromXml(frame);
                    if (!LayerManager.AllMaps.ContainsKey(newFrame.Name))
                    {
                        LayerMap map = new LayerMap(newFrame.Name, ReferenceFrames.Custom);
                        map.Frame          = newFrame;
                        map.LoadedFromTour = true;
                        LayerManager.AllMaps.Add(newFrame.Name, map);
                    }
                }
                LayerManager.ConnectAllChildren();
                LayerManager.LoadTree();
            }

            XmlNode Layers = root["Layers"];

            if (Layers != null)
            {
                foreach (XmlNode layer in Layers)
                {
                    Layer  newLayer = Layer.FromXml(layer, true);
                    string fileName = newTour.WorkingDirectory + string.Format("{0}.txt", newLayer.ID.ToString());

                    // Overwite ISS layer if in a tour using the authored ISS details
                    if (LayerManager.LayerList.ContainsKey(newLayer.ID) && newLayer.ID == ISSLayer.ISSGuid)
                    {
                        LayerManager.DeleteLayerByID(newLayer.ID, true, false);
                    }

                    // Ask about merging other layers.
                    if (LayerManager.LayerList.ContainsKey(newLayer.ID) && newLayer.ID != ISSLayer.ISSGuid)
                    {
                        if (!newTour.CollisionChecked)
                        {
                            if (UiTools.ShowMessageBox(Language.GetLocalizedText(958, "There are layers with the same name. Overwrite existing layers?"), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope"), System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                            {
                                newTour.OverWrite = true;
                            }
                            else
                            {
                                newTour.OverWrite = false;
                            }
                            newTour.CollisionChecked = true;
                        }

                        if (newTour.OverWrite)
                        {
                            LayerManager.DeleteLayerByID(newLayer.ID, true, false);
                        }
                    }

                    try
                    {
                        newLayer.LoadedFromTour = true;
                        newLayer.LoadData(fileName);
                        LayerManager.Add(newLayer, false);
                    }
                    catch
                    {
                    }
                }
                LayerManager.LoadTree();
            }

            if (File.Exists(newTour.WorkingDirectory + "Author.png"))
            {
                newTour.authorImage = UiTools.LoadBitmap(newTour.WorkingDirectory + "Author.png");
            }

            newTour.tourDirty = 0;
            return(newTour);
        }
コード例 #22
0
        public void UpdateSlideStates()
        {
            bool slideChanging = false;


            if (!ProjectorServer)
            {
                TimeSpan slideElapsedTime = SpaceTimeController.MetaNow - slideStartTime;

                if ((slideElapsedTime > tour.CurrentTourStop.Duration && playing) || (slideElapsedTime.TotalSeconds > PreRollTime && PreRoll))
                {
                    NextSlide();
                    slideChanging = true;
                }

                slideElapsedTime = SpaceTimeController.MetaNow - slideStartTime;

                if (tour.CurrentTourStop != null)
                {
                    tour.CurrentTourStop.TweenPosition = Math.Min(1, (float)(slideElapsedTime.TotalMilliseconds / tour.CurrentTourStop.Duration.TotalMilliseconds));
                }
            }
            else
            {
                try
                {
                    if (tour.CurrentTourStop != null)
                    {
                        if (lastSlideIndex != LayerManager.CurrentSlideID)
                        {
                            slideChanging             = true;
                            lastSlideIndex            = LayerManager.CurrentSlideID;
                            tour.CurrentTourstopIndex = LayerManager.CurrentSlideID;
                            if (tour.CurrentTourStop.MasterSlide)
                            {
                                currentMasterSlide = null;
                            }
                            else
                            {
                                currentMasterSlide = tour.GetMasterSlideForIndex(tour.CurrentTourstopIndex);
                            }
                            LayerManager.SetVisibleLayerList(tour.CurrentTourStop.Layers);
                        }
                        tour.CurrentTourStop.TweenPosition = LayerManager.SlideTweenPosition;
                    }
                }
                catch
                {
                }
                onTarget = true;
            }


            if (tour.CurrentTourStop != null)
            {
                tour.CurrentTourStop.FaderOpacity = 0;
                Tile.fastLoad = false;
                double elapsedSeconds = tour.CurrentTourStop.TweenPosition * tour.CurrentTourStop.Duration.TotalSeconds;
                if (slideChanging)
                {
                    Earth3d.MainWindow.CrossFadeFrame = false;
                }

                switch (tour.CurrentTourStop.Transition)
                {
                case TransitionType.Slew:
                    tour.CurrentTourStop.FaderOpacity = 0;
                    Earth3d.MainWindow.CrossFadeFrame = false;
                    break;

                case TransitionType.CrossCut:
                {
                    if (slideChanging)
                    {
                        Tile.fastLoad          = true;
                        Tile.fastLoadAutoReset = false;
                    }
                    if (elapsedSeconds < (elapsedSeconds - tour.CurrentTourStop.TransitionHoldTime))
                    {
                        Earth3d.MainWindow.CrossFadeFrame = true;
                        tour.CurrentTourStop.FaderOpacity = 1;
                    }
                    else
                    {
                        tour.CurrentTourStop.FaderOpacity = 0;
                        Earth3d.MainWindow.CrossFadeFrame = false;
                    }
                }
                break;

                case TransitionType.CrossFade:
                {
                    Earth3d.MainWindow.CrossFadeFrame = true;
                    double opacity = Math.Max(0, 1 - Math.Min(1, (elapsedSeconds - tour.CurrentTourStop.TransitionHoldTime) / tour.CurrentTourStop.TransitionTime));
                    tour.CurrentTourStop.FaderOpacity = (float)opacity;
                    if (slideChanging)
                    {
                        Tile.fastLoad          = true;
                        Tile.fastLoadAutoReset = false;
                    }
                }
                break;

                case TransitionType.FadeOutIn:
                case TransitionType.FadeIn:
                {
                    Earth3d.MainWindow.CrossFadeFrame = false;
                    double opacity = Math.Max(0, 1 - Math.Min(1, (elapsedSeconds - tour.CurrentTourStop.TransitionHoldTime) / tour.CurrentTourStop.TransitionTime));
                    tour.CurrentTourStop.FaderOpacity = (float)opacity;
                }
                break;

                case TransitionType.FadeOut:
                    Earth3d.MainWindow.CrossFadeFrame = false;
                    break;

                default:
                    break;
                }

                if (!tour.CurrentTourStop.IsLinked && tour.CurrentTourstopIndex < (tour.TourStops.Count - 1))
                {
                    TransitionType nextTrans     = tour.TourStops[tour.CurrentTourstopIndex + 1].Transition;
                    double         nextTransTime = tour.TourStops[tour.CurrentTourstopIndex + 1].TransitionOutTime;


                    switch (nextTrans)
                    {
                    case TransitionType.FadeOut:
                    case TransitionType.FadeOutIn:
                    {
                        if (tour.CurrentTourStop.FaderOpacity == 0)
                        {
                            Earth3d.MainWindow.CrossFadeFrame = false;
                            double opacity = Math.Max(0, 1 - Math.Min(1, (tour.CurrentTourStop.Duration.TotalSeconds - elapsedSeconds) / nextTransTime));
                            tour.CurrentTourStop.FaderOpacity = (float)opacity;
                        }
                    }
                    break;

                    default:
                        break;
                    }
                }
            }
        }
コード例 #23
0
 public AnimationTarget(TourStop owner)
 {
     this.owner = owner;
 }
コード例 #24
0
        //public static TourDocument FromUrl(string url, Action callMe)
        //{

        //    TourDocument temp = new TourDocument();
        //    temp.Url = url;
        //    temp.callMe = callMe;

        //    temp.webFile = new WebFile(Util.GetTourComponent(url, "master"));
        //    temp.webFile.OnStateChange = temp.LoadXmlDocument;
        //    temp.webFile.Send();

        //    return temp;
        //}

        //private void LoadXmlDocument()
        //{
        //    if (webFile.State == StateType.Error)
        //    {
        //        Script.Literal("alert({0})", webFile.Message);
        //    }
        //    else if (webFile.State == StateType.Received)
        //    {
        //        FromXml(webFile.GetXml());
        //        callMe();
        //    }
        //}


        public void FromXml(XmlDocument doc)
        {
            XmlNode root = Util.SelectSingleNode(doc, "Tour");


            id     = root.Attributes.GetNamedItem("ID").Value.ToString();
            Title  = root.Attributes.GetNamedItem("Title").Value.ToString();
            Author = root.Attributes.GetNamedItem("Author").Value.ToString();

            if (root.Attributes.GetNamedItem("Descirption") != null)
            {
                Description = root.Attributes.GetNamedItem("Descirption").Value;
            }

            if (root.Attributes.GetNamedItem("AuthorEmail") != null)
            {
                authorEmail = root.Attributes.GetNamedItem("AuthorEmail").Value;
            }

            if (root.Attributes.GetNamedItem("Keywords") != null)
            {
                Keywords = root.Attributes.GetNamedItem("Keywords").Value;
            }

            if (root.Attributes.GetNamedItem("OrganizationName") != null)
            {
                OrgName = root.Attributes.GetNamedItem("OrganizationName").Value;
            }



            organizationUrl = root.Attributes.GetNamedItem("OrganizationUrl").Value;

            level = (UserLevel)Enums.Parse("UserLevel", root.Attributes.GetNamedItem("UserLevel").Value);

            type = (Classification)Enums.Parse("Classification", root.Attributes.GetNamedItem("Classification").Value);

            taxonomy = root.Attributes.GetNamedItem("Taxonomy").Value.ToString();
            XmlNode TourStops = Util.SelectSingleNode(root, "TourStops");

            foreach (XmlNode tourStop in TourStops.ChildNodes)
            {
                if (tourStop.Name == "TourStop")
                {
                    AddTourStop(TourStop.FromXml(this, tourStop));
                }
            }

            XmlNode Frames = Util.SelectSingleNode(root, "ReferenceFrames");

            if (Frames != null)
            {
                foreach (XmlNode frame in Frames.ChildNodes)
                {
                    if (frame.Name == "ReferenceFrame")
                    {
                        ReferenceFrame newFrame = new ReferenceFrame();
                        newFrame.InitializeFromXml(frame);
                        if (!LayerManager.AllMaps.ContainsKey(newFrame.Name))
                        {
                            LayerMap map = new LayerMap(newFrame.Name, ReferenceFrames.Custom);
                            map.Frame          = newFrame;
                            map.LoadedFromTour = true;
                            LayerManager.AllMaps[newFrame.Name] = map;
                        }
                    }
                }
                LayerManager.ConnectAllChildren();
                LayerManager.LoadTree();
            }

            XmlNode Layers = Util.SelectSingleNode(root, "Layers");

            if (Layers != null)
            {
                foreach (XmlNode layer in Layers.ChildNodes)
                {
                    if (layer.Name == "Layer")
                    {
                        Layer newLayer = Layer.FromXml(layer, true);//.Layer.FromXml(layer, true);
                        if (newLayer != null)
                        {
                            string fileName = string.Format("{0}.txt", newLayer.ID.ToString());
                            if (LayerManager.LayerList.ContainsKey(newLayer.ID)) // && newLayer.ID != ISSLayer.ISSGuid)
                            {
                                //if (!CollisionChecked)
                                //{
                                //    if (UiTools.ShowMessageBox(Language.GetLocalizedText(958, "There are layers with the same name. Overwrite existing layers?"), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope"), System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                                //    {
                                //        OverWrite = true;
                                //    }
                                //    else
                                //    {
                                //        OverWrite = false;

                                //    }
                                //    CollisionChecked = true;
                                //}

                                //if (OverWrite)
                                //{
                                LayerManager.DeleteLayerByID(newLayer.ID, true, false);
                                //}
                            }
                            try
                            {
                                newLayer.LoadedFromTour = true;
                                newLayer.LoadData(this, fileName);
                                LayerManager.Add(newLayer, false);
                            }
                            catch
                            {
                            }
                        }
                    }
                }
                LayerManager.LoadTree();
            }

            //todo author
            //if (File.Exists(WorkingDirectory + "Author.png"))
            //{
            //    authorImage = UiTools.LoadBitmap(WorkingDirectory + "Author.png");
            //}

            tourDirty = 0;
        }