Пример #1
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);
        }
Пример #2
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";
         }
     }
 }
Пример #3
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);
         }
     }
 }
Пример #4
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();
            }
        }
Пример #5
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);
                }
            }
        }
Пример #6
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();
            }
        }
Пример #7
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();
            }
        }