internal static void PrepTourLayers() { if (TourPlayer.Playing) { TourPlayer player = (TourPlayer)WWTControl.Singleton.uiController; if (player != null) { TourDocument tour = player.Tour; if (tour.CurrentTourStop != null) { player.UpdateTweenPosition(-1); if (!tour.CurrentTourStop.KeyFramed) { tour.CurrentTourStop.UpdateLayerOpacity(); foreach (Guid key in tour.CurrentTourStop.Layers.Keys) { LayerInfo info = tour.CurrentTourStop.Layers[key]; if (LayerList.ContainsKey(info.ID)) { LayerList[info.ID].Opacity = info.FrameOpacity; LayerList[info.ID].SetParams(info.FrameParams); } } } } } } }
public static TourDocument FromUrlRaw(string url, Action callMe) { TourDocument temp = new TourDocument(); temp.Url = url; temp.callMe = callMe; temp.cabinet = FileCabinet.FromUrl(url, callMe); return(temp); }
public void Close() { if (tour != null) { if (Playing) { Stop(switchedToFullScreen); } // todo check for changes tour = null; } }
public override void LoadData(TourDocument tourDoc, string filename) { Blob blob = tourDoc.GetFileBlob(filename); FileReader doc = new FileReader(); doc.OnLoadEnd = delegate(FileProgressEvent ee) { dataFile = doc.Result as string; LoadString(dataFile); }; doc.ReadAsText(blob); }
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); }
public UndoTourSlidelistChange(string text, TourDocument tour) { undoList = new List <TourStop>(); for (int i = 0; i < tour.TourStops.Count; i++) { undoList.Add(tour.TourStops[i]); } currentIndex = tour.CurrentTourstopIndex; actionText = text; targetTour = tour; targetTour.TourDirty = true; }
public static void LoadBackground() { if (loading) { return; } loading = true; string url = "http://www.worldwidetelescope.org/data/iss.wtt"; doc = TourDocument.FromUrlRaw(url, delegate { CreateSpaceStation(); }); }
public static void LoadBackground() { if (loading) { return; } loading = true; string url = URLHelpers.singleton.coreStaticUrl("data/iss.wtt"); doc = TourDocument.FromUrlRaw(url, delegate { CreateSpaceStation(); }); }
public UndoTourPropertiesChange(string text, TourDocument tour) { undoTitle = tour.Title; undoAuthor = tour.Author; undoAuthorEmail = tour.AuthorEmail; undoDescription = tour.Description; undoAuthorImage = tour.AuthorImage; undoOrganizationUrl = tour.OrganizationUrl; undoOrgName = tour.OrgName; undoKeywords = tour.Keywords; undoTaxonomy = tour.Taxonomy; undoLevel = tour.Level; // undoDomeMode = tour.DomeMode; actionText = text; targetTour = tour; targetTour.TourDirty = true; }
public override void LoadData(TourDocument tourDoc, string filename) { if (extension.ToLowerCase().StartsWith(".fit")) { System.Html.Data.Files.Blob blob = tourDoc.GetFileBlob(filename.Replace(".txt", extension)); FitsImage fi = new FitsImage("image.fit", blob, DoneLoading); imageSet.WcsImage = fi; if (max > 0 || min > 0) { fi.lastBitmapMax = max; fi.lastBitmapMin = min; fi.lastScale = lastScale; } } else { loaded = true; } }
public override void LoadData(TourDocument tourDoc, string filename) { if (extension.ToLowerCase().StartsWith(".fit")) { System.Html.Data.Files.Blob blob = tourDoc.GetFileBlob(filename.Replace(".txt", extension)); FitsImage fi; if (RenderContext.UseGlVersion2) { fi = new FitsImage(imageSet, "image.fit", blob, DoneLoading); } else { fi = new FitsImageJs(imageSet, "image.fit", blob, DoneLoading); } imageSet.WcsImage = fi; } else { loaded = true; } }
//todo remove the stuff from draw that is redundant once predraw has run internal static void PreDraw(RenderContext renderContext, float opacity, bool astronomical, string referenceFrame, bool nested) { if (!AllMaps.ContainsKey(referenceFrame)) { return; } LayerMap thisMap = AllMaps[referenceFrame]; if (thisMap.ChildMaps.Count == 0 && thisMap.Layers.Count == 0) { return; } if (TourPlayer.Playing) { TourPlayer player = (TourPlayer)WWTControl.Singleton.uiController as TourPlayer; if (player != null) { TourDocument tour = player.Tour; if (tour.CurrentTourStop != null) { player.UpdateTweenPosition(-1); tour.CurrentTourStop.UpdateLayerOpacity(); foreach (Guid key in tour.CurrentTourStop.Layers.Keys) { LayerInfo info = tour.CurrentTourStop.Layers[key]; if (LayerList.ContainsKey(info.ID)) { LayerList[info.ID].Opacity = info.FrameOpacity; LayerList[info.ID].SetParams(info.FrameParams); } } } } } Matrix3d matOld = renderContext.World; Matrix3d matOldNonRotating = renderContext.WorldBaseNonRotating; double oldNominalRadius = renderContext.NominalRadius; if (thisMap.Frame.Reference == ReferenceFrames.Custom) { thisMap.ComputeFrame(renderContext); if (thisMap.Frame.ReferenceFrameType != ReferenceFrameTypes.Orbital) //if (true) { renderContext.World = Matrix3d.MultiplyMatrix(thisMap.Frame.WorldMatrix, renderContext.World); } else { renderContext.World = Matrix3d.MultiplyMatrix(thisMap.Frame.WorldMatrix, renderContext.WorldBaseNonRotating); } renderContext.NominalRadius = thisMap.Frame.MeanRadius; } for (int pass = 0; pass < 2; pass++) { foreach (Layer layer in AllMaps[referenceFrame].Layers) { if ((pass == 0 && layer is ImageSetLayer) || (pass == 1 && !(layer is ImageSetLayer))) { if (layer.Enabled) // && astronomical == layer.Astronomical) { double layerStart = SpaceTimeController.UtcToJulian(layer.StartTime); double layerEnd = SpaceTimeController.UtcToJulian(layer.EndTime); double fadeIn = SpaceTimeController.UtcToJulian(layer.StartTime) - ((layer.FadeType == FadeType.FadeIn || layer.FadeType == FadeType.Both) ? (layer.FadeSpan / 864000000) : 0); double fadeOut = SpaceTimeController.UtcToJulian(layer.EndTime) + ((layer.FadeType == FadeType.FadeOut || layer.FadeType == FadeType.Both) ? (layer.FadeSpan / 864000000) : 0); if (SpaceTimeController.JNow > fadeIn && SpaceTimeController.JNow < fadeOut) { float fadeOpacity = 1; if (SpaceTimeController.JNow < layerStart) { fadeOpacity = (float)((SpaceTimeController.JNow - fadeIn) / (layer.FadeSpan / 864000000)); } if (SpaceTimeController.JNow > layerEnd) { fadeOpacity = (float)((fadeOut - SpaceTimeController.JNow) / (layer.FadeSpan / 864000000)); } if (thisMap.Frame.Reference == ReferenceFrames.Sky) { layer.Astronomical = true; } layer.PreDraw(renderContext, opacity * fadeOpacity); } } } } } if (nested) { foreach (string key in AllMaps[referenceFrame].ChildMaps.Keys) { LayerMap map = AllMaps[referenceFrame].ChildMaps[key]; if ((map.Frame.Reference == ReferenceFrames.Custom || map.Frame.Reference == ReferenceFrames.Identity)) { PreDraw(renderContext, opacity, astronomical, map.Name, nested); } } } renderContext.NominalRadius = oldNominalRadius; renderContext.World = matOld; renderContext.WorldBaseNonRotating = matOldNonRotating; }
public virtual void LoadData(TourDocument doc, string filename) { return; }
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; }
public void PlayTour(string url) { if (uiController is TourPlayer) { TourPlayer player = (TourPlayer)uiController; player.Stop(false); } tour = TourDocument.FromUrl(url, delegate { TourPlayer player = new TourPlayer(); player.Tour = tour; tour.CurrentTourstopIndex = -1; uiController = player; player.Play(); } ); }
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; }
public override void LoadData(TourDocument doc, string filename) { return; }
internal static void Draw(RenderContext renderContext, float opacity, bool astronomical, string referenceFrame, bool nested, bool cosmos) { if (!AllMaps.ContainsKey(referenceFrame)) { return; } LayerMap thisMap = AllMaps[referenceFrame]; if (!thisMap.Enabled || (thisMap.ChildMaps.Count == 0 && thisMap.Layers.Count == 0 && !(thisMap.Frame.ShowAsPoint || thisMap.Frame.ShowOrbitPath))) { return; } if (TourPlayer.Playing) { TourPlayer player = (TourPlayer)WWTControl.Singleton.uiController; if (player != null) { TourDocument tour = player.Tour; if (tour.CurrentTourStop != null) { player.UpdateTweenPosition(-1); tour.CurrentTourStop.UpdateLayerOpacity(); foreach (Guid key in tour.CurrentTourStop.Layers.Keys) { LayerInfo info = tour.CurrentTourStop.Layers[key]; if (LayerList.ContainsKey(info.ID)) { LayerList[info.ID].Opacity = info.FrameOpacity; LayerList[info.ID].SetParams(info.FrameParams); } } } } } Matrix3d matOld = renderContext.World; Matrix3d matOldNonRotating = renderContext.WorldBaseNonRotating; double oldNominalRadius = renderContext.NominalRadius; if (thisMap.Frame.Reference == ReferenceFrames.Custom) { thisMap.ComputeFrame(renderContext); if (thisMap.Frame.ReferenceFrameType != ReferenceFrameTypes.Orbital && thisMap.Frame.ReferenceFrameType != ReferenceFrameTypes.Trajectory) //if (true) { renderContext.World = Matrix3d.MultiplyMatrix(thisMap.Frame.WorldMatrix, renderContext.World); } else { renderContext.World = Matrix3d.MultiplyMatrix(thisMap.Frame.WorldMatrix, renderContext.WorldBaseNonRotating); } renderContext.NominalRadius = thisMap.Frame.MeanRadius; } if (thisMap.Frame.ShowAsPoint) { // todo Draw point planet... // Planets.DrawPointPlanet(renderContext.Device, new Vector3d(0, 0, 0), (float).2, thisMap.Frame.RepresentativeColor, true); } for (int pass = 0; pass < 2; pass++) { foreach (Layer layer in AllMaps[referenceFrame].Layers) { if ((pass == 0 && layer is ImageSetLayer) || (pass == 1 && !(layer is ImageSetLayer))) { if (layer.Enabled) // && astronomical == layer.Astronomical) { double layerStart = SpaceTimeController.UtcToJulian(layer.StartTime); double layerEnd = SpaceTimeController.UtcToJulian(layer.EndTime); double fadeIn = SpaceTimeController.UtcToJulian(layer.StartTime) - ((layer.FadeType == FadeType.FadeIn || layer.FadeType == FadeType.Both) ? (layer.FadeSpan / 864000000) : 0); double fadeOut = SpaceTimeController.UtcToJulian(layer.EndTime) + ((layer.FadeType == FadeType.FadeOut || layer.FadeType == FadeType.Both) ? (layer.FadeSpan / 864000000) : 0); if (SpaceTimeController.JNow > fadeIn && SpaceTimeController.JNow < fadeOut) { float fadeOpacity = 1; if (SpaceTimeController.JNow < layerStart) { fadeOpacity = (float)((SpaceTimeController.JNow - fadeIn) / (layer.FadeSpan / 864000000)); } if (SpaceTimeController.JNow > layerEnd) { fadeOpacity = (float)((fadeOut - SpaceTimeController.JNow) / (layer.FadeSpan / 864000000)); } layer.Astronomical = astronomical; //if (thisMap.Frame.Reference == ReferenceFrames.Sky) //{ // layer.Astronomical = true; //} layer.Draw(renderContext, opacity * fadeOpacity, cosmos); } } } } } if (nested) { foreach (string key in AllMaps[referenceFrame].ChildMaps.Keys) { LayerMap map = AllMaps[referenceFrame].ChildMaps[key]; if (map.Frame.ShowOrbitPath && Settings.Active.SolarSystemOrbits) { if (map.Frame.ReferenceFrameType == ReferenceFrameTypes.Orbital) { if (map.Frame.Orbit == null) { map.Frame.Orbit = new Orbit(map.Frame.Elements, 360, map.Frame.RepresentativeColor, 1, (float)renderContext.NominalRadius); } Matrix3d matSaved = renderContext.World; renderContext.World = Matrix3d.MultiplyMatrix(thisMap.Frame.WorldMatrix, renderContext.WorldBaseNonRotating); map.Frame.Orbit.Draw3D(renderContext, 1f * .25f, Vector3d.Create(0, 0, 0)); renderContext.World = matSaved; } else if (map.Frame.ReferenceFrameType == ReferenceFrameTypes.Trajectory) { //todo add trajectories back //if (map.Frame.trajectoryLines == null) //{ // map.Frame.trajectoryLines = new LineList(renderContext.Device); // map.Frame.trajectoryLines.ShowFarSide = true; // map.Frame.trajectoryLines.UseNonRotatingFrame = true; // int count = map.Frame.Trajectory.Count - 1; // for (int i = 0; i < count; i++) // { // Vector3d pos1 = map.Frame.Trajectory[i].Position; // Vector3d pos2 = map.Frame.Trajectory[i + 1].Position; // pos1.Multiply(1 / renderContext.NominalRadius); // pos2.Multiply(1 / renderContext.NominalRadius); // map.Frame.trajectoryLines.AddLine(pos1, pos2, map.Frame.RepresentativeColor, new Dates()); // } //} //Matrix3D matSaved = renderContext.World; //renderContext.World = thisMap.Frame.WorldMatrix * renderContext.WorldBaseNonRotating; //map.Frame.trajectoryLines.DrawLines(renderContext, Earth3d.MainWindow.showMinorOrbits.Opacity * .25f); //renderContext.World = matSaved; } } if ((map.Frame.Reference == ReferenceFrames.Custom || map.Frame.Reference == ReferenceFrames.Identity)) { Draw(renderContext, opacity, astronomical, map.Name, nested, cosmos); } } } renderContext.NominalRadius = oldNominalRadius; renderContext.World = matOld; renderContext.WorldBaseNonRotating = matOldNonRotating; }