예제 #1
0
 public void RemoveTourStop(TourStop ts)
 {
     tourStops.Remove(ts);
     if (currentTourstopIndex > tourStops.Count - 1)
     {
         currentTourstopIndex--;
     }
     TourDirty = true;
 }
예제 #2
0
        internal static TourStop FromXml(TourDocument owner, XmlNode tourStop)
        {
            TourStop newTourStop = new TourStop();
            newTourStop.owner = owner;

            newTourStop.Id = tourStop.Attributes.GetNamedItem("Id").Value.ToString();
            newTourStop.Name = tourStop.Attributes.GetNamedItem("Name").Value.ToString();
            newTourStop.Description = tourStop.Attributes.GetNamedItem("Description").Value.ToString();
            newTourStop.thumbnailString = tourStop.Attributes.GetNamedItem("Thumbnail").Value.ToString();
            newTourStop.duration = Util.ParseTimeSpan(tourStop.Attributes.GetNamedItem("Duration").Value.ToString());

            if (tourStop.Attributes.GetNamedItem("Master") != null)
            {
                newTourStop.masterSlide = bool.Parse(tourStop.Attributes.GetNamedItem("Master").Value);
            }

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

            if (tourStop.Attributes.GetNamedItem("InterpolationType") != null)
            {
                switch (tourStop.Attributes.GetNamedItem("InterpolationType").Value)
                {
                    case "Linear":
                        newTourStop.InterpolationType = InterpolationType.Linear;
                        break;
                    case "EaseIn":
                        newTourStop.InterpolationType = InterpolationType.EaseIn;
                        break;
                    case "EaseOut":
                        newTourStop.InterpolationType = InterpolationType.EaseOut;
                        break;
                    case "EaseInOut":
                        newTourStop.InterpolationType = InterpolationType.EaseInOut;
                        break;
                    case "Exponential":
                        newTourStop.InterpolationType = InterpolationType.Exponential;
                        break;
                    case "Default":
                        newTourStop.InterpolationType = InterpolationType.DefaultV;
                        break;
                    default:
                        newTourStop.InterpolationType = InterpolationType.Linear;
                        break;
                }
            }

            newTourStop.fadeInOverlays = true;

            if (tourStop.Attributes.GetNamedItem("FadeInOverlays") != null)
            {
                newTourStop.fadeInOverlays = bool.Parse(tourStop.Attributes.GetNamedItem("FadeInOverlays").Value);
            }

            if (tourStop.Attributes.GetNamedItem("Transition") != null)
            {
                //newTourStop.transition = (TransitionType)Enum.Parse(typeof(TransitionType), tourStop.Attributes.GetNamedItem("Transition").Value, true);

                switch (tourStop.Attributes.GetNamedItem("Transition").Value)
                {
                    case "Slew":
                        newTourStop.transition = TransitionType.Slew;
                        break;
                    case "Instant":

                        newTourStop.transition = TransitionType.Instant;
                        break;
                    case "CrossFade":

                        newTourStop.transition = TransitionType.CrossFade;
                        break;
                    case "FadeToBlack":
                        newTourStop.transition = TransitionType.FadeToBlack;
                        break;
                    default:
                        break;
                }
            }

            if (tourStop.Attributes.GetNamedItem("HasLocation") != null)
            {
                newTourStop.hasLocation = bool.Parse(tourStop.Attributes.GetNamedItem("HasLocation").Value);
            }

            if (newTourStop.hasLocation)
            {
                if (tourStop.Attributes.GetNamedItem("LocationAltitude") != null)
                {
                    newTourStop.locationAltitude = double.Parse(tourStop.Attributes.GetNamedItem("LocationAltitude").Value);
                }
                if (tourStop.Attributes.GetNamedItem("LocationLat") != null)
                {
                    newTourStop.locationLat = double.Parse(tourStop.Attributes.GetNamedItem("LocationLat").Value);
                }
                if (tourStop.Attributes.GetNamedItem("LocationLng") != null)
                {
                    newTourStop.locationLng = double.Parse(tourStop.Attributes.GetNamedItem("LocationLng").Value);
                }
            }

            if (tourStop.Attributes.GetNamedItem("HasTime") != null)
            {
                newTourStop.hasTime = bool.Parse(tourStop.Attributes.GetNamedItem("HasTime").Value);

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

            if (tourStop.Attributes.GetNamedItem("ActualPlanetScale") != null)
            {
                newTourStop.actualPlanetScale = bool.Parse(tourStop.Attributes.GetNamedItem("ActualPlanetScale").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowClouds") != null)
            {
                newTourStop.showClouds = bool.Parse(tourStop.Attributes.GetNamedItem("ShowClouds").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowConstellationBoundries") != null)
            {
                newTourStop.showConstellationBoundries = bool.Parse(tourStop.Attributes.GetNamedItem("ShowConstellationBoundries").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowConstellationFigures") != null)
            {
                newTourStop.showConstellationFigures = bool.Parse(tourStop.Attributes.GetNamedItem("ShowConstellationFigures").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowConstellationSelection") != null)
            {
                newTourStop.showConstellationSelection = bool.Parse(tourStop.Attributes.GetNamedItem("ShowConstellationSelection").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowEcliptic") != null)
            {
                newTourStop.showEcliptic = bool.Parse(tourStop.Attributes.GetNamedItem("ShowEcliptic").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowElevationModel") != null)
            {
                newTourStop.showElevationModel = bool.Parse(tourStop.Attributes.GetNamedItem("ShowElevationModel").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowFieldOfView") != null)
            {
                newTourStop.showFieldOfView = bool.Parse(tourStop.Attributes.GetNamedItem("ShowFieldOfView").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowGrid") != null)
            {
                newTourStop.showGrid = bool.Parse(tourStop.Attributes.GetNamedItem("ShowGrid").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowHorizon") != null)
            {
                newTourStop.showHorizon = bool.Parse(tourStop.Attributes.GetNamedItem("ShowHorizon").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowHorizonPanorama") != null)
            {
                newTourStop.showHorizonPanorama = bool.Parse(tourStop.Attributes.GetNamedItem("ShowHorizonPanorama").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowMoonsAsPointSource") != null)
            {
                newTourStop.showMoonsAsPointSource = bool.Parse(tourStop.Attributes.GetNamedItem("ShowMoonsAsPointSource").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowSolarSystem") != null)
            {
                newTourStop.showSolarSystem = bool.Parse(tourStop.Attributes.GetNamedItem("ShowSolarSystem").Value);
            }

            if (tourStop.Attributes.GetNamedItem("FovTelescope") != null)
            {
                newTourStop.fovTelescope = int.Parse(tourStop.Attributes.GetNamedItem("FovTelescope").Value);
            }

            if (tourStop.Attributes.GetNamedItem("FovEyepiece") != null)
            {
                newTourStop.fovEyepiece = int.Parse(tourStop.Attributes.GetNamedItem("FovEyepiece").Value);
            }

            if (tourStop.Attributes.GetNamedItem("FovCamera") != null)
            {
                newTourStop.fovCamera = int.Parse(tourStop.Attributes.GetNamedItem("FovCamera").Value);
            }

            if (tourStop.Attributes.GetNamedItem("LocalHorizonMode") != null)
            {
                newTourStop.localHorizonMode = bool.Parse(tourStop.Attributes.GetNamedItem("LocalHorizonMode").Value);
            }

            if (tourStop.Attributes.GetNamedItem("GalacticMode") != null)
            {
                newTourStop.galacticMode = bool.Parse(tourStop.Attributes.GetNamedItem("GalacticMode").Value);
            }

            if (tourStop.Attributes.GetNamedItem("SolarSystemStars") != null)
            {
                newTourStop.solarSystemStars = bool.Parse(tourStop.Attributes.GetNamedItem("SolarSystemStars").Value);
            }

            if (tourStop.Attributes.GetNamedItem("SolarSystemMilkyWay") != null)
            {
                newTourStop.solarSystemMilkyWay = bool.Parse(tourStop.Attributes.GetNamedItem("SolarSystemMilkyWay").Value);
            }

            if (tourStop.Attributes.GetNamedItem("SolarSystemCosmos") != null)
            {
                newTourStop.solarSystemCosmos = bool.Parse(tourStop.Attributes.GetNamedItem("SolarSystemCosmos").Value);
            }

            if (tourStop.Attributes.GetNamedItem("SolarSystemOrbits") != null)
            {
                newTourStop.solarSystemOrbits = bool.Parse(tourStop.Attributes.GetNamedItem("SolarSystemOrbits").Value);
            }

            if (tourStop.Attributes.GetNamedItem("SolarSystemOverlays") != null)
            {
                newTourStop.solarSystemOverlays = bool.Parse(tourStop.Attributes.GetNamedItem("SolarSystemOverlays").Value);
            }

            if (tourStop.Attributes.GetNamedItem("SolarSystemLighting") != null)
            {
                newTourStop.solarSystemLighting = bool.Parse(tourStop.Attributes.GetNamedItem("SolarSystemLighting").Value);
            }

            if (tourStop.Attributes.GetNamedItem("SolarSystemScale") != null)
            {
                newTourStop.solarSystemScale = int.Parse(tourStop.Attributes.GetNamedItem("SolarSystemScale").Value);
            }

            if (tourStop.Attributes.GetNamedItem("SolarSystemMultiRes") != null)
            {
                newTourStop.solarSystemMultiRes = bool.Parse(tourStop.Attributes.GetNamedItem("SolarSystemMultiRes").Value);
            }

            //new
            if (tourStop.Attributes.GetNamedItem("ShowEquatorialGridText") != null)
            {
                newTourStop.showEquatorialGridText = bool.Parse(tourStop.Attributes.GetNamedItem("ShowEquatorialGridText").Value);
            }
            if (tourStop.Attributes.GetNamedItem("ShowGalacticGrid") != null)
            {
                newTourStop.showGalacticGrid = bool.Parse(tourStop.Attributes.GetNamedItem("ShowGalacticGrid").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowGalacticGridText") != null)
            {
                newTourStop.showGalacticGridText = bool.Parse(tourStop.Attributes.GetNamedItem("ShowGalacticGridText").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowEclipticGrid") != null)
            {
                newTourStop.showEclipticGrid = bool.Parse(tourStop.Attributes.GetNamedItem("ShowEclipticGrid").Value);
            }
            if (tourStop.Attributes.GetNamedItem("ShowEclipticGridText") != null)
            {
                newTourStop.showEclipticGridText = bool.Parse(tourStop.Attributes.GetNamedItem("ShowEclipticGridText").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowEclipticOverviewText") != null)
            {
                newTourStop.showEclipticOverviewText = bool.Parse(tourStop.Attributes.GetNamedItem("ShowEclipticOverviewText").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowAltAzGrid") != null)
            {
                newTourStop.showAltAzGrid = bool.Parse(tourStop.Attributes.GetNamedItem("ShowAltAzGrid").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowAltAzGridText") != null)
            {
                newTourStop.showAltAzGridText = bool.Parse(tourStop.Attributes.GetNamedItem("ShowAltAzGridText").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowPrecessionChart") != null)
            {
                newTourStop.showPrecessionChart = bool.Parse(tourStop.Attributes.GetNamedItem("ShowPrecessionChart").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowConstellationPictures") != null)
            {
                newTourStop.showConstellationPictures = bool.Parse(tourStop.Attributes.GetNamedItem("ShowConstellationPictures").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowConstellationLabels") != null)
            {
                newTourStop.showConstellationLabels = bool.Parse(tourStop.Attributes.GetNamedItem("ShowConstellationLabels").Value);
            }

            if (tourStop.Attributes.GetNamedItem("SolarSystemCMB") != null)
            {
                newTourStop.solarSystemCMB = bool.Parse(tourStop.Attributes.GetNamedItem("SolarSystemCMB").Value);
            }

            if (tourStop.Attributes.GetNamedItem("SolarSystemMinorPlanets") != null)
            {
                newTourStop.solarSystemMinorPlanets = bool.Parse(tourStop.Attributes.GetNamedItem("SolarSystemMinorPlanets").Value);
            }

            if (tourStop.Attributes.GetNamedItem("SolarSystemPlanets") != null)
            {
                newTourStop.solarSystemPlanets = bool.Parse(tourStop.Attributes.GetNamedItem("SolarSystemPlanets").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowEarthSky") != null)
            {
                newTourStop.showEarthSky = bool.Parse(tourStop.Attributes.GetNamedItem("ShowEarthSky").Value);
            }

            if (tourStop.Attributes.GetNamedItem("SolarSystemMinorOrbits") != null)
            {
                newTourStop.solarSystemMinorOrbits = bool.Parse(tourStop.Attributes.GetNamedItem("SolarSystemMinorOrbits").Value);
            }

            if (tourStop.Attributes.GetNamedItem("ShowSkyOverlays") != null)
            {
                newTourStop.showSkyOverlays = bool.Parse(tourStop.Attributes.GetNamedItem("ShowSkyOverlays").Value);
            }
            else
            {
                newTourStop.showSkyOverlays = true;
            }

            if (tourStop.Attributes.GetNamedItem("ShowConstellations") != null)
            {
                newTourStop.showConstellations = bool.Parse(tourStop.Attributes.GetNamedItem("ShowConstellations").Value);
            }
            else
            {
                newTourStop.showConstellations = true;
            }

            if (tourStop.Attributes.GetNamedItem("ShowSkyNode") != null)
            {
                newTourStop.showSkyNode = bool.Parse(tourStop.Attributes.GetNamedItem("ShowSkyNode").Value);
            }
            else
            {
                newTourStop.showSkyNode = true;
            }

            if (tourStop.Attributes.GetNamedItem("ShowSkyGrids") != null)
            {
                newTourStop.showSkyGrids = bool.Parse(tourStop.Attributes.GetNamedItem("ShowSkyGrids").Value);
            }
            else
            {
                newTourStop.showSkyGrids = true;
            }

            if (tourStop.Attributes.GetNamedItem("ShowSkyOverlaysIn3d") != null)
            {
                newTourStop.showSkyOverlaysIn3d = bool.Parse(tourStop.Attributes.GetNamedItem("ShowSkyOverlaysIn3d").Value);
            }

            if (tourStop.Attributes.GetNamedItem("EarthCutawayView") != null)
            {
                newTourStop.earthCutawayView = bool.Parse(tourStop.Attributes.GetNamedItem("EarthCutawayView").Value);
            }
            if (tourStop.Attributes.GetNamedItem("ShowISSModel") != null)
            {
                newTourStop.showISSModel = bool.Parse(tourStop.Attributes.GetNamedItem("ShowISSModel").Value);
            }

            if (tourStop.Attributes.GetNamedItem("MilkyWayModel") != null)
            {
                newTourStop.milkyWayModel = bool.Parse(tourStop.Attributes.GetNamedItem("MilkyWayModel").Value);
            }

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

            if (tourStop.Attributes.GetNamedItem("ConstellationBoundariesFilter") != null)
            {
                newTourStop.constellationFiguresFilter = ConstellationFilter.Parse(tourStop.Attributes.GetNamedItem("ConstellationBoundariesFilter").Value);
            }
            else
            {
                newTourStop.constellationFiguresFilter = new ConstellationFilter();
            }

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

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

            if (tourStop.Attributes.GetNamedItem("MinorPlanetsFilter") != null)
            {
                newTourStop.minorPlanetsFilter = int.Parse(tourStop.Attributes.GetNamedItem("MinorPlanetsFilter").Value);
            }
            if (tourStop.Attributes.GetNamedItem("PlanetOrbitsFilter") != null)
            {
                newTourStop.planetOrbitsFilter = int.Parse(tourStop.Attributes.GetNamedItem("PlanetOrbitsFilter").Value);
            }

            XmlNode place = Util.SelectSingleNode(tourStop, "Place");

            newTourStop.target = Place.FromXml(place);

            XmlNode endTarget = Util.SelectSingleNode(tourStop, "EndTarget");
            if (endTarget != null)
            {
                newTourStop.endTarget = Place.FromXml(endTarget);
            }

            XmlNode overlays = Util.SelectSingleNode(tourStop, "Overlays");

            foreach (XmlNode overlay in overlays.ChildNodes)
            {
                //todo this might have issuse if all the childeren are not good

                newTourStop.AddOverlay(Overlay.FromXml(newTourStop, overlay));
            }

            XmlNode musicNode = Util.SelectSingleNode(tourStop, "MusicTrack");

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

            XmlNode voiceNode = Util.SelectSingleNode(tourStop, "VoiceTrack");

            if (voiceNode != null)
            {
                newTourStop.voiceTrack = (AudioOverlay)Overlay.FromXml(newTourStop,  Util.SelectSingleNode(voiceNode, "Overlay"));
            }

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

            return newTourStop;
        }
예제 #3
0
        public void AddTourStop(TourStop ts)
        {
            ts.Owner = this;

            TourStops.Add(ts);
            currentTourstopIndex = tourStops.Count - 1;

            TourDirty = true;
        }
예제 #4
0
 public void InsertTourStop(TourStop ts)
 {
     ts.Owner = this;
     if (currentTourstopIndex > -1)
     {
         TourStops.Insert(currentTourstopIndex, ts);
     }
     else
     {
         TourStops.Add(ts);
         currentTourstopIndex = tourStops.Count - 1;
     }
     TourDirty = true;
 }
예제 #5
0
        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;
        }
예제 #6
0
        //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;
        }
예제 #7
0
        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;
        }
예제 #8
0
        //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
        private void StopMaster()
        {
            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;
            }
        }
예제 #10
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);
                    }
                }
            }
        }
예제 #11
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();
 }
예제 #12
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))
            {
                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)
                {
                    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)]);

                            //tour.CurrentTourstopIndex = tour.GetTourStopIndexByID(tour.CurrentTourStop.NextSlide);
                            //PlayMasterForCurrent();
                            break;
                    }

                }
                else
                {
                    tour.CurrentTourstopIndex++;
                }

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

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

                    foreach (Overlay overlay in currentMasterSlide.Overlays)
                    {
                        overlay.Stop();
                    }
                    currentMasterSlide = null;
                }
                WWTControl.Singleton.GotoTarget(tour.CurrentTourStop.Target, false, false, false);

                slideStartTime = Date.Now;
                // Move to new settings
                Settings.TourSettings = tour.CurrentTourStop;
                SpaceTimeController.Now = tour.CurrentTourStop.StartTime;
                SpaceTimeController.SyncToClock = false;

            }
            else
            {
                StopMaster();
                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();
                }
            }
        }
예제 #13
0
 public MasterTime( TourStop master, double durration)
 {
     Master = master;
     Durration = durration;
 }