public static IAgVORefCrdnAngle DisplayAngle(string angleName, IAgStkObject stkObject, Color vectorColor) { IAgAircraft _aircraft = stkObject as IAgAircraft; IAgCrdn _angleVGT = stkObject.Vgt.Angles[angleName] as IAgCrdn; IAgVORefCrdnCollection refCrdns = GetRefCrdns(stkObject); //_aircraft.VO.Vector.RefCrdns; List <string> displayVectors = new List <string>(); foreach (IAgVORefCrdn item in refCrdns) { displayVectors.Add(item.Name); } IAgVORefCrdnAngle _angleVO; if (displayVectors.Contains(_angleVGT.QualifiedPath)) { _angleVO = refCrdns.GetCrdnByName( AgEGeometricElemType.eAngleElem, _angleVGT.QualifiedPath) as IAgVORefCrdnAngle; } else { _angleVO = refCrdns.Add( AgEGeometricElemType.eAngleElem, _angleVGT.QualifiedPath) as IAgVORefCrdnAngle; } _angleVO.AngleValueVisible = true; _angleVO.Color = vectorColor; _angleVO.LabelVisible = true; return(_angleVO); }
private void DisplayElement(AgEGeometricElemType type, IAgCrdn element, Color color) { IAgVOVector vectorGraphics = m_selectedObject.VO.Vector; IAgVORefCrdn elementGraphics; // If element exists, get by name. otherwise add it. try { elementGraphics = vectorGraphics.RefCrdns.GetCrdnByName(type, element.QualifiedPath); } catch { elementGraphics = vectorGraphics.RefCrdns.Add(type, element.QualifiedPath); } elementGraphics.Visible = true; elementGraphics.LabelVisible = true; elementGraphics.Color = color; try { ((IAgVORefCrdnAngle)elementGraphics).AngleValueVisible = true; } catch { // element is not an angle } }
public static void VectorChangeColor(string vectorName, IAgStkObject stkObject, Color SelectedColor) { IAgAircraft _aircraft = stkObject as IAgAircraft; IAgCrdn _vectorVGT = stkObject.Vgt.Vectors[vectorName] as IAgCrdn; IAgVORefCrdnVector _vectorVO = _aircraft.VO.Vector.RefCrdns.Add(AgEGeometricElemType.eVectorElem, _vectorVGT.QualifiedPath) as IAgVORefCrdnVector; _vectorVO.Color = SelectedColor; }
private void cbStkObjects_SelectedIndexChanged(object sender, EventArgs e) { string simpleName; string className; Events.Items.Clear(); //Change options in Events box StringCollection objectPaths = m_stkObjectsLibrary.GetObjectPathListFromInstanceNamesXml(CommonData.StkRoot.AllInstanceNamesToXML(), ""); simpleName = cbStkObjects.Text; 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); string objectPath = className + "/" + simpleName; IAgStkObject obj = CommonData.StkRoot.GetObjectFromPath(objectPath); events = obj.Vgt.Events; int eventCount = obj.Vgt.Events.Count; for (int i = 0; i < eventCount; i++) { IAgCrdn currentEvent = (IAgCrdn)events[i]; Events.Items.Add(currentEvent.Name); } } } if (cbStkObjects.Text.Contains("Access")) { IAgScenario scenario = CommonData.StkRoot.CurrentScenario as IAgScenario; Array accesses = scenario.GetExistingAccesses(); int numAccesses = accesses.GetLength(0); for (int i = 0; i < numAccesses; i++) { string object1 = accesses.GetValue(i, 0).ToString(); string shortobject1 = object1.Substring(object1.IndexOf('/') + 1); string object2 = accesses.GetValue(i, 1).ToString(); string shortobject2 = object2.Substring(object2.IndexOf('/') + 1); if (cbStkObjects.Text.Contains(shortobject1) && cbStkObjects.Text.Contains(shortobject2)) { IAgStkAccess access = scenario.GetAccessBetweenObjectsByPath(object1, object2); accessEvents = access.Vgt.Events; for (int j = 0; j < accessEvents.Count; j++) { IAgCrdn currentEvent = (IAgCrdn)accessEvents[j]; Events.Items.Add(currentEvent.Name); } } } } }
//Get all events in scenario public static List <IAgCrdn> GetAllEventInstances() { StkObjectsLibrary m_stkObjectsLibrary = new StkObjectsLibrary(); List <IAgCrdn> events = new List <IAgCrdn>(); IAgScenario scenario = CommonData.StkRoot.CurrentScenario as IAgScenario; //Get all access events available in scenario Array accesses = scenario.GetExistingAccesses(); int numAccesses = accesses.GetLength(0); for (int i = 0; i < numAccesses; i++) { string object1 = accesses.GetValue(i, 0).ToString(); string shortobject1 = object1.Substring(object1.IndexOf('/') + 1); string object2 = accesses.GetValue(i, 1).ToString(); string shortobject2 = object2.Substring(object2.IndexOf('/') + 1); IAgStkAccess access = scenario.GetAccessBetweenObjectsByPath(object1, object2); IAgCrdnEventGroup accessEvents = access.Vgt.Events; for (int j = 0; j < accessEvents.Count; j++) { IAgCrdn currentEvent = (IAgCrdn)accessEvents[j]; events.Add(currentEvent); } } //Get all object events available in scenario string simpleName; string className; foreach (string path in CommonData.objectPaths) { int instanceNameStartPos = path.LastIndexOf("/") + 1; simpleName = path.Substring(instanceNameStartPos); className = m_stkObjectsLibrary.ClassNameFromObjectPath(path); string objectPath = className + "/" + simpleName; IAgStkObject obj = null; try { obj = CommonData.StkRoot.GetObjectFromPath(objectPath); IAgCrdnEventGroup eventGroup = obj.Vgt.Events; int eventCount = obj.Vgt.Events.Count; for (int i = 0; i < eventCount; i++) { IAgCrdn currentEvent = (IAgCrdn)eventGroup[i]; events.Add(currentEvent); } } catch (Exception) { } } return(events); }
public static void VectorChangeSize(string vectorName, double ScaleValue, IAgStkObject stkObject) { if (stkObject.ClassName == "Aircraft") { IAgAircraft _aircraft = stkObject as IAgAircraft; IAgCrdn vector = stkObject.Vgt.Vectors[vectorName] as IAgCrdn; IAgVOVector vectorVO = _aircraft.VO.Vector; vectorVO.ScaleRelativeToModel = true; vectorVO.VectorSizeScale = ScaleValue; } }
public static void DisplayAxes(string axesName, IAgCrdnPoint displayOrigin, IAgStkObject stkObject, Color axesColor) { IAgCrdn axesVGT = stkObject.Vgt.Axes[axesName] as IAgCrdn; string cmd = "VO " + stkObject.Path + " SetVectorGeometry Add \"" + axesVGT.QualifiedPath + "\" Show On" + " Color " + axesColor.Name + " ShowLabel On" + " OriginPointDef \"" + (displayOrigin as IAgCrdn).QualifiedPath.Replace(" Point", "") + "\""; string cmdResult; TryConnect(cmd, out cmdResult); }
public static void VectorChangePoint(string vectorName, string OriginPointName, IAgStkObject stkObject) { string VectorDisplayOrigin = OriginPointName; //IAgAircraft _aircraft = stkObject as IAgAircraft; IAgCrdn vector = stkObject.Vgt.Vectors[vectorName] as IAgCrdn; IAgCrdn point = stkObject.Vgt.Points[OriginPointName] as IAgCrdn; IAgVORefCrdnCollection refCrdns = GetRefCrdns(stkObject); IAgVORefCrdnVector vectorVO = refCrdns.GetCrdnByName(AgEGeometricElemType.eVectorElem, vector.QualifiedPath) as IAgVORefCrdnVector; vectorVO.DrawAtPoint = true; vectorVO.Point = point.QualifiedPath; }
void PopulateComboBox() { // Add all vectors on object to both lists IAgCrdnVectorGroup vectors = m_selectedObject.Vgt.Vectors; foreach (IAgCrdnVector vector in vectors) { // All vectors implement IAgCrdn interface which provides // information about the vector instance and its type. IAgCrdn crdn = vector as IAgCrdn; alignedVectorComboBox.Items.Add(crdn.Name); constrainedVectorComboBox.Items.Add(crdn.Name); } }
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(); } }
public static IAgVORefCrdnVector DisplayVector(string vectorName, IAgStkObject stkObject, Color vectorColor) { if (!stkObject.Vgt.Vectors.Contains(vectorName)) { return(null); } IAgCrdn _vectorVGT = stkObject.Vgt.Vectors[vectorName] as IAgCrdn; IAgVORefCrdnCollection refCrdns = GetRefCrdns(stkObject); List <string> displayVectors = new List <string>(); foreach (IAgVORefCrdn item in refCrdns) { displayVectors.Add(item.Name); } IAgVORefCrdnVector _vectorVO; if (displayVectors.Contains(_vectorVGT.QualifiedPath)) { _vectorVO = refCrdns.GetCrdnByName(AgEGeometricElemType.eVectorElem, _vectorVGT.QualifiedPath) as IAgVORefCrdnVector; } else { _vectorVO = refCrdns.Add(AgEGeometricElemType.eVectorElem, _vectorVGT.QualifiedPath) as IAgVORefCrdnVector; } _vectorVO.Visible = true; _vectorVO.Color = vectorColor; _vectorVO.ArrowType = AgEArrowType.e3D; _vectorVO.LabelVisible = true; _vectorVO.MagnitudeVisible = true; //_vectorVO.MagnitudeUnitAbrv = "nm"; return(_vectorVO); }
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(); } }