public AudioOverlay( TourStop owner, string filename)
 {
     isDesignTimeOnly = true;
     X = 0;
     Y = 0;
     this.filename = Guid.NewGuid().ToString() + filename.Substring(filename.LastIndexOf("."));
     this.Owner = owner;
     this.Name = owner.GetNextDefaultName("Audio");
     File.Copy(filename, Owner.Owner.WorkingDirectory + this.filename);
 }
 public static void UpdateOverlayList(TourStop tourStop, Selection selection)
 {
     if (master != null)
     {
         master.ItemList.Nodes.Clear();
         if (tourStop != null)
         {
             foreach (var overlay in tourStop.Overlays)
             {
                 var 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();
 }
 private void tourStopList_ShowStartPosition(object sender, TourStop e)
 {
     ShowSlideStartPosition(Tour.CurrentTourStop);
     TourEditorUI.ClearSelection();
 }
        public FlipbookOverlay( TourStop owner, string filename)
        {
            this.Owner = owner;

            string extension = filename.Substring(filename.LastIndexOf("."));

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

            this.Name = filename.Substring(filename.LastIndexOf('\\') +1);
            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 BitmapOverlay(TourStop owner, string filename)
        {
            this.Owner = owner;
            this.filename = Guid.NewGuid().ToString() + ".png";

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

            Bitmap bmp = new Bitmap(Owner.Owner.WorkingDirectory + this.filename);
            Width = bmp.Width;
            Height = bmp.Height;
            bmp.Dispose();
            GC.SuppressFinalize(bmp);
            bmp = null;
            X = 0;
            Y = 0;
        }
        internal static Overlay FromXml(TourStop owner, System.Xml.XmlNode overlay)
        {
            string overlayClassName = overlay.Attributes["Type"].Value.ToString();

            Type overLayType = Type.GetType(overlayClassName);

            Overlay newOverlay = (Overlay)System.Activator.CreateInstance(overLayType);
            newOverlay.owner = owner;
            newOverlay.FromXml(overlay);
            return newOverlay;
        }
 public AnimationTarget(TourStop owner)
 {
     this.owner = owner;
 }
        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;
                    }
                }
            }
        }
        public FlipbookOverlay Copy(TourStop owner)
        {
            //todo fix this
            var newFlipbookOverlay = new FlipbookOverlay();
            newFlipbookOverlay.Owner = owner;
            newFlipbookOverlay.filename = filename;
            newFlipbookOverlay.X = X;
            newFlipbookOverlay.Y = Y;
            newFlipbookOverlay.Width = Width;
            newFlipbookOverlay.Height = Height;
            newFlipbookOverlay.Color = Color;
            newFlipbookOverlay.Opacity = Opacity;
            newFlipbookOverlay.RotationAngle = RotationAngle;
            newFlipbookOverlay.Name = Name + " - Copy";
            newFlipbookOverlay.StartFrame = StartFrame;
            newFlipbookOverlay.Frames = Frames;
            newFlipbookOverlay.LoopType = LoopType;
            newFlipbookOverlay.FrameSequence = FrameSequence;
            newFlipbookOverlay.FramesX = FramesX;
            newFlipbookOverlay.FramesY = FramesY;

            return newFlipbookOverlay;
        }
        public BitmapOverlay Copy(TourStop owner)
        {
            var newBmpOverlay = new BitmapOverlay();
            newBmpOverlay.Owner = owner;
            newBmpOverlay.filename = filename;
            newBmpOverlay.X = X;
            newBmpOverlay.Y = Y;
            newBmpOverlay.Width = Width;
            newBmpOverlay.Height = Height;
            newBmpOverlay.Color = Color;
            newBmpOverlay.Opacity = Opacity;
            newBmpOverlay.RotationAngle = RotationAngle;
            newBmpOverlay.Name = Name + " - Copy";

            return newBmpOverlay;
        }
        public BitmapOverlay( TourStop owner, Image image)
        {
            Owner = owner;
            // to make directory and guid filename in tour temp dir.
            filename = Guid.NewGuid()+".png";

            Name = owner.GetNextDefaultName("Image");
            X = 0;
            Y = 0;
            image.Save(Owner.Owner.WorkingDirectory + filename, ImageFormat.Png);
            Width = image.Width;
            Height = image.Height;
        }
        internal static Overlay FromXml(TourStop owner, XmlNode overlay)
        {
            var overlayClassName = overlay.Attributes["Type"].Value;

            var overLayType = Type.GetType(overlayClassName);

            var newOverlay = (Overlay)Activator.CreateInstance(overLayType);
            newOverlay.owner = owner;
            newOverlay.FromXml(overlay);
            return newOverlay;
        }
 public void PlayFromTourstop(TourStop ts)
 {
     tour.CurrentTourStop = ts;
     PlayFromCurrentTourstop();
 }
        private void AddSlide(bool insert)
        {
            //todo localize
            Undo.Push(new UndoTourSlidelistChange(Language.GetLocalizedText(426, "Add New Slide"), tour));

            Cursor.Current = Cursors.WaitCursor;
            var placeName = "Current Screen";
            var newPlace = new TourPlace(placeName, Earth3d.MainWindow.viewCamera, Classification.Unidentified, Earth3d.MainWindow.Constellation, Earth3d.MainWindow.CurrentImageSet.DataSetType, Earth3d.MainWindow.SolarSystemTrack);
            newPlace.ThumbNail = null;
            newPlace.StudyImageset = Earth3d.MainWindow.StudyImageset;
            newPlace.BackgroundImageSet = Earth3d.MainWindow.CurrentImageSet.StockImageSet;

            var newTourStop = new TourStop(newPlace);

            if (insert)
            {
                tour.InsertTourStop(newTourStop);
            }
            else
            {
                tour.AddTourStop(newTourStop);
            }

            if (tour.CurrentTourStop != null)
            {
                MusicTrack.Target = tour.CurrentTourStop;
                VoiceTrack.Target = tour.CurrentTourStop;
            }
            else
            {
                MusicTrack.Target = null;
                VoiceTrack.Target = null;

            }
            tour.CurrentTourStop.Layers = LayerManager.GetVisibleLayerList(tour.CurrentTourStop.Layers);

            newTourStop.Thumbnail = newPlace.ThumbNail = Earth3d.MainWindow.GetScreenThumbnail();

            tourStopList.SelectedItem = tourStopList.FindItem(newTourStop);
            tourStopList.Refresh();
            TourEditorUI.ClearSelection();
            Cursor.Current = Cursors.Default;
            TimeLine.RefreshUi();
        }
        public void ShowSlideStartPosition(TourStop ts)
        {
            tour.CurrentTourStop = ts;
            //tourText.Text = tour.CurrentTourStop.Description;
            if (ts != null)
            {
                MusicTrack.Target = tour.CurrentTourStop;
                VoiceTrack.Target = tour.CurrentTourStop;
            }
            else
            {
                MusicTrack.Target = null;
                VoiceTrack.Target = null;

            }
            TourEditorUI.ClearSelection();
            if (tour.CurrentTourStop != null)
            {
                tour.CurrentTourStop.SyncSettings();
                SpaceTimeController.Now = tour.CurrentTourStop.StartTime;
                SpaceTimeController.SyncToClock = false;
                Earth3d.MainWindow.GotoTarget(ts.Target, false, true, false);
                tour.CurrentTourStop.TweenPosition = 0f;
                tour.CurrentTourStop.UpdateLayerOpacity();
                LayerManager.SetVisibleLayerList(tour.CurrentTourStop.Layers);

            }
        }
Beispiel #16
0
        public static string GetXmlText(TourStop ts)
        {
            StringBuilder sb = new StringBuilder();
            using (System.IO.StringWriter textWriter = new System.IO.StringWriter(sb))
            {
                using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(textWriter))
                {
                    writer.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");

                    ts.SaveToXml(writer, true);
                }
            }
            return sb.ToString();
        }
        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());
                    }
                }
            }
        }
Beispiel #18
0
 public void RemoveTourStop(TourStop ts)
 {
     tourStops.Remove(ts);
     if (currentTourstopIndex > tourStops.Count - 1)
     {
         currentTourstopIndex--;
     }
     TourDirty = true;
 }
        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;
            }
        }
Beispiel #20
0
        public void AddTourStop(TourStop ts)
        {
            ts.Owner = this;

            TourStops.Add(ts);
            currentTourstopIndex = tourStops.Count - 1;
            TourDirty = true;
        }
 public int FindItem(TourStop ts)
 {
     for (int i = 0; i < Items.Count; i++)
     {
         if (Items[i] == ts)
         {
             return i;
         }
     }
     return -1;
 }
Beispiel #22
0
        public double ElapsedTimeSinceLastMaster(int index, out TourStop masterOut)
        {
            masterOut = null;
            if (index == 0 && index >= tourStops.Count)
            {
                return 0;
            }
            var totalTime = 0.0;
            for (var i = 0; i < index; i++)
            {
                if (tourStops[i].MasterSlide)
                {
                    totalTime = 0;
                    masterOut = tourStops[i];
                }

                totalTime += tourStops[i].Duration.TotalMilliseconds / 1000;
                if (i > 0 && !tourStops[i].MasterSlide)
                {
                    switch (tourStops[i].Transition)
                    {
                        case TransitionType.Slew:
                            var 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)))
                            {
                                var 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;
        }
 public ShapeOverlay( TourStop owner, ShapeType shapeType)
 {
     ShapeType = shapeType;
     this.Owner = owner;
     this.Name = owner.GetNextDefaultName(shapeType.ToString());
 }
Beispiel #24
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;
 }
        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;
        }
 void tourStopList_ItemClicked(object sender, TourStop e)
 {
     id = e.Id;
     LinkToSlideCheckbox.Checked = true;
     LinkToNextCheckbox.Checked = false;
     ReturnToCallerCheckbox.Checked = false;
 }
        public FlipbookOverlay( TourStop owner, Image image)
        {
            this.Owner = owner;
            // 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;
        }
Beispiel #28
0
        internal static TourStop FromXml(TourDocument owner, System.Xml.XmlNode tourStop)
        {
            TourStop newTourStop = new TourStop();
            newTourStop.owner = owner;

            newTourStop.Id = tourStop.Attributes["Id"].Value.ToString();
            newTourStop.Name = tourStop.Attributes["Name"].Value.ToString();
            newTourStop.Description = tourStop.Attributes["Description"].Value.ToString();
            newTourStop.thumbnailString = tourStop.Attributes["Thumbnail"].Value.ToString();
            newTourStop.duration = TimeSpan.Parse(tourStop.Attributes["Duration"].Value.ToString());
            if (tourStop.Attributes["Master"] != null)
            {
                newTourStop.masterSlide = Convert.ToBoolean(tourStop.Attributes["Master"].Value);
            }

            if (tourStop.Attributes["NextSlide"] != null)
            {
                newTourStop.nextSlide = tourStop.Attributes["NextSlide"].Value;
            }

            if (tourStop.Attributes["InterpolationType"] != null)
            {
                newTourStop.interpolationType = (InterpolationType)Enum.Parse(typeof(InterpolationType), tourStop.Attributes["InterpolationType"].Value);
            }

            newTourStop.fadeInOverlays = true;

            if (tourStop.Attributes["FadeInOverlays"] != null)
            {
                newTourStop.fadeInOverlays = Convert.ToBoolean(tourStop.Attributes["FadeInOverlays"].Value);
            }

            if (tourStop.Attributes["TransitionType"] != null)
            {
                newTourStop.transition = (TransitionType)Enum.Parse(typeof(TransitionType), tourStop.Attributes["TransitionType"].Value);
            }

            if (tourStop.Attributes["TransitionOutTime"] != null)
            {
                newTourStop.TransitionOutTime = double.Parse(tourStop.Attributes["TransitionOutTime"].Value);
            }

            if (tourStop.Attributes["TransitionHoldTime"] != null)
            {
                newTourStop.TransitionHoldTime = double.Parse(tourStop.Attributes["TransitionHoldTime"].Value);
            }

            if (tourStop.Attributes["TransitionTime"] != null)
            {
                newTourStop.TransitionTime = double.Parse(tourStop.Attributes["TransitionTime"].Value);
            }

            if (tourStop.Attributes["HasLocation"] != null)
            {
                newTourStop.hasLocation = Convert.ToBoolean(tourStop.Attributes["HasLocation"].Value);
            }

            if (newTourStop.hasLocation)
            {
                if (tourStop.Attributes["LocationAltitude"] != null)
                {
                    newTourStop.locationAltitude = Convert.ToDouble(tourStop.Attributes["LocationAltitude"].Value);
                }
                if (tourStop.Attributes["LocationLat"] != null)
                {
                    newTourStop.locationLat = Convert.ToDouble(tourStop.Attributes["LocationLat"].Value);
                }
                if (tourStop.Attributes["LocationLng"] != null)
                {
                    newTourStop.locationLng = Convert.ToDouble(tourStop.Attributes["LocationLng"].Value);
                }
            }

            if (tourStop.Attributes["HasTime"] != null)
            {
                newTourStop.hasTime = Convert.ToBoolean(tourStop.Attributes["HasTime"].Value);

                if (newTourStop.hasTime)
                {
                    if (tourStop.Attributes["StartTime"] != null)
                    {
                        newTourStop.startTime = DateTime.Parse(tourStop.Attributes["StartTime"].Value);
                    }
                    if (tourStop.Attributes["EndTime"] != null)
                    {
                        newTourStop.endTime = DateTime.Parse(tourStop.Attributes["EndTime"].Value);
                    }
                }
            }

            if (tourStop.Attributes["ActualPlanetScale"] != null)
            {
                newTourStop.actualPlanetScale = Convert.ToBoolean(tourStop.Attributes["ActualPlanetScale"].Value);
            }

            if (tourStop.Attributes["ShowClouds"] != null)
            {
                newTourStop.showClouds = Convert.ToBoolean(tourStop.Attributes["ShowClouds"].Value);
            }

            if (tourStop.Attributes["EarthCutawayView"] != null)
            {
                newTourStop.earthCutawayView = Convert.ToBoolean(tourStop.Attributes["EarthCutawayView"].Value);
            }

            if (tourStop.Attributes["ShowConstellationBoundries"] != null)
            {
                newTourStop.showConstellationBoundries = Convert.ToBoolean(tourStop.Attributes["ShowConstellationBoundries"].Value);
            }

            if (tourStop.Attributes["ShowConstellationFigures"] != null)
            {
                newTourStop.showConstellationFigures = Convert.ToBoolean(tourStop.Attributes["ShowConstellationFigures"].Value);
            }

            if (tourStop.Attributes["ShowConstellationSelection"] != null)
            {
                newTourStop.showConstellationSelection = Convert.ToBoolean(tourStop.Attributes["ShowConstellationSelection"].Value);
            }

            if (tourStop.Attributes["ShowEcliptic"] != null)
            {
                newTourStop.showEcliptic = Convert.ToBoolean(tourStop.Attributes["ShowEcliptic"].Value);
            }

            if (tourStop.Attributes["ShowElevationModel"] != null)
            {
                newTourStop.showElevationModel = Convert.ToBoolean(tourStop.Attributes["ShowElevationModel"].Value);
            }

            if (tourStop.Attributes["ShowFieldOfView"] != null)
            {
                newTourStop.showFieldOfView = Convert.ToBoolean(tourStop.Attributes["ShowFieldOfView"].Value);
            }

            if (tourStop.Attributes["ShowGrid"] != null)
            {
                newTourStop.showGrid = Convert.ToBoolean(tourStop.Attributes["ShowGrid"].Value);
            }

            if (tourStop.Attributes["ShowHorizon"] != null)
            {
                newTourStop.showHorizon = Convert.ToBoolean(tourStop.Attributes["ShowHorizon"].Value);
            }

            if (tourStop.Attributes["ShowHorizonPanorama"] != null)
            {
                newTourStop.showHorizonPanorama = Convert.ToBoolean(tourStop.Attributes["ShowHorizonPanorama"].Value);
            }

            if (tourStop.Attributes["ShowMoonsAsPointSource"] != null)
            {
                newTourStop.showMoonsAsPointSource = Convert.ToBoolean(tourStop.Attributes["ShowMoonsAsPointSource"].Value);
            }

            if (tourStop.Attributes["ShowSolarSystem"] != null)
            {
                newTourStop.showSolarSystem = Convert.ToBoolean(tourStop.Attributes["ShowSolarSystem"].Value);
            }

            if (tourStop.Attributes["FovTelescope"] != null)
            {
                newTourStop.fovTelescope = Convert.ToInt32(tourStop.Attributes["FovTelescope"].Value);
            }

            if (tourStop.Attributes["FovEyepiece"] != null)
            {
                newTourStop.fovEyepiece = Convert.ToInt32(tourStop.Attributes["FovEyepiece"].Value);
            }

            if (tourStop.Attributes["FovCamera"] != null)
            {
                newTourStop.fovCamera = Convert.ToInt32(tourStop.Attributes["FovCamera"].Value);
            }

            if (tourStop.Attributes["LocalHorizonMode"] != null)
            {
                newTourStop.localHorizonMode = Convert.ToBoolean(tourStop.Attributes["LocalHorizonMode"].Value);
            }

            if (tourStop.Attributes["GalacticMode"] != null)
            {
                newTourStop.galacticMode = Convert.ToBoolean(tourStop.Attributes["GalacticMode"].Value);
            }
            else
            {
                newTourStop.galacticMode = false;
            }

            //if (tourStop.Attributes["MilkyWayModel"] != null)
            //{
            //    newTourStop.milkyWayModel = Convert.ToBoolean(tourStop.Attributes["MilkyWayModel"].Value);
            //}
            //else
            //{
            //    newTourStop.milkyWayModel = true;
            //}

            if (tourStop.Attributes["SolarSystemStars"] != null)
            {
                newTourStop.solarSystemStars = Convert.ToBoolean(tourStop.Attributes["SolarSystemStars"].Value);
            }

            if (tourStop.Attributes["SolarSystemMilkyWay"] != null)
            {
                newTourStop.solarSystemMilkyWay = Convert.ToBoolean(tourStop.Attributes["SolarSystemMilkyWay"].Value);
            }

            if (tourStop.Attributes["SolarSystemCosmos"] != null)
            {
                newTourStop.solarSystemCosmos = Convert.ToBoolean(tourStop.Attributes["SolarSystemCosmos"].Value);
            }

            if (tourStop.Attributes["SolarSystemCMB"] != null)
            {
                newTourStop.solarSystemCMB = Convert.ToBoolean(tourStop.Attributes["SolarSystemCMB"].Value);
            }

            if (tourStop.Attributes["SolarSystemOrbits"] != null)
            {
                newTourStop.solarSystemOrbits = Convert.ToBoolean(tourStop.Attributes["SolarSystemOrbits"].Value);
            }

            if (tourStop.Attributes["SolarSystemMinorOrbits"] != null)
            {
                newTourStop.solarSystemMinorOrbits = Convert.ToBoolean(tourStop.Attributes["SolarSystemMinorOrbits"].Value);
            }
            else
            {
                newTourStop.solarSystemMinorOrbits = false;
            }

            if (tourStop.Attributes["SolarSystemMinorPlanets"] != null)
            {
                newTourStop.solarSystemMinorPlanets = Convert.ToBoolean(tourStop.Attributes["SolarSystemMinorPlanets"].Value);
            }
            else
            {
                newTourStop.solarSystemMinorPlanets = false;
            }

            if (tourStop.Attributes["SolarSystemPlanets"] != null)
            {
                newTourStop.solarSystemPlanets = Convert.ToBoolean(tourStop.Attributes["SolarSystemPlanets"].Value);
            }
            else
            {
                newTourStop.solarSystemPlanets = true;
            }

            if (tourStop.Attributes["SolarSystemOverlays"] != null)
            {
                newTourStop.solarSystemOverlays = Convert.ToBoolean(tourStop.Attributes["SolarSystemOverlays"].Value);
            }

            if (tourStop.Attributes["SolarSystemLighting"] != null)
            {
                newTourStop.solarSystemLighting = Convert.ToBoolean(tourStop.Attributes["SolarSystemLighting"].Value);
            }

            if (tourStop.Attributes["ShowISSModel"] != null)
            {
                newTourStop.showISSModel = Convert.ToBoolean(tourStop.Attributes["ShowISSModel"].Value);
            }

            if (tourStop.Attributes["SolarSystemScale"] != null)
            {
                newTourStop.solarSystemScale = Convert.ToInt32(tourStop.Attributes["SolarSystemScale"].Value);
            }

            if (tourStop.Attributes["MinorPlanetsFilter"] != null)
            {
                newTourStop.minorPlanetsFilter = Convert.ToInt32(tourStop.Attributes["MinorPlanetsFilter"].Value);
            }
            else
            {
                newTourStop.minorPlanetsFilter = int.MaxValue;
            }

            if (tourStop.Attributes["PlanetOrbitsFilter"] != null)
            {
                newTourStop.planetOrbitsFilter = Convert.ToInt32(tourStop.Attributes["PlanetOrbitsFilter"].Value);
            }
            else
            {
                newTourStop.planetOrbitsFilter = int.MaxValue;
            }

            if (tourStop.Attributes["SolarSystemMultiRes"] != null)
            {
                newTourStop.solarSystemMultiRes = Convert.ToBoolean(tourStop.Attributes["SolarSystemMultiRes"].Value);
            }

            if (tourStop.Attributes["ShowEarthSky"] != null)
            {
                newTourStop.showEarthSky = Convert.ToBoolean(tourStop.Attributes["ShowEarthSky"].Value);
            }

            if (tourStop.Attributes["ShowEquatorialGridText"] != null)
            {
                newTourStop.showEquatorialGridText = Convert.ToBoolean(tourStop.Attributes["ShowEquatorialGridText"].Value);
            }
            else
            {
                newTourStop.showEquatorialGridText = false;
            }

            if (tourStop.Attributes["ShowGalacticGrid"] != null)
            {
                newTourStop.showGalacticGrid = Convert.ToBoolean(tourStop.Attributes["ShowGalacticGrid"].Value);
            }
            else
            {
                newTourStop.showGalacticGrid = false;
            }

            if (tourStop.Attributes["ShowGalacticGridText"] != null)
            {
                newTourStop.showGalacticGridText = Convert.ToBoolean(tourStop.Attributes["ShowGalacticGridText"].Value);
            }
            else
            {
                newTourStop.showGalacticGridText = false;
            }

            if (tourStop.Attributes["ShowEclipticGrid"] != null)
            {
                newTourStop.showEclipticGrid = Convert.ToBoolean(tourStop.Attributes["ShowEclipticGrid"].Value);
            }
            else
            {
                newTourStop.showEclipticGrid = false;
            }

            if (tourStop.Attributes["ShowEclipticGridText"] != null)
            {
                newTourStop.showEclipticGridText = Convert.ToBoolean(tourStop.Attributes["ShowEclipticGridText"].Value);
            }
            else
            {
                newTourStop.showEclipticGridText = false;
            }

            if (tourStop.Attributes["ShowEclipticOverviewText"] != null)
            {
                newTourStop.showEclipticOverviewText = Convert.ToBoolean(tourStop.Attributes["ShowEclipticOverviewText"].Value);
            }
            else
            {
                newTourStop.showEclipticOverviewText = false;
            }

            if (tourStop.Attributes["ShowAltAzGrid"] != null)
            {
                newTourStop.showAltAzGrid = Convert.ToBoolean(tourStop.Attributes["ShowAltAzGrid"].Value);
            }
            else
            {
                newTourStop.showAltAzGrid = false;
            }

            if (tourStop.Attributes["ShowAltAzGridText"] != null)
            {
                newTourStop.showAltAzGridText = Convert.ToBoolean(tourStop.Attributes["ShowAltAzGridText"].Value);
            }
            else
            {
                newTourStop.showAltAzGridText = false;
            }

            if (tourStop.Attributes["ShowPrecessionChart"] != null)
            {
                newTourStop.showPrecessionChart = Convert.ToBoolean(tourStop.Attributes["ShowPrecessionChart"].Value);
            }
            else
            {
                newTourStop.showPrecessionChart = false;
            }

            if (tourStop.Attributes["ConstellationPictures"] != null)
            {
                newTourStop.showConstellationPictures = Convert.ToBoolean(tourStop.Attributes["ConstellationPictures"].Value);
            }
            else
            {
                newTourStop.showConstellationPictures = false;
            }

            if (tourStop.Attributes["ShowConstellationLabels"] != null)
            {
                newTourStop.showConstellationLabels = Convert.ToBoolean(tourStop.Attributes["ShowConstellationLabels"].Value);
            }
            else
            {
                newTourStop.showConstellationLabels = false;
            }

            if (tourStop.Attributes["ConstellationsEnabled"] != null)
            {
                newTourStop.constellationsEnabled = tourStop.Attributes["ConstellationsEnabled"].Value;
            }
            else
            {
                newTourStop.constellationsEnabled = "";
            }

            if (tourStop.Attributes["ShowSkyOverlays"] != null)
            {
                newTourStop.showSkyOverlays = Convert.ToBoolean(tourStop.Attributes["ShowSkyOverlays"].Value);
            }
            else
            {
                newTourStop.showSkyOverlays = true;
            }

            if (tourStop.Attributes["ShowConstellations"] != null)
            {
                newTourStop.showConstellations = Convert.ToBoolean(tourStop.Attributes["ShowConstellations"].Value);
            }
            else
            {
                newTourStop.showConstellations = true;
            }

            if (tourStop.Attributes["ShowSkyNode"] != null)
            {
                newTourStop.showSkyNode = Convert.ToBoolean(tourStop.Attributes["ShowSkyNode"].Value);
            }
            else
            {
                newTourStop.showSkyNode = true;
            }

            if (tourStop.Attributes["ShowSkyGrids"] != null)
            {
                newTourStop.showSkyGrids = Convert.ToBoolean(tourStop.Attributes["ShowSkyGrids"].Value);
            }
            else
            {
                newTourStop.showSkyGrids = true;
            }

            if (tourStop.Attributes["SkyOverlaysIn3d"] != null)
            {
                newTourStop.skyOverlaysIn3d = Convert.ToBoolean(tourStop.Attributes["SkyOverlaysIn3d"].Value);
            }
            else
            {
                newTourStop.skyOverlaysIn3d = false;
            }

            if (tourStop.Attributes["ConstellationFiguresFilter"] != null)
            {
                newTourStop.constellationFiguresFilter = ConstellationFilter.Parse(tourStop.Attributes["ConstellationFiguresFilter"].Value);
            }
            else
            {
                newTourStop.constellationFiguresFilter = ConstellationFilter.AllConstellation;
            }

            if (tourStop.Attributes["ConstellationBoundariesFilter"] != null)
            {
                newTourStop.constellationBoundariesFilter = ConstellationFilter.Parse(tourStop.Attributes["ConstellationBoundariesFilter"].Value);
            }
            else
            {
                newTourStop.constellationBoundariesFilter = ConstellationFilter.AllConstellation;
            }

            if (tourStop.Attributes["ConstellationNamesFilter"] != null)
            {
                newTourStop.constellationNamesFilter = ConstellationFilter.Parse(tourStop.Attributes["ConstellationNamesFilter"].Value);
            }
            else
            {
                newTourStop.constellationNamesFilter = ConstellationFilter.AllConstellation;
            }

            if (tourStop.Attributes["ConstellationArtFilter"] != null)
            {
                newTourStop.constellationArtFilter = ConstellationFilter.Parse(tourStop.Attributes["ConstellationArtFilter"].Value);
            }
            else
            {
                newTourStop.constellationArtFilter = ConstellationFilter.AllConstellation;
            }

            XmlNode place = tourStop["Place"];

            newTourStop.target = TourPlace.FromXml(place);

            XmlNode endTarget = tourStop["EndTarget"];
            if (endTarget != null)
            {
                newTourStop.endTarget = TourPlace.FromXml(endTarget);
            }

            XmlNode overlays = tourStop["Overlays"];

            foreach (XmlNode overlay in overlays)
            {
                newTourStop.AddOverlay(Overlay.FromXml(newTourStop, overlay));
            }

            XmlNode musicNode = tourStop["MusicTrack"];

            if (musicNode != null)
            {
                newTourStop.musicTrack = (AudioOverlay)Overlay.FromXml(newTourStop, musicNode.FirstChild);
            }

            XmlNode voiceNode = tourStop["VoiceTrack"];

            if (voiceNode != null)
            {
                newTourStop.voiceTrack = (AudioOverlay)Overlay.FromXml(newTourStop, voiceNode.FirstChild);
            }
            XmlNode layerNode = tourStop["VisibleLayers"];
            if (layerNode != null)
            {
                newTourStop.LoadLayerList(layerNode);
            }

            XmlNode animationTargetsNode = tourStop["AnimationTargets"];
            if (animationTargetsNode != null)
            {
                newTourStop.LoadAnimationTargets(animationTargetsNode);
            }

            newTourStop.thumbnail = UiTools.LoadBitmap(string.Format("{0}{1}.thumb.png", newTourStop.owner.WorkingDirectory, newTourStop.id));

            return newTourStop;
        }
        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;
        }
 private void tourStopList_ShowEndPosition(object sender, TourStop e)
 {
     showEndSkyPosition_Click(this, new EventArgs());
 }