public FormTargetTrack(DailyPosition dp, DailyPosition mp, string targetNameS) { InitializeComponent(); targetName = targetNameS; tgtDateUTC = dp.UTCdate; moonDateUTC = mp.iRise; tgtUpH = dp.Rising.ToLocalTime().Hour + (dp.Rising.ToLocalTime().Minute / 60.0); tgtDownH = dp.Setting.ToLocalTime().Hour + (dp.Setting.ToLocalTime().Minute / 60.0); tgtDecD = 90.0 - Transform.RadiansToDegrees(dp.Position.Dec); tgtPosition = dp.Position; MoonPosition = mp.Position; obsLocation = dp.Location; //Set lat obsLatD = Transform.RadiansToDegrees(dp.Location.Lat); //Moon look up stuff Celestial.RADec moonRADec = DailyPosition.MoonRaDec(Celestial.DateToJ2kC(dp.UTCdate)); moonDecD = 90 - Transform.RadiansToDegrees(mp.Position.Dec); //Get the rise/set times from TSX sky6StarChart tsxs = new sky6StarChart(); sky6ObjectInformation tsxo = new sky6ObjectInformation(); //Set the date/time to the local date for the target tsxs.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_JulianDateNow, Celestial.DateToJulian(tgtDateUTC)); //Get some target stuff that's hard to calculate tsxs.Find(targetName); //wait a second System.Threading.Thread.Sleep(500); tsxo.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_TRANSIT_TIME); tgtTransitH = tsxo.ObjInfoPropOut; //Test stuff //double testmoontransitH = MoonPosition.TransitTime(tgtDateUTC, obsLocation); //Get some moon stuff now tsxs.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_JulianDateNow, Celestial.DateToJulian(moonDateUTC)); tsxs.Find("Moon"); //wait a second System.Threading.Thread.Sleep(500); tsxo.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_RISE_TIME); moonRiseH = tsxo.ObjInfoPropOut; tsxo.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_SET_TIME); moonSetH = tsxo.ObjInfoPropOut; //put the target back in tsxs.Find(targetName); tsxs = null; tsxo = null; return; }
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; }