Пример #1
0
        private static void ShowVector(AgSatellite satObj, string type)
        {
            string       name = "Satellite/" + satObj.InstanceName + " " + type;
            IAgVORefCrdn ecc  = GetVector(satObj, name);

            ecc.Visible      = true;
            ecc.LabelVisible = true;
            IAgVORefCrdnVector eccVector = ecc as IAgVORefCrdnVector;

            eccVector.DrawAtCB = true;
            TurnOnTrueScale(satObj, type);
        }
Пример #2
0
 private static IAgVORefCrdn GetVector(AgSatellite satObj, string name)
 {
     try
     {
         IAgVORefCrdn vector = satObj.VO.Vector.RefCrdns.GetCrdnByName(0, name);
         return(vector);
     }
     catch
     {
         satObj.VO.Vector.RefCrdns.Add(0, name);
         return(satObj.VO.Vector.RefCrdns.GetCrdnByName(0, name));
     }
 }
Пример #3
0
        private static void HideVector(AgSatellite satObj, string type)
        {
            IAgVORefCrdn ecc = GetVector(satObj, "Satellite/" + satObj.InstanceName + " " + type + " Vector");

            ecc.Visible = false;
        }
Пример #4
0
        public static void ChangeTargetThreatView(ViewData view)
        {
            IAgSatellite     sat;
            IAgExecCmdResult result;
            string           cmd = null;
            int windowId         = GetWindowId(view.WindowName, 1);

            SetAnimation(view);

            try
            {
                string objectPath = view.TargetSatellite;
                cmd = "VO * View FromTo FromRegName \"STK Object\" FromName \"" + objectPath + "\" ToRegName  \"STK Object\" ToName  \"" + objectPath + "\" WindowID " + windowId.ToString();
                CommonData.StkRoot.ExecuteCommand(cmd);
                CommonData.StkRoot.ExecuteCommand("VO * View Top WindowID " + windowId.ToString());
                CommonData.StkRoot.ExecuteCommand("VO * View Zoom WindowID " + windowId.ToString() + " FractionofCB -0.3");
            }
            catch (Exception)
            {
            }

            string objPath  = view.TargetSatellite;
            string objPath1 = view.TargetSatellite;

            sat = CommonData.StkRoot.GetObjectFromPath(objPath) as IAgSatellite;
            sat.VO.OrbitSystems.FixedByWindow.IsVisible    = true;
            sat.VO.OrbitSystems.InertialByWindow.IsVisible = false;
            cmd = "VO */" + objPath + " Pass3d Inherit Off OrbitLead OnePass OrbitTrail SameAsLead";
            try
            {
                CommonData.StkRoot.ExecuteCommand(cmd);
            }
            catch (Exception)
            {
                MessageBox.Show("Could not update Lead/Trail Settings");
            }

            foreach (var item in view.ThreatSatNames)
            {
                if (item != "")
                {
                    objPath = item;
                    sat     = CommonData.StkRoot.GetObjectFromPath(objPath) as IAgSatellite;
                    cmd     = "VO */" + objPath + " Pass3d Inherit Off OrbitLead None OrbitTrail Quarter";
                    try
                    {
                        CommonData.StkRoot.ExecuteCommand(cmd);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Could not update Lead/Trail Settings");
                    }
                }
            }

            if (view.EnableProximityBox)
            {
                try
                {
                    sat = CommonData.StkRoot.GetObjectFromPath(objPath1) as IAgSatellite;
                    IAgStkObject       sat1  = CommonData.StkRoot.GetObjectFromPath(objPath1);
                    IAgCrdnPlaneNormal plane = sat1.Vgt.Planes.Factory.Create("ProximityPlane", "", AgECrdnPlaneType.eCrdnPlaneTypeNormal) as IAgCrdnPlaneNormal;
                    //IAgVORefCrdn newPlane = plane as IAgVORefCrdn;
                    //string planeName = newPlane.Name;
                    plane.NormalVector.SetPath(view.TargetSatellite + " Nadir(Detic)");
                    plane.ReferencePoint.SetPath(view.TargetSatellite + " Center");
                    plane.ReferenceVector.SetPath(view.TargetSatellite + " Velocity");

                    sat.VO.Vector.RefCrdns.Add(AgEGeometricElemType.ePlaneElem, objPath1 + " ProximityPlane");
                    IAgVORefCrdn newPlane = sat.VO.Vector.RefCrdns.GetCrdnByName(AgEGeometricElemType.ePlaneElem, objPath1 + " ProximityPlane Plane");
                    newPlane.Visible              = true;
                    newPlane.LabelVisible         = false;
                    newPlane.Color                = System.Drawing.Color.LimeGreen;
                    sat.VO.Vector.VectorSizeScale = 5;
                    IAgVORefCrdnPlane newPlane1 = newPlane as IAgVORefCrdnPlane;
                    newPlane1.CircGridVisible         = true;
                    newPlane1.Size                    = 3;
                    newPlane1.PlaneGridSpacing        = 50; //km
                    newPlane1.TransparentPlaneVisible = true;
                    newPlane1.DrawAtObject            = true;
                }
                catch (Exception)
                {
                    MessageBox.Show("Could not create proximity box");
                }
            }

            if (view.EnableProximityEllipsoid)
            {
                try
                {
                    sat = CommonData.StkRoot.GetObjectFromPath(objPath1) as IAgSatellite;
                    IAgStkObject sat1 = CommonData.StkRoot.GetObjectFromPath(objPath1);
                    sat.VO.Proximity.Ellipsoid.IsVisible       = true;
                    sat.VO.Proximity.Ellipsoid.XSemiAxisLength = Double.Parse(view.EllipsoidX);
                    sat.VO.Proximity.Ellipsoid.YSemiAxisLength = Double.Parse(view.EllipsoidY);
                    sat.VO.Proximity.Ellipsoid.ZSemiAxisLength = Double.Parse(view.EllipsoidZ);
                }
                catch (Exception)
                {
                    MessageBox.Show("Could not create proximity ellipsoid");
                }
            }

            foreach (ObjectData item in CommonData.InitialObjectData)
            {
                try
                {
                    CommonData.StkRoot.ExecuteCommand("VO " + item.SimplePath + " DynDataText RemoveAll");
                }
                catch (Exception)
                {
                }
            }
            //if (CommonData.PreviousDataDisplayObject != null)
            //{
            //    try
            //    {
            //        CommonData.StkRoot.ExecuteCommand("VO */" + CommonData.PreviousDataDisplayObject + " DynDataText RemoveAll");
            //    }
            //    catch (Exception)
            //    {

            //    }
            //}

            if (view.TtDataDisplayActive)
            {
                if (view.TtDataDisplayObject == "AllThreat")
                {
                    List <string> locations = new List <string>();
                    int           count     = 0;
                    locations.Add("TopLeft"); locations.Add("TopRight"); locations.Add("BottomLeft"); locations.Add("BottomRight");

                    foreach (string item in view.ThreatSatNames)
                    {
                        if (count < 4)
                        {
                            try
                            {
                                if (view.TtDataDisplayReportName == "RIC")
                                {
                                    cmd = "VO */" + view.ThreatSatNames[count] + " DynDataText DataDisplay \"" + view.TtDataDisplayReportName + "\" Show On Font Medium Color yellow Pos " + locations[count] + " Window " + windowId.ToString() + " PreData \"" + view.TargetSatellite + "\"";
                                    CommonData.StkRoot.ExecuteCommand(cmd);
                                    CommonData.PreviousDataDisplayObject = view.TtDataDisplayObject;
                                }
                                else
                                {
                                    cmd = "VO */" + view.ThreatSatNames[count] + " DynDataText DataDisplay \"" + view.TtDataDisplayReportName + "\" Show On Font Medium Color yellow Pos " + locations[count] + " Window " + windowId.ToString();
                                    CommonData.StkRoot.ExecuteCommand(cmd);
                                    CommonData.PreviousDataDisplayObject = view.TtDataDisplayObject;
                                }
                            }
                            catch (Exception)
                            {
                            }
                        }
                        count++;
                    }
                }
                else
                {
                    try
                    {
                        if (view.TtDataDisplayReportName == "RIC")
                        {
                            cmd = "VO */" + view.TtDataDisplayObject + " DynDataText DataDisplay \"" + view.TtDataDisplayReportName + "\" Show On Font Medium Color yellow Pos " + view.TtDataDisplayLocation + " Window " + windowId.ToString() + " PreData \"" + view.TargetSatellite + "\"";
                            CommonData.StkRoot.ExecuteCommand(cmd);
                            CommonData.PreviousDataDisplayObject = view.TtDataDisplayObject;
                        }
                        else
                        {
                            cmd = "VO */" + view.TtDataDisplayObject + " DynDataText DataDisplay \"" + view.TtDataDisplayReportName + "\" Show On Font Medium Color yellow Pos " + view.TtDataDisplayLocation + " Window " + windowId.ToString();
                            CommonData.StkRoot.ExecuteCommand(cmd);
                            CommonData.PreviousDataDisplayObject = view.TtDataDisplayObject;
                        }
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Could not create data display");
                    }
                }
            }

            if (view.ObjectHideShow)
            {
                string message    = "Error changing Hide/Show for following objects: \n";
                int    errorCount = 0;
                if (view.ViewObjectData.Count != 0)
                {
                    foreach (ObjectData item in view.ViewObjectData)
                    {
                        try
                        {
                            SetObjectVisibility(item);
                        }
                        catch (Exception e)
                        {
                            message = message + item.SimpleName + "\n";
                            errorCount++;
                        }
                    }

                    if (errorCount != 0)
                    {
                        MessageBox.Show(message);
                    }
                }
            }
        }