Esempio n. 1
0
        private void GetSiteLocation()
        {
            //Import scout text query and parse out tracking parameters
            sky6StarChart tsxsc = new sky6StarChart();

            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_Latitude);
            BestObservatory.MySiteLat = tsxsc.DocPropOut;
            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_Longitude);
            BestObservatory.MySiteLong = tsxsc.DocPropOut;
            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_ElevationInMeters);
            BestObservatory.MySiteElev = tsxsc.DocPropOut / 1000;
            return;
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static double GetLocationLatitude()
        {
            //Get and return the latitude of the current TSX star chart (as set by location)
            sky6StarChart tsxsc = new sky6StarChart();

            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_Latitude);
            double lat = Convert.ToDouble(tsxsc.DocPropOut);

            return(lat);
        }
Esempio n. 3
0
        public ObjectList(DBQFileManagement.SearchType searchDB, DateTime duskDateLocal, DateTime dawnDateLocal)
        {
            //Determine if search database file exists, if not, create it
            if (!DBQFileManagement.DBQsInstalled())
            {
                DBQFileManagement.InstallDBQs();
            }

            //Load the path to the selected search database query
            sky6DataWizard tsxdw = new sky6DataWizard();

            tsxdw.Path = DBQFileManagement.GetDBQPath(searchDB);
            //Set the search date for the dusk query
            sky6StarChart tsxs = new sky6StarChart();

            tsxs.DocumentProperty(Sk6DocumentProperty.sk6DocProp_Latitude);
            oLat = tsxs.DocPropOut;
            tsxs.DocumentProperty(Sk6DocumentProperty.sk6DocProp_Longitude);
            oLong = tsxs.DocPropOut;
            double jdate = Celestial.DateToJulian(duskDateLocal.ToUniversalTime());

            tsxs.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_JulianDateNow, jdate);
            tsxdw.Open();
            //sky6ObjectInformation tsxoi = new sky6ObjectInformation();
            sky6ObjectInformation tsxoi = tsxdw.RunQuery;

            //Fill in data arrays (for speed purposes)
            int tgtcount = tsxoi.Count;

            for (int i = 0; i < tgtcount; i++)
            {
                tsxoi.Index = i;
                //tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_ALL_INFO);
                //var AllInfo = tsxoi.ObjInfoPropOut;

                tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1);
                oname = (tsxoi.ObjInfoPropOut);
                tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_OBJECTTYPE);
                otype = (tsxoi.ObjInfoPropOut);
                tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_MAJ_AXIS_MINS);
                osize = (tsxoi.ObjInfoPropOut);
                tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RISE_TIME);
                orise = (duskDateLocal - duskDateLocal.TimeOfDay).AddHours(tsxoi.ObjInfoPropOut);
                tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_SET_TIME);
                oset = (duskDateLocal - duskDateLocal.TimeOfDay).AddHours(tsxoi.ObjInfoPropOut);
                tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000);
                oDec = (tsxoi.ObjInfoPropOut);
                tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000);
                oRA = (tsxoi.ObjInfoPropOut);
                //compute the duration
                oduration = Celestial.IntervalOverlap(duskDateLocal, dawnDateLocal, orise, oset);
                //compute the maximum altitude
                omaxaltitude = ComputeMaxAltitude(duskDateLocal, dawnDateLocal, oRA, oDec, oLat, oLong);
                // if the duration is greater than zero, then add it
                if (oduration > 0)
                {
                    dbqList.Add(new DBQObject(oname, otype, osize, oset, orise, oDec, oRA, oLat, oLong, oduration, omaxaltitude));
                }
            }
            //Note that all these entries should have at least some duration
            //Set the search date for the dawn query
            jdate = Celestial.DateToJulian(dawnDateLocal.ToUniversalTime());
            tsxs.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_JulianDateNow, jdate);
            tsxdw.Open();
            tsxoi = tsxdw.RunQuery;

            //check each entry to see if it is already in the dusk list
            //  if so, just ignor, if not get the resf of the info and add it
            for (int i = 0; i < tsxoi.Count; i++)
            {
                tsxoi.Index = i;
                tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1);
                oname = (tsxoi.ObjInfoPropOut);
                bool newEntry = true;
                foreach (DBQObject tgt in dbqList)
                {
                    if (tgt.Name == oname)
                    {
                        newEntry = false;
                        break;
                    }
                }
                if (newEntry)
                {
                    tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_OBJECTTYPE);
                    otype = (tsxoi.ObjInfoPropOut);
                    tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_MAJ_AXIS_MINS);
                    osize = (tsxoi.ObjInfoPropOut);
                    tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RISE_TIME);
                    orise = (duskDateLocal - duskDateLocal.TimeOfDay).AddHours(tsxoi.ObjInfoPropOut);
                    tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_SET_TIME);
                    oset = (duskDateLocal - duskDateLocal.TimeOfDay).AddHours(tsxoi.ObjInfoPropOut);
                    tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000);
                    oDec = (tsxoi.ObjInfoPropOut);
                    tsxoi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000);
                    oRA = (tsxoi.ObjInfoPropOut);
                    //compute the duration
                    oduration = Celestial.IntervalOverlap(duskDateLocal, dawnDateLocal, orise, oset);
                    //compute the maximum altitude
                    omaxaltitude = ComputeMaxAltitude(duskDateLocal, dawnDateLocal, oRA, oDec, oLat, oLong);
                    // if the duration is greater than zero, then add it
                    if (oduration > 0)
                    {
                        dbqList.Add(new DBQObject(oname, otype, osize, oset, orise, oDec, oRA, oLat, oLong, oduration, omaxaltitude));
                    }
                }
            }

            //Now clear out all the entries that have no duration between
            //Reset tsx to computer clock
            tsxs.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_UseComputerClock, 1);
            tsxs  = null;
            tsxoi = null;
            return;
        }
Esempio n. 4
0
        public FormImagePlanner()
        {
            InitializeComponent();

            SelectionEnabled = false;
            ButtonGreen(DetailsButton);
            ButtonGreen(AltitudeButton);
            ButtonGreen(PreviewButton);
            ButtonGreen(AddTargetPlanButton);
            ButtonGreen(DeleteTargetPlanButton);
            ButtonGreen(PrintButton);
            ButtonGreen(DoneButton);
            ButtonGreen(InfoButton);
            ButtonGreen(ProspectButton);
            ButtonGreen(AssessButton);
            ButtonGreen(TrackButton);

            this.FontHeight        = 1;
            MonthCalendar.RowCount = 31;
            for (int i = 0; i <= 30; i++)
            {
                MonthCalendar.Rows[i].HeaderCell.Value = (i + 1).ToString();
            }

            //Compute current dates based on TSX star chart julian date
            //  this allows star charts to be in different locations and time zones
            //  as set up by user
            sky6StarChart tsxsc = new sky6StarChart();

            //Get the star chart julian date and convert to current date/time
            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_JulianDateNow);
            DateTime dateTSXutc = AstroMath.Celestial.JulianToDate(tsxsc.DocPropOut);

            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_Time_Zone);
            double tzTSX = tsxsc.DocPropOut;

            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_DaylightSavingTimeIndex);
            double   tzIndexTSX = tsxsc.DocPropOut;
            DateTime dateTSX    = dateTSXutc.AddHours(tzTSX + tzIndexTSX);

            CurrentYearPick.Value = dateTSX.Year;
            GenerateCalendar();
            Show();
            System.Windows.Forms.Application.DoEvents();
            SelectionEnabled = true;
            //Figure out the year and load it into the year box
            string thisyear = dateTSX.ToString("yyyy");

            CurrentYearPick.Value = Convert.ToInt16(thisyear);
            //Pick the current date as the selected cell
            SelectedDate = dateTSX;
            int jCol = dateTSX.Month - 1;
            int iRow = dateTSX.Day - 1;

            MonthCalendar.Rows[iRow].Cells[jCol].Selected = true;

            //Fill in Humason target plans
            XFiles xf = new XFiles();

            if (xf != null)
            {
                List <string> tgtList = xf.GetTargetFiles();
                foreach (string tgt in tgtList)
                {
                    if (!(tgt.Contains("Default")))
                    {
                        ImagePlannerTargetList.Items.Add(tgt);
                    }
                }
                if (ImagePlannerTargetList.Items.Count > 0)
                {
                    ImagePlannerTargetList.SelectedItem = ImagePlannerTargetList.Items[0];
                }
            }
            QPUpdate.WazzupEventHandler += WazzupEvent_Handler;

            return;
        }
Esempio n. 5
0
        //Calendar generation methods

        private void GenerateCalendar()
        {
            sky6StarChart         tdoc = new sky6StarChart();
            sky6Utils             tute = new sky6Utils();
            sky6ObjectInformation tobj = new sky6ObjectInformation();

            double traH;      //target RA in hours
            double tdecD;     //target Dec in degrees
            double tlatD;     //Observer Latitude in degrees
            double tlongD;    //Observer Longitude in degrees

            try
            {
                tdoc.Find(TargetNameBox.Text);
            }
            catch (Exception ex)
            {
                //! found
                System.Windows.Forms.MessageBox.Show("Target not Found: " + TargetNameBox.Text + " " + ex.Message);
                TargetNameBox.Text = "";
                return;
            }
            //Reset the target name to whatever TSX found
            tobj.Index = 0;
            //tobj.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1);
            //TargetNameBox.Text = tobj.ObjInfoPropOut;
            enteringTargetState = false;
            //TargetNameBox.Text = TargetNameBox.Text.Replace(" ", "");

            int vj = tobj.Count;

            tobj.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000);
            traH = tobj.ObjInfoPropOut;
            tobj.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000);
            tdecD = tobj.ObjInfoPropOut;
            tdoc.DocumentProperty(TheSky64Lib.Sk6DocumentProperty.sk6DocProp_Latitude);
            tlatD = tdoc.DocPropOut;
            tdoc.DocumentProperty(TheSky64Lib.Sk6DocumentProperty.sk6DocProp_Longitude);
            tlongD = tdoc.DocPropOut;
            tdoc.DocumentProperty(TheSky64Lib.Sk6DocumentProperty.sk6DocProp_Time_Zone);

            Celestial.RADec  tgtRADec    = new Celestial.RADec(Transform.HoursToRadians(traH), Transform.DegreesToRadians(tdecD));
            Celestial.LatLon obsLocation = new Celestial.LatLon(Transform.DegreesToRadians(tlatD), Transform.DegreesToRadians(-tlongD));

            sundata = TargetControl.SunCycle((int)CurrentYearPick.Value, obsLocation);
            tgtdata = TargetControl.TargetCycle(tgtRADec, sundata, obsLocation, (double)MinAltitudeBox.Value);
            tgtdata = TargetControl.MoonPhase(tgtdata);

            moondata = TargetControl.MoonCycle(tgtdata, obsLocation);
            //Update the target positions with the moonfree properties
            tgtdata = TargetControl.MoonClear(tgtdata, moondata);

            WriteTitle(TargetNameBox.Text, CurrentYearPick.Value.ToString());
            SpawnCalendar(tgtdata);
            if ((CurrentYearPick.Value % 4) != 0)
            {
                ClearLeapDay();
            }
            WriteMoonTip(moondata);
            Show();
            System.Windows.Forms.Application.DoEvents();
            return;
        }