/*********************************************************************/ /* Finds date of Pratipat, Krsna Paksa, Visnu Masa */ /* */ /* EARTHDATA earth - location */ /* int nYear - Gregorian year */ /* */ /*********************************************************************/ public static GPGregorianTime getFirstDayOfYear(GPLocationProvider earth, int nYear) { int[] a = new int[] { 2, 15, 3, 1, 3, 15, 4, 1, 4, 15 }; GPGregorianTime d = new GPGregorianTime(earth); GPAstroData day = new GPAstroData(); int gy, j, masa; int step; uint tmp; if (nYear >= 1950 && nYear < 2058) { tmp = gGaurBeg[(nYear - 1950) * 26 + 22]; d.setDate(nYear, Convert.ToInt32(tmp & 0x3e0) >> 5, Convert.ToInt32(tmp & 0x1f)); d.NextDay(); a[0] = d.getMonth(); a[1] = d.getDay(); } for (int i = 0; i < 10; i += 2) { d.setDate(nYear, a[i], a[i + 1]); day.calculateDayData(d, earth); masa = day.determineMasa(d, out gy); if (masa == 11) // visnu masa { do { // shifts date step = day.nTithi / 2; step = (step > 0) ? step : 1; for (j = step; j > 0; j--) { d.PreviousDay(); } // try new time day.calculateDayData(d, earth); }while (day.nTithi < 28); d.NextDay(); d.setDayHours(day.sun.getSunriseDayHours()); return(d); } } d.Clear(); d.setDayHours(day.sun.getSunriseDayHours()); return(d); }
public static int getGaurabdaYear(GPGregorianTime vc, GPLocationProvider earth) { GPAstroData day = new GPAstroData(); int n; day.calculateDayData(vc, earth); day.determineMasa(vc, out n); return(n); }
//=========================================================================== // //=========================================================================== public static void VCTIMEtoVATIME(GPGregorianTime vc, out GPVedicTime va, GPLocationProvider earth) { GPAstroData day = new GPAstroData(); va = new GPVedicTime(); day.calculateDayData(vc, earth); va.masa = day.determineMasa(vc, out va.gyear); va.tithi = day.nTithi; }
public static int WriteXML_Tithi(StringBuilder doc, GPLocationProvider loc, GPGregorianTime vc) { doc.Append("<xml>\n"); doc.Append("\t<request name=\"Tithi\" version=\"" + GPFileHelper.FileVersion + "\">\n"); doc.Append("\t\t<arg name=\"longitude\" val=\"" + vc.getLocation().GetLongitudeEastPositive() + "\" />\n"); doc.Append("\t\t<arg name=\"latitude\" val=\"" + vc.getLocation().GetLatitudeNorthPositive() + "\" />\n"); doc.Append("\t\t<arg name=\"timezone\" val=\"" + vc.getLocation().getTimeZone().OffsetSeconds / 60 + "\" />\n"); doc.Append("\t\t<arg name=\"startdate\" val=\"" + vc + "\" />\n"); doc.Append("\t</request>\n"); doc.Append("\t<result name=\"Tithi\">\n"); GPGregorianTime d = new GPGregorianTime(vc); GPGregorianTime d1 = new GPGregorianTime(loc); GPGregorianTime d2 = new GPGregorianTime(loc); GPAstroData day = new GPAstroData(); day.calculateDayData(vc, loc); d.setDayHours(day.sun.getSunriseDayHours()); GPTithi.GetPrevTithiStart(d, out d1); GPTithi.GetNextTithiStart(d, out d2); //dt.SetDegTime(d1.getDayHours() * 360); // start tithi at t[0] doc.Append("\t\t<tithi\n\t\t\tid=\"" + day.nTithi + "\"\n"); doc.Append("\t\t\tname=\"" + GPTithi.getName(day.nTithi) + "\"\n"); doc.Append("\t\t\tstartdate=\"" + d1.getShortDateString() + "\"\n"); doc.Append("\t\t\tstarttime=\"" + d1.getShortTimeString() + "\"\n"); //dt.SetDegTime(d2.getDayHours() * 360); doc.Append("\t\t\tenddate=\"" + d2.getShortDateString() + "\"\n"); doc.Append("\t\t\tendtime=\"" + d2.getShortTimeString() + "\"\n />"); doc.Append("\t</result>\n"); doc.Append("</xml>\n"); return(1); }
public static GPGregorianTime CalcTithiEndEx(GPGregorianTime vcStart, int GYear, int nMasa, int nPaksa, int nTithi, GPLocationProvider earth, out GPGregorianTime endTithi) { int i, gy, nType; GPGregorianTime d = new GPGregorianTime(earth); GPGregorianTime dtemp = new GPGregorianTime(earth); GPAstroData day = new GPAstroData(); int tithi; int counter; GPGregorianTime start = new GPGregorianTime(earth), end = new GPGregorianTime(earth); // SUNDATA sun; // MOONDATA moon; double sunrise; start.setDayHours(-1.0); end.setDayHours(-1.0); start.Clear(); end.Clear(); /* d = GetFirstDayOfYear(earth, nGYear + 1486); * d.shour = 0.5; * d.TimeZone = earth.tzone; */ d.Copy(vcStart); i = 0; do { d.AddDays(13); day.calculateDayData(d, earth); day.nMasa = day.determineMasa(d, out gy); day.nGaurabdaYear = gy; i++; }while (((day.nPaksa != nPaksa) || (day.nMasa != nMasa)) && (i <= 30)); if (i >= 30) { d.Clear(); endTithi = d; return(d); } // we found masa and paksa // now we have to find tithi tithi = nTithi + nPaksa * 15; if (day.nTithi == tithi) { // loc1 // find tithi juncts in this day and according to that times, // look in previous or next day for end and start of this tithi nType = 1; } else { if (day.nTithi < tithi) { // do increment of date until nTithi == tithi // but if nTithi > tithi // then do decrement of date counter = 0; while (counter < 30) { d.NextDay(); day.calculateDayData(d, earth); if (day.nTithi == tithi) { goto cont_2; } if ((day.nTithi < tithi) && (day.nPaksa != nPaksa)) { d.PreviousDay(); goto cont_2; } if (day.nTithi > tithi) { d.PreviousDay(); goto cont_2; } counter++; } // somewhere is error d.Clear(); nType = 0; } else { // do decrement of date until nTithi <= tithi counter = 0; while (counter < 30) { d.PreviousDay(); day.calculateDayData(d, earth); if (day.nTithi == tithi) { goto cont_2; } if ((day.nTithi > tithi) && (day.nPaksa != nPaksa)) { goto cont_2; } if (day.nTithi < tithi) { goto cont_2; } counter++; } // somewhere is error d.Clear(); nType = 0; } cont_2: if (day.nTithi == tithi) { // do the same as in loc1 nType = 1; } else { // nTithi != tithi and nTithi < tithi // but on next day is nTithi > tithi // that means we will find start and the end of tithi // in this very day or on next day before sunrise nType = 2; } } // now we know the type of day-accurancy // nType = 0 means, that we dont found a day // nType = 1 means, we find day, when tithi was present at sunrise // nType = 2 means, we found day, when tithi started after sunrise // but ended before next sunrise // sunrise = day.sun.getSunriseDayHours() / 360 + day.sun.rise.getLocation().getTimeZoneOffsetHours() / 24; if (nType == 1) { GPGregorianTime d1, d2; d.setDayHours(sunrise); GetPrevTithiStart(d, out d1); //d = d1; //d.shour += 0.02; GetNextTithiStart(d, out d2); endTithi = d2; return(d1); } else if (nType == 2) { GPGregorianTime d1, d2; d.setDayHours(sunrise); GetNextTithiStart(d, out d1); d.Copy(d1); d.addDayHours(0.1); GetNextTithiStart(d, out d2); endTithi = d2; return(d1); } // if nType == 0, then this algoritmus has some failure if (nType == 0) { d.Clear(); d.setDayHours(0.0); endTithi = d; } else { d.Copy(start); endTithi = end; } return(d); }
/*********************************************************************/ /* Calculates Date of given Tithi */ /*********************************************************************/ public static GPGregorianTime CalcTithiDate(int nGYear, int nMasa, int nPaksa, int nTithi, GPLocationProvider earth) { int i = 0, gy = 0; GPGregorianTime d = new GPGregorianTime(earth); GPAstroData day = new GPAstroData(); int tithi = 0; int counter = 0; uint tmp = 0; if (nGYear >= 464 && nGYear < 572) { tmp = GPGaurabdaYear.gGaurBeg[(nGYear - 464) * 26 + nMasa * 2 + nPaksa]; d.setDate(Convert.ToInt32(tmp & 0xfffc00) >> 10, Convert.ToInt32(tmp & 0x3e0) >> 5, Convert.ToInt32(tmp & 0x1f)); d.NextDay(); day.calculateDayData(d, earth); day.nMasa = day.determineMasa(d, out gy); day.nGaurabdaYear = gy; } else { //d = GetFirstDayOfYear(earth, nGYear + 1486); d.setDate(nGYear + 1486, 2 + nMasa, 15); if (d.getMonth() > 12) { d.setDate(d.getYear() + 1, d.getMonth() - 12, 0); } d.setDayHours(0.5); i = 0; do { d.AddDays(13); day.calculateDayData(d, earth); day.nMasa = day.determineMasa(d, out gy); day.nGaurabdaYear = gy; i++; }while (((day.nPaksa != nPaksa) || (day.nMasa != nMasa)) && (i <= 30)); } if (i >= 30) { d.Clear(); return(d); } // we found masa and paksa // now we have to find tithi tithi = nTithi + nPaksa * 15; if (day.nTithi == tithi) { // loc1 // find tithi juncts in this day and according to that times, // look in previous or next day for end and start of this tithi d.PreviousDay(); day.calculateDayData(d, earth); if ((day.nTithi > tithi) && (day.nPaksa != nPaksa)) { d.NextDay(); } return(d); } if (day.nTithi < tithi) { // do increment of date until nTithi == tithi // but if nTithi > tithi // then do decrement of date counter = 0; while (counter < 16) { d.NextDay(); day.calculateDayData(d, earth); if (day.nTithi == tithi) { return(d); } if ((day.nTithi < tithi) && (day.nPaksa != nPaksa)) { return(d); } if (day.nTithi > tithi) { return(d); } counter++; } // somewhere is error d.Clear(); return(d); } else { // do decrement of date until nTithi <= tithi counter = 0; while (counter < 16) { d.PreviousDay(); day.calculateDayData(d, earth); if (day.nTithi == tithi) { return(d); } if ((day.nTithi > tithi) && (day.nPaksa != nPaksa)) { d.NextDay(); return(d); } if (day.nTithi < tithi) { d.NextDay(); return(d); } counter++; } // somewhere is error d.Clear(); return(d); } // now we know the type of day-accurancy // nType = 0 means, that we dont found a day // nType = 1 means, we find day, when tithi was present at sunrise // nType = 2 means, we found day, when tithi started after sunrise // but ended before next sunrise // }
public void calculateAppearanceDayData(GPLocationProvider aLocation, GPGregorianTime aEvente) { //MOONDATA moon; //SUNDATA sun; location = aLocation; evente = new GPGregorianTime(aEvente); double dd; GPAstroData d = details; GPGregorianTime vc = evente; GPGregorianTime vcsun = evente; b_adhika = false; d.calculateDayData(aEvente, aLocation); //d.nTithi = GetPrevTithiStart(m_earth, vc, dprev); //GetNextTithiStart(m_earth, vc, dnext); //vcsun.setDayHours(vcsun.getDayHours() - vcsun.getTimeZoneOffsetHours() / 24.0); vcsun.normalizeValues(); d.sun.calculateCoordinatesMethodC(vcsun, -1); d.moon.MoonCalc(vcsun.getJulianGreenwichTime()); d.msDistance = GPMath.putIn360(d.moon.longitude_deg - d.sun.eclipticalLongitude - 180.0); d.msAyanamsa = GPAyanamsa.GetAyanamsa(vc.getJulianGreenwichTime()); // tithi dd = d.msDistance / 12.0; d.nTithi = Convert.ToInt32(Math.Floor(dd)); d.nTithiElapse = GPMath.frac(dd) * 100.0; d.nPaksa = (d.nTithi >= 15) ? 1 : 0; // naksatra dd = GPMath.putIn360(d.moon.longitude_deg - d.msAyanamsa); dd = (dd * 3.0) / 40.0; d.nNaksatra = Convert.ToInt32(Math.Floor(dd)); d.nNaksatraElapse = GPMath.frac(dd) * 100.0; d.nMasa = d.determineMasa(vc, out d.nGaurabdaYear); d.nMoonRasi = GPEngine.GetRasi(d.moon.longitude_deg, d.msAyanamsa); d.nSunRasi = GPEngine.GetRasi(d.sun.eclipticalLongitude, d.msAyanamsa); if (d.nMasa == GPMasa.ADHIKA_MASA) { d.nMasa = GPEngine.GetRasi(d.sun.eclipticalLongitude, d.msAyanamsa); b_adhika = true; } string dstApplicable = ""; //List<string> gstr = GPStrings.getSharedStrings().gstr; output.Add(new GPStringPair(GPStrings.getString(25), "", true)); output.Add(new GPStringPair(GPStrings.getString(7), vc.ToString())); output.Add(new GPStringPair(GPStrings.getString(8), vc.getShortTimeString(true, ref dstApplicable))); output.Add(new GPStringPair(GPStrings.getString(9), vc.getLocation().getFullName())); //output.Add(new GPStringPair(gstr[10], vc.getLocation().getLatitudeString())); //output.Add(new GPStringPair(gstr[11], vc.getLocation().getLongitudeString())); //output.Add(new GPStringPair(gstr[12], vc.getLocation().getTimeZoneName())); //output.Add(new GPStringPair(gstr[1001], dstApplicable)); output.Add(new GPStringPair(GPStrings.getString(13), GPTithi.getName(d.nTithi))); output.Add(new GPStringPair(GPStrings.getString(14), string.Format("{0:0.###} %", d.nTithiElapse))); output.Add(new GPStringPair(GPStrings.getString(15), GPNaksatra.getName(d.nNaksatra))); output.Add(new GPStringPair(GPStrings.getString(16), string.Format("{0:0.###} % ({1})", d.nNaksatraElapse, GPStrings.getString(811 + Convert.ToInt32(d.nNaksatraElapse / 25.0))))); output.Add(new GPStringPair(GPStrings.getString(991), GPSankranti.getName(d.nMoonRasi))); output.Add(new GPStringPair(GPStrings.getString(992), GPSankranti.getName(d.nSunRasi))); output.Add(new GPStringPair(GPStrings.getString(20), GPPaksa.getName(d.nPaksa))); if (b_adhika == true) { output.Add(new GPStringPair(GPStrings.getString(22), string.Format("{0} {1}", GPMasa.GetName(d.nMasa), GPStrings.getString(21)))); } else { output.Add(new GPStringPair(GPStrings.getString(22), GPMasa.GetName(d.nMasa))); } output.Add(new GPStringPair(GPStrings.getString(23), d.nGaurabdaYear.ToString())); if (GPDisplays.AppDay.childNameSuggestions()) { output.Add(new GPStringPair()); output.Add(new GPStringPair(GPStrings.getString(17), "", true)); output.Add(new GPStringPair()); output.Add(new GPStringPair(GPStrings.getString(18), string.Format("{0}...", GPAppHelper.GetNaksatraChildSylable(d.nNaksatra, Convert.ToInt32(d.nNaksatraElapse / 25.0))))); output.Add(new GPStringPair(GPStrings.getString(19), string.Format("{0}...", GPAppHelper.GetRasiChildSylable(d.nMoonRasi)))); } vc.Today(); GPVedicTime va = new GPVedicTime(); GPGregorianTime vctemp; va.tithi = d.nTithi; va.masa = d.nMasa; va.gyear = GPGaurabdaYear.getGaurabdaYear(vc, location); if (va.gyear < d.nGaurabdaYear) { va.gyear = d.nGaurabdaYear; } int countC = GPUserDefaults.IntForKey("appday.celebs", 3); if (countC > 0) { output.Add(new GPStringPair()); output.Add(new GPStringPair(GPStrings.getString(24), "", true)); output.Add(new GPStringPair()); } int m = 0; for (int i = 0; i < 6; i++) { GPEngine.VATIMEtoVCTIME(va, out vctemp, location); if (va.gyear > d.nGaurabdaYear) { if (m < countC) { output.Add(new GPStringPair(string.Format("{0} {1}", GPStrings.getString(994), va.gyear), vctemp.ToString())); m++; } } va.gyear++; } }
public int CalcMasaList(GPLocationProvider loc, int nYear, int nCount) { GPMasaListResults mlist = this; GPAstroData day = new GPAstroData(); GPGregorianTime d = new GPGregorianTime(loc); GPGregorianTime de = new GPGregorianTime(loc); GPGregorianTime t = new GPGregorianTime(loc); vc_end = new GPGregorianTime(loc); vc_start = new GPGregorianTime(loc); int lm = -1; mlist.n_startYear = nYear; mlist.n_countYears = nCount; d.Copy(GPGaurabdaYear.getFirstDayOfYear(loc, nYear)); de.Copy(GPGaurabdaYear.getFirstDayOfYear(loc, nYear + nCount)); mlist.vc_start.Copy(d); mlist.vc_end.Copy(de); mlist.m_location = loc; alloc(nCount); int i = 0; int prev_paksa = -1; int current = 0; while (d.IsBeforeThis(de)) { day.calculateDayData(d, loc); if (prev_paksa != day.nPaksa) { day.nMasa = day.determineMasa(d, out day.nGaurabdaYear); if (lm != day.nMasa) { if (lm >= 0) { t.Copy(d); t.PreviousDay(); mlist.arr[current].vc_end.Copy(t); current++; } lm = day.nMasa; mlist.arr[current].masa = day.nMasa; mlist.arr[current].year = day.nGaurabdaYear; mlist.arr[current].vc_start.Copy(d); } } prev_paksa = day.nPaksa; d.NextDay(); i++; } t.Copy(d); mlist.arr[current].vc_end.Copy(t); current++; mlist.n_countMasa = current; return(1); }
public static int WriteXML_GaurabdaNextTithi(StringBuilder doc, GPLocationProvider loc, GPGregorianTime vcStart, GPVedicTime vaStart) { int gmasa, gpaksa, gtithi; gmasa = vaStart.masa; gpaksa = vaStart.tithi / 15; gtithi = vaStart.tithi % 15; doc.Append("<xml>\n"); doc.Append("\t<request name=\"Tithi\" version=\"" + GPFileHelper.FileVersion + "\">\n"); doc.Append("\t\t<arg name=\"longitude\" val=\"" + loc.GetLongitudeEastPositive() + "\" />\n"); doc.Append("\t\t<arg name=\"latitude\" val=\"" + loc.GetLatitudeNorthPositive() + "\" />\n"); doc.Append("\t\t<arg name=\"timezone\" val=\"" + loc.getTimeZone().OffsetSeconds / 60 + "\" />\n"); doc.Append("\t\t<arg name=\"start date\" val=\"" + vcStart + "\" />\n"); doc.Append("\t\t<arg name=\"masa\" val=\"" + gmasa + "\" />\n"); doc.Append("\t\t<arg name=\"paksa\" val=\"" + gpaksa + "\" />\n"); doc.Append("\t\t<arg name=\"tithi\" val=\"" + gtithi + "\" />\n"); doc.Append("\t</request>\n"); doc.Append("\t<result name=\"Tithi\">\n"); GPGregorianTime vcs = new GPGregorianTime(loc); GPGregorianTime vce = new GPGregorianTime(loc); GPGregorianTime today = new GPGregorianTime(loc); GPSun sun = new GPSun(); int A; double sunrise; GPAstroData day = new GPAstroData(); int oTithi, oPaksa, oMasa, oYear; today.Copy(vcStart); today.PreviousDay(); vcStart.SubDays(15); for (A = 0; A <= 3; A++) { vcs = GPTithi.CalcTithiEndEx(vcStart, 0, gmasa, gpaksa, gtithi, loc, out vce); if (!vcs.IsBeforeThis(today)) { oTithi = gpaksa * 15 + gtithi; oMasa = gmasa; oPaksa = gpaksa; oYear = 0; doc.Append("\t<celebration\n"); // doc.Append( "\t\t<tithi\n"); doc.Append("\t\trtithi=\"" + GPTithi.getName(oTithi) + "\"\n"); doc.Append("\t\trmasa=\"" + GPMasa.GetName(oMasa) + "\"\n"); doc.Append("\t\trpaksa=\"" + GPPaksa.getName(oPaksa) + "\"\n"); // test ci je ksaya today.Copy(vcs); today.setDayHours(0.5); sun.SunCalc(today, loc); sunrise = sun.getSunriseDayHours(); if (sunrise < vcs.getDayHours()) { today.Copy(vce); sun.SunCalc(today, loc); sunrise = sun.getSunriseDayHours(); if (sunrise < vce.getDayHours()) { // normal type vcs.NextDay(); doc.Append("\t\ttype=\"normal\"\n"); } else { // ksaya vcs.NextDay(); day.calculateDayData(vcs, loc); oTithi = day.nTithi; oPaksa = day.nPaksa; oMasa = day.determineMasa(vcs, out oYear); doc.Append("\t\ttype=\"ksaya\"\n"); } } else { // normal, alebo prvy den vriddhi today.Copy(vce); sun.SunCalc(today, loc); if (sun.getSunriseDayHours() < vce.getDayHours()) { // first day of vriddhi type doc.Append("\t\ttype=\"vriddhi\"\n"); } else { // normal doc.Append("\t\ttype=\"normal\"\n"); } } doc.Append("\t\tdate=\"" + vcs + "\"\n"); doc.Append("\t\totithi=\"" + GPTithi.getName(oTithi) + "\"\n"); doc.Append("\t\tomasa=\"" + GPMasa.GetName(oMasa) + "\"\n"); doc.Append("\t\topaksa=\"" + GPPaksa.getName(oPaksa) + "\"\n"); doc.Append("\t/>\n"); break; } else { vcStart.Copy(vcs); vcs.NextDay(); } } doc.Append("\t</result>\n"); doc.Append("</xml>\n"); return(1); }
public static int WriteXML_GaurabdaTithi(StringBuilder doc, GPLocationProvider loc, GPVedicTime vaStart, GPVedicTime vaEnd) { int gyearA = vaStart.gyear; int gyearB = vaEnd.gyear; int gmasa = vaStart.masa; int gpaksa = vaStart.tithi / 15; int gtithi = vaStart.tithi % 15; if (gyearB < gyearA) { gyearB = gyearA; } doc.Append("<xml>\n"); doc.Append("\t<request name=\"Tithi\" version=\"" + GPFileHelper.FileVersion + "\">\n"); doc.Append("\t\t<arg name=\"longitude\" val=\"" + loc.getLocation(0).GetLongitudeEastPositive() + "\" />\n"); doc.Append("\t\t<arg name=\"latitude\" val=\"" + loc.getLocation(0).GetLatitudeNorthPositive() + "\" />\n"); doc.Append("\t\t<arg name=\"timezone\" val=\"" + loc.getLocation(0).getTimeZone().OffsetSeconds / 60 + "\" />\n"); if (gyearA > 1500) { doc.Append("\t\t<arg name=\"year-start\" val=\"" + gyearA + "\" />\n"); doc.Append("\t\t<arg name=\"year-end\" val=\"" + gyearB + "\" />\n"); } else { doc.Append("\t\t<arg name=\"gaurabdayear-start\" val=\"" + gyearA + "\" />\n"); doc.Append("\t\t<arg name=\"gaurabdayear-end\" val=\"" + gyearB + "\" />\n"); } doc.Append("\t\t<arg name=\"masa\" val=\"" + gmasa + "\" />\n"); doc.Append("\t\t<arg name=\"paksa\" val=\"" + gpaksa + "\" />\n"); doc.Append("\t\t<arg name=\"tithi\" val=\"" + gtithi + "\" />\n"); doc.Append("\t</request>\n"); doc.Append("\t<result name=\"Tithi\">\n"); GPGregorianTime vcs = new GPGregorianTime(loc), vce = new GPGregorianTime(loc), today = new GPGregorianTime(loc); GPSun sun = new GPSun(); int A, B; double sunrise; GPAstroData day = new GPAstroData(); int oTithi, oPaksa, oMasa, oYear; if (gyearA > 1500) { A = gyearA - 1487; B = gyearB - 1485; } else { A = gyearA; B = gyearB; } for (; A <= B; A++) { vcs = GPTithi.CalcTithiEnd(A, gmasa, gpaksa, gtithi, loc, out vce); if (gyearA > 1500) { if ((vcs.getYear() < gyearA) || (vcs.getYear() > gyearB)) { continue; } } oTithi = gpaksa * 15 + gtithi; oMasa = gmasa; oPaksa = gpaksa; oYear = 0; doc.Append("\t<celebration\n"); doc.Append("\t\trtithi=\"" + GPTithi.getName(oTithi) + "\"\n"); doc.Append("\t\trmasa=\"" + GPMasa.GetName(oMasa) + "\"\n"); doc.Append("\t\trpaksa=\"" + GPPaksa.getName(oPaksa) + "\"\n"); // test ci je ksaya today.Copy(vcs); today.setDayHours(0.5); sun.SunCalc(today, loc); sunrise = sun.getSunriseDayHours(); if (sunrise < vcs.getDayHours()) { today.Copy(vce); sun.SunCalc(today, loc); sunrise = sun.getSunriseDayHours(); if (sunrise < vce.getDayHours()) { // normal type vcs.NextDay(); doc.Append("\t\ttype=\"normal\"\n"); } else { // ksaya vcs.NextDay(); day.calculateDayData(vcs, loc); oTithi = day.nTithi; oPaksa = day.nPaksa; oMasa = day.determineMasa(vcs, out oYear); doc.Append("\t\ttype=\"ksaya\"\n"); } } else { // normal, alebo prvy den vriddhi today.Copy(vce); sun.SunCalc(today, loc); if (sun.getSunriseDayHours() < vce.getDayHours()) { // first day of vriddhi type doc.Append("\t\ttype=\"vriddhi\"\n"); } else { // normal doc.Append("\t\ttype=\"normal\"\n"); } } doc.Append("\t\tdate=\"" + vcs + "\"\n"); doc.Append("\t\totithi=\"" + GPTithi.getName(oTithi) + "\"\n"); doc.Append("\t\tomasa=\"" + GPMasa.GetName(oMasa) + "\"\n"); doc.Append("\t\topaksa=\"" + GPPaksa.getName(oPaksa) + "\"\n"); doc.Append("\t/>\n"); // doc.Append( "\t\t</celebration>\n"); } doc.Append("\t</result>\n"); doc.Append("</xml>\n"); return(1); }