Ejemplo n.º 1
0
 public void Initialize(IAgUtPluginSite site)
 {
     m_stkPluginSite = site as IAgStkPluginSite;
     if (m_stkPluginSite != null)
     {
         m_vectorToolProvider = m_stkPluginSite.VectorToolProvider;
         m_calcToolProvider   = m_stkPluginSite.CalcToolProvider;
     }
 }
Ejemplo n.º 2
0
        public void Free()
        {
            try
            {
                Debug.WriteLine("--> Entered", this.m_Name + ".Free()");

                if (this.m_UPS != null)
                {
                    if (this.m_MsgStatus)
                    {
                        this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgDebug, this.m_Name + ".Free():");
                        this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgDebug, this.m_Name + ".Free(): PreNextCntr( " + this.m_PreNextCntr + " )");
                        this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgDebug, this.m_Name + ".Free(): EvalCntr( " + this.m_EvalCntr + " )");
                        this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgDebug, this.m_Name + ".Free(): PostEvalCntr( " + this.m_PostEvalCntr + " )");
                    }

                    Marshal.ReleaseComObject(this.m_UPS);
                }
                this.m_UPS = null;

                if (this.m_SPS != null)
                {
                    Marshal.ReleaseComObject(this.m_SPS);
                }
                this.m_SPS = null;

                if (this.m_CPP != null)
                {
                    Marshal.ReleaseComObject(this.m_CPP);
                }
                this.m_CPP = null;

                if (this.m_CCV != null)
                {
                    Marshal.ReleaseComObject(this.m_CCV);
                }
                this.m_CCV = null;
            }
            catch (Exception ex)
            {
                if (this.m_UPS != null)
                {
                    this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgAlarm, this.m_Name + ".Free(): Exception Message( " + ex.Message + " )");
                    this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgAlarm, this.m_Name + ".Free(): Exception StackTr( " + ex.StackTrace + " )");
                }
                Debug.WriteLine("Exception Message( " + ex.Message + " )", this.m_Name + ".Free()");
                Debug.WriteLine("Exception StackTr( " + ex.StackTrace + " )", this.m_Name + ".Free()");
            }
            finally
            {
                Debug.WriteLine("<-- Exited", this.m_Name + ".Free()");
            }
        }
Ejemplo n.º 3
0
        public Example1() : base()
        {
            try
            {
                Debug.WriteLine("--> Entered", this.m_Name + ".Example1()");

                this.SetAttributeConfigDefaults();

                this.m_UPS = null;
                this.m_SPS = null;
                this.m_CPP = null;
                this.m_CCV = null;

                this.m_SRPArea      = 0.0;
                this.m_PreNextCntr  = 0;                                     // CLR initializes to zero, but do it anyways.
                this.m_EvalCntr     = 0;                                     // CLR initializes to zero, but do it anyways.
                this.m_PostEvalCntr = 0;                                     // CLR initializes to zero, but do it anyways.
                this.m_SrpIsOn      = false;
            }
            finally
            {
                Debug.WriteLine("<-- Exited", this.m_Name + ".Example1()");
            }
        }
Ejemplo n.º 4
0
        public bool Init(IAgUtPluginSite Site)
        {
            DebugMessage(AgEUtLogMsgType.eUtLogMsgDebug, "DragLiftExample:Init()");

            if (Site != null)
            {
                _AgUtPluginSite = Site;

                if (_Enabled)
                {
                    DebugMessage(AgEUtLogMsgType.eUtLogMsgInfo, "DragLiftExample:Init(): Enabled");
                }
                else
                {
                    DebugMessage(AgEUtLogMsgType.eUtLogMsgInfo, "DragLiftExample:Init(): Disabled because Enabled flag is False");
                }

                if (_Enabled)
                {
                    IAgCrdnPluginCalcProvider calcPrv = null;
                    IAgCrdnPluginProvider     vtPrv   = null;

                    IAgGatorPluginSite gatorSite = Site as IAgGatorPluginSite;

                    if (gatorSite != null)
                    {
                        calcPrv = gatorSite.CalcToolProvider;
                        vtPrv   = gatorSite.VectorToolProvider;
                    }
                    else
                    {
                        IAgStkPluginSite stkSite = Site as IAgStkPluginSite;

                        if (stkSite != null)
                        {
                            calcPrv = stkSite.CalcToolProvider;
                            vtPrv   = stkSite.VectorToolProvider;
                        }
                    }

                    if (calcPrv != null)
                    {
                        string CalcName   = "Orbit.Classical.TrueAnomaly";
                        string SourceName = ""; // "Satellite/RefSat"; // Can use <MySelf> (or "" which means <Myself>)

                        _trueAnomScalar = calcPrv.GetCalcScalar(CalcName, SourceName);

                        if (_trueAnomScalar == null)
                        {
                            Message(AgEUtLogMsgType.eUtLogMsgAlarm, "Cannot obtain TrueAnomaly CalcScalar");
                        }
                        else if (!_trueAnomScalar.IsConfigured)
                        {
                            Message(AgEUtLogMsgType.eUtLogMsgAlarm, "TrueAnomaly CalcScalar not configured for use");

                            _trueAnomScalar = null;
                        }
                        else
                        {
                            DebugMessage(AgEUtLogMsgType.eUtLogMsgInfo, "TrueAnomaly CalcScalar ready for use");
                        }
                    }
                    else
                    {
                        Message(AgEUtLogMsgType.eUtLogMsgAlarm, "Cannot obtain CalcToolProvider");
                    }

                    if (vtPrv != null)
                    {
                        string VectorName        = "Position";
                        string SourceName        = ""; // "Satellite/RefSat";     // Can use <MySelf> (or "" which means <Myself>)
                        string RefAxesName       = "Fixed";
                        string RefAxesSourceName = "CentralBody/Earth";

                        _posVec = vtPrv.ConfigureVector(VectorName, SourceName, RefAxesName, RefAxesSourceName);

                        if (_posVec == null)
                        {
                            Message(AgEUtLogMsgType.eUtLogMsgAlarm, "Cannot obtain Position vector");
                        }
                        else if (!_posVec.IsConfigured)
                        {
                            Message(AgEUtLogMsgType.eUtLogMsgAlarm, "Position vector not configured for use");

                            _posVec = null;
                        }
                        else
                        {
                            DebugMessage(AgEUtLogMsgType.eUtLogMsgInfo, "Position vector ready for use");
                        }
                    }
                    else
                    {
                        Message(AgEUtLogMsgType.eUtLogMsgAlarm, "Cannot obtain VectorToolProvider");
                    }
                }
            }
            else
            {
                Message(AgEUtLogMsgType.eUtLogMsgAlarm, "DragLiftExample:Init(): Forcing Disabled because Plugin Site was null!");

                _Enabled = false;
            }

            return(_Enabled);
        }
Ejemplo n.º 5
0
        public bool Init(IAgUtPluginSite Ups)
        {
            try
            {
                Debug.WriteLine("--> Entered", this.m_Name + ".Init()");

                this.m_UPS = Ups;

                if (this.m_UPS != null)
                {
                    if (this.m_Enabled)
                    {
                        m_SPS = this.m_UPS as IAgStkPluginSite;

                        if (this.m_SPS != null)
                        {
                            this.m_CPP = this.m_SPS.VectorToolProvider;

                            if (this.m_CPP != null)
                            {
                                this.m_CCV = this.m_CPP.ConfigureVector(this.m_VectorName, "", "J2000", "CentralBody/Earth");
                            }

                            if (this.m_MsgStatus)
                            {
                                this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgDebug, this.m_Name + ".Init():");
                                this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgDebug, this.m_Name + ".Init(): AccelRefFrame( " + this.AccelRefFrame + " )");
                                this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgDebug, this.m_Name + ".Init(): AccelX( " + this.m_AccelX + " )");
                                this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgDebug, this.m_Name + ".Init(): AccelY( " + this.m_AccelY + " )");
                                this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgDebug, this.m_Name + ".Init(): AccelZ( " + this.m_AccelZ + " )");
                            }

                            if (this.m_CCV == null)
                            {
                                this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgDebug, this.m_Name + ".Init(): Could not obtain " + m_VectorName);
                                this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgDebug, this.m_Name + ".Init(): Turning off the computation of SRP Area");
                            }
                        }
                        else
                        {
                            this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgDebug, this.m_Name + ".Init(): Could not obtain IAgStkPluginSite from" + this.m_UPS.SiteName);
                            this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgDebug, this.m_Name + ".Init(): Turning off the computation of SRP Area");
                        }
                    }
                    else
                    {
                        if (this.m_MsgStatus)
                        {
                            this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgDebug, this.m_Name + ".Init(): Disabled");
                        }
                    }
                }
                else
                {
                    throw new Exception("UtPluginSite was null");
                }
            }
            catch (Exception ex)
            {
                this.m_Enabled = false;

                if (this.m_UPS != null)
                {
                    this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgAlarm, this.m_Name + ".Init(): Exception Message( " + ex.Message + " )");
                    this.m_UPS.Message(AgEUtLogMsgType.eUtLogMsgAlarm, this.m_Name + ".Init(): Exception StackTr( " + ex.StackTrace + " )");
                }
                Debug.WriteLine("Exception Message( " + ex.Message + " )", this.m_Name + ".Init()");
                Debug.WriteLine("Exception StackTr( " + ex.StackTrace + " )", this.m_Name + ".Init()");
            }
            finally
            {
                Debug.WriteLine("<-- Exited", this.m_Name + ".Init()");
            }

            return(this.m_Enabled);
        }