コード例 #1
0
        private string GetClassName(string name)
        {
            StkObjectsLibrary mStkObjectsLibrary = new StkObjectsLibrary();
            string            simpleName;
            string            classNameTemp = null;
            string            className     = null;
            string            truncPath     = null;

            simpleName = name;
            StringCollection objectPaths = mStkObjectsLibrary.GetObjectPathListFromInstanceNamesXml(CommonData.StkRoot.AllInstanceNamesToXML(), "");

            foreach (string path in objectPaths)
            {
                string objectName = mStkObjectsLibrary.ObjectName(path);
                classNameTemp = mStkObjectsLibrary.ClassNameFromObjectPath(path);
                if (objectName == simpleName && classNameTemp != "Scenario")
                {
                    if (classNameTemp == "Sensor" || classNameTemp == "Transmitter" || classNameTemp == "Receiver" || classNameTemp == "Antenna" || classNameTemp == "Radar")
                    {
                        truncPath = mStkObjectsLibrary.ObjectPathWithoutName(path);
                        truncPath = mStkObjectsLibrary.TruncatedObjectPath(truncPath);
                        //int index = truncPath.LastIndexOf('/');
                        //truncPath = truncPath.Substring(0, index);
                        className = truncPath;
                    }
                    else
                    {
                        className = mStkObjectsLibrary.ClassNameFromObjectPath(path);
                    }
                }
            }
            return(className);
        }
コード例 #2
0
        public NewViewForm()
        {
            InitializeComponent();
            StkObjectsLibrary mStkObjectsLibrary = new StkObjectsLibrary();

            CommonData.CurrentViewObjectData = SmartViewFunctions.GetObjectData();
            _threatNames = new List <string>();

            PopulateComboBoxes();
            PopulateObjects(FocusedItem, true);
            if (FocusedItem.Items.Count != 0)
            {
                FocusedItem.SelectedIndex = 0;
            }
            PopulateObjects(DisplayObject, false);
            if (DisplayObject.Items.Count != 0)
            {
                DisplayObject.SelectedIndex = 0;
            }
            PopulateObjects(ObjectName2D, false);
            if (ObjectName2D.Items.Count != 0)
            {
                ObjectName2D.SelectedIndex = 0;
            }
            DataDisplayOptions.Enabled    = false;
            TTDataDisplayOptions.Enabled  = false;
            GEODataDisplayOptions.Enabled = false;
            GeoBoxOptions.Enabled         = false;
            HideShowOptions.Enabled       = false;
            EllipsoidDefinition.Enabled   = false;
            PopulateObjects(GEODisplayObject, false);

            mStkObjectsLibrary = new StkObjectsLibrary();
        }
コード例 #3
0
        private void PopulateObjectList(ListView view, string className)
        {
            _mStkObjectsLibrary = new StkObjectsLibrary();
            view.Items.Clear();
            string           simpleName;
            string           classNameTemp;
            StringCollection objectNames = _mStkObjectsLibrary.GetObjectPathListFromInstanceNamesXml(CommonData.StkRoot.AllInstanceNamesToXML(), "");

            foreach (string objectName in objectNames)
            {
                classNameTemp = _mStkObjectsLibrary.ClassNameFromObjectPath(objectName);
                if (className == "Sensor" && classNameTemp == className)
                {
                    if (objectName.Contains("Facility") || objectName.Contains("Place") || objectName.Contains("Target"))
                    {
                        ListViewItem item = new ListViewItem();
                        simpleName = _mStkObjectsLibrary.ObjectName(objectName);
                        CommonData.SensorNames.Add(simpleName);
                        string simplePath = _mStkObjectsLibrary.SimplifiedObjectPath(objectName);
                        CommonData.SensorParentNames.Add(simplePath.Split(new string[] { "/" }, StringSplitOptions.None).First());
                        item.Text = simpleName;
                        view.Items.Add(item);
                    }
                }
                else if (classNameTemp == className)
                {
                    ListViewItem item = new ListViewItem();
                    simpleName = _mStkObjectsLibrary.ObjectName(objectName);
                    item.Text  = simpleName;
                    view.Items.Add(item);
                }
            }
        }
コード例 #4
0
        private void PopulateObjects(ComboBox combo, bool includeEarth)
        {
            StkObjectsLibrary mStkObjectsLibrary = new StkObjectsLibrary();

            combo.Items.Clear();
            string           simpleName;
            string           className;
            StringCollection objectNames = mStkObjectsLibrary.GetObjectPathListFromInstanceNamesXml(CommonData.StkRoot.AllInstanceNamesToXML(), "");

            if (includeEarth)
            {
                combo.Items.Add("Earth");
            }
            foreach (string objectName in objectNames)
            {
                className = mStkObjectsLibrary.ClassNameFromObjectPath(objectName);

                if (className != "Scenario" && className != "Sensor" && className != "Antenna" && className != "Transmitter" && className != "Receiver" && className != "CoverageDefinition" && className != "FigureOfMerit" && className != "Radar" && className != "Constellation" && className != "Chain" && className != "CommSystem" && className != "Volumetric")
                {
                    simpleName = mStkObjectsLibrary.ObjectName(objectName);
                    combo.Items.Add(simpleName);
                    if (className + "/" + simpleName == CommonData.SavedViewList[CommonData.SelectedIndex].ViewTarget)
                    {
                        combo.SelectedIndex = combo.Items.Count - 1;
                    }
                }
            }
        }
コード例 #5
0
        private string GetClassName(string name)
        {
            StkObjectsLibrary mStkObjectsLibrary = new StkObjectsLibrary();
            string            simpleName;
            string            classNameTemp = null;
            string            className     = null;
            string            truncPath     = null;

            simpleName = name;
            StringCollection objectPaths = mStkObjectsLibrary.GetObjectPathListFromInstanceNamesXml(CommonData.StkRoot.AllInstanceNamesToXML(), "");

            foreach (string path in objectPaths)
            {
                string objectName = mStkObjectsLibrary.ObjectName(path);
                classNameTemp = mStkObjectsLibrary.ClassNameFromObjectPath(path);
                if (objectName == simpleName && classNameTemp != "Scenario")
                {
                    if (classNameTemp == "Sensor")
                    {
                        truncPath = mStkObjectsLibrary.ObjectPathWithoutName(path);
                        truncPath = mStkObjectsLibrary.TruncatedObjectPath(truncPath);
                        className = truncPath;
                    }
                    else
                    {
                        className = mStkObjectsLibrary.ClassNameFromObjectPath(path);
                    }
                }
            }
            return(className);
        }
コード例 #6
0
        public static string GetClassName(string name)
        {
            StkObjectsLibrary mStkObjectsLibrary = new StkObjectsLibrary();
            string            simpleName;
            string            classNameTemp = null;
            string            className     = null;

            simpleName = name;
            StringCollection objectPaths = mStkObjectsLibrary.GetObjectPathListFromInstanceNamesXml(CommonData.StkRoot.AllInstanceNamesToXML(), "");

            if (simpleName.Contains("Earth"))
            {
                className = "CentralBody";
            }
            else
            {
                foreach (string path in objectPaths)
                {
                    string objectName = mStkObjectsLibrary.ObjectName(path);
                    classNameTemp = mStkObjectsLibrary.ClassNameFromObjectPath(path);
                    if (objectName == simpleName && className != "Scenario")
                    {
                        className = mStkObjectsLibrary.ClassNameFromObjectPath(path);
                    }
                }
            }
            return(className);
        }
コード例 #7
0
 public CustomLeadTrailForm()
 {
     InitializeComponent();
     library = new StkObjectsLibrary();
     PopulateTable(CommonData.CurrentViewObjectData);
     currentCell = new Tuple <int, int>(0, 0);
 }
コード例 #8
0
        public static List <ObjectData> GetObjectData()
        {
            List <ObjectData> objectData         = new List <ObjectData>();
            StkObjectsLibrary mStkObjectsLibrary = new StkObjectsLibrary();
            string            simpleName;
            string            className;
            StringCollection  objectNames = mStkObjectsLibrary.GetObjectPathListFromInstanceNamesXml(CommonData.StkRoot.AllInstanceNamesToXML(), "");

            foreach (string objectName in objectNames)
            {
                className = mStkObjectsLibrary.ClassNameFromObjectPath(objectName);

                if (className != "Scenario" && className != "Antenna" && className != "Radar" && className != "Constellation" && className != "Volumetric")
                {
                    ObjectData current = new ObjectData();

                    current.SimpleName = mStkObjectsLibrary.ObjectName(objectName);
                    current.ClassName  = className;
                    current.LongPath   = objectName;
                    current.SimplePath = mStkObjectsLibrary.SimplifiedObjectPath(objectName);

                    current.HideShow = GetObjectVisibility(current.ClassName, current.SimplePath);

                    List <AgELeadTrailData> leadtrailData = GetLeadTrailData(current.SimplePath, current.ClassName);
                    if (leadtrailData.Count != 0)
                    {
                        current.LeadSetting3D  = leadtrailData[0];
                        current.TrailSetting3D = leadtrailData[1];
                        current.LeadSetting2D  = leadtrailData[2];
                        current.TrailSetting2D = leadtrailData[3];
                    }

                    if (current.ClassName == "Satellite")
                    {
                        current.CoordSys = GetOrbitSystemData(current.SimplePath);
                    }
                    objectData.Add(current);
                }
            }


            return(objectData);
        }
コード例 #9
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();
            }
        }
コード例 #10
0
        public NewViewForm()
        {
            InitializeComponent();
            StkObjectsLibrary mStkObjectsLibrary = new StkObjectsLibrary();

            CommonData.CurrentViewObjectData = SmartViewFunctions.GetObjectData();

            PopulateComboBoxes();
            PopulateObjects(FocusedItem, true);
            ViewName3D.Text = "New View";
            ViewName2D.Text = "New View";
            if (FocusedItem.Items.Count != 0)
            {
                FocusedItem.SelectedIndex = 0;
            }
            PopulateObjects(DisplayObject, false);
            if (DisplayObject.Items.Count != 0)
            {
                DisplayObject.SelectedIndex = 0;
            }
            PopulateObjects(ObjectName2D, false);
            if (ObjectName2D.Items.Count != 0)
            {
                ObjectName2D.SelectedIndex = 0;
            }
            PopulateObjects(PredataObject, false);
            PredataObject.Items.Insert(0, "None");
            PredataObject.SelectedIndex = 0;
            DataDisplayOptions.Enabled  = false;
            HideShowOptions.Enabled     = false;
            VectorHideShow.Enabled      = false;
            CustomLeadTrail.Enabled     = false;
            //initialize some settings in the current view data
            current.EnableProximityBox       = false;
            current.EnableGeoBox             = false;
            current.EnableProximityEllipsoid = false;
            current.SecondaryDataDisplay.DataDisplayActive = false;
            current.ApplyVectorScaling = false;
            current.OverrideTimeStep   = false;
            mStkObjectsLibrary         = new StkObjectsLibrary();
        }
コード例 #11
0
        private void PopulatePreDataObjects(ComboBox combo, bool includeEarth)
        {
            StkObjectsLibrary mStkObjectsLibrary = new StkObjectsLibrary();

            combo.Items.Clear();
            string           simpleName;
            string           className;
            StringCollection objectNames = mStkObjectsLibrary.GetObjectPathListFromInstanceNamesXml(CommonData.StkRoot.AllInstanceNamesToXML(), "");

            if (includeEarth)
            {
                combo.Items.Add("Earth");
                if ("CentralBody/Earth" == CommonData.SavedViewList[CommonData.SelectedIndex].ViewTarget)
                {
                    combo.SelectedIndex = 0;
                }
            }
            combo.Items.Add("None");
            foreach (string objectName in objectNames)
            {
                className = mStkObjectsLibrary.ClassNameFromObjectPath(objectName);

                if (className != "Scenario" && className != "Sensor" && className != "CoverageDefinition" && className != "FigureOfMerit" && className != "Constellation" && className != "Chain" && className != "CommSystem" && className != "Volumetric")
                {
                    simpleName = mStkObjectsLibrary.ObjectName(objectName);
                    combo.Items.Add(simpleName);
                    if (_fromEdit)
                    {
                        if (className + "/" + simpleName == CommonData.SavedViewList[CommonData.SelectedIndex].SecondaryDataDisplay.PredataObject)
                        {
                            combo.SelectedIndex = combo.Items.Count - 1;
                        }
                    }
                }
            }

            if (combo.SelectedIndex == -1)
            {
                combo.SelectedIndex = 0;
            }
        }
コード例 #12
0
        public static string GetObjectPath(string name)
        {
            StkObjectsLibrary mStkObjectsLibrary = new StkObjectsLibrary();
            string            objectPath         = null;
            string            simpleName;
            string            className;

            simpleName = name;
            StringCollection objectPaths = mStkObjectsLibrary.GetObjectPathListFromInstanceNamesXml(CommonData.StkRoot.AllInstanceNamesToXML(), "");

            foreach (string path in objectPaths)
            {
                string objectName = mStkObjectsLibrary.ObjectName(path);
                className = mStkObjectsLibrary.ClassNameFromObjectPath(path);
                if (objectName == simpleName && className != "Scenario")
                {
                    className  = mStkObjectsLibrary.ClassNameFromObjectPath(path);
                    objectPath = className + "/" + objectName;
                }
            }

            return(objectPath);
        }
コード例 #13
0
        private void PopulateList()
        {
            ObjectList.Nodes.Clear();
            _data = CommonData.CurrentViewObjectData;
            string parentStr        = null;
            string parentSimpleName = null;
            int    parentCount      = 0;
            int    childCount       = 0;

            if (FilterType.SelectedIndex == 0)
            {
                for (int i = 0; i < _data.Count; i++)
                {
                    if (parentStr == null)
                    {
                        parentStr        = _data[i].SimplePath;
                        parentSimpleName = _data[i].SimpleName;
                        ObjectList.Nodes.Add(_data[i].SimpleName);
                        if (_data[i].HideShow)
                        {
                            ObjectList.Nodes[0].Checked = true;
                        }
                        parentCount++;
                    }
                    else if (_data[i].SimplePath.Contains(parentStr))
                    {
                        ObjectList.Nodes[parentCount - 1].Nodes.Add(_data[i].SimpleName);
                        if (_data[i].HideShow)
                        {
                            ObjectList.Nodes[parentCount - 1].Nodes[childCount].Checked = true;
                        }
                        childCount++;
                    }
                    else
                    {
                        parentStr        = _data[i].SimplePath;
                        parentSimpleName = _data[i].SimpleName;
                        ObjectList.Nodes.Add(_data[i].SimpleName);
                        parentCount++;
                        if (_data[i].HideShow)
                        {
                            ObjectList.Nodes[parentCount - 1].Checked = true;
                        }
                        childCount = 0;
                    }
                }
            }
            else if (FilterType.SelectedIndex == 1)
            {
                IAgExecCmdResult  result;
                StkObjectsLibrary mStkObjectsLibrary = new StkObjectsLibrary();
                List <string>     usedObjects        = new List <string>();
                result = CommonData.StkRoot.ExecuteCommand("ShowNames * Class Constellation");
                if (result[0] != "None")
                {
                    string[] constArray = result[0].Split(null);
                    foreach (var item in constArray)
                    {
                        string simplePath = mStkObjectsLibrary.SimplifiedObjectPath(item);
                        string newItem    = item.Split('/').Last();
                        if (newItem != "" && newItem != null)
                        {
                            ObjectList.Nodes.Add(newItem);
                            parentCount++;
                            IAgConstellation        currentConst = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgConstellation;
                            IAgObjectLinkCollection objects      = currentConst.Objects;
                            childCount = 0;
                            if (objects.Count != 0)
                            {
                                foreach (IAgObjectLink thing in objects)
                                {
                                    ObjectList.Nodes[parentCount - 1].Nodes.Add(thing.Name);
                                    childCount++;
                                    ObjectData element = _data.Find(p => p.SimpleName == thing.Name);
                                    if (element != null)
                                    {
                                        if (element.HideShow)
                                        {
                                            ObjectList.Nodes[parentCount - 1].Nodes[childCount - 1].Checked = true;
                                        }
                                    }
                                    usedObjects.Add(thing.Name);
                                }
                            }
                        }
                    }
                    ObjectList.Nodes.Add("No Known Constellation");
                    parentCount++;
                    childCount = 0;
                    foreach (var item in _data)
                    {
                        if (!usedObjects.Contains(item.SimpleName))
                        {
                            ObjectList.Nodes[parentCount - 1].Nodes.Add(item.SimpleName);
                            childCount++;
                            if (item.HideShow)
                            {
                                ObjectList.Nodes[parentCount - 1].Nodes[childCount - 1].Checked = true;
                            }
                        }
                    }
                }
            }
        }