Beispiel #1
0
        public static void AutoContour(string fomPath, string staticOrAnimation)
        {
            IAgStkObject figureofMerit = root.GetObjectFromPath(fomPath);

            IAgDataPrvFixed fomDP = (IAgDataPrvFixed)figureofMerit.DataProviders["Overall Value"];
            //Execute the data providers over the scenario interval - scen.StartTime to scen.StopTime
            IAgDrResult fomResult = fomDP.Exec();

            Array mini = fomResult.DataSets.GetDataSetByName("Minimum").GetValues();
            Array maxi = fomResult.DataSets.GetDataSetByName("Maximum").GetValues();

            double min = .99 * (double)mini.GetValue(0);
            double max = 1.01 * (double)maxi.GetValue(0);

            double step = (max - min) / 99.0;

            string staticOnOff;
            string animationOnOff;

            if (staticOrAnimation.ToLower() == "static")
            {
                staticOnOff    = "On";
                animationOnOff = "Off";
            }
            else
            {
                staticOnOff    = "Off";
                animationOnOff = "On";
            }

            root.ExecuteCommand("BatchGraphics * On");
            root.ExecuteCommand("Graphics " + fomPath + " Contours " + staticOrAnimation + " ColorRamp red blue StartStop " + min.ToString() + " " + max.ToString() + " " + step.ToString());
            root.ExecuteCommand("Graphics " + fomPath + " Contours Static Show " + staticOnOff);
            root.ExecuteCommand("Graphics " + fomPath + " Static " + staticOnOff);
            root.ExecuteCommand("Graphics " + fomPath + " Contours Animation Show " + animationOnOff);
            root.ExecuteCommand("Graphics " + fomPath + " Animation " + animationOnOff);
            root.ExecuteCommand("BatchGraphics * Off");
        }
Beispiel #2
0
        public void Initialize()
        {
            if (m_pSite != null)
            {
                Image menuImage = null;

                Assembly currentAssembly = Assembly.GetExecutingAssembly();
                menuImage = Image.FromStream(currentAssembly.GetManifestResourceStream(m_imageResource));
                m_picture = OlePictureHelper.OlePictureFromImage(menuImage);
                object AgUiApp = m_pSite.Application;
                m_root = (AgStkObjectRootClass)Marshal.CreateWrapperOfType(AgUiApp.GetType().InvokeMember("Personality2", System.Reflection.BindingFlags.GetProperty, null, AgUiApp, null), typeof(AgStkObjectRootClass));

                //read preference file
                AGI.STKUtil.IAgExecCmdResult cmdResult = m_root.ExecuteCommand("GetDirectory / DefaultUser");
                string userPath = cmdResult[0].ToString();
                m_prefPath = Path.Combine(userPath, m_configPath);
                if (File.Exists(m_prefPath))
                {
                    using (StreamReader streamReader = new StreamReader(m_prefPath))
                    {
                        m_stringValue = streamReader.ReadLine();
                        m_doubleValue = Double.Parse(streamReader.ReadLine());
                        streamReader.Close();
                    }
                }
                else
                {
                    m_stringValue = "";
                    m_doubleValue = 0.0;
                }
            }
            else
            {
                MessageBox.Show("Error: Couldn't aquire STK Root Object");
            }
        }
        public void setViewVGT()
        {
            IAgExecCmdResult result = m_root.ExecuteCommand("VectorTool_R * Exists \"CentralBody/Sun SunView Point\"");

            if (result[0].CompareTo("1") != 0)
            {
                m_root.ExecuteCommand("VectorTool * CentralBody/Sun Create Point SunView \"Fixed in System\" Cartesian 1e13 1e13 1e13 \"CentralBody/Sun J2000\"");
            }
            m_root.ExecuteCommand("VO * ViewFromTo Normal From \"CentralBody/Sun SunView Point\" to CentralBody/Sun");
        }