コード例 #1
0
        /// <summary>
        /// Getting values of location and time from user interface
        /// In GCAL.Base there are used classes:
        ///  - GPGregorianTime - for storing calendar date and time
        ///  - GPLocationProvider - for storing location
        /// In user interface, there are usually strings, double and DateTime
        /// This function is specific for this test application, but you
        /// can see how the values are converted
        /// </summary>
        public void initVars()
        {
            GPLocation loca = new GPLocation();

            loca.setCity(textBox1.Text);
            double d;
            int    l;

            if (double.TryParse(textBox2.Text, out d))
            {
                loca.setLongitudeEastPositive(d);
            }
            else
            {
                loca.setLongitudeEastPositive(0);
                textBox2.Text = "0.0";
            }
            if (double.TryParse(textBox3.Text, out d))
            {
                loca.setLatitudeNorthPositive(d);
            }
            else
            {
                loca.setLatitudeNorthPositive(0.0);
                textBox3.Text = "0.0";
            }

            loc = new GPLocationProvider();
            loca.setTimeZoneName(comboBox1.Text);
            loc.setDefaultLocation(loca);

            if (!int.TryParse(textBox4.Text, out l))
            {
                l             = 1;
                textBox4.Text = "1";
            }

            if (l <= 0)
            {
                l             = 1;
                textBox4.Text = "1";
            }

            days = l;

            //
            // converting dates
            //
            DateTime dd = dateTimePicker1.Value;
            DateTime dt = dateTimePicker2.Value;

            startDate = new DateTime(dd.Year, dd.Month, dd.Day, dt.Hour, dt.Minute, dt.Second);
            endDate   = startDate.AddDays(days);
        }
コード例 #2
0
        public void SetData(GPLocationProvider loa, GPLocationProvider lob, GPGregorianTime sd, double travelDurationHours)
        {
            GPLocationProvider lp = new GPLocationProvider();

            lp.setDefaultLocation(loa.getDefaultLocation());
            GPLocationChange locChange = new GPLocationChange();

            locChange.LocationA     = loa.getDefaultLocation();
            locChange.LocationB     = lob.getDefaultLocation();
            locChange.TimezoneStart = true;
            locChange.julianStart   = sd.getJulianGreenwichTime();
            locChange.julianEnd     = locChange.julianStart + travelDurationHours / 24.0;
            lp.addChange(locChange);

            provider = lp;

            startDateA = new GPGregorianTime(sd);
            startDateA.setLocationProvider(lp);
            startDateA.AddDays(-6);
            nCount = 15;
        }