public SkyLabel(RenderContext11 renderContext, Vector3d point, string text, LabelSytle style) { Text = text; Style = style; if (texture == null) { texture = Texture11.FromBitmap(Properties.Resources.circle, 0); } pos = point; center = new Vector3(9, 9, 0); textBatch = new Text3dBatch(80); if (style == LabelSytle.Telrad) { // Telrad-style labels are always screen-aligned Text3d t3 = new Text3d(new Vector3d(0, 0, 0.1), new Vector3d(0, 1, 0), text, 20, .01); t3.alignment = Text3d.Alignment.Left; textBatch.Add(t3); } else { // This will produce sky or orbit aligned text textBatch.Add(new Text3d(pos, new Vector3d(0, 1, 0), text, 20, .01)); } }
public SkyLabel(RenderContext11 renderContext, double ra, double dec, string text, LabelSytle style, double distance) { RA = ra; Dec = dec; Text = text; Style = style; Distance = distance; if (texture == null) { texture = Texture11.FromBitmap(Properties.Resources.circle, 0); } Vector3d up = new Vector3d(); Vector3d textPos = new Vector3d(); if (Earth3d.MainWindow.SolarSystemMode) { pos = Coordinates.RADecTo3d(ra, -dec, distance); up = Coordinates.RADecTo3d(ra, -dec + 90, distance); pos.RotateX(Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow) / 180.0 * Math.PI); pos.Add(Planets.GetPlanet3dLocation(SolarSystemObjects.Earth)); up.RotateX(Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow) / 180.0 * Math.PI); up.Add(Planets.GetPlanet3dLocation(SolarSystemObjects.Earth)); } else { pos = Coordinates.RADecTo3d(ra + 12, dec, distance); textPos = Coordinates.RADecTo3d(ra + 12, dec + 2, distance); up = Coordinates.RADecTo3d(ra + 12, dec + 92, distance); } center = new Vector3(9, 9, 0); textBatch = new Text3dBatch(24); if (style == LabelSytle.Telrad) { // Telrad-style labels are always screen-aligned Text3d t3 = new Text3d(new Vector3d(0, 0, 0.1), new Vector3d(0, 1, 0), text, 20, .01); t3.alignment = Text3d.Alignment.Left; textBatch.Add(t3); } else { up.Normalize(); textPos.Normalize(); textBatch.Add(new Text3d(textPos, up, text, 20, .0005)); } }
public static void InitializeConstellationNames() { NamesBatch = new Text3dBatch(80); foreach (IPlace centroid in ConstellationNamePositions.Values) { Vector3d center = Coordinates.RADecTo3d(centroid.RA + 12, centroid.Dec, 1); Vector3d up = new Vector3d(0, 1, 0); string name = centroid.Name; name = FullNames[centroid.Constellation]; if (centroid.Name == "Triangulum Australe") { name = name.Replace(" ", "\n "); } NamesBatch.Add(new Text3d(center, up, name, 80, .000125)); } }
public SkyLabel(RenderContext11 renderContext, Vector3d point, string text, LabelSytle style) { Text = text; Style = style; if (texture == null) { texture = Texture11.FromBitmap(Resources.circle, 0); } pos = point; center = new Vector3(9, 9, 0); textBatch = new Text3dBatch(80); if (style == LabelSytle.Telrad) { // Telrad-style labels are always screen-aligned var t3 = new Text3d(new Vector3d(0, 0, 0.1), new Vector3d(0, 1, 0), text, 20, .01); t3.alignment = Text3d.Alignment.Left; textBatch.Add(t3); } else { // This will produce sky or orbit aligned text textBatch.Add(new Text3d(pos, new Vector3d(0,1,0), text, 20, .01)); } }
public SkyLabel(RenderContext11 renderContext, double ra, double dec, string text, LabelSytle style, double distance) { RA = ra; Dec = dec; Text = text; Style = style; Distance = distance; if (texture == null) { texture = Texture11.FromBitmap(Resources.circle, 0); } var up = new Vector3d(); var textPos = new Vector3d(); if (Earth3d.MainWindow.SolarSystemMode) { pos = Coordinates.RADecTo3d(ra, -dec, distance); up = Coordinates.RADecTo3d(ra, -dec + 90, distance); pos.RotateX(Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow) / 180.0 * Math.PI); pos.Add(Planets.GetPlanet3dLocation(SolarSystemObjects.Earth)); up.RotateX(Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow) / 180.0 * Math.PI); up.Add(Planets.GetPlanet3dLocation(SolarSystemObjects.Earth)); } else { pos = Coordinates.RADecTo3d(ra+12, dec, distance); textPos = Coordinates.RADecTo3d(ra + 12, dec + 2, distance); up = Coordinates.RADecTo3d(ra+12, dec + 92, distance); } center = new Vector3(9, 9, 0); textBatch = new Text3dBatch(24); if (style == LabelSytle.Telrad) { // Telrad-style labels are always screen-aligned var t3 = new Text3d(new Vector3d(0, 0, 0.1), new Vector3d(0, 1, 0), text, 20, .01); t3.alignment = Text3d.Alignment.Left; textBatch.Add(t3); } else { up.Normalize(); textPos.Normalize(); textBatch.Add(new Text3d(textPos, up, text, 20, .0005)); } }
// TEXT WKT like syntax // // Text("String to Display", sizeInDegrees, lat lng alt, rotation tilt bank) private void ParseTextString(string parens, string mods, Color lineColor, Color polyColor, double alt, Dates date) { if (!parens.StartsWith("(") && parens.EndsWith(")")) { return; } try { parens = parens.Substring(1, parens.Length - 2); var parts = UiTools.SplitString(parens, ','); if (textBatch == null) { textBatch = new Text3dBatch(); } var text = parts[0]; double rawSize = float.Parse(parts[1].Trim()); var textSize = (float)(.00012f * rawSize); // Test to compare angle vs est angle. //double textAngle = 2 * Math.Tan(((rawSize/180)*Math.PI) /2); var lla = parts[2].Trim().Split(new[] { ' ' }); var lat = double.Parse(lla[1]); var lng = double.Parse(lla[0]); if (astronomical && bufferIsFlat) { lng -= 180; } var altitude = alt == 0 ? 1 : alt; if (lla.Length > 2) { altitude = 1 + double.Parse(lla[2]) / (astronomical ? 1 : meanRadius); } if (alt == 0 && astronomical && !bufferIsFlat) { altitude = 1000 * UiTools.AuPerLightYear; textSize = (float)(textSize * altitude); } if (alt == 0 && astronomical && !bufferIsFlat) { altitude = 1000 * UiTools.AuPerLightYear; textSize = (float)(textSize * altitude); } var location = Coordinates.GeoTo3dDouble(lat, lng, altitude); var up = Coordinates.GeoTo3dDouble(lat + 90, lng, 1); double rotation = 0; double tilt = 0; double bank = 0; if (parts.Length > 3) { var rtb = parts[3].Trim().Split(new[] { ' ' }); rotation = double.Parse(rtb[0]); if (rtb.Length > 1) { tilt = double.Parse(rtb[1]); } if (rtb.Length > 2) { bank = double.Parse(rtb[2]); } } var text3d = new Text3d(location, up, text, astronomical ? 1 : -1, textSize); text3d.Color = polyColor; text3d.Rotation = rotation; text3d.Tilt = tilt; text3d.Bank = bank; textBatch.Add(text3d); } catch { } }
private void Earth3d_Load(object sender, System.EventArgs e) { CheckOSVersion(); string path = Properties.Settings.Default.ImageSetUrl; if (Properties.Settings.Default.ImageSetUrl.ToLower().Contains("imagesetsnew")) { Properties.Settings.Default.ImageSetUrl = "http://www.worldwidetelescope.org/wwtweb/catalog.aspx?X=ImageSets5"; } Earth3d.MainWindow = this; this.dsm = new DataSetManager(); Constellations.Containment = this.constellationCheck; ContextSearch.InitializeDatabase(true); LoadExploreRoot(); if (explorerRoot != null) { ContextSearch.AddFolderToSearch(explorerRoot, true); } ContextSearch.AddCatalogs(true); BackInitDelegate initBackground = SearchInit; initBackground.BeginInvoke(null, null); this.WindowState = FormWindowState.Maximized; this.FormBorderStyle = TouchKiosk ? FormBorderStyle.None : FormBorderStyle.Sizable; TileCache.StartQueue(); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); Earth3d.MainWindow.Config.DomeTilt = (float)Properties.Settings.Default.DomeTilt; if (ProjectorServer) { ShowFullScreen(true); this.timer.Interval = 1000; this.InputTimer.Enabled = false; Cursor.Hide(); Properties.Settings.Default.ShowCrosshairs = false; Properties.Settings.Default.SolarSystemMultiRes = true; NetControl.Start(); } else { if (Properties.Settings.Default.ListenMode || Settings.DomeView) { NetControl.Start(); } } if (Settings.MasterController) { NetControl.StartStatusListner(); } if (Settings.MasterController) { NetControl.LoadNodeList(); } if (Earth3d.TouchKiosk) { this.menuTabs.IsVisible = false; this.kioskTitleBar.Visible = true; Properties.Settings.Default.ShowTouchControls = true; ShowFullScreen(true); } if (NoUi) { this.menuTabs.IsVisible = false; Properties.Settings.Default.ShowTouchControls = true; ShowFullScreen(true); } Tile.GrayscaleStyle = Properties.Settings.Default.MonochromeImageStyle; // This forces a init at startup does not do anything but force the static contstuctor to fire now LayerManager.LoadTree(); listenUpBoysToolStripMenuItem.Checked = Properties.Settings.Default.ListenMode; int id = Properties.Settings.Default.StartUpLookAt; if (Properties.Settings.Default.StartUpLookAt == 5) { id = Properties.Settings.Default.LastLookAtMode; } if (Properties.Settings.Default.StartUpLookAt == 6) { Random rnd = new Random(); id = rnd.Next(-1, 5); Properties.Settings.Default.LastLookAtMode = id; } CurrentImageSet = GetDefaultImageset((ImageSetType)id, BandPass.Visible); Properties.Settings.Default.SettingChanging += new System.Configuration.SettingChangingEventHandler(Default_SettingChanging); Properties.Settings.Default.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(Default_PropertyChanged); if (Properties.Settings.Default.LocalHorizonMode) { viewType = ViewTypes.AltAz; } else { viewType = ViewTypes.Equatorial; } InitSpaceNavigator(); ReadyToRender = true; Refresh(); try { fov = new FieldOfView(Properties.Settings.Default.FovTelescope, Properties.Settings.Default.FovCamera, Properties.Settings.Default.FovEyepiece); } catch { } SpaceTimeController.Altitude = Properties.Settings.Default.LocationAltitude; SpaceTimeController.Location = Coordinates.FromLatLng(Properties.Settings.Default.LocationLat, Properties.Settings.Default.LocationLng); TourPlayer.TourEnded += new EventHandler(TourPlayer_TourEnded); if (KmlMarkers == null) { KmlMarkers = new KmlLabels(); } ReadyToRender = true; Initialized = true; this.Activate(); fadeImageSet.State = false; fadeImageSet.State = true; fadeImageSet.TargetState = false; // Force settings Properties.Settings.Default.ActualPlanetScale = true; Properties.Settings.Default.HighPercitionPlanets = true; Properties.Settings.Default.ShowMoonsAsPointSource = false; Properties.Settings.Default.ShowSolarSystem.TargetState = true; toolStripMenuItem2.Checked = Settings.MasterController; viewCamera.Target = SolarSystemObjects.Sun; if (!ProjectorServer) { webServer.Startup(); sampConnection = new Samp(); // Register goto SampMessageHandler.RegiseterMessage(new SampCoordPointAtSky(new CoordPointAtSkyDelegate(SampGoto))); SampMessageHandler.RegiseterMessage(new SampTableLoadVoTable(new TableLoadVoTableDelegate(SampLoadTable))); SampMessageHandler.RegiseterMessage(new SampImageLoadFits(new ImageLoadFitsDelegate(SampLoadFitsImage))); SampMessageHandler.RegiseterMessage(new SampTableHighlightRow(new TableHighlightRowDelegate(SampHighlightRow))); NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged); MidiMapManager.Startup(); } Fader.TargetState = false; hold = new Text3dBatch(80); hold.Add(new Text3d(new Vector3d(0, 0, 1), new Vector3d(0, 1, 0), " 0hr123456789-+", 80, .0001f)); hold.Add(new Text3d(new Vector3d(0, 0, 1), new Vector3d(0, 1, 0), "JanuyFebMcApilg", 80, .0001f)); hold.Add(new Text3d(new Vector3d(0, 0, 1), new Vector3d(0, 1, 0), "stSmOoNvDBCEdqV", 80, .0001f)); hold.Add(new Text3d(new Vector3d(0, 0, 1), new Vector3d(0, 1, 0), "jxGHILPRTU", 80, .0001f)); hold.PrepareBatch(); Constellations.InitializeConstellationNames(); if (Properties.Settings.Default.ShowClientNodeList && !ProjectorServer) { ClientNodeList.ShowNodeList(); } if (DetachScreenId > -1) { FreeFloatRenderWindow(DetachScreenId); } if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.RefreshToken)) { WindowsLiveSignIn(); } }
public static void CleanUpAll() { foreach(Constellations item in instances) { item.CleanUp(); } if (NamesBatch != null) { NamesBatch.Dispose(); GC.SuppressFinalize(NamesBatch); NamesBatch = null; } }