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 void Add(Text3d newItem) { Items.Add(newItem); }
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 { } }