Ejemplo n.º 1
0
        private void PrintLagna(PrintPageEventArgs e)
        {
            e.HasMorePages = true;
            Graphics g = e.Graphics;

            g.ResetTransform();
            g.TranslateTransform(100, header_offset);

            for (int j = 1; j <= 12; j++)
            {
                ZodiacHouse zh = new ZodiacHouse((ZodiacHouse.Name)j);
                g.DrawString(zh.value.ToString(), f, b,
                             day_offset + 100 + (int)zh.value * time_width, 0);
            }
            g.TranslateTransform(0, f.Height);

            int i = local_index;

            while (i < locals.Count)
            {
                PanchangaLocalMoments local = (PanchangaLocalMoments)locals[i];
                Moment m_sunrise            = new Moment(local.sunrise_ut, h);
                g.DrawString(m_sunrise.ToString(), f, b, day_offset, 0);

                for (int j = 0; j < local.lagnas_ut.Count; j++)
                {
                    PanchangaMomentInfo pmi = (PanchangaMomentInfo)local.lagnas_ut[j];
                    //Moment m_lagna = new Moment(pmi.ut, h);
                    ZodiacHouse zh = new ZodiacHouse((ZodiacHouse.Name)pmi.info);
                    zh = zh.add(12);
                    Font _f = f;

                    if (local.lagna_zh == zh.value)
                    {
                        _f = this.f_u;
                    }

                    g.DrawString(
                        this.utTimeToString(pmi.ut, local.sunrise_ut, local.sunrise),
                        _f, b,
                        day_offset + 100 + (int)zh.value * time_width, 0);
                }

                local_index = ++i;
                g.TranslateTransform(0, f.Height);
                if (g.Transform.OffsetY > e.PageBounds.Height - this.header_offset)
                {
                    return;
                }
            }

            this.bPrintLagna = false;
            e.HasMorePages   = false;
        }
Ejemplo n.º 2
0
        private void PrintFirstPage(PrintPageEventArgs e)
        {
            e.HasMorePages = true;
            Graphics g = e.Graphics;

            g.ResetTransform();
            g.TranslateTransform(margin_offset, header_offset);

            PrintTitle(g, 0, this.wday_offset + this.wday_width, "Date/Day");
            PrintTitle(g, this.sunrise_offset, this.sunset_offset + this.sunset_width, "Sunrise/set");
            PrintTitle(g, this.nak_name_offset, this.nak_time_offset + this.nak_time_width, "Nakshatra");
            PrintTitle(g, this.tithi_name_offset, this.tithi_time_offset + this.tithi_time_width, "Tithi");
            PrintTitle(g, this.karana_name_1_offset, this.karana_time_2_offset + this.karana_time_width, "Karana");
            PrintTitle(g, this.sm_name_offset, this.sm_time_offset + this.sm_time_width, "SM-Yoga");

            g.TranslateTransform(0, (float)(f.Height * 1.5));

            int iStart = local_index;
            int i      = local_index;

            while (i < locals.Count)
            {
                int numLines = 1;
                PanchangaLocalMoments local = (PanchangaLocalMoments)locals[i];
                Moment m_sunrise            = new Moment(local.sunrise_ut, h);
                Moment m_sunset             = new Moment(0, 0, 0, local.sunset);

                g.DrawString(m_sunrise.ToShortDateString(), f, b, day_offset, 0);
                g.DrawString(Basics.weekdayToShortString(local.wday), f, b, wday_offset, 0);

                if (opts.ShowSunriset)
                {
                    g.DrawString(m_sunrise.ToTimeString(), f, b, sunrise_offset, 0);
                    g.DrawString(m_sunset.ToTimeString(), f, b, sunset_offset, 0);
                }

                int numTithis  = local.tithi_index_end - local.tithi_index_start;
                int numNaks    = local.nakshatra_index_end - local.nakshatra_index_start;
                int numSMYogas = local.smyoga_index_end - local.smyoga_index_start;
                int numKaranas = local.karana_index_end - local.karana_index_start;

                if (opts.CalcTithiCusps)
                {
                    numLines = Math.Max(numLines, numTithis);
                    for (int j = 0; j < numTithis; j++)
                    {
                        PanchangaMomentInfo pmi = (PanchangaMomentInfo)globals.tithis_ut[local.tithi_index_start + 1 + j];
                        Tithi  t      = new Tithi((Tithi.Name)pmi.info);
                        Moment mTithi = new Moment(pmi.ut, h);
                        g.DrawString(t.ToUnqualifiedString(), f, b, tithi_name_offset, j * f.Height);
                        g.DrawString(this.utTimeToString(pmi.ut, local.sunrise_ut, local.sunrise),
                                     f, b, tithi_time_offset, j * f.Height);
                    }
                }

                if (opts.CalcKaranaCusps)
                {
                    numLines = Math.Max(numLines, (int)Math.Ceiling(numKaranas / 2.0));
                    for (int j = 0; j < numKaranas; j++)
                    {
                        PanchangaMomentInfo pmi = (PanchangaMomentInfo)globals.karanas_ut[local.karana_index_start + 1 + j];
                        Karana k           = new Karana((Karana.Name)pmi.info);
                        Moment mKarana     = new Moment(pmi.ut, h);
                        int    jRow        = (int)Math.Floor((decimal)j / 2);
                        int    name_offset = karana_name_1_offset;
                        int    time_offset = karana_time_1_offset;
                        if (j % 2 == 1)
                        {
                            name_offset = karana_name_2_offset;
                            time_offset = karana_time_2_offset;
                        }

                        g.DrawString(k.value.ToString(), f, b, name_offset, jRow * f.Height);
                        g.DrawString(this.utTimeToString(pmi.ut, local.sunrise_ut, local.sunrise),
                                     f, b, time_offset, jRow * f.Height);
                    }
                }

                if (opts.CalcNakCusps)
                {
                    numLines = Math.Max(numLines, numNaks);
                    for (int j = 0; j < numNaks; j++)
                    {
                        PanchangaMomentInfo pmi = (PanchangaMomentInfo)globals.nakshatras_ut[local.nakshatra_index_start + 1 + j];
                        Nakshatra           n   = new Nakshatra((Nakshatra.Name)pmi.info);
                        Moment mNak             = new Moment(pmi.ut, h);
                        g.DrawString(n.ToString(), f, b, nak_name_offset, j * f.Height);
                        g.DrawString(this.utTimeToString(pmi.ut, local.sunrise_ut, local.sunrise),
                                     f, b, nak_time_offset, j * f.Height);
                    }
                }

                if (opts.CalcSMYogaCusps)
                {
                    numLines = Math.Max(numLines, numSMYogas);
                    for (int j = 0; j < numSMYogas; j++)
                    {
                        PanchangaMomentInfo pmi = (PanchangaMomentInfo)globals.smyogas_ut[local.smyoga_index_start + 1 + j];
                        SunMoonYoga         sm  = new SunMoonYoga((SunMoonYoga.Name)pmi.info);
                        Moment mSMYoga          = new Moment(pmi.ut, h);
                        g.DrawString(sm.value.ToString(), f, b, sm_name_offset, j * f.Height);
                        g.DrawString(this.utTimeToString(pmi.ut, local.sunrise_ut, local.sunrise),
                                     f, b, sm_time_offset, j * f.Height);
                    }
                }


#if DND
                string s_rahu_kala = string.Format("{0} - {1}",
                                                   this.utTimeToString(local.kalas_ut[local.rahu_kala_index], local.sunrise_ut, local.sunrise),
                                                   this.utTimeToString(local.kalas_ut[local.rahu_kala_index + 1], local.sunrise_ut, local.sunrise));
                g.DrawString(s_rahu_kala, f, b, rahu_kala_offset, 0);
#endif

                g.TranslateTransform(0, f.Height * numLines);

                local_index = ++i;

                if (g.Transform.OffsetY > e.PageBounds.Height - this.header_offset - divisional_chart_size)
                {
                    goto first_done;
                }
            }

            this.bPrintPanchanga = false;
            this.local_index     = 0;

first_done:
            float offsetY = g.Transform.OffsetY;
            float offsetX = margin_offset + sm_time_offset + sm_time_width;

            Moment          mCurr  = new Moment(((PanchangaLocalMoments)locals[iStart]).sunrise_ut, h);
            HoraInfo        hiCurr = new HoraInfo(mCurr, h.info.lat, h.info.lon, h.info.tz);
            Horoscope       hCurr  = new Horoscope(hiCurr, h.options);
            DivisionalChart dc     = new DivisionalChart(hCurr);
            dc.PrintMode         = true;
            dc.options.ViewStyle = DivisionalChart.UserOptions.EViewStyle.Panchanga;
            dc.SetOptions(dc.options);
            dc.DrawChart(g, divisional_chart_size, divisional_chart_size);

            g.ResetTransform();
            // horizontal top & bottom
            g.DrawLine(p, margin_offset - 5, header_offset - 5, margin_offset + sm_time_offset + sm_time_width + 5, header_offset - 5);
            g.DrawLine(p, margin_offset - 5, header_offset - 5 + f.Height * (float)1.5, margin_offset + sm_time_offset + sm_time_width + 5, header_offset - 5 + f.Height * (float)1.5);
            g.DrawLine(p, margin_offset - 5, offsetY + 5, offsetX + 5, offsetY + 5);
            // vertical left and right
            g.DrawLine(p, margin_offset - 5, header_offset - 5, margin_offset - 5, offsetY + 5);
            g.DrawLine(p, offsetX + 5, header_offset - 5, offsetX + 5, offsetY + 5);

            g.DrawLine(p,
                       margin_offset + sunset_offset + sunset_width - 2, header_offset - 5,
                       margin_offset + sunset_offset + sunset_width - 2, offsetY + 5);

            g.DrawLine(p,
                       margin_offset + tithi_time_offset + tithi_time_width - 2, header_offset - 5,
                       margin_offset + tithi_time_offset + tithi_time_width - 2, offsetY + 5);

            g.DrawLine(p,
                       margin_offset + nak_time_offset + nak_time_width - 2, header_offset - 5,
                       margin_offset + nak_time_offset + nak_time_width - 2, offsetY + 5);

            g.DrawLine(p,
                       margin_offset + karana_time_2_offset + karana_time_width - 2, header_offset - 5,
                       margin_offset + karana_time_2_offset + karana_time_width - 2, offsetY + 5);
        }
Ejemplo n.º 3
0
        private void DisplayEntry(PanchangaLocalMoments local)
        {
            string s;
            int    day = 0, month = 0, year = 0;
            double time = 0;

            sweph.swe_revjul(local.sunrise_ut, ref year, ref month, ref day, ref time);
            Moment m = new Moment(year, month, day, time);

            this.mList.Items.Add(string.Format("{0}, {1}", local.wday, m.ToDateString()));

            if (this.opts.ShowSunriset)
            {
                s = string.Format("Sunrise at {0}. Sunset at {1}",
                                  this.timeToString(local.sunrise),
                                  this.timeToString(local.sunset));
                this.mList.Items.Add(s);
            }

            if (this.opts.CalcSpecialKalas)
            {
                string s_rahu = string.Format("Rahu Kala from {0} to {1}",
                                              new Moment(local.kalas_ut[local.rahu_kala_index], h).ToTimeString(),
                                              new Moment(local.kalas_ut[local.rahu_kala_index + 1], h).ToTimeString());
                string s_gulika = string.Format("Gulika Kala from {0} to {1}",
                                                new Moment(local.kalas_ut[local.gulika_kala_index], h).ToTimeString(),
                                                new Moment(local.kalas_ut[local.gulika_kala_index + 1], h).ToTimeString());
                string s_yama = string.Format("Yama Kala from {0} to {1}",
                                              new Moment(local.kalas_ut[local.yama_kala_index], h).ToTimeString(),
                                              new Moment(local.kalas_ut[local.yama_kala_index + 1], h).ToTimeString());

                if (opts.OneEntryPerLine)
                {
                    this.mList.Items.Add(s_rahu);
                    this.mList.Items.Add(s_gulika);
                    this.mList.Items.Add(s_yama);
                }
                else
                {
                    this.mList.Items.Add(string.Format("{0}. {1}. {2}.", s_rahu, s_gulika, s_yama));
                }
            }

            if (this.opts.CalcTithiCusps)
            {
                string s_tithi = "";

                if (local.tithi_index_start == local.tithi_index_end &&
                    local.tithi_index_start >= 0)
                {
                    PanchangaMomentInfo pmi = (PanchangaMomentInfo)globals.tithis_ut[local.tithi_index_start];
                    Tithi t = new Tithi((Tithi.Name)pmi.info);
                    this.mList.Items.Add(string.Format("{0} - full.", t.value));
                }
                else
                {
                    for (int i = local.tithi_index_start + 1; i <= local.tithi_index_end; i++)
                    {
                        if (i < 0)
                        {
                            continue;
                        }
                        PanchangaMomentInfo pmi = (PanchangaMomentInfo)globals.tithis_ut[i];
                        Tithi t = new Tithi((Tithi.Name)pmi.info).addReverse(2);
                        s_tithi += string.Format("{0} until {1}",
                                                 t.value,
                                                 this.utTimeToString(pmi.ut, local.sunrise_ut, local.sunrise));

                        if (this.opts.OneEntryPerLine)
                        {
                            this.mList.Items.Add(s_tithi);
                            s_tithi = "";
                        }
                        else
                        {
                            s_tithi += ". ";
                        }
                    }
                    if (false == opts.OneEntryPerLine)
                    {
                        this.mList.Items.Add(s_tithi);
                    }
                }
            }


            if (this.opts.CalcKaranaCusps)
            {
                string s_karana = "";

                if (local.karana_index_start == local.karana_index_end &&
                    local.karana_index_start >= 0)
                {
                    PanchangaMomentInfo pmi = (PanchangaMomentInfo)globals.karanas_ut[local.karana_index_start];
                    Karana k = new Karana((Karana.Name)pmi.info);
                    this.mList.Items.Add(string.Format("{0} karana - full.", k.value));
                }
                else
                {
                    for (int i = local.karana_index_start + 1; i <= local.karana_index_end; i++)
                    {
                        if (i < 0)
                        {
                            continue;
                        }
                        PanchangaMomentInfo pmi = (PanchangaMomentInfo)globals.karanas_ut[i];
                        Karana k = new Karana((Karana.Name)pmi.info).addReverse(2);
                        s_karana += string.Format("{0} karana until {1}",
                                                  k.value,
                                                  this.utTimeToString(pmi.ut, local.sunrise_ut, local.sunrise));

                        if (this.opts.OneEntryPerLine)
                        {
                            this.mList.Items.Add(s_karana);
                            s_karana = "";
                        }
                        else
                        {
                            s_karana += ". ";
                        }
                    }
                    if (false == opts.OneEntryPerLine)
                    {
                        this.mList.Items.Add(s_karana);
                    }
                }
            }



            if (this.opts.CalcSMYogaCusps)
            {
                string s_smyoga = "";

                if (local.smyoga_index_start == local.smyoga_index_end &&
                    local.smyoga_index_start >= 0)
                {
                    PanchangaMomentInfo pmi = (PanchangaMomentInfo)globals.smyogas_ut[local.smyoga_index_start];
                    SunMoonYoga         sm  = new SunMoonYoga((SunMoonYoga.Name)pmi.info);
                    this.mList.Items.Add(string.Format("{0} yoga - full.", sm.value));
                }
                else
                {
                    for (int i = local.smyoga_index_start + 1; i <= local.smyoga_index_end; i++)
                    {
                        if (i < 0)
                        {
                            continue;
                        }
                        PanchangaMomentInfo pmi = (PanchangaMomentInfo)globals.smyogas_ut[i];
                        SunMoonYoga         sm  = new SunMoonYoga((SunMoonYoga.Name)pmi.info).addReverse(2);
                        s_smyoga += string.Format("{0} yoga until {1}",
                                                  sm.value,
                                                  this.utTimeToString(pmi.ut, local.sunrise_ut, local.sunrise));

                        if (this.opts.OneEntryPerLine)
                        {
                            this.mList.Items.Add(s_smyoga);
                            s_smyoga = "";
                        }
                        else
                        {
                            s_smyoga += ". ";
                        }
                    }
                    if (false == opts.OneEntryPerLine)
                    {
                        this.mList.Items.Add(s_smyoga);
                    }
                }
            }



            if (this.opts.CalcNakCusps)
            {
                string s_nak = "";

                if (local.nakshatra_index_start == local.nakshatra_index_end &&
                    local.nakshatra_index_start >= 0)
                {
                    PanchangaMomentInfo pmi = (PanchangaMomentInfo)globals.nakshatras_ut[local.nakshatra_index_start];
                    Nakshatra           n   = new Nakshatra((Nakshatra.Name)pmi.info);
                    this.mList.Items.Add(string.Format("{0} - full.", n.value));
                }
                else
                {
                    for (int i = local.nakshatra_index_start + 1; i <= local.nakshatra_index_end; i++)
                    {
                        if (i < 0)
                        {
                            continue;
                        }
                        PanchangaMomentInfo pmi = (PanchangaMomentInfo)globals.nakshatras_ut[i];
                        Nakshatra           n   = new Nakshatra((Nakshatra.Name)pmi.info).addReverse(2);
                        s_nak += string.Format("{0} until {1}",
                                               n.value,
                                               this.utTimeToString(pmi.ut, local.sunrise_ut, local.sunrise));
                        if (this.opts.OneEntryPerLine)
                        {
                            this.mList.Items.Add(s_nak);
                            s_nak = "";
                        }
                        else
                        {
                            s_nak += ". ";
                        }
                    }
                    if (false == opts.OneEntryPerLine)
                    {
                        this.mList.Items.Add(s_nak);
                    }
                }
            }

            if (this.opts.CalcLagnaCusps)
            {
                string      sLagna = "    ";
                ZodiacHouse zBase  = new ZodiacHouse(local.lagna_zh);
                for (int i = 0; i < 12; i++)
                {
                    PanchangaMomentInfo pmi   = (PanchangaMomentInfo)local.lagnas_ut[i];
                    ZodiacHouse         zCurr = new ZodiacHouse((ZodiacHouse.Name)pmi.info);
                    zCurr  = zCurr.add(12);
                    sLagna = string.Format("{0}{1} Lagna until {2}. ", sLagna, zCurr.value,
                                           this.utTimeToString(pmi.ut, local.sunrise_ut, local.sunrise));
                    if (opts.OneEntryPerLine || i % 4 == 3)
                    {
                        this.mList.Items.Add(sLagna);
                        sLagna = "";
                    }
                }
            }

            if (this.opts.CalcHoraCusps)
            {
                string sHora = "    ";
                for (int i = 0; i < 24; i++)
                {
                    int       ib    = (int)Basics.normalize_exc_lower(0, 7, local.hora_base + i);
                    Body.Name bHora = h.horaOrder[ib];
                    sHora = string.Format("{0}{1} hora until {2}. ", sHora, bHora,
                                          this.utTimeToString(local.horas_ut[i + 1], local.sunrise_ut, local.sunrise));
                    if (opts.OneEntryPerLine || i % 4 == 3)
                    {
                        this.mList.Items.Add(sHora);
                        sHora = "";
                    }
                }
            }

            if (this.opts.CalcKalaCusps)
            {
                string sKala = "    ";
                for (int i = 0; i < 16; i++)
                {
                    int       ib    = (int)Basics.normalize_exc_lower(0, 8, local.kala_base + i);
                    Body.Name bKala = h.kalaOrder[ib];
                    sKala = string.Format("{0}{1} kala until {2}. ", sKala, bKala,
                                          this.utTimeToString(local.kalas_ut[i + 1], local.sunrise_ut, local.sunrise));
                    if (opts.OneEntryPerLine || i % 4 == 3)
                    {
                        this.mList.Items.Add(sKala);
                        sKala = "";
                    }
                }
            }

            this.mList.Items.Add("");
        }
Ejemplo n.º 4
0
        private void ComputeEntry(double ut, double[] geopos)
        {
            int    year = 0, month = 0, day = 0;
            double sunset = 0, hour = 0;

            sweph.obtainLock(h);
            h.populateSunrisetCacheHelper(ut - 0.5, ref sunrise, ref sunset, ref ut_sr);
            sweph.releaseLock(h);

            sweph.swe_revjul(ut_sr, ref year, ref month, ref day, ref hour);
            Moment    moment_sr = new Moment(year, month, day, hour);
            Moment    moment_ut = new Moment(ut, h);
            HoraInfo  infoCurr  = new HoraInfo(moment_ut, h.info.lat, h.info.lon, h.info.tz);
            Horoscope hCurr     = new Horoscope(infoCurr, h.options);

            ListViewItem li = null;

            PanchangaLocalMoments local = new PanchangaLocalMoments();

            local.sunrise    = hCurr.sunrise;
            local.sunset     = sunset;
            local.sunrise_ut = ut_sr;
            sweph.swe_revjul(ut, ref year, ref month, ref day, ref hour);
            local.wday = (Basics.Weekday)sweph.swe_day_of_week(ut);



            local.kalas_ut = hCurr.getKalaCuspsUt();
            if (this.opts.CalcSpecialKalas)
            {
                Body.Name bStart = Basics.weekdayRuler(hCurr.wday);
                if (hCurr.options.KalaType == HoroscopeOptions.EHoraType.Lmt)
                {
                    bStart = Basics.weekdayRuler(hCurr.lmt_wday);
                }

                local.rahu_kala_index   = this.rahu_kalas[(int)bStart];
                local.gulika_kala_index = this.gulika_kalas[(int)bStart];
                local.yama_kala_index   = this.yama_kalas[(int)bStart];
            }

            if (opts.CalcLagnaCusps)
            {
                li = new ListViewItem();
                sweph.obtainLock(h);
                BodyPosition     bp_lagna_sr = Basics.CalculateSingleBodyPosition(ut_sr, sweph.BodyNameToSweph(Body.Name.Lagna), Body.Name.Lagna, BodyType.Name.Lagna, h);
                DivisionPosition dp_lagna_sr = bp_lagna_sr.toDivisionPosition(new Division(Basics.DivisionType.Rasi));
                local.lagna_zh = dp_lagna_sr.zodiac_house.value;

                Longitude bp_lagna_base = new Longitude(bp_lagna_sr.longitude.toZodiacHouseBase());
                double    ut_transit    = ut_sr;
                for (int i = 1; i <= 12; i++)
                {
                    Retrogression r = new Retrogression(h, Body.Name.Lagna);
                    ut_transit = r.GetLagnaTransitForward(ut_transit, bp_lagna_base.add(i * 30.0));

                    PanchangaMomentInfo pmi = new PanchangaMomentInfo(
                        ut_transit, (int)bp_lagna_sr.longitude.toZodiacHouse().add(i + 1).value);
                    local.lagnas_ut.Add(pmi);
                }

                sweph.releaseLock(h);
            }

            if (opts.CalcTithiCusps)
            {
                Transit t = new Transit(h);
                sweph.obtainLock(h);
                Tithi tithi_start = t.LongitudeOfTithi(ut_sr).toTithi();
                Tithi tithi_end   = t.LongitudeOfTithi(ut_sr + 1.0).toTithi();

                Tithi tithi_curr = tithi_start.add(1);
                local.tithi_index_start = globals.tithis_ut.Count - 1;
                local.tithi_index_end   = globals.tithis_ut.Count - 1;

                while (tithi_start.value != tithi_end.value &&
                       tithi_curr.value != tithi_end.value)
                {
                    tithi_curr = tithi_curr.add(2);
                    double dLonToFind = ((double)(int)tithi_curr.value - 1) * (360.0 / 30.0);
                    double ut_found   = t.LinearSearchBinary(ut_sr, ut_sr + 1.0, new Longitude(dLonToFind),
                                                             new ReturnLon(t.LongitudeOfTithiDir));

                    globals.tithis_ut.Add(new PanchangaMomentInfo(ut_found, (int)tithi_curr.value));
                    local.tithi_index_end++;
                }
                sweph.releaseLock(h);
            }


            if (opts.CalcKaranaCusps)
            {
                Transit t = new Transit(h);
                sweph.obtainLock(h);
                Karana karana_start = t.LongitudeOfTithi(ut_sr).toKarana();
                Karana karana_end   = t.LongitudeOfTithi(ut_sr + 1.0).toKarana();

                Karana karana_curr = karana_start.add(1);
                local.karana_index_start = globals.karanas_ut.Count - 1;
                local.karana_index_end   = globals.karanas_ut.Count - 1;

                while (karana_start.value != karana_end.value &&
                       karana_curr.value != karana_end.value)
                {
                    karana_curr = karana_curr.add(2);
                    double dLonToFind = ((double)(int)karana_curr.value - 1) * (360.0 / 60.0);
                    double ut_found   = t.LinearSearchBinary(ut_sr, ut_sr + 1.0, new Longitude(dLonToFind),
                                                             new ReturnLon(t.LongitudeOfTithiDir));

                    globals.karanas_ut.Add(new PanchangaMomentInfo(ut_found, (int)karana_curr.value));
                    local.karana_index_end++;
                }
                sweph.releaseLock(h);
            }

            if (opts.CalcSMYogaCusps)
            {
                Transit t = new Transit(h);
                sweph.obtainLock(h);
                SunMoonYoga sm_start = t.LongitudeOfSunMoonYoga(ut_sr).toSunMoonYoga();
                SunMoonYoga sm_end   = t.LongitudeOfSunMoonYoga(ut_sr + 1.0).toSunMoonYoga();

                SunMoonYoga sm_curr = sm_start.add(1);
                local.smyoga_index_start = globals.smyogas_ut.Count - 1;
                local.smyoga_index_end   = globals.smyogas_ut.Count - 1;

                while (sm_start.value != sm_end.value &&
                       sm_curr.value != sm_end.value)
                {
                    sm_curr = sm_curr.add(2);
                    double dLonToFind = ((double)(int)sm_curr.value - 1) * (360.0 / 27);
                    double ut_found   = t.LinearSearchBinary(ut_sr, ut_sr + 1.0, new Longitude(dLonToFind),
                                                             new ReturnLon(t.LongitudeOfSunMoonYogaDir));

                    globals.smyogas_ut.Add(new PanchangaMomentInfo(ut_found, (int)sm_curr.value));
                    local.smyoga_index_end++;
                }

                sweph.releaseLock(h);
            }


            if (opts.CalcNakCusps)
            {
                bool    bDiscard = true;
                Transit t        = new Transit(h, Body.Name.Moon);
                sweph.obtainLock(h);
                Nakshatra nak_start = t.GenericLongitude(ut_sr, ref bDiscard).toNakshatra();
                Nakshatra nak_end   = t.GenericLongitude(ut_sr + 1.0, ref bDiscard).toNakshatra();

                local.nakshatra_index_start = globals.nakshatras_ut.Count - 1;
                local.nakshatra_index_end   = globals.nakshatras_ut.Count - 1;

                Nakshatra nak_curr = nak_start.add(1);

                while (nak_start.value != nak_end.value &&
                       nak_curr.value != nak_end.value)
                {
                    nak_curr = nak_curr.add(2);
                    double dLonToFind = ((double)((int)nak_curr.value - 1)) * (360.0 / 27.0);
                    double ut_found   = t.LinearSearchBinary(ut_sr, ut_sr + 1.0, new Longitude(dLonToFind),
                                                             new ReturnLon(t.GenericLongitude));

                    globals.nakshatras_ut.Add(new PanchangaMomentInfo(ut_found, (int)nak_curr.value));
                    Console.WriteLine("Found nakshatra {0}", nak_curr.value);
                    local.nakshatra_index_end++;
                }
                sweph.releaseLock(h);
            }

            if (opts.CalcHoraCusps)
            {
                local.horas_ut = hCurr.getHoraCuspsUt();
                hCurr.calculateHora(ut_sr + 1.0 / 24.0, ref local.hora_base);
            }

            if (opts.CalcKalaCusps)
            {
                hCurr.calculateKala(ref local.kala_base);
            }


            this.locals.Add(local);
            this.DisplayEntry(local);
        }