private void TrimUnselected_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("This will remove all unchecked components from the object's 3D Graphics->Vector list. \n Do you wish to continue?", "Warning", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { string parentStr = null; int index; IAgStkObject obj; dynamic vo; foreach (TreeNode item in AvailableVectorList.Nodes) { index = _data.IndexOf(_data.Where(p => p.SimpleName == item.Text).FirstOrDefault()); parentStr = _data[index].SimplePath; obj = CommonData.StkRoot.GetObjectFromPath(parentStr); vo = SmartViewFunctions.GetObjectVO(obj); if (vo != null) { IAgVORefCrdnCollection crdns = vo.Vector.RefCrdns; foreach (TreeNode child in item.Nodes) { if (!child.Checked) { crdns.RemoveByName(dict[child.Text], child.Text); } } } } PopulateList(); } }
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); }
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; }
private void PopulateList() { AvailableVectorList.Nodes.Clear(); string parentStr = null; string parentSimpleName = null; int parentCount = 0; int childCount = 0; string name = null; for (int i = 0; i < _data.Count; i++) { parentStr = _data[i].SimplePath; IAgStkObject obj = CommonData.StkRoot.GetObjectFromPath(parentStr); dynamic vo = SmartViewFunctions.GetObjectVO(obj); //Only populate objects that have valid vo properties if (vo != null) { IAgVORefCrdnCollection vgtComponents = vo.Vector.RefCrdns; //Only populate objects with valid vgt components in object properties list (i.e. 3D Graphics->Vector) if (vgtComponents.Count > 0) { AvailableVectorList.Nodes.Add(_data[i].SimpleName); parentCount++; childCount = 0; //Display all vgt components for the parent object. Add key value pairs into local dictionary and cross reference with existing options in saved view for (int j = 0; j < vgtComponents.Count; j++) { name = vgtComponents[j].Name; AvailableVectorList.Nodes[parentCount - 1].Nodes.Add(name); if (!dict.ContainsKey(name)) { dict.Add(name, vgtComponents[j].TypeID); } if (_data[i].ActiveVgtComponents.Keys.Contains(name)) { AvailableVectorList.Nodes[parentCount - 1].Nodes[childCount].Checked = true; } else { AvailableVectorList.Nodes[parentCount - 1].Nodes[childCount].Checked = false; } childCount++; } } } } }
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); }