Beispiel #1
0
        private void ApplyButton_Click(object sender, EventArgs e)
        {
            CommonData.applied = true;
            Section current = CommonData.sectionList[CommonData.selectedArtic];
            //Section current = new Section();

            string articFullName = PossibleArtics.Text;

            string[] articNameSplit = articFullName.Split(new Char[] { '-' }, 2);
            CommonData.objectName = articNameSplit[0];
            CommonData.articName  = articNameSplit[1];

            current.startTimeValue = StartTimeValue.Text;
            current.durationValue  = DurationValue.Text;
            current.startValue     = StartValue.Text;
            current.endValue       = EndValue.Text;
            current.deadbandValue  = DBValue.Text;
            current.accelValue     = AcValue.Text;
            current.decelValue     = DcValue.Text;
            current.dutyValue      = DCDeltaValue.Text;
            current.periodValue    = Period.Text;
            current.sectionName    = sectionName.Text;
            current.articName      = CommonData.articName;
            current.objectName     = CommonData.objectName;

            string section = ArticFunctions.CreateSection(CommonData.objectName, CommonData.articName, current.startTimeValue, current.durationValue, current.startValue, current.endValue, current.deadbandValue, current.accelValue, current.decelValue, current.dutyValue, current.periodValue, current.sectionName);

            current.sectionText = section;
            CommonData.sectionList[CommonData.selectedArtic] = current;
            this.Close();
        }
Beispiel #2
0
        private void PopulatePossibleArtics()
        {
            string       objectPath = CommonData.objectClass + "/" + CommonData.simpleName;
            IAgStkObject obj        = CommonData.StkRoot.GetObjectFromPath(objectPath);
            Array        names      = ArticFunctions.GetArticulations(obj);

            foreach (var item in names)
            {
                if (item.ToString().Contains("Time"))
                {
                }
                else
                {
                    PossibleArtics.Items.Add(item);
                }
            }
            if (CommonData.selectedArtic != -1)
            {
                try
                {
                    int index = PossibleArtics.FindString(CommonData.sectionList[CommonData.selectedArtic].objectName + "-" + CommonData.sectionList[CommonData.selectedArtic].articName);
                    PossibleArtics.SelectedIndex = index;
                }
                catch (Exception)
                {
                }
            }
        }
Beispiel #3
0
        private void CreateButton_Click(object sender, EventArgs e)
        {
            CommonData.added = true;
            Section current = new Section();

            current.isLinked       = false;
            current.sectionNumber  = CommonData.totalSectionCount + 1;
            current.startTimeValue = StartTimeValue.Text;
            current.durationValue  = DurationValue.Text;
            current.startValue     = StartValue.Text;
            current.endValue       = EndValue.Text;
            current.deadbandValue  = DBValue.Text;
            current.accelValue     = AcValue.Text;
            current.decelValue     = DcValue.Text;
            current.dutyValue      = DCDeltaValue.Text;
            current.periodValue    = Period.Text;
            current.sectionName    = sectionName.Text;
            current.articName      = CommonData.articName;
            current.objectName     = CommonData.objectName;

            string section = ArticFunctions.CreateSection(CommonData.objectName, CommonData.articName, current.startTimeValue, current.durationValue, current.startValue, current.endValue, current.deadbandValue, current.accelValue, current.decelValue, current.dutyValue, current.periodValue, current.sectionName);

            current.sectionText = section;
            CommonData.sectionList.Add(current);
            this.Close();
        }
Beispiel #4
0
 private void Remove_Click(object sender, EventArgs e)
 {
     //remove the section of the text file related to the chosen listing
     //int sectionNum = CreatedArtic.SelectedIndex;
     //ArticFunctions.RemoveSection(CommonData.fileStr, sectionNum);
     //if (sectionNum!=-1)
     //{
     //    CreatedArtic.Items.RemoveAt(sectionNum);
     //}
     if (CreatedArtic.SelectedIndex != -1)
     {
         List <string> selectedNames = new List <string>();
         foreach (string name in CreatedArtic.SelectedItems)
         {
             selectedNames.Add(name);
         }
         foreach (var item in selectedNames)
         {
             for (int i = 0; i < CommonData.sectionList.Count; i++)
             {
                 if (CreatedArtic.Items[i].ToString() == item)
                 {
                     ArticFunctions.RemoveSection(CommonData.fileStr, i);
                     CreatedArtic.Items.RemoveAt(i);
                 }
             }
         }
     }
 }
Beispiel #5
0
        private void Paste_Click(object sender, EventArgs e)
        {
            string name  = null;
            int    count = 0;

            foreach (Section item in CommonData.ClipboardSectionList)
            {
                CommonData.sectionList.Add(item);
                count = CommonData.sectionList.Count - 1;
                if (!String.IsNullOrWhiteSpace(item.sectionName))
                {
                    name = CommonData.sectionList[count].sectionName;
                }
                else
                {
                    name = CommonData.sectionList[count].objectName + CommonData.sectionList[count].articName + " Start Time: " + CommonData.sectionList[count].startTimeValue + "sec";
                }
                if (item.isLinked && !item.linkedToList)
                {
                    name = name + "  |  LINKED";
                    CreatedArtic.Items.Add(name);
                }
                else if (item.linkedToList)
                {
                    name = name + "  |  LINKED TO INTERVAL LIST";
                    CreatedArtic.Items.Add(name);
                }
                else
                {
                    CreatedArtic.Items.Add(name);
                }
                count++;
            }
            ArticFunctions.CreateFile(CommonData.fileStr);
        }
Beispiel #6
0
 //remove selected index in list and remove from section list
 private void RemoveLink_Click(object sender, EventArgs e)
 {
     if (CommonData.selectedArtic != -1 && CommonData.sectionList.Count != 0)
     {
         CommonData.sectionList[CommonData.selectedArtic].isLinked = false;
         string       className  = CommonData.objectClass;
         string       simpleName = CommonData.simpleName;
         string       objectPath = className + "/" + simpleName;
         IAgStkObject obj        = CommonData.StkRoot.GetObjectFromPath(objectPath);
         if (CommonData.sectionList[CommonData.selectedArtic].linkedToList == true)
         {
             bool sameInst = false;
             foreach (string name in CommonData.sectionList[CommonData.selectedArtic].linkedToListInstantNames)
             {
                 for (int i = 0; i < CommonData.sectionList.Count; i++)
                 {
                     if (i == CommonData.selectedArtic)
                     {
                     }
                     else if (CommonData.sectionList[i].linkedToList)
                     {
                         foreach (string instanceString in CommonData.sectionList[i].linkedToListInstantNames)
                         {
                             if (instanceString == name)
                             {
                                 sameInst = true;
                             }
                         }
                     }
                 }
                 if (obj.Vgt.Events.Contains(name) && sameInst == false)
                 {
                     obj.Vgt.Events.Remove(name);
                 }
                 sameInst = false;
             }
         }
         CommonData.sectionList[CommonData.selectedArtic].linkedToList = false;
         CommonData.sectionList[CommonData.selectedArtic].linkedToListStrings.Clear();
         CommonData.sectionList[CommonData.selectedArtic].linkedListSections.Clear();
         ArticFunctions.CreateFile(CommonData.fileStr);
         CommonData.linkChanged      = true;
         CommonData.previousSelected = CommonData.selectedArtic;
         if (!String.IsNullOrWhiteSpace(CommonData.sectionList[CommonData.selectedArtic].sectionName))
         {
             CreatedArtic.Items[CommonData.selectedArtic] = CommonData.sectionList[CommonData.selectedArtic].sectionName;
         }
         else
         {
             CreatedArtic.Items[CommonData.selectedArtic] = CommonData.sectionList[CommonData.selectedArtic].objectName + CommonData.sectionList[CommonData.selectedArtic].articName + " Start Time: " + CommonData.sectionList[CommonData.selectedArtic].startTimeValue + "sec";
         }
     }
 }
Beispiel #7
0
        private void LoadAttitude_Click(object sender, EventArgs e)
        {
            foreach (Section item in CommonData.sectionList)
            {
                item.linkedToAttitude = false;
                if (item.articName.Contains("Yaw") || item.articName.Contains("Pitch") || item.articName.Contains("Roll"))
                {
                    item.linkedToAttitude = true;
                }
            }
            string       objectPath = CommonData.objectClass + "/" + CommonData.simpleName;
            IAgStkObject obj        = CommonData.StkRoot.GetObjectFromPath(objectPath);
            string       fileName   = CommonData.directoryStr + "\\" + CommonData.simpleName + ".a";

            if (AttitudeCoordFrame.SelectedIndex == 0)
            {
                ArticFunctions.WriteVVLHAttitudeFile(fileName);
            }
            else if (AttitudeCoordFrame.SelectedIndex == 1)
            {
                ArticFunctions.WriteICRFAttitudeFile(fileName);
            }

            if (CommonData.objectClass == "Aircraft")
            {
                try
                {
                    AgAircraft aircraft = obj as AgAircraft;
                    IAgVeRouteAttitudeStandard attitude = aircraft.Attitude as IAgVeRouteAttitudeStandard;
                    attitude.External.Load(fileName);
                }
                catch (Exception)
                {
                    MessageBox.Show("Could not load attitude file");
                }
            }
            else if (CommonData.objectClass == "Satellite")
            {
                try
                {
                    IAgSatellite sat = obj as IAgSatellite;
                    IAgVeOrbitAttitudeStandard attitude = sat.Attitude as IAgVeOrbitAttitudeStandard;
                    attitude.External.Load(fileName);
                }
                catch (Exception)
                {
                    MessageBox.Show("Could not load attitude file");
                }
            }
        }
Beispiel #8
0
 private void Edit_Click(object sender, EventArgs e)
 {
     if (CommonData.selectedArtic != -1 && CommonData.sectionList.Count != 0)
     {
         //open edit form
         CommonData.applied = false;
         EditArticForm form = new EditArticForm(CommonData.selectedArtic);
         form.ShowDialog();
         if (CommonData.applied)
         {
             //change names in articulations list
             CommonData.previousSelected = CommonData.selectedArtic;
             if (CommonData.sectionList[CommonData.selectedArtic].isLinked)
             {
                 if (!String.IsNullOrWhiteSpace(CommonData.sectionList[CommonData.selectedArtic].sectionName))
                 {
                     CreatedArtic.Items[CommonData.selectedArtic] = CommonData.sectionList[CommonData.selectedArtic].sectionName + "  |  LINKED";
                 }
                 else
                 {
                     CreatedArtic.Items[CommonData.selectedArtic] = CommonData.sectionList[CommonData.selectedArtic].objectName + CommonData.sectionList[CommonData.selectedArtic].articName + " Start Time: " + CommonData.sectionList[CommonData.selectedArtic].startTimeValue + "sec" + "  |  LINKED";
                 }
             }
             else if (CommonData.sectionList[CommonData.selectedArtic].linkedToList)
             {
                 if (!String.IsNullOrWhiteSpace(CommonData.sectionList[CommonData.selectedArtic].sectionName))
                 {
                     CreatedArtic.Items[CommonData.selectedArtic] = CommonData.sectionList[CommonData.selectedArtic].sectionName + "  |  LINKED TO INTERVAL LIST";
                 }
                 else
                 {
                     CreatedArtic.Items[CommonData.selectedArtic] = CommonData.sectionList[CommonData.selectedArtic].objectName + CommonData.sectionList[CommonData.selectedArtic].articName + " Start Time: " + CommonData.sectionList[CommonData.selectedArtic].startTimeValue + "sec" + "  |  LINKED TO INTERVAL LIST";
                 }
             }
             else
             {
                 if (!String.IsNullOrWhiteSpace(CommonData.sectionList[CommonData.selectedArtic].sectionName))
                 {
                     CreatedArtic.Items[CommonData.selectedArtic] = CommonData.sectionList[CommonData.selectedArtic].sectionName;
                 }
                 else
                 {
                     CreatedArtic.Items[CommonData.selectedArtic] = CommonData.sectionList[CommonData.selectedArtic].objectName + CommonData.sectionList[CommonData.selectedArtic].articName + " Start Time: " + CommonData.sectionList[CommonData.selectedArtic].startTimeValue + "sec";;
                 }
             }
             ArticFunctions.CreateFile(CommonData.fileStr);
         }
     }
 }
Beispiel #9
0
        private void Link_Click(object sender, EventArgs e)
        {
            if (Events.SelectedIndex == -1)
            {
                MessageBox.Show("Please select Time Instance");
            }
            else
            {
                CommonData.sectionList[CommonData.selectedArtic].isLinked = true;
                string linkedText;
                string line1 = "BEGIN SMARTEPOCH \n";
                string line2 = "BEGIN EVENT \n";
                string line3 = "Type EVENT_LINKTO \n";
                string line4 = null;
                string line5 = null;
                linkedText = line1 + line2 + line3;

                if (cbStkObjects.Text.Contains("Access"))
                {
                    IAgCrdn currentEvent = (IAgCrdn)accessEvents[Events.SelectedIndex];
                    string  eventName    = currentEvent.Name;
                    CommonData.sectionList[CommonData.selectedArtic].linkTimeInstanceName = eventName;
                    string pathStr = currentEvent.Path;
                    line4 = "Name " + eventName + " \n";
                    line5 = "RelativePath " + pathStr.Substring(0, pathStr.IndexOf(" ")) + " \n";
                }
                else
                {
                    IAgCrdn currentEvent = (IAgCrdn)events[Events.SelectedIndex];
                    string  eventName    = currentEvent.Name;
                    CommonData.sectionList[CommonData.selectedArtic].linkTimeInstanceName = eventName;
                    string pathStr = currentEvent.Path;
                    line4 = "Name " + eventName + " \n";
                    line5 = "RelativePath " + pathStr.Substring(0, pathStr.IndexOf(" ")) + " \n";
                }
                string line6 = "END EVENT" + " \n";
                string line7 = "END SMARTEPOCH" + " \n";

                linkedText = linkedText + line4 + line5 + line6 + line7;
                CommonData.sectionList[CommonData.selectedArtic].linkString = linkedText;
                ArticFunctions.CreateFile(CommonData.fileStr);
                this.Close();
            }
        }
Beispiel #10
0
        private void AddArtic_Click(object sender, EventArgs e)
        {
            CommonData.added = false;
            //Load add articulation form
            var form = new AddArticForm();

            form.ShowDialog();
            //change CreatedArtic list if added
            if (CommonData.added)
            {
                ArticFunctions.CreateFile(CommonData.fileStr);
                int index = CommonData.sectionList.Count - 1;
                if (!String.IsNullOrWhiteSpace(CommonData.sectionList[index].sectionName))
                {
                    CreatedArtic.Items.Add(CommonData.sectionList[index].sectionName);
                }
                else
                {
                    CreatedArtic.Items.Add(CommonData.sectionList[index].objectName + " " + CommonData.sectionList[index].articName + " | " + " Start Time: " + CommonData.sectionList[index].startTimeValue);
                }
            }
        }
Beispiel #11
0
        private void Link_Click(object sender, EventArgs e)
        {
            if (IncrementCheck.Checked && String.IsNullOrWhiteSpace(IncrementStepValue.Text))
            {
                MessageBox.Show("IncrementStep Value Required");
            }
            else if (Events.SelectedIndex == -1)
            {
                MessageBox.Show("Please select Interval List");
            }
            else
            {
                int index = Events.SelectedIndex;
                IAgCrdnEventIntervalList currentList;
                List <string>            startTimes = new List <string>();
                List <string>            stopTimes  = new List <string>();
                string listName;

                if (cbStkObjects.Text.Contains("Access"))
                {
                    currentList = accessEventIntervalsCollections[index];
                    IAgCrdn currentListRe = accessEventIntervalsCollections[index] as IAgCrdn;
                    listName = currentListRe.Name;
                }
                else
                {
                    currentList = eventIntervalsCollections[index];
                    IAgCrdn currentListRe = eventIntervalsCollections[index] as IAgCrdn;
                    listName = currentListRe.Name;
                }
                IAgCrdnIntervalListResult intervals = currentList.FindIntervals();
                int numIntervals = intervals.Intervals.Count;
                for (int i = 0; i < numIntervals; i++)
                {
                    IAgCrdnInterval interval = intervals.Intervals[i];
                    string          startStr = interval.Start.ToString();
                    string          stopStr  = interval.Stop.ToString();
                    startTimes.Add(startStr);
                    stopTimes.Add(stopStr);
                }
                CommonData.sectionList[CommonData.selectedArtic].linkedToList = true;
                string linkedText;
                string line1 = "BEGIN SMARTEPOCH \n";
                string line2 = "BEGIN EVENT \n";
                string line3 = "Type EVENT_LINKTO \n";
                string line4 = null;
                string line5 = null;
                linkedText = line1 + line2 + line3;


                if (typeEnum == 0)
                {
                    if (cbStkObjects.Text.Contains("Access"))
                    {
                        for (int i = 0; i < startTimes.Count; i++)
                        {
                            string name = "ArticCreatorList_" + listName + "_" + "StartTime" + i.ToString();
                            CommonData.sectionList[CommonData.selectedArtic].linkedToListInstantNames.Add(name);
                            IAgCrdnEvent timeEvent = null;
                            if (access.Vgt.Events.Contains(name))
                            {
                                foreach (IAgCrdnEvent @event in access.Vgt.Events)
                                {
                                    // All events implement IAgCrdn interface which provides
                                    // information about the event instance and its type.
                                    IAgCrdn crdn = @event as IAgCrdn;
                                    if (crdn.Name == name)
                                    {
                                        timeEvent = @event;
                                    }
                                }
                            }
                            else
                            {
                                timeEvent = access.Vgt.Events.Factory.CreateEventEpoch(name, "Description");
                            }
                            IAgCrdnEventEpoch asEpoch = timeEvent as IAgCrdnEventEpoch;
                            asEpoch.Epoch = startTimes[i];
                            IAgCrdn currentEvent = (IAgCrdn)timeEvent;
                            string  eventName    = currentEvent.Name;
                            string  pathStr      = currentEvent.Path;
                            line4 = "Name " + eventName + " \n";
                            line5 = "RelativePath " + pathStr.Substring(0, pathStr.IndexOf(" ")) + " \n";
                            string line6 = "END EVENT" + " \n";
                            string line7 = "END SMARTEPOCH" + " \n";

                            string linkedTextFinal = linkedText + line4 + line5 + line6 + line7;
                            CommonData.sectionList[CommonData.selectedArtic].linkedToListStrings.Add(linkedTextFinal);
                        }
                    }
                    else
                    {
                        for (int i = 0; i < startTimes.Count; i++)
                        {
                            string name = "ArticCreatorList_" + listName + "_" + "StartTime" + i.ToString();
                            CommonData.sectionList[CommonData.selectedArtic].linkedToListInstantNames.Add(name);
                            IAgCrdnEvent timeEvent = null;
                            if (obj.Vgt.Events.Contains(name))
                            {
                                foreach (IAgCrdnEvent @event in obj.Vgt.Events)
                                {
                                    // All events implement IAgCrdn interface which provides
                                    // information about the event instance and its type.
                                    IAgCrdn crdn = @event as IAgCrdn;
                                    if (crdn.Name == name)
                                    {
                                        timeEvent = @event;
                                    }
                                }
                            }
                            else
                            {
                                timeEvent = obj.Vgt.Events.Factory.CreateEventEpoch(name, "Description");
                            }

                            IAgCrdnEventEpoch asEpoch = timeEvent as IAgCrdnEventEpoch;
                            asEpoch.Epoch = startTimes[i];

                            IAgCrdn currentEvent = (IAgCrdn)timeEvent;
                            string  eventName    = currentEvent.Name;
                            string  pathStr      = currentEvent.Path;
                            line4 = "Name " + eventName + " \n";
                            line5 = "RelativePath " + pathStr.Substring(0, pathStr.IndexOf(" ")) + " \n";
                            string line6 = "END EVENT" + " \n";
                            string line7 = "END SMARTEPOCH" + " \n";

                            string linkedTextFinal = linkedText + line4 + line5 + line6 + line7;
                            CommonData.sectionList[CommonData.selectedArtic].linkedToListStrings.Add(linkedTextFinal);
                        }
                    }
                }
                else if (typeEnum == 1)
                {
                    if (cbStkObjects.Text.Contains("Access"))
                    {
                        for (int i = 0; i < stopTimes.Count; i++)
                        {
                            string name = "ArticCreatorList_" + listName + "_" + "StopTime" + i.ToString();
                            CommonData.sectionList[CommonData.selectedArtic].linkedToListInstantNames.Add(name);
                            IAgCrdnEvent timeEvent = null;
                            if (access.Vgt.Events.Contains(name))
                            {
                                foreach (IAgCrdnEvent @event in access.Vgt.Events)
                                {
                                    // All events implement IAgCrdn interface which provides
                                    // information about the event instance and its type.
                                    IAgCrdn crdn = @event as IAgCrdn;
                                    if (crdn.Name == name)
                                    {
                                        timeEvent = @event;
                                    }
                                }
                            }
                            else
                            {
                                timeEvent = access.Vgt.Events.Factory.CreateEventEpoch(name, "Description");
                            }
                            IAgCrdnEventEpoch asEpoch = timeEvent as IAgCrdnEventEpoch;
                            asEpoch.Epoch = stopTimes[i];

                            IAgCrdn currentEvent = (IAgCrdn)timeEvent;
                            string  eventName    = currentEvent.Name;
                            string  pathStr      = currentEvent.Path;
                            line4 = "Name " + eventName + " \n";
                            line5 = "RelativePath " + pathStr.Substring(0, pathStr.IndexOf(" ")) + " \n";
                            string line6 = "END EVENT" + " \n";
                            string line7 = "END SMARTEPOCH" + " \n";

                            string linkedTextFinal = linkedText + line4 + line5 + line6 + line7;
                            CommonData.sectionList[CommonData.selectedArtic].linkedToListStrings.Add(linkedTextFinal);
                        }
                    }
                    else
                    {
                        for (int i = 0; i < startTimes.Count; i++)
                        {
                            string name = "ArticCreatorList_" + listName + "_" + "StopTime" + i.ToString();
                            CommonData.sectionList[CommonData.selectedArtic].linkedToListInstantNames.Add(name);
                            IAgCrdnEvent timeEvent = null;
                            if (obj.Vgt.Events.Contains(name))
                            {
                                foreach (IAgCrdnEvent @event in obj.Vgt.Events)
                                {
                                    // All events implement IAgCrdn interface which provides
                                    // information about the event instance and its type.
                                    IAgCrdn crdn = @event as IAgCrdn;
                                    if (crdn.Name == name)
                                    {
                                        timeEvent = @event;
                                    }
                                }
                            }
                            else
                            {
                                timeEvent = obj.Vgt.Events.Factory.CreateEventEpoch(name, "Description");
                            }
                            IAgCrdnEventEpoch asEpoch = timeEvent as IAgCrdnEventEpoch;
                            asEpoch.Epoch = stopTimes[i];
                            IAgCrdn currentEvent = (IAgCrdn)timeEvent;
                            string  eventName    = currentEvent.Name;
                            string  pathStr      = currentEvent.Path;
                            line4 = "Name " + eventName + " \n";
                            line5 = "RelativePath " + pathStr.Substring(0, pathStr.IndexOf(" ")) + " \n";
                            string line6 = "END EVENT" + " \n";
                            string line7 = "END SMARTEPOCH" + " \n";

                            string linkedTextFinal = linkedText + line4 + line5 + line6 + line7;
                            CommonData.sectionList[CommonData.selectedArtic].linkedToListStrings.Add(linkedTextFinal);
                        }
                    }
                }
                if (IncrementCheck.Checked)
                {
                    CommonData.sectionList[CommonData.selectedArtic].isIncremented = true;
                    int    numSections     = intervals.Intervals.Count;
                    double startValueOG    = Convert.ToDouble(CommonData.sectionList[CommonData.selectedArtic].startValue);
                    double stepValueDouble = Convert.ToDouble(IncrementStepValue.Text);
                    for (int i = 0; i < numSections; i++)
                    {
                        LinkedListSection current = new LinkedListSection();

                        current.startValue = Convert.ToString((startValueOG + i * stepValueDouble));
                        current.endValue   = Convert.ToString((startValueOG + (i + 1) * stepValueDouble));

                        current.startTimeValue = CommonData.sectionList[CommonData.selectedArtic].startTimeValue;
                        current.durationValue  = CommonData.sectionList[CommonData.selectedArtic].durationValue;
                        current.deadbandValue  = CommonData.sectionList[CommonData.selectedArtic].deadbandValue;
                        current.accelValue     = CommonData.sectionList[CommonData.selectedArtic].accelValue;
                        current.dutyValue      = CommonData.sectionList[CommonData.selectedArtic].dutyValue;
                        current.decelValue     = CommonData.sectionList[CommonData.selectedArtic].decelValue;
                        current.periodValue    = CommonData.sectionList[CommonData.selectedArtic].periodValue;
                        current.sectionName    = CommonData.sectionList[CommonData.selectedArtic].sectionName;
                        string section = ArticFunctions.CreateSection(CommonData.sectionList[CommonData.selectedArtic].objectName, CommonData.sectionList[CommonData.selectedArtic].articName, current.startTimeValue, current.durationValue, current.startValue, current.endValue, current.deadbandValue, current.accelValue, current.decelValue, current.dutyValue, current.periodValue, current.sectionName);
                        current.sectionText = section;

                        CommonData.sectionList[CommonData.selectedArtic].linkedListSections.Add(current);
                    }
                }
                ArticFunctions.CreateFile(CommonData.fileStr);
                this.Close();
            }
        }
Beispiel #12
0
        private void LinkToAttitude_CheckedChanged(object sender, EventArgs e)
        {
            CommonData.StkRoot.UnitPreferences.SetCurrentUnit("DateFormat", "EpSec");
            string       objectPath = CommonData.objectClass + "/" + CommonData.simpleName;
            IAgStkObject obj        = CommonData.StkRoot.GetObjectFromPath(objectPath);

            if (LinkToAttitude.Checked)
            {
                AttitudeCoordFrame.Enabled = true;
                MainBody.Enabled           = true;
                AttitudeCoordFrame.Items.Add("VVLH");
                //AttitudeCoordFrame.Items.Add("ICRF");
                AttitudeCoordFrame.SelectedIndex = 0;
                foreach (Section item in CommonData.sectionList)
                {
                    item.linkedToAttitude = false;
                    if (item.articName.Contains("Yaw") || item.articName.Contains("Pitch") || item.articName.Contains("Roll"))
                    {
                        item.linkedToAttitude = true;
                    }
                }
                //Recreate and load articulation file
                ArticFunctions.CreateFile(CommonData.fileStr);
                ArticFunctions.LoadArticFile();

                //Add possible Main Body Options to dropdown menu
                //Defined as possible articulation objects, not articulation movements
                Array  names       = ArticFunctions.GetArticulations(obj);
                string currentName = null;
                foreach (string name in names)
                {
                    if (name.Split('-')[0] == currentName)
                    {
                    }
                    else
                    {
                        if (name.Split('-')[0] == "Time")
                        {
                        }
                        else
                        {
                            MainBody.Items.Add(name.Split('-')[0]);
                            currentName = name.Split('-')[0];
                        }
                    }
                }
                MainBody.SelectedIndex = 0;
            }
            else
            {
                foreach (Section item in CommonData.sectionList)
                {
                    item.linkedToAttitude = false;
                }
                //recreate articulation file and reload
                ArticFunctions.CreateFile(CommonData.fileStr);
                ArticFunctions.LoadArticFile();
                //turn off attitude file in object settings and disable settings on form
                if (CommonData.objectClass == "Aircraft")
                {
                    IAgGreatArcVehicle         aircraft = obj as IAgGreatArcVehicle;
                    IAgVeRouteAttitudeStandard attitude = aircraft.Attitude as IAgVeRouteAttitudeStandard;
                    attitude.External.Disable();
                }
                else if (CommonData.objectClass == "Satellite")
                {
                    IAgSatellite sat = obj as IAgSatellite;
                    IAgVeOrbitAttitudeStandard attitude = sat.Attitude as IAgVeOrbitAttitudeStandard;
                    attitude.External.Disable();
                }
                MainBody.Enabled           = false;
                AttitudeCoordFrame.Enabled = false;
                AttitudeCoordFrame.Items.Clear();
                MainBody.Items.Clear();
            }
        }
Beispiel #13
0
        private void cbStkObjects_SelectedIndexChanged(object sender, EventArgs e)
        {
            string simpleName;
            string className;
            string ext;

            CommonData.totalSectionCount = 0;
            //Change options in articulation box
            StringCollection objectPaths = m_stkObjectsLibrary.GetObjectPathListFromInstanceNamesXml(CommonData.StkRoot.AllInstanceNamesToXML(), "");

            foreach (string path in objectPaths)
            {
                CommonData.objectPaths.Add(path);
            }
            simpleName = cbStkObjects.Text;
            CreatedArtic.Items.Clear();
            MainBody.Items.Clear();
            LinkToAttitude.Checked = false;
            int startnum = CommonData.sectionList.Count;

            for (int i = (startnum - 1); i > -1; i--)
            {
                CommonData.sectionList.RemoveAt(i);
            }
            foreach (string path in objectPaths)
            {
                string objectName = m_stkObjectsLibrary.ObjectName(path);
                className = m_stkObjectsLibrary.ClassNameFromObjectPath(path);
                if (objectName == simpleName && className != "Scenario")
                {
                    className = m_stkObjectsLibrary.ClassNameFromObjectPath(path);
                    CommonData.objectClass = className;
                    CommonData.simpleName  = simpleName;
                    string       objectPath = className + "/" + simpleName;
                    IAgStkObject obj        = CommonData.StkRoot.GetObjectFromPath(objectPath);

                    //Clear possible articulations if another object was previously selected
                    PossibleArtic.Items.Clear();

                    //Add possible articulations to dropdown menu
                    Array names = ArticFunctions.GetArticulations(obj);
                    foreach (var item in names)
                    {
                        if (item.ToString().Contains("Time"))
                        {
                        }
                        else
                        {
                            PossibleArtic.Items.Add(item);
                        }
                    }

                    //Get the right file extension based on object class
                    ext = ArticFunctions.GetExtension(className);
                    AgExecCmdResult directory = (AgExecCmdResult)CommonData.StkRoot.ExecuteCommand("GetDirectory / Scenario");
                    CommonData.directoryStr = m_stkObjectsLibrary.GetScenarioDirectory();
                    CommonData.fileStr      = CommonData.directoryStr + "\\" + simpleName + ext;

                    //If file exists read the file and add current articulations to list of sections
                    if (File.Exists(CommonData.fileStr))
                    {
                        //read in file
                        List <Section> fileSections = ArticFunctions.ReadFile(CommonData.fileStr);
                        //populate created articulation list based on file
                        foreach (Section item in fileSections)
                        {
                            CommonData.sectionList.Add(item);
                            if (!String.IsNullOrWhiteSpace(item.sectionName))
                            {
                                if (item.isLinked)
                                {
                                    CreatedArtic.Items.Add(item.sectionName + "  |  LINKED");
                                }
                                else if (item.linkedToList)
                                {
                                    CreatedArtic.Items.Add(item.sectionName + "  |  LINKED TO INTERVAL LIST");
                                }
                                else
                                {
                                    CreatedArtic.Items.Add(item.sectionName);
                                }
                            }
                            else
                            {
                                if (item.isLinked)
                                {
                                    CreatedArtic.Items.Add(item.objectName + item.articName + " Start Time: " + item.startTimeValue + "sec" + "  |  LINKED");
                                }
                                else if (item.linkedToList)
                                {
                                    CreatedArtic.Items.Add(item.objectName + item.articName + " Start Time: " + item.startTimeValue + "sec" + "  |  LINKED TO INTERVAL LIST");
                                }
                                else
                                {
                                    CreatedArtic.Items.Add(item.objectName + item.articName + " Start Time: " + item.startTimeValue + "sec");
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #14
0
 private void RemoveAll_Click(object sender, EventArgs e)
 {
     //removes all lines from text file
     ArticFunctions.RemoveAll(CommonData.fileStr);
     CreatedArtic.Items.Clear();
 }
Beispiel #15
0
 private void LoadArticFile_Click(object sender, EventArgs e)
 {
     ArticFunctions.LoadArticFile();
 }