Exemplo n.º 1
0
        public static void ExportPngYear(GCLocation calLocation, string dir, string locationFileName, int currentYear)
        {
            Size imageSize = new Size(1280, 1024);

            using (Bitmap b = new Bitmap(imageSize.Width, imageSize.Height))
            {
                using (Graphics g = Graphics.FromImage(b))
                {
                    CalendarTableDrawer ctd = new CalendarTableDrawer();
                    TResultCalendar     rc  = new TResultCalendar();
                    rc.CalculateCalendar(calLocation, new GregorianDateTime(currentYear, 1, 1), 366);

                    for (int i = 1; i <= 12; i++)
                    {
                        g.Clear(Color.White);
                        ctd.Draw(g, imageSize, rc, currentYear, i);
                        b.Save(Path.Combine(dir, string.Format("{0}-{1}-{2:00}.png", locationFileName, currentYear, i)), ImageFormat.Png);
                    }
                }
            }

            string        text = string.Format("<html><head><title>{0} {1}</title></head><body>", locationFileName, currentYear);
            StringBuilder sb   = new StringBuilder();

            sb.Append(text);
            for (int i = 1; i < 13; i++)
            {
                sb.AppendFormat("<p><img src=\"{0}-{1}-{2:00}.png\"></p>", locationFileName, currentYear, i);
            }
            sb.AppendFormat("</body></html>");

            File.WriteAllText(Path.Combine(dir, string.Format("{0}-{1}.html", locationFileName, currentYear)), sb.ToString());
        }
Exemplo n.º 2
0
        public CoreEventsTab()
        {
            InitializeComponent();
            richTextBox1.Dock = DockStyle.Fill;
            pictureBox1.Dock  = DockStyle.Fill;

            string s = Properties.Settings.Default.CoreEventsLocation;

            if (s.Length < 1)
            {
                s = GCGlobal.LastLocation.EncodedString;
            }
            coreLocation = new GCLocation();
            coreLocation.EncodedString = s;
            s = Properties.Settings.Default.CoreEventsStartDate;
            if (s.Length > 1)
            {
                coreStartDate.EncodedString = s;
            }
            s = Properties.Settings.Default.CoreEventsEndDate;
            if (s.Length > 1)
            {
                coreEndDate.EncodedString = s;
            }

            SetMode(Properties.Settings.Default.CoreEventsShowMode);
        }
Exemplo n.º 3
0
        public RatedEventsTab()
        {
            InitializeComponent();
            richTextBox1.Dock = DockStyle.Fill;
            pictureBox1.Dock  = DockStyle.Fill;

            string s = Properties.Settings.Default.RatedLocation;

            if (s.Length < 1)
            {
                s = GCGlobal.LastLocation.EncodedString;
            }
            ratedLocation = new GCLocation();
            ratedLocation.EncodedString = s;
            s = Properties.Settings.Default.RatedStartDate;
            if (s.Length > 1)
            {
                ratedStartDate.EncodedString = s;
            }
            s = Properties.Settings.Default.RatedEndDate;
            if (s.Length > 1)
            {
                ratedEndDate.EncodedString = s;
            }

            InitTemplates();
            s = Properties.Settings.Default.RatedConfiguration;
            SelectedConfiguration = GCConfigRatedManager.GetConfiguration(s);

            bEnchit = true;
            templateComboBox.SelectedIndex = templateComboBox.Items.IndexOf(SelectedConfiguration.Title);
            bEnchit = false;

            SetMode(Properties.Settings.Default.RatedEventsShowMode);
        }
        private void FunctionCalcBoundariesSync(Quadrant map, GregorianDateTime date)
        {
            GCLog.Write("Ekadasi Boundaries Calculation START");
            RootArray           = null;
            CalculationFinished = false;

            GregorianDateTime dt = new GregorianDateTime(date);

            dt.PreviousDay();
            dt.PreviousDay();

            GCLocation loc = new GCLocation();
            TTimeZone  tz  = new TTimeZone();

            loc.Latitude  = 0;
            loc.Longitude = 0;
            loc.TimeZone  = tz;

            TResultCalendar cal = new TResultCalendar();

            cal.EkadasiOnly = true;

            List <Quadrant> quandrantList = new List <Quadrant>();

            quandrantList.Add(map);
            QuadrantArray qa;

            map = null;
            int count = 0, maxCount = 2000;

            while (quandrantList.Count > 0)
            {
                map = quandrantList[0];
                quandrantList.RemoveAt(0);
                if (stopRequested)
                {
                    break;
                }
                map.Details = CalculateQuadrantArray(map, dt, loc, cal, quandrantList);
                if (RootArray == null)
                {
                    RootArray = map.Details;
                }

                // for testing
                count++;
                if (count >= maxCount)
                {
                    break;
                }
            }

            CalculationFinished = true;

            GCLog.Write("Ekadasi Boundaries Calculation END");

            StopMethodDelegate stopMethod = new StopMethodDelegate(PerformeStop);

            this.Invoke(stopMethod);
        }
        private void eventMapOverlayView1_OnClick(object o, EventmapOverlayEventArgs e)
        {
            GregorianDateTime dt = new GregorianDateTime(SelectedDate);

            dt.PreviousDay();
            dt.PreviousDay();

            GCLocation loc = new GCLocation();
            TTimeZone  tz  = new TTimeZone();

            loc.Latitude  = 0;
            loc.Longitude = 0;
            loc.TimeZone  = tz;

            TResultCalendar cal = new TResultCalendar();

            cal.EkadasiOnly = true;

            VAISNAVADAY vd = GetCalcDay(dt, loc, cal, e.Longitude, e.Latitude);

            string str = string.Format("{0}, sunrise: {1}, longitude: {2}, latitude: {3}"
                                       , vd.date.ToString(), vd.astrodata.sunRise.ToLongTimeString()
                                       , e.Longitude, e.Latitude);

            labelStatus.Text = str;
        }
Exemplo n.º 6
0
        public MasaListTab()
        {
            InitializeComponent();
            richTextBox1.Dock      = DockStyle.Fill;
            pictureBox1.Dock       = DockStyle.Fill;
            toolStripTextBox1.Text = DateTime.Now.Year.ToString();
            toolStripTextBox2.Text = "1";

            string s = Properties.Settings.Default.MasaListLocation;

            if (s.Length < 1)
            {
                s = GCGlobal.LastLocation.EncodedString;
            }
            masaLocation = new GCLocation();
            masaLocation.EncodedString = s;
            masaYear = Properties.Settings.Default.MasaListYear;
            if (masaYear < 1600)
            {
                masaYear = DateTime.Now.Year;
            }
            masaCount = Properties.Settings.Default.MasaListCount;
            if (masaCount < 1)
            {
                masaCount = 1;
            }

            SetMode(Properties.Settings.Default.MasaListShowMode);
        }
Exemplo n.º 7
0
 private void onLocationDone(object sender, EventArgs e)
 {
     if (sender is GCLocation)
     {
         GCLocation lr = sender as GCLocation;
         GCGlobal.AddRecentLocation(lr);
         masaLocation = lr;
         Recalculate();
     }
 }
Exemplo n.º 8
0
 private void onLocationDone(object sender, EventArgs e)
 {
     if (sender is GCLocation)
     {
         GCLocation lr = sender as GCLocation;
         GCGlobal.myLocation = lr;
         LocationText(lr.Title);
         Recalculate();
     }
 }
Exemplo n.º 9
0
        public SearchTab()
        {
            InitializeComponent();

            EarthLocation = GCGlobal.myLocation;

            buttonLocation.Text = EarthLocation.GetFullName();

            pictureBox1.Visible = false;
        }
Exemplo n.º 10
0
 private void onLocationDone(object sender, EventArgs e)
 {
     if (sender is GCLocation)
     {
         GCLocation lr = sender as GCLocation;
         GCGlobal.AddRecentLocation(lr);
         calLocation = lr;
         calendarDataView1.ClearCalendarData();
         Recalculate();
     }
 }
Exemplo n.º 11
0
        private void Panel1_OnLocationSelected(object sender, EventArgs e)
        {
            if (sender is GCLocation)
            {
                DialogResult     = DialogResult.OK;
                SelectedLocation = (GCLocation)sender;
            }
            else
            {
                DialogResult     = DialogResult.Cancel;
                SelectedLocation = null;
            }

            Close();
        }
Exemplo n.º 12
0
 public static void ExportPng(GCLocation calLocation, string directory, string locname, int year, int month)
 {
     using (Bitmap b = new Bitmap(1280, 1024))
     {
         using (Graphics g = Graphics.FromImage(b))
         {
             g.Clear(Color.White);
             CalendarTableDrawer ctd = new CalendarTableDrawer();
             TResultCalendar     rc  = new TResultCalendar();
             rc.CalculateCalendar(calLocation, new GregorianDateTime(year, month, 1), 32);
             ctd.Draw(g, new Size(1280, 1024), rc, year, month);
         }
         b.Save(Path.Combine(directory, string.Format("{0}-{1}-{2:00}.png", locname, year, month)), ImageFormat.Png);
     }
 }
        public VAISNAVADAY GetCalcDay(GregorianDateTime dt, GCLocation loc, TResultCalendar cal, double longitude, double latitude)
        {
            loc.SetCoordinates(longitude, latitude);
            cal.CalculateCalendar(loc, dt, 5);
            for (int i = 0; i < 5; i++)
            {
                VAISNAVADAY vd = cal.GetDay(i);
                if (vd.nFastID == FastType.FAST_EKADASI)
                {
                    return(vd);
                }
            }

            return(null);
        }
Exemplo n.º 14
0
        public CalendarTab()
        {
            InitializeComponent();

            calendarDataView1.Dock  = DockStyle.Fill;
            calendarTableView1.Dock = DockStyle.Fill;
            pictureBox1.Dock        = DockStyle.Fill;


            string s = Properties.Settings.Default.CalendarLocation;

            if (s.Length < 1)
            {
                s = GCGlobal.LastLocation.EncodedString;
            }
            calLocation = new GCLocation();
            calLocation.EncodedString = s;
            s = Properties.Settings.Default.CalendarStartDate;
            if (s.Length > 1)
            {
                calStartDate.EncodedString = s;
            }
            s = Properties.Settings.Default.CalendarEndDate;
            if (s.Length > 1)
            {
                calEndDate.EncodedString = s;
            }

            if ((calStartDate.year < 1500 || calStartDate.year > 3000) ||
                calEndDate.year < 1500 || calEndDate.year > 3000)
            {
                calStartDate     = new GregorianDateTime();
                calStartDate.day = 1;
                calEndDate       = new GregorianDateTime(calStartDate);
                calEndDate.AddDays(60);
            }

            calendarTableView1.calLocation = calLocation;
            calendarTableView1.LiveRefresh = true;

            calendarDataView1.DataSource = this;
            calendarDataView1.InitWithKey("2017-10");

            SetMode(0);
        }
Exemplo n.º 15
0
        public AppDayTab()
        {
            InitializeComponent();
            richTextBox1.Dock = DockStyle.Fill;
            pictureBox1.Dock  = DockStyle.Fill;

            string s = Properties.Settings.Default.AppDayDateTime;

            appDayDateTime.EncodedString = Properties.Settings.Default.AppDayDateTime;
            s = Properties.Settings.Default.AppDayLocation;
            if (s.Length < 1)
            {
                s = GCGlobal.LastLocation.EncodedString;
            }
            appDayLocation = new GCLocation();
            appDayLocation.EncodedString = s;
            SetMode(Properties.Settings.Default.AppDayShowMode);
            Recalculate();
        }
        private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
        {
            if (e.Index >= 0 && e.Index < GCGlobal.recentLocations.Count)
            {
                GCLocation cr = GCGlobal.recentLocations[e.Index];

                if ((e.State & DrawItemState.Selected) != 0)
                {
                    e.Graphics.FillRectangle(Brushes.LightYellow, e.Bounds);
                }
                else
                {
                    e.Graphics.FillRectangle(SystemBrushes.Control, e.Bounds);
                }

                SizeF a = e.Graphics.MeasureString("A", CaptionFont);
                e.Graphics.DrawString(cr.Title, CaptionFont, Brushes.Black, PaddingX, e.Bounds.Top + PaddingX);
                e.Graphics.DrawString(cr.Format("{longitudeText} {latitudeText}, {timeZoneName}"),
                                      TextFont, Brushes.Gray, PaddingX, e.Bounds.Top + PaddingX + a.Height + Spacing);
            }
        }
Exemplo n.º 17
0
        public static void ExportTableCalendar(GCLocation calLocation, int printYearStart, int printYearEnd, string folderPath)
        {
            TResultCalendar   m_calendarToPrint = new TResultCalendar();
            GregorianDateTime startDate         = new GregorianDateTime(printYearStart, 1, 1);
            GregorianDateTime endDate           = new GregorianDateTime(printYearEnd, 12, 1);

            m_calendarToPrint.CalculateCalendar(calLocation, startDate, endDate.GetJulianInteger() - startDate.GetJulianInteger() + 31);

            string DocumentName = string.Format("{0}_{1}", calLocation.Title, printYearStart);

            PdfDocument doc = new PdfDocument();

            CalendarPdfDrawer ctd = new CalendarPdfDrawer();

            for (int year = printYearStart; year <= printYearEnd; year++)
            {
                for (int month = 1; month <= 12; month++)
                {
                    PdfPage page = doc.AddPage();
                    page.Size        = PdfSharp.PageSize.A4;
                    page.Orientation = PdfSharp.PageOrientation.Landscape;

                    XGraphics gfx = XGraphics.FromPdfPage(page);

                    SizeF pageSizeF = gfx.PageSize.ToSizeF();
                    ctd.PaddingTop    = Convert.ToInt32(pageSizeF.Height / 20);
                    ctd.PaddingBottom = Convert.ToInt32(pageSizeF.Height / 20);
                    ctd.PaddingLeft   = Convert.ToInt32(pageSizeF.Width / 20);
                    ctd.PaddingRight  = Convert.ToInt32(pageSizeF.Width / 20);

                    ctd.Draw(gfx, gfx.PageSize, m_calendarToPrint, year, month);
                }
            }

            doc.Save(folderPath);
        }
Exemplo n.º 18
0
        public GCEarthData GetEarthData()
        {
            GCLocation L = LocationRef;

            return(L.GetEarthData());
        }
Exemplo n.º 19
0
 public void PrintPdfYear(GCLocation loc, int year, string fileName)
 {
     GCPrintService.ExportTableCalendar(loc, year, year, fileName);
 }
Exemplo n.º 20
0
        internal void Draw(XGraphics graphics, XSize size, Base.TResultCalendar tResultCalendar, int nYear, int nMonth)
        {
            XGraphics g          = graphics;
            XSize     textSize   = XSize.Empty;
            double    fontH1Size = (float)Math.Min(size.Height - PaddingLeft - PaddingRight, size.Width * 0.707f - PaddingTop - PaddingBottom) / 30;

            xMarginLeft     = PaddingLeft;
            yMarginTop      = PaddingTop;
            xMarginRight    = (float)(size.Width - PaddingRight);
            yUnderTitleBar  = 0;
            yUnderMainTitle = 0;
            double        tx;
            double        cellInset  = fontH1Size / 5;
            XStringFormat rectFormat = new XStringFormat();
            DateTime      dtToday    = DateTime.Now;
            GCLocation    loc        = tResultCalendar.m_Location;


            InitializeFonts((float)fontH1Size);

            string str;

            DrawTitle(nYear, nMonth, g);

            if (tResultCalendar == null)
            {
                return;
            }

            DrawRightTitleInfo(tResultCalendar, g);

            g.DrawLine(monthDivider, xMarginLeft, yUnderTitleBar, xMarginRight, yUnderTitleBar);

            firstDayOfWeekGeneral = (loc.Country.FirstDayOfWeek < 0 || loc.Country.FirstDayOfWeek > 6)
                ? GCDisplaySettings.Current.getValue(GCDS.GENERAL_FIRST_DOW)
                : loc.Country.FirstDayOfWeek;
            xCellWidth = (xMarginRight - xMarginLeft) / 7.0f;

            double tempTextHeight = fontH1Size / 5;

            // draw names of weekdays
            textSize = DrawWeekdayHeader(g, tempTextHeight);

            yTableTop = (float)(yUnderTitleBar + 2 * tempTextHeight + textSize.Height);


            yMarginBottom = (float)(size.Height - PaddingBottom);
            int firstIndex  = 0;
            int firstDayDow = 0;

            for (int i = 0; i < tResultCalendar.m_nCount; i++)
            {
                GregorianDateTime gdt = tResultCalendar.m_pData[i].date;
                if (gdt.day == 1 && gdt.month == nMonth && gdt.year == nYear)
                {
                    firstIndex  = i;
                    firstDayDow = gdt.dayOfWeek;
                }
            }

            int daysBeforeFirstDay = (firstDayDow - firstDayOfWeekGeneral + 14) % 7;
            int monthDays          = GregorianDateTime.GetMonthMaxDays(nYear, nMonth);

            int totalDays  = daysBeforeFirstDay + monthDays;
            int weeksCount = ((totalDays % 7) == 0) ? (totalDays / 7) : (totalDays / 7 + 1);

            yCellHeight = (yMarginBottom - yTableTop) / weeksCount;

            XRect         rcf = new XRect();
            int           row, column, di;
            StringBuilder masaText = new StringBuilder();

            for (int i = 1; i <= monthDays; i++)
            {
                di     = daysBeforeFirstDay + i - 1;
                row    = di / 7;
                column = di % 7;

                VAISNAVADAY vd      = tResultCalendar.m_pData[firstIndex + i - 1];
                VAISNAVADAY vd_prev = tResultCalendar.m_pData[firstIndex + i - 2];
                VAISNAVADAY vd_next = tResultCalendar.m_pData[firstIndex + i];

                ConstructMasaText(masaText, i, vd, vd_prev, vd_next);

                yCellMarginTop  = yTableTop + row * yCellHeight + cellInset;
                xCellMarginLeft = xMarginLeft + column * xCellWidth + cellInset;

                rcf.X      = xCellMarginLeft - cellInset;
                rcf.Y      = yCellMarginTop - cellInset;
                rcf.Width  = xCellWidth;
                rcf.Height = yCellHeight;
                if (vd.nFastID == FastType.FAST_EKADASI)
                {
                    g.DrawRectangle(Brushes.LightGreen, rcf);
                }
                else if (vd.nFastID != 0)
                {
                    g.DrawRectangle(Brushes.LightSkyBlue, rcf);
                }
                if (dtToday.Day == i && dtToday.Month == nMonth && dtToday.Year == nYear)
                {
                    g.DrawRectangle(todayBorder, rcf.Left, rcf.Top, rcf.Width, rcf.Height);
                }


                textSize = DrawCellDayNumber(g, i);

                yCellAnchor1      = yCellMarginTop + textSize.Height + cellInset;
                xCellAnchor1      = xCellMarginLeft + textSize.Width + cellInset;
                xCellMarginRight  = xCellMarginLeft + xCellWidth - 2 * cellInset;
                yCellMarginBottom = yCellMarginTop + yCellHeight - 2 * cellInset;


                tempTextHeight = DrawTithiText(g, vd);

                yCellAnchor1 = Math.Max(tempTextHeight + cellInset, yCellAnchor1);


                rcf.X      = xCellAnchor1;
                rcf.Y      = yCellMarginTop;
                rcf.Width  = xCellMarginRight - xCellAnchor1;
                rcf.Height = textSize.Height + 2;

                str = GetEventsLineText(vd);

                XFont f = fontS2;
                textSize = g.MeasureString(str, fontS2);
                double tsh = textSize.Width / (xCellWidth - 2 * cellInset) * textSize.Height;
                if (textSize.Height + yCellAnchor1 + cellInset > yCellMarginTop + yCellHeight)
                {
                    f        = fontS3;
                    textSize = g.MeasureString(str, f);
                }
                rcf.Y      = yCellAnchor1;
                rcf.X      = xCellMarginLeft;
                rcf.Width  = xCellWidth - 2 * cellInset;
                rcf.Height = yCellMarginBottom - yCellAnchor1 + 2;

                DrawTextRectangle(g, rectFormat, str, rcf, f);
            }

            // masa info text
            string masaTextStr = masaText.ToString();

            textSize = g.MeasureString(masaTextStr, fontS2);
            g.DrawString(masaText.ToString(), fontS2, Brushes.Black, xMarginLeft, yUnderMainTitle + textSize.Height);

            // final step: draw matrix
            for (int i = 0; i < 8; i++)
            {
                g.DrawLine(dayDivider, xMarginLeft + i * xCellWidth, yTableTop, xMarginLeft + i * xCellWidth, yMarginBottom);
            }
            for (int j = 0; j <= weeksCount; j++)
            {
                g.DrawLine(dayDivider, xMarginLeft, yTableTop + j * yCellHeight, xMarginRight, yTableTop + j * yCellHeight);
            }
        }
Exemplo n.º 21
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            SetProgressValue locdel = new SetProgressValue(SetLocationsProgressValue);
            SetProgressValue yrdel  = new SetProgressValue(SetYearsProgressvalue);

            List <FileRec>   files     = new List <FileRec>();
            HashSet <string> countries = new HashSet <string>();

            GCDisplaySettings stateDetailedText = new GCDisplaySettings("Detailed Calendar");
            GCDisplaySettings stateText         = new GCDisplaySettings("Brief Calendar");
            GCDisplaySettings stateOrig         = GCDisplaySettings.Current;

            try
            {
//                stateText.Clear();
                stateText.setValue(GCDS.CAL_DST_CHANGE, 1);
                stateText.setValue(GCDS.CAL_EKADASI_PARANA, 1);
                stateText.setValue(GCDS.CAL_FEST_0, 1);
                stateText.CalHeaderType = 1;
                stateText.setValue(GCDS.CAL_MASA_CHANGE, 1);
                stateText.setValue(GCDS.CAL_MOON_LONG, 0);
                stateText.setValue(GCDS.CAL_MOON_RISE, 0);
                stateText.setValue(GCDS.CAL_MOON_SET, 0);
                stateText.setValue(GCDS.CAL_SANKRANTI, 0);
                stateText.setValue(GCDS.CAL_SUN_LONG, 0);
                stateText.setValue(GCDS.CAL_SUN_RISE, 0);
                stateText.setValue(GCDS.CAL_SUN_SANDHYA, 0);
                stateText.setValue(GCDS.CAL_VRDDHI, 0);
                stateText.setValue(GCDS.COREEVENTS_ABHIJIT_MUHURTA, 0);
                stateText.setValue(GCDS.COREEVENTS_ASCENDENT, 0);
                stateText.setValue(GCDS.COREEVENTS_CONJUNCTION, 0);
                stateText.setValue(GCDS.COREEVENTS_GULIKALAM, 0);
                stateText.setValue(GCDS.COREEVENTS_MOON, 0);
                stateText.setValue(GCDS.COREEVENTS_MOONRASI, 0);
                stateText.setValue(GCDS.COREEVENTS_NAKSATRA, 0);
                stateText.setValue(GCDS.COREEVENTS_RAHUKALAM, 0);
                stateText.setValue(GCDS.COREEVENTS_SANKRANTI, 0);
                stateText.setValue(GCDS.COREEVENTS_SUN, 0);
                stateText.setValue(GCDS.COREEVENTS_TITHI, 0);
                stateText.setValue(GCDS.COREEVENTS_YAMAGHANTI, 0);
                stateText.setValue(GCDS.COREEVENTS_YOGA, 0);

                stateDetailedText.setValue(GCDS.CAL_ARUN_TIME, 0);
                stateDetailedText.setValue(GCDS.CAL_ARUN_TITHI, 0);
                stateDetailedText.setValue(GCDS.CAL_AYANAMSHA, 0);
                stateDetailedText.setValue(GCDS.CAL_BRAHMA_MUHURTA, 1);
                stateDetailedText.setValue(GCDS.CAL_COREEVENTS, 1);
                stateDetailedText.setValue(GCDS.CAL_DST_CHANGE, 1);
                stateDetailedText.setValue(GCDS.CAL_EKADASI_PARANA, 1);
                stateDetailedText.setValue(GCDS.CAL_FEST_0, 1);
                stateDetailedText.CalHeaderType = 1;
                stateDetailedText.setValue(GCDS.CAL_JULIAN, 0);
                stateDetailedText.setValue(GCDS.CAL_KSAYA, 0);
                stateDetailedText.setValue(GCDS.CAL_MASA_CHANGE, 1);
                stateDetailedText.setValue(GCDS.CAL_SUN_RISE, 1);
                stateDetailedText.setValue(GCDS.CAL_SUN_SANDHYA, 1);
                stateDetailedText.setValue(GCDS.COREEVENTS_CONJUNCTION, 1);
                stateDetailedText.setValue(GCDS.COREEVENTS_GULIKALAM, 0);
                stateDetailedText.setValue(GCDS.COREEVENTS_MOON, 1);
                stateDetailedText.setValue(GCDS.COREEVENTS_MOONRASI, 1);
                stateDetailedText.setValue(GCDS.COREEVENTS_NAKSATRA, 1);
                stateDetailedText.setValue(GCDS.COREEVENTS_TITHI, 1);
                stateDetailedText.setValue(GCDS.COREEVENTS_YAMAGHANTI, 0);
                stateDetailedText.setValue(GCDS.COREEVENTS_YOGA, 1);
                stateDetailedText.setValue(GCDS.GENERAL_FIRST_DOW, stateOrig.getValue(GCDS.GENERAL_FIRST_DOW));


                string  content;
                FileRec currentFileRec;

                for (int locIndex = 0; locIndex < SelectedLocations.Count; locIndex++)
                {
                    TLocation loc = SelectedLocations[locIndex];
                    if (!countries.Contains(loc.Country.Name))
                    {
                        countries.Add(loc.Country.Name);
                    }
                    progressBar1.Invoke(locdel, locIndex);
                    for (int year = StartYear; year <= EndYear; year++)
                    {
                        if (backgroundWorker1.CancellationPending)
                        {
                            return;
                        }
                        if (CancelRequested)
                        {
                            return;
                        }

                        progressBar2.Invoke(yrdel, year);
                        //                        Thread.Sleep(1000);

                        TResultCalendar calendar;
                        GCLocation      locRef = loc.GetLocationRef();


                        currentFileRec = new FileRec()
                        {
                            filename       = year.ToString() + "_" + ToFilePart(loc.CityName) + ".html",
                            filenameDetail = year.ToString() + "_" + ToFilePart(loc.CityName) + "_d.html",
                            filenamePdf    = year.ToString() + "_" + ToFilePart(loc.CityName) + ".pdf",
                            city           = loc.CityName,
                            country        = loc.Country.Name,
                            year           = year
                        };

                        files.Add(currentFileRec);

                        GCDisplaySettings.Current = stateText;
                        calendar = new TResultCalendar(loc.GetLocationRef(), year);
                        content  = calendar.formatText(GCDataFormat.HTML);
                        // print plain TXT
                        File.WriteAllText(Path.Combine(OutputDir, currentFileRec.filename), content);
                        // print PDF
                        PrintPdfYear(calendar, year, Path.Combine(OutputDir, currentFileRec.filenamePdf));

                        GCDisplaySettings.Current = stateDetailedText;
                        calendar = new TResultCalendar(loc.GetLocationRef(), year);
                        content  = calendar.formatText(GCDataFormat.HTML);
                        // print detailed TXT
                        File.WriteAllText(Path.Combine(OutputDir, currentFileRec.filenameDetail), content);
                    }

                    // write location index file
                    if (StartYear != EndYear)
                    {
                        File.WriteAllText(Path.Combine(OutputDir, ToFilePart(loc.CityName) + ".html"), GenerateYearIndex(loc, StartYear, EndYear));
                    }
                }

                for (int year = StartYear; year <= EndYear; year++)
                {
                    // write main index file
                    File.WriteAllText(Path.Combine(OutputDir, "y" + year.ToString() + ".html"), GenerateMainIndex(countries, year, year));
                }

                // write main index file
                File.WriteAllText(Path.Combine(OutputDir, "index.html"), GenerateMainIndex(countries, StartYear, EndYear));

                // write main years file
                //File.WriteAllText(Path.Combine(OutputDir, "years.html"), GenerateYearsOverview(StartYear, EndYear));

                progressBar1.Invoke(new SetProgressValue(SetDialogCompleted), 0);
            }
            catch (Exception ex)
            {
                Debugger.Log(0, "", "Error: " + ex.Message + "\n" + ex.StackTrace + "\n");
            }
            finally
            {
                GCDisplaySettings.Current = stateOrig;
            }
        }
        private QuadrantArray CalculateQuadrantArray(Quadrant map, GregorianDateTime dt, GCLocation loc, TResultCalendar cal, List <Quadrant> qlist)
        {
            QuadrantArray qa = new QuadrantArray(map, calculateSplits(map.LongitudeRange, map.pixelsX), calculateSplits(map.LatitudeRange, map.pixelsY));

            for (int lo = 0; lo < qa.Longitudes.Length; lo++)
            {
                for (int la = 0; la < qa.Latitudes.Length; la++)
                {
                    if (qa.Points[lo, la].Result != null)
                    {
                        continue;
                    }
                    VAISNAVADAY vd = GetCalcDay(dt, loc, cal, qa.Longitudes[lo], qa.Latitudes[la]);

                    /*                    loc.SetCoordinates(qa.Longitudes[lo], qa.Latitudes[la]);
                     *                  cal.CalculateCalendar(loc, dt, 5);
                     *                  for (int i = 0; i < 5; i++)
                     *                  {
                     *                      VAISNAVADAY vd = cal.GetDay(i);
                     *                      if (vd.nFastID == FastType.FAST_EKADASI)
                     *                      {
                     *                          qa.Points[lo, la].Result = GetSafeResult(vd);
                     *                      }
                     *                  }*/
                    if (vd != null)
                    {
                        qa.Points[lo, la].Result = GetSafeResult(vd);
                    }
                }
            }

            for (int lo = 0; lo < qa.Quadrants.GetLength(0); lo++)
            {
                for (int la = 0; la < qa.Quadrants.GetLength(1); la++)
                {
                    if (qa.Quadrants[lo, la].ResultState == QuadrantResultState.Decomposable)
                    {
                        qlist.Add(qa.Quadrants[lo, la]);
                    }
                }
            }

            return(qa);
        }