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 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);
        }