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 void updateModelSize(double epsec) { Array cameraPosition = m_scene.Scenes[0].Camera.Position; IAgCrdnSystem cameraReference = m_scene.Scenes[0].Camera.PositionReferenceFrame; ArrayList objectTypeArray = new ArrayList(); objectTypeArray.Add(AgESTKObjectType.eAircraft); objectTypeArray.Add(AgESTKObjectType.eFacility); objectTypeArray.Add(AgESTKObjectType.eGroundVehicle); objectTypeArray.Add(AgESTKObjectType.eLaunchVehicle); objectTypeArray.Add(AgESTKObjectType.eMissile); objectTypeArray.Add(AgESTKObjectType.eSatellite); objectTypeArray.Add(AgESTKObjectType.eShip); foreach (AgESTKObjectType objectType in objectTypeArray) { foreach (IAgStkObject objectInstance in m_root.CurrentScenario.Children.GetElements(objectType)) { if (!magDiff.ContainsKey(objectInstance.Path)) { magDiff.Add(objectInstance.Path, 1); } IAgCrdnPoint centerPoint = objectInstance.Vgt.Points["Center"]; IAgCrdnPointLocateInSystemResult pointResult = centerPoint.LocateInSystem(epsec, cameraReference); double xDiff = (double)cameraPosition.GetValue(0) - pointResult.Position.X; double yDiff = (double)cameraPosition.GetValue(1) - pointResult.Position.Y; double zDiff = (double)cameraPosition.GetValue(2) - pointResult.Position.Z; double thisMagDiff = Math.Sqrt(xDiff * xDiff + yDiff * yDiff + zDiff * zDiff); if (thisMagDiff > 1.05 * magDiff[objectInstance.Path] || thisMagDiff < .95 * magDiff[objectInstance.Path]) { magDiff[objectInstance.Path] = thisMagDiff; if (Math.Log10(scaleFactor * thisMagDiff) > 0) { var temp = Math.Log10(scaleFactor * thisMagDiff); if (objectType == AgESTKObjectType.eAircraft) { ((IAgAircraft)objectInstance).VO.Model.ScaleValue = temp; } else if (objectType == AgESTKObjectType.eFacility) { if ((temp - 0.5) < 0) { temp = 1; } ((IAgFacility)objectInstance).VO.Model.ScaleValue = temp - 0.5; } else if (objectType == AgESTKObjectType.eGroundVehicle) { if ((temp + 0.5) > 10) { temp = 10; } ((IAgGroundVehicle)objectInstance).VO.Model.ScaleValue = temp + 0.5; } else if (objectType == AgESTKObjectType.eLaunchVehicle) { ((IAgLaunchVehicle)objectInstance).VO.Model.ScaleValue = temp; } else if (objectType == AgESTKObjectType.eMissile) { if ((temp + 1.0) > 10) { temp = 10; } ((IAgMissile)objectInstance).VO.Model.ScaleValue = temp + 1.0; } else if (objectType == AgESTKObjectType.eSatellite) { if ((temp + 1.0) > 10) { temp = 10; } ((IAgSatellite)objectInstance).VO.Model.ScaleValue = temp + 1.0; } else if (objectType == AgESTKObjectType.eShip) { if ((temp - 0.5) < 0) { temp = 1; } ((IAgShip)objectInstance).VO.Model.ScaleValue = temp - 0.5; } } } } } }
public static IAgCrdnVectorDisplacement GetCreateDisplacementVector(IAgCrdnProvider vgtPrv, IAgCrdnPoint OrginPoint, IAgCrdnPoint DestPoint, string VectorName) { IAgCrdnVectorDisplacement dispVector; if (vgtPrv.Vectors.Contains(VectorName)) { dispVector = vgtPrv.Vectors[VectorName] as IAgCrdnVectorDisplacement; dispVector.Origin.SetPoint(OrginPoint); dispVector.Destination.SetPoint(DestPoint); } else { dispVector = vgtPrv.Vectors.Factory.CreateDisplacementVector(VectorName, OrginPoint, DestPoint); } return(dispVector); }
public static IAgCrdnPlaneNormal GetCreatePlaneNormal(IAgCrdnProvider vgtPrv, IAgCrdnPoint Orgin, IAgCrdnVector RefVector, IAgCrdnVector NormalVector, string PlaneName, string description) { IAgCrdnPlaneNormal plane; if (vgtPrv.Planes.Contains(PlaneName)) { plane = (IAgCrdnPlaneNormal)vgtPrv.Planes[PlaneName]; } else { plane = (IAgCrdnPlaneNormal)vgtPrv.Planes.Factory.Create(PlaneName, description, AgECrdnPlaneType.eCrdnPlaneTypeNormal); } plane.NormalVector.SetVector(NormalVector); plane.ReferencePoint.SetPoint(Orgin); plane.ReferenceVector.SetVector(RefVector); return(plane); }