Example #1
0
        // insert after
        private void button7_Click(object sender, EventArgs e)
        {
            ListBox lbox        = listBox1;
            int     index       = lbox.SelectedIndex;
            int     changeIndex = getChangeIndexFromListBoxIndex(index);

            GPLocationChange   chng     = null;
            GPLocationProvider provider = GPAppHelper.getMyLocation();

            // ask for travelling time
            // ask for starting location
            WizardDlg wizard = new WizardDlg();

            LocationPickerControl lpc = new LocationPickerControl();

            lpc.TravellerVisible = false;
            wizard.AddPage(lpc, "Target Location", "Select location, where you end your travelling");

            //LocationPickerControl lpc2 = new LocationPickerControl();
            //lpc2.TravellerVisible = false;
            //wizard.AddPage(lpc2, "Target Location", "Select location, where you finish your traveling");

            TravellingEditControl tec = new TravellingEditControl();

            if (IsSelectedLocation)
            {
                tec.LocationObj = listBox1.SelectedItem as GPLocation;
                if ((listBox1.SelectedIndex - 1) > 0)
                {
                    chng = (listBox1.Items[listBox1.SelectedIndex - 1] as GPLocationChange);
                }
            }
            if (IsSelectedTravelling)
            {
                chng            = (listBox1.SelectedItem as GPLocationChange);
                tec.LocationObj = chng.LocationB;
            }
            tec.LocationPicker2         = lpc;
            tec.TransitionTimezoneIndex = 0;
            if (chng != null)
            {
                GPGregorianTime start = new GPGregorianTime(tec.LocationObj);
                start.setJulianGreenwichTime(new GPJulianTime(chng.julianStart, 0));
                tec.SetBottomEndDateLimit(start.getLocalTime());
            }
            wizard.AddPage(tec, "Travelling time", "Specify travelling time");

            wizard.ResetPages();

            if (wizard.ShowDialog() == DialogResult.OK)
            {
                GPLocationChange newChange = new GPLocationChange();

                newChange.LocationA = tec.LocationObj;
                newChange.LocationB = lpc.SelectedLocation.getLocation(0);

                GPGregorianTime start = new GPGregorianTime(newChange.LocationA);
                start.setDateTime(tec.getUTCDateTime(0).AddHours(newChange.LocationA.getTimeZoneOffsetHours()));
                newChange.julianStart = start.getJulianGreenwichTime();

                GPGregorianTime end = new GPGregorianTime(newChange.LocationB);
                end.setDateTime(tec.getUTCDateTime(1).AddHours(newChange.LocationB.getTimeZoneOffsetHours()));
                newChange.julianEnd = end.getJulianGreenwichTime();

                newChange.TimezoneStart = (tec.TransitionTimezoneIndex == 0);

                // remove travellings before changeIndex
                // insert new travelling at index 0
                provider.removeChangesAfterIndex(changeIndex);
                provider.addChange(newChange);

                RefreshList();
                travellingChanged = true;
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            GPLocation loc;

            content.findLocations("Bratislava");
            loc = content.getLocation(0);
            GPLocationProvider provider = new GPLocationProvider(loc);
            int nCount = 365;

            GPGregorianTime   startDateA = new GPGregorianTime(loc);
            GPCalendarResults calA       = new GPCalendarResults();
            GPCalendarResults calB       = new GPCalendarResults();

            calA.progressReport = this;
            calB.progressReport = this;

            if (startDateA != null)
            {
                GPSun.sunPosMethod = GPSun.SUNPOSMETHOD_CALCULATOR;
                calA.CalculateCalendar(startDateA, nCount);
                GPSun.sunPosMethod = GPSun.SUNPOSMETHOD_CALCULATOREX;
                calB.CalculateCalendar(startDateA, nCount);
            }
            GPSun.sunPosMethod = GPSun.SUNPOSMETHOD_CALCULATOR;

            StringBuilder sb = new StringBuilder();

            GPCalendarTwoLocResults cals = new GPCalendarTwoLocResults();

            cals.CalendarA = calA;
            cals.CalendarB = calB;

            FormaterHtml.WriteCompareCalendarHTML(cals, sb);

            string HtmlText = sb.ToString();

            webBrowser1.DocumentText = HtmlText;

            GPObserver obs = new GPObserver();

            obs = loc;

            GPStrings.pushRich(false);

            StringBuilder sba = new StringBuilder();
            GPJulianTime  sunRise, sunNoon, sunSet;

            for (int i = 0; i < calA.getCount(); i++)
            {
                GPCalendarDay cd  = calA.get(i);
                GPCalendarDay cd2 = calB.get(i);
                GPAstroEngine.CalculateTimeSun(cd.date, loc, out sunRise, out sunNoon, out sunSet);
                GPGregorianTime gt = new GPGregorianTime(loc);

                GPCelestialBodyCoordinates pos = GPAstroEngine.sun_coordinate(GPDynamicTime.getUniversalTimeFromDynamicTime(2457012.82313));
                GPAstroEngine.calcHorizontal(pos, loc);

                sunRise.setLocalTimezoneOffset(loc.getTimeZoneOffsetHours());
                sba.AppendFormat("{0}     {1}    {2}  \n", cd.date.ToString(),
                                 cd.getSunriseTime().getLongTimeString(),
                                 cd2.getSunriseTime().getLongTimeString());
                gt.setDate(1992, 10, 13);
                //cd.astrodata.sun.calculateCoordinatesMethodM(gt, 360/24.0);
            }

            GPStrings.popRich();

            richTextBox1.Text = sba.ToString();


            GPGregorianTime t1 = new GPGregorianTime(loc);

            t1.setDate(2015, 4, 4);

            double jd = t1.getJulianLocalNoon();

            sba.Clear();
            for (double d = 0.3; d < 1.0; d += 0.01)
            {
                double ml  = GPAstroEngine.moon_coordinate(jd + d).eclipticalLongitude;
                double sl1 = GPAstroEngine.sun_coordinate(jd + d).eclipticalLongitude;
                double sl2 = GPAstroEngine.sunLongitudeMethodM(jd + d);
                sba.AppendFormat("{0} : {1} {2} {3}\n", jd + d, ml, sl1, sl2);
            }
            richTextBox2.Text = sba.ToString();
        }
Example #3
0
 public void SetData(GPLocationProvider lo, GPGregorianTime sd, int cn)
 {
     location  = lo;
     startDate = sd;
     nCount    = cn;
 }
Example #4
0
 public void SetData(GPLocationProvider lo, GPGregorianTime sd, GPGregorianTime ed)
 {
     location  = lo;
     startDate = sd;
     endDate   = ed;
 }
Example #5
0
 public void SetData(GPLocationProvider loca, GPGregorianTime startWesternDate, GPVedicTime startVedicDate)
 {
     location         = loca;
     startWesternTime = startWesternDate;
     startVedicTime   = startVedicDate;
 }
Example #6
0
        private void locationPickerControl1_SelectedLocationChange(object sender, EventArgs data)
        {
            GPLocationProvider loc = locationPickerControl1.SelectedLocation;

            button2.Enabled = (loc != null);
        }