コード例 #1
0
        private void RemoveCoverage_Click(object sender, EventArgs e)
        {
            if (CoverageList.FocusedItem != null && CoverageList.FocusedItem.Index != -1)
            {
                try
                {
                    IAgStkObject obj = CommonData.StkRoot.CurrentScenario.Children[CommonData.CoverageList[CommonData.CoverageIndex].CdName];
                    obj.Unload();
                    StkObjectsLibrary library = new StkObjectsLibrary();
                    IAgExecCmdResult  result;
                    result = CommonData.StkRoot.ExecuteCommand("ShowNames * Class AreaTarget");
                    if (result[0] != "None")
                    {
                        string[] facArray = result[0].Split(null);
                        foreach (var item in facArray)
                        {
                            if (item != null && item != "" && item.Contains(CommonData.CoverageList[CommonData.CoverageIndex].CdName))
                            {
                                obj = CommonData.StkRoot.GetObjectFromPath(library.TruncatedObjectPath(item));
                                obj.Unload();
                            }
                        }
                    }
                }
                catch (Exception)
                {
                }
                CommonData.CoverageList.RemoveAt(CommonData.CoverageIndex);
                CoverageList.Items.RemoveAt(CommonData.CoverageIndex);
                HomeView_Click(sender, e);

                try
                {
                    ReadWrite.WriteCoverageData(CommonData.DirectoryStr + "\\CoverageData.txt");
                }
                catch (Exception)
                {
                    MessageBox.Show("Could not write file");
                }
                PopulateCoverageList();
            }
        }
コード例 #2
0
        public static void RemoveTimelineComponentNoAwb(GroundEvent currentGroundEvent)
        {
            string satName = "z" + currentGroundEvent.Id + "-TimelineObject";

            try
            {
                IAgStkObject sat = CommonData.StkRoot.GetObjectFromPath("Satellite/" + satName);
                sat.Unload();
            }
            catch (Exception)
            {
            }
        }
コード例 #3
0
        private void CheckForExistingObject(string objectPath)
        {
            // Ask user to overwrite object if it exists
            if (CommonData.StkRoot.ObjectExists(objectPath))
            {
                DialogResult result = MessageBox.Show($"{objectPath} already exists. Overwrite this object?",
                                                      "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    IAgStkObject existingObject = CommonData.StkRoot.GetObjectFromPath(objectPath);
                    existingObject.Unload();
                }
            }
        }
コード例 #4
0
        public void EstimateProbability()
        {
            StkAssistant.SetAnalysisIntervalFromTCA(this.Primary.EpochISOYMD);
            string primaryPath   = Primary.BaselineObjectPath;
            string primaryType   = Primary.BaselineObjectType;
            string primaryName   = primaryPath.Substring(primaryPath.LastIndexOf("/") + 1);
            string secondaryPath = Secondary.BaselineObjectPath;
            string secondaryName = secondaryPath.Substring(secondaryPath.LastIndexOf("/") + 1);

            string catName = "CAT_" + primaryName;

            int counter = 0;

            while (StkAssistant.Root.CurrentScenario.Children.Contains(AgESTKObjectType.eAdvCat, catName))
            {
                catName = "CAT_" + primaryName + "_" + (++counter).ToString();
            }

            IAgStkObject cat = StkAssistant.Root.CurrentScenario.Children.New(AgESTKObjectType.eAdvCat, catName);

            string cmdResult;

            StkAssistant.TryConnect("Save / " + primaryPath, out cmdResult);
            StkAssistant.TryConnect("Save / " + secondaryPath, out cmdResult);

            StkAssistant.TryConnect("ACAT */AdvCAT/" + catName + " TimePeriod \"" + StkAssistant.Scenario.StartTime + "\" \"" + StkAssistant.Scenario.StopTime + "\"", out cmdResult);


            StkAssistant.TryConnect("ACAT */AdvCAT/" + catName + " Primary Add \"" + primaryName + ".sa\" Cov", out cmdResult);
            StkAssistant.TryConnect("ACAT */AdvCAT/" + catName + " Secondary Add \"" + secondaryName + ".sa\" Cov", out cmdResult);

            StkAssistant.TryConnect("ACAT */AdvCAT/" + catName + " Compute ShowProgress On", out cmdResult);


            StkAssistant.TryConnect("VO */AdvCAT/" + catName + " AdvCATAttributes ShowSecondary On ShowAllSecondary On", out cmdResult);


            //StkAssistant.TryConnect("ReportCreate */AdvCAT/" + catName + " Type Display Style \"Close Approach By Min Range\"", out cmdResult);
            StkAssistant.TryConnect("ACATEvents_RM */AdvCAT/" + catName, out cmdResult);
            string catTCA;

            if (!cmdResult.Equals("No events found."))
            {
                catTCA = cmdResult.Split(',')[5];

                IAgStkObject       catObject = StkAssistant.Root.GetObjectFromPath("*/AdvCAT/" + catName);
                IAgDataPrvInterval catDP     = cat.DataProviders["Events by Min Range"] as IAgDataPrvInterval;
                IAgDrResult        catResult = catDP.Exec(StkAssistant.Scenario.StartTime, StkAssistant.Scenario.StopTime);

                double catMaxProb       = (double)catResult.DataSets.GetDataSetByName("Max Collision Probability").GetValues().GetValue(0);
                double catSigmaDilution = (double)catResult.DataSets.GetDataSetByName("Sigma Dilution Threshold").GetValues().GetValue(0);

                if (Probability == 0)
                {
                    Probability = catMaxProb;
                }
                if (SigmaDilution == 0)
                {
                    SigmaDilution = Math.Round(catSigmaDilution, 3);
                }
            }

            cat.Unload();
        }