public static TourPopup ShowEndTourPopup(TourDocument tour) { CloseTourPopups(); if (endTour != null) { endTour.Close(); endTour = null; } endTour = new TourPopup(); endTour.PopupType = TourPopup.PopupTypes.TourOver; Tour tourResult = FolderBrowser.GetRelatedTour(tour.Id); if (tourResult == null) { tourResult = FolderBrowser.GetRelatedTour(tour.TagId); } if (tourResult == null) { tourResult = new Tour(); tourResult.Author = tour.Author; tourResult.Id = tour.Id; tourResult.AuthorUrl = tour.AuthorUrl; tourResult.Description = tour.Description; tourResult.AuthorImage = tour.AuthorImage; tourResult.OrgName = tour.OrgName; tourResult.OrganizationUrl = tour.OrgUrl; tourResult.Title = tour.Title; tourResult.AverageUserRating = 3; } endTour.TourResult = tourResult; endTour.Show(); return endTour; }
static public DialogResult ShowEndTourPopupModal(TourDocument tour) { CloseTourPopups(); if (endTour != null) { endTour.Close(); endTour = null; } endTour = new TourPopup(); endTour.PopupType = TourPopup.PopupTypes.TourOver; Tour tourResult = FolderBrowser.GetRelatedTour(tour.Id); if (tourResult == null) { tourResult = FolderBrowser.GetRelatedTour(tour.TagId); } if (tourResult == null) { tourResult = new Tour(); tourResult.Author = tour.Author; tourResult.Id = tour.Id; tourResult.AuthorUrl = tour.AuthorUrl; tourResult.Description = tour.Description; tourResult.AuthorImage = tour.AuthorImage; tourResult.OrgName = tour.OrgName; tourResult.OrganizationUrl = tour.OrgUrl; tourResult.Title = tour.Title; tourResult.AverageUserRating = 3; } Cursor.Show(); endTour.TourResult = tourResult; return(endTour.ShowDialog()); }
public void Close() { if (tour != null) { // todo check for changes tour = null; } }
public void Close() { if (tour != null) { // todo check for changes tour = null; } }
public void RemoveTour(TourDocument targetTour) { tours.Remove(targetTour); if (currentTour == targetTour) { currentTour = null; // todo shift to another tour? } }
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 TourDocument FromFile(string filename, bool forEdit) { FileCabinet cab = new FileCabinet(filename, BaseWorkingDirectory); cab.Extract(); TourDocument newTour = TourDocument.FromXml(cab.MasterFile); if (forEdit) { newTour.SaveFileName = filename; } return(newTour); }
public void FocusTour(TourDocument targetTour) { int index = 0; int maxIndex = (tabs.Count); foreach (TourDocument tour in Tours) { if (tour == targetTour) { CurrentTour = targetTour; SetSelectedIndex(maxIndex + index, false); this.Refresh(); return; } index++; } }
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; }
private int GetTabIndexFromPoint(Point pnt, out bool onClose, out bool onMenu, out bool onSignOut) { int index = (pnt.X - startX) / 100; int maxIndex = (tabs.Count - 1); onClose = false; onMenu = false; onSignOut = false; if (pnt.X > (Width - 80)) { onSignOut = true; return(-1); } // Adjusts for tours being double wide... if (index > maxIndex) { int tourIndex = (((index - maxIndex) + 1) / 2) - 1; index = tourIndex + maxIndex + 1; if (tourIndex < tours.Count) { currentTour = tours[tourIndex]; int closeStart = startX + (tabs.Count * 100 + tourIndex * 200) + 182; if (pnt.Y > 4 && pnt.Y < 18 && pnt.X > closeStart && pnt.X < (closeStart + 13)) { onClose = true; } } } if (pnt.Y > 23 && !onClose) { onMenu = true; } return(index); }
public void RemoveTour(TourDocument targetTour) { tours.Remove(targetTour); if (currentTour == targetTour) { currentTour = null; // todo shift to another tour? } }
private void newSlideBasedTour(object sender, EventArgs e) { if (!CloseOpenToursOrAbort(false)) { return; } TourDocument tour = new TourDocument(); TourProperties tourProps = new TourProperties(); tourProps.EditTour = tour; if (tourProps.ShowDialog() == DialogResult.OK) { tour.EditMode = true; this.menuTabs.AddTour(tour); this.menuTabs.FocusTour(tour); Undo.Clear(); } }
public static TourDocument FromXml(string filename) { var newTour = new TourDocument(); newTour.filename = filename; var doc = new XmlDocument(); doc.Load(filename); XmlNode root = doc["Tour"]; newTour.id = root.Attributes["ID"].Value; newTour.Title = root.Attributes["Title"].Value; newTour.Author = root.Attributes["Author"].Value; if (root.Attributes["Descirption"] != null) { newTour.Description = root.Attributes["Descirption"].Value; } if (root.Attributes["Description"] != null) { newTour.Description = root.Attributes["Description"].Value; } if (root.Attributes["AuthorEmail"] != null) { newTour.authorEmail = root.Attributes["AuthorEmail"].Value; } if (root.Attributes["Keywords"] != null) { newTour.Keywords = root.Attributes["Keywords"].Value; } if (root.Attributes["OrganizationName"] != null) { newTour.OrgName = root.Attributes["OrganizationName"].Value; } if (root.Attributes["DomeMode"] != null) { newTour.DomeMode = bool.Parse(root.Attributes["DomeMode"].Value); } newTour.organizationUrl = root.Attributes["OrganizationUrl"].Value; newTour.level = (UserLevel)Enum.Parse(typeof(UserLevel), root.Attributes["UserLevel"].Value); newTour.type = (Classification)Enum.Parse(typeof(Classification), root.Attributes["Classification"].Value); newTour.taxonomy = root.Attributes["Taxonomy"].Value; var timeLineTour = false; if (root.Attributes["TimeLineTour"] != null) { timeLineTour = bool.Parse(root.Attributes["TimeLineTour"].Value); } XmlNode TourStops = null; if (timeLineTour) { TourStops = root["TimeLineTourStops"]; } else { TourStops = root["TourStops"]; } foreach (XmlNode tourStop in TourStops) { newTour.AddTourStop(TourStop.FromXml(newTour, tourStop)); } XmlNode Frames = root["ReferenceFrames"]; if (Frames != null) { foreach (XmlNode frame in Frames) { var newFrame = new ReferenceFrame(); newFrame.InitializeFromXml(frame); if (!LayerManager.AllMaps.ContainsKey(newFrame.Name)) { var map = new LayerMap(newFrame.Name, ReferenceFrames.Custom); map.Frame = newFrame; map.LoadedFromTour = true; LayerManager.AllMaps.Add(newFrame.Name, map); } } LayerManager.ConnectAllChildren(); LayerManager.LoadTree(); } XmlNode Layers = root["Layers"]; if (Layers != null) { foreach (XmlNode layer in Layers) { var newLayer = Layer.FromXml(layer, true); var fileName = newTour.WorkingDirectory + string.Format("{0}.txt", newLayer.ID); // Overwite ISS layer if in a tour using the authored ISS details if (LayerManager.LayerList.ContainsKey(newLayer.ID) && newLayer.ID == ISSLayer.ISSGuid) { LayerManager.DeleteLayerByID(newLayer.ID, true, false); } // Ask about merging other layers. if (LayerManager.LayerList.ContainsKey(newLayer.ID) && newLayer.ID != ISSLayer.ISSGuid) { if (!newTour.CollisionChecked) { if (UiTools.ShowMessageBox(Language.GetLocalizedText(958, "There are layers with the same name. Overwrite existing layers?"), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope"), MessageBoxButtons.YesNo) == DialogResult.Yes) { newTour.OverWrite = true; } else { newTour.OverWrite = false; } newTour.CollisionChecked = true; } if (newTour.OverWrite) { LayerManager.DeleteLayerByID(newLayer.ID, true, false); } } try { newLayer.LoadedFromTour = true; newLayer.LoadData(fileName); LayerManager.Add(newLayer, false); } catch { } } LayerManager.LoadTree(); } if (File.Exists(newTour.WorkingDirectory + "Author.png")) { newTour.authorImage = UiTools.LoadBitmap(newTour.WorkingDirectory + "Author.png"); } newTour.tourDirty = 0; return newTour; }
public UndoTourSlidelistChange(string text, TourDocument tour) { undoList = new List<TourStop>(); for (var i = 0; i < tour.TourStops.Count; i++) { undoList.Add(tour.TourStops[i]); } currentIndex = tour.CurrentTourstopIndex; actionText = text; targetTour = tour; targetTour.TourDirty = true; }
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 void AddTour(TourDocument tour) { tours.Add(tour); this.Refresh(); }
public void FocusTour(TourDocument targetTour) { int index = 0; int maxIndex = (tabs.Count); foreach (TourDocument tour in Tours) { if (tour == targetTour) { CurrentTour = targetTour; SetSelectedIndex(maxIndex + index, false); this.Refresh(); return; } index++; } }
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; }
private int GetTabIndexFromPoint(Point pnt, out bool onClose, out bool onMenu, out bool onSignOut) { int index = (pnt.X - startX) / 100; int maxIndex = (tabs.Count - 1); onClose = false; onMenu = false; onSignOut = false; if (pnt.X > (Width -80)) { onSignOut = true; return -1; } // Adjusts for tours being double wide... if (index > maxIndex) { int tourIndex = (((index - maxIndex)+1) / 2)-1; index = tourIndex + maxIndex+1; if (tourIndex < tours.Count) { currentTour = tours[tourIndex]; int closeStart = startX + (tabs.Count * 100 + tourIndex * 200) + 182; if (pnt.Y > 4 && pnt.Y < 18 && pnt.X > closeStart && pnt.X < (closeStart + 13)) { onClose = true; } } } if (pnt.Y > 23 && ! onClose) { onMenu = true; } return index; }
public UndoTourStopChange(string text, TourDocument tour) { currentIndex = tour.CurrentTourstopIndex; actionText = text; targetTour = tour; undoXml = TourStop.GetXmlText(tour.CurrentTourStop); targetTour.TourDirty = true; }
public static void SetTour(TourDocument tour) { activeTour = tour; foreach (var tl in instances) { tl.Tour = tour; tl.EnsureVisible(); tl.Invalidate(); } }
public void AddTour(TourDocument tour) { tours.Add(tour); this.Refresh(); }
public override void ProcessRequest(string request, ref Socket socket, bool authenticated, string body) { bool cache = true; QueryString query = new QueryString(request); String sMimeType = "image/JPEG"; if (request.ToLower().IndexOf(".png") > -1) { sMimeType = "image/PNG"; } int iTotBytes = 0; string fileName = request.Substring(request.LastIndexOf("/") + 1); byte[] data = new byte[0]; if (request.Contains("/tour/")) { if (Earth3d.MainWindow.TourEdit != null) { TourDocument tour = Earth3d.MainWindow.TourEdit.Tour; if (fileName.ToLower() == "slidelist.xml") { sMimeType = "text/xml"; data = tour.GetSlideListXML(); } else if (tour != null) { data = ReadBinaryWebFileFromDisk(tour.WorkingDirectory + fileName); } } else { if (fileName.ToLower() == "slidelist.xml") { sMimeType = "text/xml"; data = TourDocument.GetEmptySlideListXML(); } } } else if (fileName == "refresh.png") { Earth3d.RefreshCommunity(); } else if (fileName == "screenshot.png") { if (ScreenBroadcast.Capturing) { data = ScreenBroadcast.ScreenImage; } } else if (request.Contains("/imageset/")) { string[] parts = request.Split(new char[] { '/' }); IImageSet imageset = (IImageSet)Earth3d.ImagesetHashTable[Convert.ToInt32(parts[2])]; if (imageset != null) { data = ReadBinaryWebFileFromDisk(imageset.Url); } } else if (fileName == "layermap") { SendBinaryFileFromDisk(Properties.Settings.Default.CahceDirectory + "\\layerSync.layers", ref socket, sMimeType); return; } else if (fileName == "tour.wtt") { SendBinaryFileFromDisk(Properties.Settings.Default.CahceDirectory + "\\tourSync.wtt", ref socket, sMimeType); return; } else if (fileName == "colorsettings") { data = NetControl.GetColorSettingsData(); } else if (fileName == "executable") { SendBinaryFileFromDisk("wwtexplorer.exe", ref socket, sMimeType); return; } else if (fileName.StartsWith("distort") || fileName.StartsWith("blend")) { string path = String.Format("{0}\\ProjetorWarpMaps\\", Properties.Settings.Default.CahceDirectory); data = ReadBinaryWebFileFromDisk(path + fileName); } else { data = ReadBinaryWebFile(fileName); } iTotBytes = data.Length; SendHeader(HttpVersion, sMimeType, iTotBytes, " 200 OK", ref socket, cache); SendToBrowser(data, iTotBytes, ref socket); }
public static TourDocument FromXml(string filename) { TourDocument newTour = new TourDocument(); newTour.filename = filename; XmlDocument doc = new XmlDocument(); doc.Load(filename); XmlNode root = doc["Tour"]; newTour.id = root.Attributes["ID"].Value.ToString(); newTour.Title = root.Attributes["Title"].Value.ToString(); newTour.Author = root.Attributes["Author"].Value.ToString(); if (root.Attributes["Descirption"] != null) { newTour.Description = root.Attributes["Descirption"].Value; } if (root.Attributes["Description"] != null) { newTour.Description = root.Attributes["Description"].Value; } if (root.Attributes["AuthorEmail"] != null) { newTour.authorEmail = root.Attributes["AuthorEmail"].Value; } if (root.Attributes["Keywords"] != null) { newTour.Keywords = root.Attributes["Keywords"].Value; } if (root.Attributes["OrganizationName"] != null) { newTour.OrgName = root.Attributes["OrganizationName"].Value; } if (root.Attributes["DomeMode"] != null) { newTour.DomeMode = bool.Parse(root.Attributes["DomeMode"].Value); } newTour.organizationUrl = root.Attributes["OrganizationUrl"].Value.ToString(); newTour.level = (UserLevel)Enum.Parse(typeof(UserLevel), root.Attributes["UserLevel"].Value.ToString()); newTour.type = (Classification)Enum.Parse(typeof(Classification), root.Attributes["Classification"].Value.ToString()); newTour.taxonomy = root.Attributes["Taxonomy"].Value.ToString(); bool timeLineTour = false; if (root.Attributes["TimeLineTour"] != null) { timeLineTour = bool.Parse(root.Attributes["TimeLineTour"].Value); } XmlNode TourStops = null; if (timeLineTour) { TourStops = root["TimeLineTourStops"]; } else { TourStops = root["TourStops"]; } foreach (XmlNode tourStop in TourStops) { newTour.AddTourStop(TourStop.FromXml(newTour, tourStop)); } XmlNode Frames = root["ReferenceFrames"]; if (Frames != null) { foreach (XmlNode frame in Frames) { ReferenceFrame newFrame = new ReferenceFrame(); newFrame.InitializeFromXml(frame); if (!LayerManager.AllMaps.ContainsKey(newFrame.Name)) { LayerMap map = new LayerMap(newFrame.Name, ReferenceFrames.Custom); map.Frame = newFrame; map.LoadedFromTour = true; LayerManager.AllMaps.Add(newFrame.Name, map); } } LayerManager.ConnectAllChildren(); LayerManager.LoadTree(); } XmlNode Layers = root["Layers"]; if (Layers != null) { foreach (XmlNode layer in Layers) { Layer newLayer = Layer.FromXml(layer, true); string fileName = newTour.WorkingDirectory + string.Format("{0}.txt", newLayer.ID.ToString()); // Overwite ISS layer if in a tour using the authored ISS details if (LayerManager.LayerList.ContainsKey(newLayer.ID) && newLayer.ID == ISSLayer.ISSGuid) { LayerManager.DeleteLayerByID(newLayer.ID, true, false); } // Ask about merging other layers. if (LayerManager.LayerList.ContainsKey(newLayer.ID) && newLayer.ID != ISSLayer.ISSGuid) { if (!newTour.CollisionChecked) { if (UiTools.ShowMessageBox(Language.GetLocalizedText(958, "There are layers with the same name. Overwrite existing layers?"), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope"), System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { newTour.OverWrite = true; } else { newTour.OverWrite = false; } newTour.CollisionChecked = true; } if (newTour.OverWrite) { LayerManager.DeleteLayerByID(newLayer.ID, true, false); } } try { newLayer.LoadedFromTour = true; newLayer.LoadData(fileName); LayerManager.Add(newLayer, false); } catch { } } LayerManager.LoadTree(); } if (File.Exists(newTour.WorkingDirectory + "Author.png")) { newTour.authorImage = UiTools.LoadBitmap(newTour.WorkingDirectory + "Author.png"); } newTour.tourDirty = 0; return(newTour); }