public Transform() { this.disposedValue = false; this.TL = new TraceLogger("", "Transform"); this.TL.Enabled = RegistryCommonCode.GetBool("Trace Transform", false); this.TL.LogMessage("New", "Trace logger created OK"); this.Utl = new Util(); this.Sw = new Stopwatch(); this.SwRecalculate = new Stopwatch(); this.AstroUtl = new ASCOM.Astrometry.AstroUtils.AstroUtils(); this.SOFA = new ASCOM.Astrometry.SOFA.SOFA(); this.RAJ2000Value = double.NaN; this.DECJ2000Value = double.NaN; this.RATopoValue = double.NaN; this.DECTopoValue = double.NaN; this.SiteElevValue = double.NaN; this.SiteLatValue = double.NaN; this.SiteLongValue = double.NaN; this.RefracValue = false; this.LastSetBy = ASCOM.Astrometry.Transform.Transform.SetBy.Never; this.RequiresRecalculate = true; this.JulianDateTTValue = 0.0; this.CheckGAC(); this.TL.LogMessage("New", "NOVAS initialised OK"); }
/// <summary> /// Returns a struct with alt & az coordinates of an object given it's Ra & Dec from a specific lat & lon on a specific date (jd) /// </summary> /// <param name="Lat"></param> /// <param name="Lon"></param> /// <param name="Ra"></param> /// <param name="Dec"></param> /// <param name="Prof"></param> /// <param name="jd"></param> /// <returns></returns> public static structAltAz GetAltAz(double Lat, double Lon, double Ra, double Dec, clsSharedData Prof, double jd) { //Lat = Current Observing Latitude //Lon = Current Observing Longitude //Ra = Right Ascention of Object //Dec = Declination of object //jd = Julian Date //GSTime = GMT Sidereal Time structAltAz ret_value = default(structAltAz); double ASCOMAlt = 0; double ASCOMAz = 0; ASCOM.Astrometry.NOVASCOM.Site Site = default(ASCOM.Astrometry.NOVASCOM.Site); ASCOM.Utilities.Util utl = default(ASCOM.Utilities.Util); ASCOM.Astrometry.NOVASCOM.Star Obj = default(ASCOM.Astrometry.NOVASCOM.Star); ASCOM.Astrometry.NOVASCOM.PositionVector PosVector = default(ASCOM.Astrometry.NOVASCOM.PositionVector); //ASCOM.Astrometry.SiteInfo Site = default(ASCOM.Astrometry.SiteInfo); //ASCOM.Astrometry.PosVector PVector = default(ASCOM.Astrometry.PosVector); ASCOM.Astrometry.NOVAS.NOVAS31 N = new ASCOM.Astrometry.NOVAS.NOVAS31(); ASCOM.Astrometry.SOFA.SOFA S = new ASCOM.Astrometry.SOFA.SOFA(); ASCOM.Astrometry.OnSurface onSurface = default(ASCOM.Astrometry.OnSurface); onSurface = new ASCOM.Astrometry.OnSurface(); onSurface.Latitude = Lat; onSurface.Longitude = Lon; onSurface.Height = Properties.Settings.Default.site_altitude; onSurface.Pressure = Properties.Settings.Default.site_pressure; onSurface.Pressure = Properties.Settings.Default.site_temperature; Site = new ASCOM.Astrometry.NOVASCOM.Site(); utl = new ASCOM.Utilities.Util(); Obj = new ASCOM.Astrometry.NOVASCOM.Star(); PosVector = new ASCOM.Astrometry.NOVASCOM.PositionVector(); //Site = new ASCOM.Astrometry.SiteInfo(); //PVector = new ASCOM.Astrometry.PosVector(); //double jd = JDNow(); double GSTime = GMSTime(); Site.Latitude = Lat; Site.Longitude = Lon; Site.Height = Properties.Settings.Default.site_altitude; Site.Pressure = Properties.Settings.Default.site_pressure; Site.Temperature = Properties.Settings.Default.site_temperature; PosVector.SetFromSite(Site, GSTime); Obj.Set(Ra, Dec, 0.0, 0.0, 0.0, 0.0); PosVector = Obj.GetTopocentricPosition(jd, Site, false); ASCOMAlt = PosVector.Elevation; ASCOMAz = PosVector.Azimuth; ret_value.Alt = ASCOMAlt; ret_value.Az = ASCOMAz; return(ret_value); }