예제 #1
0
 public override bool Equals(object obj)
 {
     if (obj is GCLocation)
     {
         GCLocation arg = obj as GCLocation;
         return(arg.Title.Equals(Title) &&
                arg.TimeZoneName.Equals(TimeZoneName) &&
                arg.GetLatitudeString().Equals(GetLatitudeString()) &&
                arg.GetLongitudeString().Equals(GetLongitudeString()));
     }
     else if (obj is string)
     {
         return((obj as string).Equals(GetFullName()));
     }
     else
     {
         return(base.Equals(obj));
     }
 }
예제 #2
0
        public static TResultCoreEvents GetCoreEventsYear(GCLocation loc, int year)
        {
            string key = "";

            if (TopocentricPancangam)
            {
                key = string.Format("{0}_{1}_{2}_{3}", loc.GetLongitudeString(), loc.GetLatitudeString(), Convert.ToInt32(loc.Altitude), year);
            }
            else
            {
                key = string.Format("0_0_0_{0}", year);
            }

            // if existing in memory, return it
            if (CoreEventsMap.ContainsKey(key))
            {
                return(CoreEventsMap[key]);
            }

            string filePath = GCGlobal.GetFileName(GCGlobal.CoreDataFolderPath, key + ".ceb");

            TResultCoreEvents ce = new TResultCoreEvents();

            // if file exists and is correct, return it
            if (File.Exists(filePath))
            {
                if (ce.LoadFile(filePath))
                {
                    CoreEventsMap[key] = ce;
                    return(ce);
                }
            }

            ce.Full = true;
            // at last, we have to calculate it
            ce.CalculateEvents(loc, year);
            ce.SaveFile(filePath);
            CoreEventsMap[key] = ce;

            return(ce);
        }
예제 #3
0
        public void calculateAppDay(GCLocation location, GregorianDateTime eventDate)
        {
            //MOONDATA moon;
            //SUNDATA sun;
            GCAstroData       d       = this.details = new GCAstroData();
            GregorianDateTime vc      = new GregorianDateTime();
            GregorianDateTime vcsun   = new GregorianDateTime();
            GCEarthData       m_earth = location.GetEarthData();

            vc.Set(eventDate);
            vcsun.Set(eventDate);

            this.b_adhika  = false;
            this.eventTime = new GregorianDateTime(eventDate);
            Location       = location;

            //d.nTithi = GetPrevTithiStart(m_earth, vc, dprev);
            //GetNextTithiStart(m_earth, vc, dnext);
            vcsun.shour -= vcsun.TimezoneHours / 24.0;
            vcsun.NormalizeValues();
            vcsun.TimezoneHours     = 0.0;
            d.sunRise               = new GCHourTime();
            d.sunRise.TotalDays     = vc.shour;
            d.sunRise.longitude     = GCCoreAstronomy.GetSunLongitude(vcsun, m_earth);
            d.sunRise.longitudeMoon = GCCoreAstronomy.GetMoonLongitude(vcsun, m_earth);
            d.Ayanamsa              = GCAyanamsha.GetAyanamsa(vc.GetJulianComplete());
            d.sunRise.Ayanamsa      = d.Ayanamsa;

            // tithi


            d.Masa = d.MasaCalc(vc, m_earth);
            if (d.Masa == (int)MasaId.ADHIKA_MASA)
            {
                d.Masa        = d.sunRise.RasiOfSun;
                this.b_adhika = true;
            }

            vc.Today();
            vc.TimezoneHours = m_earth.OffsetUtcHours;
            int               m  = 0;
            GaurabdaDate      va = new GaurabdaDate();
            GregorianDateTime vctemp;

            va.tithi = d.sunRise.Tithi;
            va.masa  = d.Masa;
            va.gyear = GCCalendar.GetGaurabdaYear(vc, m_earth);
            if (va.gyear < d.GaurabdaYear)
            {
                va.gyear = d.GaurabdaYear;
            }

            MainInfo.Add(new AppDayInfo(GCStrings.getString(7), eventDate.ToString()));
            MainInfo.Add(new AppDayBase());
            MainInfo.Add(new AppDayInfo(GCStrings.getString(8), eventDate.ShortTimeString()));
            MainInfo.Add(new AppDayBase());
            MainInfo.Add(new AppDayBase());
            MainInfo.Add(new AppDayInfo(GCStrings.getString(9), location.Title));
            MainInfo.Add(new AppDayInfo(GCStrings.getString(10), location.GetLatitudeString()));
            MainInfo.Add(new AppDayInfo(GCStrings.getString(11), location.GetLongitudeString()));
            MainInfo.Add(new AppDayInfo(GCStrings.Localized("Timezone"), location.TimeZoneName));
            MainInfo.Add(new AppDayInfo("DST", "N/A"));
            MainInfo.Add(new AppDayBase());
            MainInfo.Add(new AppDayInfo(GCStrings.getString(13), GCTithi.GetName(d.sunRise.Tithi)));
            MainInfo.Add(new AppDayInfo(GCStrings.getString(14), string.Format("{0:00.000}%", d.sunRise.TithiElapse)));
            MainInfo.Add(new AppDayInfo(GCStrings.getString(15), GCNaksatra.GetName(d.sunRise.Naksatra)));
            MainInfo.Add(new AppDayInfo(GCStrings.getString(16), string.Format("{0:00.000}% ({1} pada)", d.sunRise.NaksatraElapse, GCStrings.getString(811 + d.sunRise.NaksatraPada))));
            MainInfo.Add(new AppDayInfo(GCStrings.Localized("Moon Rasi"), GCRasi.GetName(d.sunRise.RasiOfMoon)));
            MainInfo.Add(new AppDayInfo(GCStrings.Localized("Sun Rasi"), GCRasi.GetName(d.sunRise.RasiOfSun)));
            MainInfo.Add(new AppDayInfo(GCStrings.getString(20), GCPaksa.GetName(d.sunRise.Paksa)));

            if (b_adhika == true)
            {
                MainInfo.Add(new AppDayInfo(GCStrings.getString(22), string.Format("{0} {1}", GCMasa.GetName(d.Masa), GCStrings.getString(21))));
            }
            else
            {
                MainInfo.Add(new AppDayInfo(GCStrings.getString(22), GCMasa.GetName(d.Masa)));
            }
            MainInfo.Add(new AppDayInfo(GCStrings.getString(23), d.GaurabdaYear.ToString()));

            if (GCDisplaySettings.Current.getValue(48) == 1)
            {
                MainInfo.Add(new AppDayBase(GCDS.APP_CHILDNAMES));
                MainInfo.Add(new AppDaySeparator(GCStrings.getString(17)));
                MainInfo.Add(new AppDayBase(GCDS.APP_CHILDNAMES));

                MainInfo.Add(new AppDayInfo(GCDS.APP_CHILDNAMES, GCStrings.getString(18), GCStrings.GetNaksatraChildSylable(d.sunRise.Naksatra, d.sunRise.NaksatraPada) + "..."));
                MainInfo.Add(new AppDayInfo(GCDS.APP_CHILDNAMES, GCStrings.getString(19), GCStrings.GetRasiChildSylable(d.sunRise.RasiOfMoon) + "..."));
            }

            MainInfo.Add(new AppDayBase());
            MainInfo.Add(new AppDaySeparator(GCStrings.getString(24)));
            MainInfo.Add(new AppDayBase());


            celeb_date = new GregorianDateTime[TRESULT_APP_CELEBS];
            celeb_gy   = new int[TRESULT_APP_CELEBS];

            for (int i = 0; i < TRESULT_APP_CELEBS + 3; i++)
            {
                GCCalendar.VATIMEtoVCTIME(va, out vctemp, m_earth);
                if (va.gyear > d.GaurabdaYear)
                {
                    if (m < TRESULT_APP_CELEBS)
                    {
                        MainInfo.Add(new AppDayInfo(string.Format("Gaurabda {0}", va.gyear), vctemp.ToString()));
                        this.celeb_date[m] = new GregorianDateTime(vctemp);
                        this.celeb_gy[m]   = va.gyear;
                        m++;
                    }
                }
                va.gyear++;
            }
        }