private void RunQuery() { if (cornersLast != null && !String.IsNullOrEmpty(constellation)) { contextResults.Clear(); paginator1.CurrentPage = 1; paginator1.TotalPages = 1; //Place[] results = ContextSearch.FindConteallationObjects(Constellations.Abbreviation(constellation), cornersLast, (Classification)FilterCombo.Tag); Vector3d cornerUl = Coordinates.RADecTo3d(cornersLast[0].RA, cornersLast[0].Dec, 1); Vector3d cornerLR = Coordinates.RADecTo3d(cornersLast[2].RA, cornersLast[2].Dec, 1); Vector3d dist = Vector3d.Subtract(cornerLR, cornerUl); IPlace[] results = ContextSearch.FindConteallationObjectsInCone("SolarSystem", Earth3d.MainWindow.RA, Earth3d.MainWindow.Dec, (float)dist.Length() / 2.0f, (Classification)FilterCombo.Tag); if (results != null) { contextResults.AddRange(results); } results = ContextSearch.FindConteallationObjectsInCone("Community", Earth3d.MainWindow.RA, Earth3d.MainWindow.Dec, (float)dist.Length() / 2.0f, (Classification)FilterCombo.Tag); if (results != null) { contextResults.AddRange(results); } results = ContextSearch.FindConteallationObjectsInCone(Constellations.Abbreviation(constellation), Earth3d.MainWindow.RA, Earth3d.MainWindow.Dec, (float)dist.Length() / 2.0f, (Classification)FilterCombo.Tag); if (results != null) { contextResults.AddRange(results); } contextResults.Invalidate(); //paginator1.CurrentPage = 0; //paginator1.TotalPages = contextResults.PageCount; } }
private void Delete_Click(object sender, EventArgs e) { if (MessageBox.Show(Language.GetLocalizedText(520, "Deleting this figure library will delete the constellation figures you created. Do you want to continue?"), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope"), MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { if (Earth3d.MainWindow.figureEditor != null) { if (Earth3d.MainWindow.figureEditor.SaveAndClose() != DialogResult.OK) { return; } Earth3d.MainWindow.figureEditor = null; } string filename = Constellations.GetFigurePath(figureLibrary.SelectedItem.ToString()); try { File.Delete(filename); figureLibrary.Items.Remove(figureLibrary.SelectedItem); figureLibrary.SelectedIndex = 0; } catch { MessageBox.Show("The constellation figures file cannot be deleted because the file cannot be found.", "Constellation Figure Editor"); } } }
private void overview_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(constellation)) { IPlace target = Constellations.ConstellationCentroids[Constellations.Abbreviation(constellation)]; Earth3d.MainWindow.GotoTarget(target, false, false, true); } }
private void newFigures_Click(object sender, EventArgs e) { if (Earth3d.MainWindow.figureEditor != null) { if (Earth3d.MainWindow.figureEditor.SaveAndClose() != DialogResult.OK) { return; } Earth3d.MainWindow.figureEditor = null; } SimpleInput input = new SimpleInput(Language.GetLocalizedText(515, "Figure Library Name"), Language.GetLocalizedText(238, "Name"), "", 32); bool retry = false; do { if (input.ShowDialog() == DialogResult.OK) { if (!File.Exists(Constellations.GetFigurePath(input.ResultText))) { int index = figureLibrary.Items.IndexOf(input.ResultText); if (index > -1) { MessageBox.Show(Language.GetLocalizedText(516, "Name already exists, type a different name."), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope")); retry = true; } else { string validfileName = @"^[A-Za-z0-9_ ]*$"; if (input.ResultText.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0 || !UiTools.ValidateString(input.ResultText, validfileName)) { MessageBox.Show(Language.GetLocalizedText(231, "A name can not contain any of the following characters:") + " \\ / : * ? \" < > |", "Constellation Figure Editor"); retry = true; } else { Constellations figures = new Constellations(input.ResultText); figures.Save(input.ResultText); figures = null; figureLibrary.Items.Add(input.ResultText); figureLibrary.SelectedIndex = figureLibrary.Items.IndexOf(input.ResultText); Earth3d.MainWindow.ShowFigureEditorWindow(Earth3d.MainWindow.constellationsFigures); retry = false; } } } else { MessageBox.Show(Language.GetLocalizedText(516, "Name already exists, type a different name."), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope")); retry = true; } } else { return; } } while (retry); }
public void InstallNewFigureFile(string launchTourFile) { if (UiTools.ShowMessageBox(Language.GetLocalizedText(514, "Do you want to add these constellation figures to your Figure Library?"), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope"), MessageBoxButtons.YesNo) == DialogResult.Yes) { var newName = launchTourFile.ToLower().Replace(".wwtfig",""); newName = newName.Substring(newName.LastIndexOf("\\")+1); var input = new SimpleInput(Language.GetLocalizedText(515, "Figure Library Name"), Language.GetLocalizedText(238, "Name"), newName, 32); var retry = false; do { if (input.ShowDialog() == DialogResult.OK) { if (!File.Exists(Constellations.GetFigurePath(input.ResultText))) { var index = figureLibrary.Items.IndexOf(input.ResultText); if (index > -1) { MessageBox.Show(Language.GetLocalizedText(516, "Name already exists, type a different name."), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope")); retry = true; } else { try { File.Copy(launchTourFile, Constellations.GetFigurePath(input.ResultText)); var newFigures = new Constellations(input.ResultText, null, false, false); newFigures.Save(input.ResultText); figureLibrary.Items.Add(input.ResultText); figureLibrary.SelectedIndex = figureLibrary.Items.IndexOf(input.ResultText); retry = false; } catch { if (File.Exists(Constellations.GetFigurePath(input.ResultText))) { File.Delete(Constellations.GetFigurePath(input.ResultText)); } UiTools.ShowMessageBox(Language.GetLocalizedText(517, "The file is not a valid WorldWide Telescope Constellation Figure File"), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope")); return; } } } else { MessageBox.Show(Language.GetLocalizedText(518, "Name already exists, type a different name."), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope")); retry = true; } } else { return; } } while (retry); } }
public void InstallNewFigureFile(string launchTourFile) { if (UiTools.ShowMessageBox(Language.GetLocalizedText(514, "Do you want to add these constellation figures to your Figure Library?"), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope"), MessageBoxButtons.YesNo) == DialogResult.Yes) { String newName = launchTourFile.ToLower().Replace(".wwtfig", ""); newName = newName.Substring(newName.LastIndexOf("\\") + 1); SimpleInput input = new SimpleInput(Language.GetLocalizedText(515, "Figure Library Name"), Language.GetLocalizedText(238, "Name"), newName, 32); bool retry = false; do { if (input.ShowDialog() == DialogResult.OK) { if (!File.Exists(Constellations.GetFigurePath(input.ResultText))) { int index = figureLibrary.Items.IndexOf(input.ResultText); if (index > -1) { MessageBox.Show(Language.GetLocalizedText(516, "Name already exists, type a different name."), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope")); retry = true; } else { try { File.Copy(launchTourFile, Constellations.GetFigurePath(input.ResultText)); Constellations newFigures = new Constellations(input.ResultText, null, false, false); newFigures.Save(input.ResultText); figureLibrary.Items.Add(input.ResultText); figureLibrary.SelectedIndex = figureLibrary.Items.IndexOf(input.ResultText); retry = false; } catch { if (File.Exists(Constellations.GetFigurePath(input.ResultText))) { File.Delete(Constellations.GetFigurePath(input.ResultText)); } UiTools.ShowMessageBox(Language.GetLocalizedText(517, "The file is not a valid WorldWide Telescope Constellation Figure File"), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope")); return; } } } else { MessageBox.Show(Language.GetLocalizedText(518, "Name already exists, type a different name."), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope")); retry = true; } } else { return; } } while (retry); } }
private void EditFigure_Click(object sender, EventArgs e) { if (Earth3d.MainWindow.figureEditor != null) { if (Earth3d.MainWindow.figureEditor.SaveAndClose() != DialogResult.OK) { return; } Earth3d.MainWindow.figureEditor = null; } if (figureLibrary.SelectedItem.ToString() == Language.GetLocalizedText(519, "Default Figures")) { SimpleInput input = new SimpleInput(Language.GetLocalizedText(515, "Figure Library Name"), Language.GetLocalizedText(238, "Name"), "", 32); bool retry = false; do { if (input.ShowDialog() == DialogResult.OK) { if (!File.Exists(Constellations.GetFigurePath(input.ResultText))) { int index = figureLibrary.Items.IndexOf(input.ResultText); if (index > -1) { MessageBox.Show(Language.GetLocalizedText(516, "Name already exists, type a different name."), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope")); retry = true; } else { Earth3d.MainWindow.constellationsFigures.Save(input.ResultText); figureLibrary.Items.Add(input.ResultText); figureLibrary.SelectedIndex = figureLibrary.Items.IndexOf(input.ResultText); Earth3d.MainWindow.ShowFigureEditorWindow(Earth3d.MainWindow.constellationsFigures); retry = false; } } else { MessageBox.Show(Language.GetLocalizedText(516, "Name already exists, type a different name."), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope")); retry = true; } } else { return; } } while (retry); } else { Earth3d.MainWindow.ShowFigureEditorWindow(Earth3d.MainWindow.constellationsFigures); } }
public static void AddPlaceToContextSearch(IPlace place) { if (place.Classification == Classification.Constellation) { String constellationID = Constellations.Abbreviation(place.Name); place.Constellation = constellationID; constellationObjects["Constellations"].Add(place); } else if (place.Classification == Classification.SolarSystem) { String constellationID = Constellations.Containment.FindConstellationForPoint(place.RA, place.Dec); place.Constellation = constellationID; if (constellationObjects["SolarSystem"].Find(delegate(IPlace target) { return(place.Name == target.Name); }) == null) { constellationObjects["SolarSystem"].Add(place); } } else { String constellationID = "Error"; if (place.Type == ImageSetType.Planet) { if (place.Target == SolarSystemObjects.Undefined) { constellationID = "Mars"; } else { constellationID = place.Target.ToString(); } } else if (place.Type == ImageSetType.Earth) { constellationID = "Earth"; } else { constellationID = Constellations.Containment.FindConstellationForPoint(place.RA, place.Dec); } if (constellationID != "Error") { place.Constellation = constellationID; if (constellationObjects.ContainsKey(constellationID)) { constellationObjects[constellationID].Add(place); } } } }
private void searchTimer_Tick(object sender, EventArgs e) { if (contextAreaChanged && cornersLast != null && !String.IsNullOrEmpty(constellation)) { contextResults.Clear(); Place[] results = ContextSearch.FindConteallationObjects(Constellations.Abbreviation(constellation), cornersLast, Classification.Unfiltered); if (results != null) { contextResults.AddRange(results); } contextResults.Refresh(); paginator1.CurrentPage = 0; paginator1.TotalPages = contextResults.PageCount; } contextAreaChanged = false; }
private void LoadTree() { figureTree.Nodes.Clear(); if (figures != null) { foreach (Lineset ls in figures.lines) { TreeNode parent = figureTree.Nodes.Add(Constellations.FullName(ls.Name)); parent.Tag = ls; foreach (Linepoint pnt in ls.Points) { TreeNode child = parent.Nodes.Add(pnt.ToString()); child.Tag = pnt; child.Checked = pnt.PointType != PointType.Move; } } } initialized = true; }
internal static TourPlace FromAstroObjectsRow(AstroObjectsDataset.spGetAstroObjectsRow row) { TourPlace newPlace = new TourPlace(); string seperator = ""; string name = ""; if (!row.IsPopularName1Null() && !String.IsNullOrEmpty(row.PopularName1)) { name = ProperCaps(row.PopularName1); seperator = ";"; } if (!row.IsMessierNameNull() && !String.IsNullOrEmpty(row.MessierName)) { name = name + seperator + row.MessierName; seperator = ";"; } if (!row.IsNGCNameNull() && !String.IsNullOrEmpty(row.NGCName)) { name = name + seperator + row.NGCName; seperator = ";"; } newPlace.name = name; newPlace.Type = ImageSetType.Sky; newPlace.Lat = row.Dec2000; newPlace.Lng = row.Ra2000 / 15; newPlace.constellation = Constellations.Abbreviation(row.ConstellationName); newPlace.Classification = Classification.Galaxy; //(Classification)Enum.Parse(typeof(Classification), place.Attributes["Classification"].Value); newPlace.magnitude = row.IsVisualMagnitudeNull() ? row.VisualMagnitude : 0; newPlace.AngularSize = 0; // todo fix this newPlace.ZoomLevel = .00009; return(newPlace); }
private void newFigures_Click(object sender, EventArgs e) { if (Earth3d.MainWindow.figureEditor != null) { if (Earth3d.MainWindow.figureEditor.SaveAndClose() != DialogResult.OK) { return; } Earth3d.MainWindow.figureEditor = null; } var input = new SimpleInput(Language.GetLocalizedText(515, "Figure Library Name"), Language.GetLocalizedText(238, "Name"), "", 32); var retry = false; do { if (input.ShowDialog() == DialogResult.OK) { if (!File.Exists(Constellations.GetFigurePath(input.ResultText))) { var index = figureLibrary.Items.IndexOf(input.ResultText); if (index > -1) { MessageBox.Show(Language.GetLocalizedText(516, "Name already exists, type a different name."), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope")); retry = true; } else { var validfileName = @"^[A-Za-z0-9_ ]*$"; if (input.ResultText.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0 || !UiTools.ValidateString(input.ResultText, validfileName)) { MessageBox.Show(Language.GetLocalizedText(231, "A name can not contain any of the following characters:") + " \\ / : * ? \" < > |", "Constellation Figure Editor"); retry = true; } else { var figures = new Constellations(input.ResultText); figures.Save(input.ResultText); figures = null; figureLibrary.Items.Add(input.ResultText); figureLibrary.SelectedIndex = figureLibrary.Items.IndexOf(input.ResultText); Earth3d.MainWindow.ShowFigureEditorWindow(Earth3d.MainWindow.constellationsFigures); retry = false; } } } else { MessageBox.Show(Language.GetLocalizedText(516, "Name already exists, type a different name."), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope")); retry = true; } } else { return; } } while (retry); }
public void ShowFigureEditorWindow(Constellations figures) { if (figureEditor == null) { figureEditor = new ConstellationFigureEditor(); figureEditor.Owner = this; } Properties.Settings.Default.ShowConstellationFigures.TargetState = true; figureEditor.Figures = figures; ShowFiguresEditorWindow(); }
private void LoadCurrentFigures() { constellationsFigures = new Constellations("Default Figures", "http://www.worldwidetelescope.org/data/figures.txt", false, false); }
private void UpdateTargetInfo() { if (target != null) { this.constellationName.Text = Language.GetLocalizedText(280, "in ") + Constellations.FullName(target.Constellation); if (target.Magnitude != 0) { this.magnitudeValue.Text = target.Magnitude.ToString(); } else { this.magnitudeValue.Text = Language.GetLocalizedText(281, "n/a"); } this.thumbnail.Image = target.ThumbNail; this.classificationText.Text = FriendlyName(target.Classification.ToString()); if (target.Classification == Classification.Unidentified && target.StudyImageset != null) { if (target.StudyImageset.Projection == ProjectionType.Toast || target.StudyImageset.Projection == ProjectionType.Equirectangular || target.StudyImageset.Projection == ProjectionType.Mercator) { this.thumbnail.Image = UiTools.LoadThumbnailFromWeb(target.StudyImageset.ThumbnailUrl); switch (target.StudyImageset.DataSetType) { case ImageSetType.Earth: this.classificationText.Text = Language.GetLocalizedText(282, "Survey Imagery"); this.constellationName.Text = Language.GetLocalizedText(283, "of Earth"); break; case ImageSetType.Planet: this.classificationText.Text = Language.GetLocalizedText(282, "Survey Imagery"); this.constellationName.Text = Language.GetLocalizedText(284, "of Planet/Moon"); break; case ImageSetType.Sky: this.classificationText.Text = Language.GetLocalizedText(282, "Survey Imagery"); this.constellationName.Text = Language.GetLocalizedText(285, "for Full Sky"); break; case ImageSetType.Panorama: this.classificationText.Text = Language.GetLocalizedText(286, "Panorama"); this.constellationName.Text = ""; break; default: break; } this.raLabel.Visible = false; this.raText.Visible = false; this.decText.Visible = false; this.decLabel.Visible = false; this.distanceLabel.Visible = false; this.altText.Visible = false; this.azText.Visible = false; this.magnitudeLabel.Visible = false; this.magnitudeValue.Visible = false; this.distanceValue.Visible = false; this.altLabel.Visible = false; this.azLabel.Visible = false; this.riseText.Visible = false; this.riseLabel.Visible = false; this.setLabel.Visible = false; this.setText.Visible = false; this.transitLabel.Visible = false; this.transitText.Visible = false; this.creditsText.Top = altText.Top + 4; this.creditsText.Height = 106; this.creditsLink.Top = decText.Top + 2; this.imageCreditsText.Top = raText.Top; this.research.Visible = false; this.ShowObject.Visible = false; } else { this.classificationText.Text = Language.GetLocalizedText(287, "Study Imagery"); } } if (Earth3d.TouchKiosk) { research.Visible = false; } if (target.StudyImageset != null) { ShowImageCredits(target.StudyImageset); } else if (target.BackgroundImageSet != null) { ShowImageCredits(target.BackgroundImageSet); } else { ShowImageCredits(Earth3d.MainWindow.CurrentImageSet); } bool first = true; nameValues.Text = ""; foreach (string name in target.Names) { if (!first) { nameValues.Text += "; "; } first = false; nameValues.Text += name; } nameValues.Select(); UpdateLiveValues(); } }
public SearchCriteria(string searchString) { searchString = searchString.Trim().ToLower(); Target = searchString; MagnitudeMin = -100.0; MagnitudeMax = 100.0; List <string> keywords = new List <string>(searchString.ToLower().Split(new char[] { ' ' })); if (keywords.Count > 1) { for (int i = keywords.Count - 1; i > -1; i--) { if (keywords[i] == ">" && i > 0 && i < keywords.Count - 1) { if (keywords[i - 1] == "m" || keywords[i - 1] == "mag" || keywords[i - 1] == "magnitude") { try { MagnitudeMin = Convert.ToDouble(keywords[i + 1]); } catch { } keywords.RemoveAt(i + 1); keywords.RemoveAt(i); keywords.RemoveAt(i - 1); i -= 2; continue; } } if (keywords[i] == "<" && i > 0 && i < keywords.Count - 2) { if (keywords[i - 1] == "m" || keywords[i - 1] == "mag" || keywords[i - 1] == "magnitude") { try { MagnitudeMax = Convert.ToDouble(keywords[i + 1]); } catch { } keywords.RemoveAt(i + 1); keywords.RemoveAt(i); keywords.RemoveAt(i - 1); i -= 2; continue; } } bool brokeOut = false; foreach (string classId in Enum.GetNames(typeof(Classification))) { if (keywords[i] == classId.ToLower()) { Classification |= (Classification)Enum.Parse(typeof(Classification), classId); keywords.RemoveAt(i); brokeOut = true; break; } } if (brokeOut) { continue; } if (Constellations.Abbreviations.ContainsKey(keywords[i].ToUpper())) { Constellation = keywords[i].ToUpper(); keywords.RemoveAt(i); continue; } if (Constellations.FullNames.ContainsKey(keywords[i].ToUpper())) { Constellation = Constellations.Abbreviation(keywords[i].ToUpper()); keywords.RemoveAt(i); continue; } } //keywords.Add(searchString); Keywords = keywords; string spacer = ""; Target = ""; foreach (string keyword in Keywords) { Target += spacer + keyword; spacer = " "; } } else { Keywords = null; } if (Classification == 0) { Classification = Classification.Unfiltered; } }