public string GenerateMainIndex(HashSet <string> countries, int sy, int ey) { StringBuilder sb = new StringBuilder(); sb.Append("<html><head></title>Vaisnava calendars</title></head>"); sb.Append("<body>"); if (sy != ey) { sb.AppendLine("<h1>All Years</h1>"); sb.AppendLine("<p>"); for (int y = sy; y <= ey; y++) { if (y > sy) { sb.AppendLine(" | "); } sb.AppendFormat("<a href=\"{1}\">{0}</a> ", y, "y" + y.ToString() + ".html"); } sb.AppendLine("</p>"); sb.AppendLine("<hr>"); } foreach (string s in countries) { sb.AppendLine("<h1>" + s + "</h1>"); sb.AppendLine("<hr>"); foreach (TLocation loc in SelectedLocations) { if (loc.Country.Name.Equals(s)) { if (sy == ey) { sb.Append("<p>"); sb.AppendFormat("<a href=\"{1}\">{0} {2}</a> ", loc.CityName, sy.ToString() + "_" + ToFilePart(loc.CityName) + ".html", sy); sb.AppendFormat(" | <a href=\"{1}\">{0} {2} (Full)</a>", loc.CityName, sy.ToString() + "_" + ToFilePart(loc.CityName) + "_d.html", sy); sb.AppendFormat(" | <a href=\"{1}\">{0} {2} (PDF)</a>", loc.CityName, sy.ToString() + "_" + ToFilePart(loc.CityName) + ".pdf", sy); sb.AppendFormat(" {0} {1}", GCEarthData.GetTextLatitude(loc.Latitude), GCEarthData.GetTextLongitude(loc.Longitude)); sb.Append("</p>\n"); } else { sb.AppendFormat("<p><a href=\"{1}\">{0} {2}-{3}</a> {4} {5}</p>\n", loc.CityName, ToFilePart(loc.CityName) + ".html", sy, ey, GCEarthData.GetTextLatitude(loc.Latitude), GCEarthData.GetTextLongitude(loc.Longitude)); } } } } sb.Append("</body>"); sb.Append("</html>"); return(sb.ToString()); }
public void setLocation(TLocation selloc) { SelectedLocation = selloc; TCountry findCountry = (PrefferedCountry is TCountry ? PrefferedCountry as TCountry : null); comboBox1.BeginUpdate(); foreach (TCountry ct in TCountry.Countries) { comboBox1.Items.Add(ct); } comboBox1.Sorted = true; comboBox1.EndUpdate(); comboBox2.BeginUpdate(); foreach (TTimeZone tz in TTimeZone.TimeZoneList) { comboBox2.Items.Add(tz); } comboBox2.EndUpdate(); if (SelectedLocation == null) { textBox1.Text = "<new location>"; textBox2.Text = "12N50"; textBox3.Text = "50W13"; comboBox1.SelectedIndex = 0; comboBox2.SelectedIndex = 0; } else { textBox1.Text = SelectedLocation.CityName; for (int i = 0; i < comboBox1.Items.Count; i++) { TCountry tc = comboBox1.Items[i] as TCountry; if (tc.Name.Equals(SelectedLocation.Country.Name)) { comboBox1.SelectedIndex = i; break; } } textBox2.Text = GCEarthData.GetTextLatitude(SelectedLocation.Latitude); textBox3.Text = GCEarthData.GetTextLongitude(SelectedLocation.Longitude); for (int j = 0; j < comboBox2.Items.Count; j++) { TTimeZone tz = comboBox2.Items[j] as TTimeZone; if (tz.Name.Equals(SelectedLocation.TimeZoneName)) { comboBox2.SelectedIndex = j; break; } } } }
private void AddLocationToListView(TLocation loc) { ListViewItem lvi = new ListViewItem(loc.CityName); lvi.SubItems.Add(loc.Country.Name); lvi.SubItems.Add(GCEarthData.GetTextLatitude(loc.Latitude)); lvi.SubItems.Add(GCEarthData.GetTextLongitude(loc.Longitude)); lvi.SubItems.Add(TTimeZone.GetTimeZoneOffsetText(loc.TimeZone.OffsetMinutes / 60.0)); lvi.Tag = loc; listView1.Items.Add(lvi); }
private ListViewItem ListItemFromLocation(TLocation L) { ListViewItem lvi = new ListViewItem(L.CityName); lvi.SubItems.Add(L.Country.Name); lvi.SubItems.Add(GCEarthData.GetTextLatitude(L.Latitude)); lvi.SubItems.Add(GCEarthData.GetTextLongitude(L.Longitude)); lvi.SubItems.Add(L.TimeZoneName); lvi.Tag = L; return(lvi); }
public string GenerateYearIndex(TLocation loc, int sy, int ey) { StringBuilder sb = new StringBuilder(); sb.Append("<html><head></title>Vaisnava calendars</title></head>"); sb.Append("<body>"); sb.AppendLine("<h1>" + loc.CityName + " (" + loc.Country.Name + ")" + "</h1>"); sb.AppendFormat("<p>{0} {1}</p>", GCEarthData.GetTextLatitude(loc.Latitude), GCEarthData.GetTextLongitude(loc.Longitude)); sb.AppendLine("<hr>"); sb.AppendLine("<h2>Text (Brief)</h2>"); sb.AppendLine("<p>"); for (int y = sy; y <= ey; y++) { if (y > sy) { sb.AppendLine(" | "); } sb.AppendFormat("<a href=\"{1}\">{0}</a> ", y, y.ToString() + "_" + ToFilePart(loc.CityName) + ".html", sy); } sb.AppendLine("</p>"); sb.AppendLine("<hr>"); sb.AppendLine("<h2>Text (Full)</h2>"); sb.AppendLine("<p>"); for (int y = sy; y <= ey; y++) { if (y > sy) { sb.AppendLine(" | "); } sb.AppendFormat("<a href=\"{1}\">{0}</a> ", y, y.ToString() + "_" + ToFilePart(loc.CityName) + "_d.html", sy); } sb.AppendLine("</p>"); sb.AppendLine("<hr>"); sb.AppendLine("<h2>PDF</h2>"); sb.AppendLine("<p>"); for (int y = sy; y <= ey; y++) { if (y > sy) { sb.AppendLine(" | "); } sb.AppendFormat("<a href=\"{1}\">{0}</a> ", y, y.ToString() + "_" + ToFilePart(loc.CityName) + ".pdf", sy); } sb.AppendLine("</p>"); sb.Append("</body>"); sb.Append("</html>"); return(sb.ToString()); }
private static void TestAscendant() { GCEarthData earth = new GCEarthData(); earth.latitudeDeg = 48.133; earth.longitudeDeg = 17.1; GregorianDateTime gt = new GregorianDateTime(2016, 9, 26); gt.shour = 0.0; gt.TimezoneHours = 2.0; for (int i = 0; i < 144; i++) { double d = earth.GetAscendantDegrees(gt.GetJulianDetailed()); Debugger.Log(0, "", string.Format("{0} {1} {2}\n", gt.ToString(), gt.LongTimeString(), d)); gt.shour += 10 / 1440.0; } }
private static void TestHouses(StringBuilder sb) { GregorianDateTime g = new GregorianDateTime(2016, 9, 1); g.shour = 0.0; g.TimezoneHours = 0.0; GCEarthData earth = GCGlobal.myLocation.GetEarthData(); GCEarth e = new GCEarth(); sb.AppendLine(string.Format("{0,12} {1,8} {2,-15} ", "Date", "Time", "Julian")); sb.AppendLine("---------------------------------------------------------------------------------------"); for (int i = 0; i < 400; i++) { double jd = g.GetJulianComplete(); double t = (jd - 2451545) / 365250; double sl1 = GCCoreAstronomy.GetSunLongitude(g, earth); double el, eb, er; GCEarth.Calculate(jd, out el, out eb, out er); double rl, rb, rr; GCRahu.Calculate(jd, out rl, out rb, out rr); double ml, mb, mr; GCMoonData.Calculate(jd, out ml, out mb, out mr); double ay = GCAyanamsha.GetAyanamsa(jd); sb.AppendLine(string.Format("{0,12} {1,8} {2,-15:F6}", g.ToString(), g.LongTime, jd)); sb.AppendLine(); for (int j = 5; j < 6; j++) { GCVSOPAstronomy.GetGeocentricCoordinates(j, jd, out rl, out rb, out rr); sb.AppendLine(string.Format(" {0,14} {1:F6}", GCStrings.GetPlanetNameEn(j), rl)); } sb.AppendLine(); g.AddHours(24); } File.WriteAllText("d:\\Temp\\gcaltest.txt", sb.ToString()); }