public ConstellationFilter Clone() { ConstellationFilter newFilter = new ConstellationFilter(); newFilter.Clone(this); return(newFilter); }
static Constellations() { try { if (!Directory.Exists(Properties.Settings.Default.CahceDirectory)) { Directory.CreateDirectory(Properties.Settings.Default.CahceDirectory); } if (!Directory.Exists(Properties.Settings.Default.CahceDirectory + @"data")) { Directory.CreateDirectory(Properties.Settings.Default.CahceDirectory + @"data"); } ConstellationCentroids = new Dictionary <string, IPlace>(); DataSetManager.DownloadFile("http://www.worldwidetelescope.org/data/constellationNames_RADEC_EN.txt", Properties.Settings.Default.CahceDirectory + @"data\constellationNamesRADEC.txt", true, true); FullNames = new Dictionary <string, string>(); Abbreviations = new Dictionary <string, string>(); PictureBlendStates = new Dictionary <string, BlendState>(); int id = 0; StreamReader sr = new StreamReader(Properties.Settings.Default.CahceDirectory + @"data\constellationNamesRADEC.txt"); string line; while (sr.Peek() >= 0) { line = sr.ReadLine(); string[] data = line.Split(new char[] { ',' }); ConstellationFilter.BitIDs.Add(data[1], id++); PictureBlendStates.Add(data[1], new BlendState(false, 1000, 0)); ConstellationCentroids.Add(data[1], new TourPlace(data[0], Convert.ToDouble(data[3]), Convert.ToDouble(data[2]), Classification.Constellation, data[1], ImageSetType.Sky, 360)); } sr.Close(); ConstellationNamePositions = new Dictionary <string, IPlace>(); DataSetManager.DownloadFile("http://www.worldwidetelescope.org/wwtweb/catalog.aspx?q=ConstellationNamePositions_EN", Properties.Settings.Default.CahceDirectory + @"data\ConstellationNamePositions.txt", true, true); sr = new StreamReader(Properties.Settings.Default.CahceDirectory + @"data\ConstellationNamePositions.txt"); while (sr.Peek() >= 0) { line = sr.ReadLine(); string[] data = line.Split(new char[] { ',' }); ConstellationNamePositions.Add(data[1], new TourPlace(data[0], Convert.ToDouble(data[3]), Convert.ToDouble(data[2]), Classification.Constellation, data[1], ImageSetType.Sky, 360)); } sr.Close(); string path = ArtworkPath; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } DataSetManager.DownloadFile("http://www.worldwidetelescope.org/wwtweb/catalog.aspx?W=hevelius", ArtworkPath + "default.wtml", false, true); AddAllNameMappings(); ConstellationFilter.InitSets(); } catch { } }
public SettingParameter(bool edgeTrigger, double opacity, bool targetState, ConstellationFilter filter) { EdgeTrigger = edgeTrigger; Opacity = opacity; TargetState = targetState; Filter = filter; Animated = false; }
public void Remove(ConstellationFilter filter) { SaveBits(); for (int i = 0; i < 3; i++) { Bits[i] = Bits[i] & ~filter.Bits[i]; } CheckChanged(); }
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { if (value is string) { ConstellationFilter cf = ConstellationFilter.Parse(value as string); cf.SettingsOwned = true; return(cf); } return(base.ConvertFrom(context, culture, value)); }
public SettingsAnimator(StockSkyOverlayTypes type) { settingsType = type; SettingParameter sp = Settings.Ambient.GetSetting(settingsType); constant = sp.EdgeTrigger; if (sp.Filter != null) { filter = sp.Filter.Clone(); } }
public static void InitSets() { ConstellationFilter all = AllConstellation; all.Internal = true; Families.Add("AllConstellation", all); Families.Add("Zodiacal", Zodiacal); Families.Add("Ursa Major Family", UrsaMajorFamily); Families.Add("Perseus Family", PerseusFamily); Families.Add("Hercules Family", HerculesFamily); Families.Add("Orion Family", OrionFamily); Families.Add("Heavenly Waters", HeavenlyWaters); Families.Add("Bayer Family", BayerFamily); Families.Add("La Caille Family", LaCaileFamily); LoadCustomFilters(); }
public static ConstellationFilter Parse(string val) { string[] parts = ((string)val).Split(new char[] { ',' }); ConstellationFilter cf = new ConstellationFilter(); try { for (int i = 0; i < 3; i++) { cf.Bits[i] = Int32.Parse(parts[i]); } } catch { } return(cf); }
public static void LoadCustomFilters() { string savedFilders = AppSettings.SettingsBase["SavedFilters"].ToString(); string[] lines = savedFilders.Split(new char[] { '\n' }); foreach (string line in lines) { try { string[] parts = line.Split(new char[] { ';' }); if (parts.Length > 1) { ConstellationFilter filter = ConstellationFilter.Parse(parts[1]); Families.Add(parts[0], filter); } } catch { } } }
public SettingParameter GetSetting(StockSkyOverlayTypes type) { bool edgeTrigger = false; double opacity = 0; bool targetState = false; ConstellationFilter filter = null; switch (type) { case StockSkyOverlayTypes.EquatorialGrid: opacity = Properties.Settings.Default.ShowGrid.Opacity; targetState = Properties.Settings.Default.ShowGrid.TargetState; break; case StockSkyOverlayTypes.EquatorialGridText: opacity = Properties.Settings.Default.ShowEquatorialGridText.Opacity; targetState = Properties.Settings.Default.ShowEquatorialGridText.TargetState; break; case StockSkyOverlayTypes.GalacticGrid: opacity = Properties.Settings.Default.ShowGalacticGrid.Opacity; targetState = Properties.Settings.Default.ShowGalacticGrid.TargetState; break; case StockSkyOverlayTypes.GalacticGridText: opacity = Properties.Settings.Default.ShowGalacticGridText.Opacity; targetState = Properties.Settings.Default.ShowGalacticGridText.TargetState; break; case StockSkyOverlayTypes.EclipticGrid: opacity = Properties.Settings.Default.ShowEclipticGrid.Opacity; targetState = Properties.Settings.Default.ShowEclipticGrid.TargetState; break; case StockSkyOverlayTypes.EclipticGridText: opacity = Properties.Settings.Default.ShowEclipticGridText.Opacity; targetState = Properties.Settings.Default.ShowEclipticGridText.TargetState; break; case StockSkyOverlayTypes.EclipticOverview: opacity = Properties.Settings.Default.ShowEcliptic.Opacity; targetState = Properties.Settings.Default.ShowEcliptic.TargetState; break; case StockSkyOverlayTypes.EclipticOverviewText: opacity = Properties.Settings.Default.ShowEclipticOverviewText.Opacity; targetState = Properties.Settings.Default.ShowEclipticOverviewText.TargetState; break; case StockSkyOverlayTypes.PrecessionChart: opacity = Properties.Settings.Default.ShowPrecessionChart.Opacity; targetState = Properties.Settings.Default.ShowPrecessionChart.TargetState; break; case StockSkyOverlayTypes.AltAzGrid: opacity = Properties.Settings.Default.ShowAltAzGrid.Opacity; targetState = Properties.Settings.Default.ShowAltAzGrid.TargetState; break; case StockSkyOverlayTypes.AltAzGridText: opacity = Properties.Settings.Default.ShowAltAzGridText.Opacity; targetState = Properties.Settings.Default.ShowAltAzGridText.TargetState; break; case StockSkyOverlayTypes.ConstellationFigures: opacity = Properties.Settings.Default.ShowConstellationFigures.Opacity; targetState = Properties.Settings.Default.ShowConstellationFigures.TargetState; filter = Properties.Settings.Default.ConstellationFiguresFilter.Clone(); break; case StockSkyOverlayTypes.ConstellationBoundaries: opacity = Properties.Settings.Default.ShowConstellationBoundries.Opacity; targetState = Properties.Settings.Default.ShowConstellationBoundries.TargetState; filter = Properties.Settings.Default.ConstellationBoundariesFilter.Clone(); break; case StockSkyOverlayTypes.ConstellationFocusedOnly: opacity = Properties.Settings.Default.ShowConstellationSelection.Opacity; targetState = Properties.Settings.Default.ShowConstellationSelection.TargetState; break; case StockSkyOverlayTypes.ConstellationNames: opacity = Properties.Settings.Default.ShowConstellationLabels.Opacity; targetState = Properties.Settings.Default.ShowConstellationLabels.TargetState; filter = Properties.Settings.Default.ConstellationNamesFilter.Clone(); break; case StockSkyOverlayTypes.ConstellationPictures: opacity = Properties.Settings.Default.ShowConstellationPictures.Opacity; targetState = Properties.Settings.Default.ShowConstellationPictures.TargetState; filter = Properties.Settings.Default.ConstellationArtFilter.Clone(); break; case StockSkyOverlayTypes.SkyGrids: opacity = Properties.Settings.Default.ShowSkyGrids.Opacity; targetState = Properties.Settings.Default.ShowSkyGrids.TargetState; break; case StockSkyOverlayTypes.Constellations: opacity = Properties.Settings.Default.Constellations.Opacity; targetState = Properties.Settings.Default.Constellations.TargetState; break; case StockSkyOverlayTypes.SolarSystemStars: opacity = Properties.Settings.Default.SolarSystemStars.Opacity; targetState = Properties.Settings.Default.SolarSystemStars.TargetState; break; case StockSkyOverlayTypes.SolarSystemMilkyWay: opacity = Properties.Settings.Default.SolarSystemMilkyWay.Opacity; targetState = Properties.Settings.Default.SolarSystemMilkyWay.TargetState; break; case StockSkyOverlayTypes.SolarSystemCosmos: opacity = Properties.Settings.Default.SolarSystemCosmos.Opacity; targetState = Properties.Settings.Default.SolarSystemCosmos.TargetState; break; case StockSkyOverlayTypes.SolarSystemCMB: opacity = Properties.Settings.Default.SolarSystemCMB.Opacity; targetState = Properties.Settings.Default.SolarSystemCMB.TargetState; break; case StockSkyOverlayTypes.SolarSystemOrbits: opacity = Properties.Settings.Default.SolarSystemOrbits.Opacity; targetState = Properties.Settings.Default.SolarSystemOrbits.TargetState; break; case StockSkyOverlayTypes.OrbitFilters: opacity = Properties.Settings.Default.PlanetOrbitsFilter; targetState = Properties.Settings.Default.PlanetOrbitsFilter != 0; edgeTrigger = true; break; case StockSkyOverlayTypes.SolarSystemPlanets: opacity = Properties.Settings.Default.SolarSystemPlanets.Opacity; targetState = Properties.Settings.Default.SolarSystemPlanets.TargetState; break; case StockSkyOverlayTypes.SolarSystemAsteroids: opacity = Properties.Settings.Default.SolarSystemMinorPlanets.Opacity; targetState = Properties.Settings.Default.SolarSystemMinorPlanets.TargetState; break; case StockSkyOverlayTypes.MPCZone1: case StockSkyOverlayTypes.MPCZone2: case StockSkyOverlayTypes.MPCZone3: case StockSkyOverlayTypes.MPCZone4: case StockSkyOverlayTypes.MPCZone5: case StockSkyOverlayTypes.MPCZone6: case StockSkyOverlayTypes.MPCZone7: { int id = (int)type - (int)StockSkyOverlayTypes.MPCZone1; int bit = (int)Math.Pow(2, id); targetState = (Properties.Settings.Default.MinorPlanetsFilter & bit) != 0; opacity = targetState ? 1 : 0; edgeTrigger = true; } break; case StockSkyOverlayTypes.SolarSystemLighting: opacity = Properties.Settings.Default.SolarSystemLighting ? 1 : 0; targetState = Properties.Settings.Default.SolarSystemLighting; break; case StockSkyOverlayTypes.ShowISSModel: opacity = Properties.Settings.Default.ShowISSModel ? 1 : 0; targetState = Properties.Settings.Default.ShowISSModel; break; case StockSkyOverlayTypes.SolarSystemMinorOrbits: opacity = Properties.Settings.Default.SolarSystemMinorOrbits.Opacity; targetState = Properties.Settings.Default.SolarSystemMinorOrbits.TargetState; break; case StockSkyOverlayTypes.ShowEarthCloudLayer: opacity = Properties.Settings.Default.ShowClouds.Opacity; targetState = Properties.Settings.Default.ShowClouds.TargetState; break; case StockSkyOverlayTypes.ShowElevationModel: opacity = Properties.Settings.Default.ShowElevationModel ? 1 : 0; targetState = Properties.Settings.Default.ShowElevationModel; break; case StockSkyOverlayTypes.MultiResSolarSystemBodies: opacity = Properties.Settings.Default.SolarSystemMultiRes ? 1 : 0; targetState = Properties.Settings.Default.SolarSystemMultiRes; break; case StockSkyOverlayTypes.EarthCutAway: opacity = Properties.Settings.Default.EarthCutawayView.Opacity; targetState = Properties.Settings.Default.EarthCutawayView.TargetState; break; case StockSkyOverlayTypes.ShowSolarSystem: opacity = Properties.Settings.Default.ShowSolarSystem.Opacity; targetState = Properties.Settings.Default.ShowSolarSystem.TargetState; break; case StockSkyOverlayTypes.Clouds8k: opacity = Properties.Settings.Default.CloudMap8k ? 1 : 0; targetState = Properties.Settings.Default.CloudMap8k; break; case StockSkyOverlayTypes.FiledOfView: opacity = Properties.Settings.Default.ShowFieldOfView.Opacity; targetState = Properties.Settings.Default.ShowFieldOfView.TargetState; break; case StockSkyOverlayTypes.FadeToBlack: opacity = Earth3d.MainWindow.Fader.Opacity; targetState = Earth3d.MainWindow.Fader.TargetState; break; default: return(new SettingParameter(false, -1, false, null)); } return(new SettingParameter(edgeTrigger, opacity, targetState, filter)); }
public ConstellationFilter Clone() { ConstellationFilter newFilter = new ConstellationFilter(); newFilter.Clone(this); return newFilter; }
public static ConstellationFilter Parse(string val) { var parts = val.Split(new[] { ',' }); var cf = new ConstellationFilter(); try { for (var i = 0; i < 3; i++) { cf.Bits[i] = Int32.Parse(parts[i]); } } catch { } return cf; }
private void AddFilters(List<LayerUITreeNode> nodes, StockSkyOverlay so, ConstellationFilter filter) { var filterNode = new LayerUITreeNode(); filterNode.Name = Language.GetLocalizedText(1115, "Filter"); filterNode.Tag = filter; filterNode.Checked = true; filterNode.NodeSelected += filterNode_NodeSelected; filterNode.NodeChecked += filterNode_NodeChecked; nodes.Add(filterNode); AddConstellationParts(filterNode, ConstellationFilter.AllConstellation); }
private void AddConstellationParts(LayerUITreeNode filterNode, ConstellationFilter constellationFilter) { foreach (var kv in ConstellationFilter.BitIDs) { if (constellationFilter.IsSet(kv.Key)) { var constellationNodes = filterNode.Add(Constellations.FullName(kv.Key)); constellationNodes.Tag = filterNode.Tag; constellationNodes.Checked = true; constellationNodes.NodeSelected += constellationNodes_NodeSelected; constellationNodes.NodeChecked += constellationNodes_NodeChecked; constellationNodes.IsChecked += constellationNodes_IsChecked; } } }
public static ConstellationFilter Parse(string val) { string[] parts = ((string)val).Split(new char[] { ',' }); ConstellationFilter cf = new ConstellationFilter(); try { for (int i = 0; i < 3; i++) { cf.Bits[i] = Int32.Parse(parts[i]); } } catch { } return cf; }
public void Combine(ConstellationFilter filter) { SaveBits(); for (var i = 0; i < 3; i++) { Bits[i] = Bits[i] | filter.Bits[i]; } CheckChanged(); }
private void AddConstellationParts(LayerUITreeNode filterNode, ConstellationFilter constellationFilter) { foreach (KeyValuePair<string, int> kv in ConstellationFilter.BitIDs) { if (constellationFilter.IsSet(kv.Key)) { LayerUITreeNode constellationNodes = filterNode.Add(Constellations.FullName(kv.Key)); constellationNodes.Tag = filterNode.Tag; constellationNodes.Checked = true; constellationNodes.NodeSelected += new LayerUITreeNodeSelectedDelegate(constellationNodes_NodeSelected); constellationNodes.NodeChecked += new LayerUITreeNodeCheckedDelegate(constellationNodes_NodeChecked); constellationNodes.IsChecked += new LayerUITreeNodeIsCheckedDelegate(constellationNodes_IsChecked); } } }