コード例 #1
0
 public static void SetGridClass(IAgCoverageDefinition cov, string className)
 {
     if (className == "Facility")
     {
         cov.PointDefinition.GridClass = AgECvGridClass.eGridClassFacility;
     }
     else if (className == "Place")
     {
         cov.PointDefinition.GridClass = AgECvGridClass.eGridClassPlace;
     }
     else if (className == "Target")
     {
         cov.PointDefinition.GridClass = AgECvGridClass.eGridClassTarget;
     }
     else if (className == "Aircraft")
     {
         cov.PointDefinition.GridClass = AgECvGridClass.eGridClassAircraft;
     }
     else if (className == "Missile")
     {
     }
     else if (className == "Sensor")
     {
         cov.PointDefinition.GridClass = AgECvGridClass.eGridClassSensor;
     }
     else if (className == "Transmitter")
     {
         cov.PointDefinition.GridClass = AgECvGridClass.eGridClassTransmitter;
     }
     else if (className == "Receiver")
     {
         cov.PointDefinition.GridClass = AgECvGridClass.eGridClassReceiver;
     }
 }
コード例 #2
0
 public static void SetGridConstraint(IAgCoverageDefinition cov, string className, string objectPath)
 {
     //Grid Seed can only be applied once for some reason so try statement is used in case coverage is in edit mode
     SetGridClass(cov, className);
     try
     {
         cov.PointDefinition.UseGridSeed = true;
     }
     catch (Exception)
     {
     }
     cov.PointDefinition.SeedInstance = objectPath;
 }
コード例 #3
0
        public static void DefineCoverage(string cdName, List <string> oaNames, string pointGran)
        {
            try
            {
                IAgCoverageDefinition covDef = CommonData.StkRoot.GetObjectFromPath("CoverageDefinition/" + cdName) as IAgCoverageDefinition;
                covDef.Grid.BoundsType = AgECvBounds.eBoundsCustomRegions;
                IAgCvBoundsCustomRegions grid = covDef.Grid.Bounds as IAgCvBoundsCustomRegions;
                foreach (string oaName in oaNames)
                {
                    grid.AreaTargets.Add("AreaTarget/" + oaName);
                }

                //CommonData.StkRoot.ExecuteCommand("Cov */CoverageDefinition/" + cdName + " Grid AreaOfInterest Custom AreaTarget AreaTarget/" + oaName);
                CommonData.StkRoot.ExecuteCommand("Cov */CoverageDefinition/" + cdName + " Grid PointGranularity LatLon " + pointGran);
                CommonData.StkRoot.ExecuteCommand("Graphics */CoverageDefinition/" + cdName + " Static Points Off");
                CommonData.StkRoot.ExecuteCommand("Cov */CoverageDefinition/" + cdName + " Access Clear");
                CommonData.StkRoot.ExecuteCommand("Cov */CoverageDefinition/" + cdName + " Access AutoRecompute Off");
            }
            catch (Exception)
            {
            }
        }
コード例 #4
0
        public static void SetObjectVisibility(ObjectData objectData)
        {
            string className  = objectData.ClassName;
            string simplePath = objectData.SimplePath;

            if (className == "Satellite")
            {
                IAgSatellite myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgSatellite;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "Aircraft")
            {
                IAgAircraft myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgAircraft;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "Facility")
            {
                IAgFacility myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgFacility;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "Missile")
            {
                IAgMissile myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgMissile;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "GroundVehicle")
            {
                IAgGroundVehicle myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgGroundVehicle;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "Sensor")
            {
                IAgSensor myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgSensor;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "Transmitter")
            {
                IAgTransmitter myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgTransmitter;
                //Try/Catch for when object above it is already turned off
                try
                {
                    if (objectData.HideShow)
                    {
                        myObject.Graphics.Show = true;
                    }
                    else
                    {
                        myObject.Graphics.Show = false;
                    }
                }
                catch (Exception e)
                {
                }
            }
            else if (className == "Receiver")
            {
                IAgReceiver myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgReceiver;
                //Try/Catch for when object above it is already turned off
                try
                {
                    if (objectData.HideShow)
                    {
                        myObject.Graphics.Show = true;
                    }
                    else
                    {
                        myObject.Graphics.Show = false;
                    }
                }
                catch (Exception e)
                {
                }
            }
            else if (className == "CoverageDefinition")
            {
                IAgCoverageDefinition myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgCoverageDefinition;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "FigureOfMerit")
            {
                IAgFigureOfMerit myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgFigureOfMerit;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "CommSystem")
            {
                IAgCommSystem myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgCommSystem;
                if (objectData.HideShow)
                {
                    myObject.Graphics.Show = true;
                }
                else
                {
                    myObject.Graphics.Show = false;
                }
            }
            else if (className == "Chain")
            {
                IAgChain myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgChain;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "Place")
            {
                IAgPlace myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgPlace;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
            else if (className == "AreaTarget")
            {
                IAgAreaTarget myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgAreaTarget;
                if (objectData.HideShow)
                {
                    myObject.Graphics.IsObjectGraphicsVisible = true;
                }
                else
                {
                    myObject.Graphics.IsObjectGraphicsVisible = false;
                }
            }
        }
コード例 #5
0
        public static bool GetObjectVisibility(string className, string simplePath)
        {
            bool visible = false;

            if (className == "Satellite")
            {
                IAgSatellite myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgSatellite;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "Aircraft")
            {
                IAgAircraft myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgAircraft;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "Facility")
            {
                IAgFacility myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgFacility;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "Missile")
            {
                IAgMissile myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgMissile;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "GroundVehicle")
            {
                IAgGroundVehicle myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgGroundVehicle;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "Sensor")
            {
                IAgSensor myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgSensor;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "Transmitter")
            {
                IAgTransmitter myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgTransmitter;
                visible = myObject.Graphics.Show;
            }
            else if (className == "Receiver")
            {
                IAgReceiver myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgReceiver;
                visible = myObject.Graphics.Show;
            }
            else if (className == "CoverageDefinition")
            {
                IAgCoverageDefinition myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgCoverageDefinition;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "FigureOfMerit")
            {
                IAgFigureOfMerit myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgFigureOfMerit;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "CommSystem")
            {
                IAgCommSystem myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgCommSystem;
                visible = myObject.Graphics.Show;
            }
            else if (className == "Chain")
            {
                IAgChain myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgChain;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "Place")
            {
                IAgPlace myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgPlace;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }
            else if (className == "AreaTarget")
            {
                IAgAreaTarget myObject = CommonData.StkRoot.GetObjectFromPath(simplePath) as IAgAreaTarget;
                visible = myObject.Graphics.IsObjectGraphicsVisible;
            }

            return(visible);
        }
コード例 #6
0
ファイル: STK.cs プロジェクト: xiaozangyu/STKCodeExamples
        public static void CreateCoverage(AgStkObjectRoot root, TLE tle)
        {
            try
            {
                IAgCoverageDefinition covDef = root.CurrentScenario.Children.New(AgESTKObjectType.eCoverageDefinition, "CovDef") as IAgCoverageDefinition;

                // add all target objects as assets
                IAgStkObjectElementCollection allChildrenOfType = root.CurrentScenario.Children.GetElements(AgESTKObjectType.eTarget);
                IAgCvAssetListCollection      assetCollection   = covDef.AssetList;
                foreach (IAgStkObject o in allChildrenOfType)
                {
                    string satAssetName = "Target/" + o.InstanceName;
                    assetCollection.Add(satAssetName);
                }

                covDef.Graphics.Static.IsPointsVisible = false;

                // set the grid resolution
                IAgCvGrid cvGrid = covDef.Grid;
                cvGrid.ResolutionType = AgECvResolution.eResolutionLatLon;
                IAgCvResolutionLatLon res = cvGrid.Resolution as IAgCvResolutionLatLon;
                res.LatLon = 1;

                // set the points altitude
                IAgCvPointDefinition pointDefinition = covDef.PointDefinition;
                pointDefinition.AltitudeMethod = AgECvAltitudeMethod.eAltitude;
                pointDefinition.Altitude       = 20.0;
                covDef.PointDefinition.GroundAltitudeMethod = AgECvGroundAltitudeMethod.eCvGroundAltitudeMethodUsePointAlt;

                // set the start/stop time
                DateTime startDate = tle.GetTleEpoch();
                DateTime stopDate  = startDate.AddMilliseconds(1);
                covDef.Interval.AnalysisInterval.SetExplicitInterval(startDate.ToString("dd MMM yyyy hh:mm:ss.fff"), stopDate.ToString("dd MMM yyyy hh:mm:ss.fff"));

                covDef.Advanced.AutoRecompute = false;
                covDef.ComputeAccesses();


                IAgFigureOfMerit fom = root.CurrentScenario.Children["CovDef"].Children.New(AgESTKObjectType.eFigureOfMerit, "Likelihood") as IAgFigureOfMerit;
                fom.SetDefinitionType(AgEFmDefinitionType.eFmNAssetCoverage);
                fom.Graphics.Animation.IsVisible     = false;
                fom.Graphics.Static.FillTranslucency = 20;
                IAgFmGfxContours contours = fom.Graphics.Static.Contours;
                contours.IsVisible   = true;
                contours.ContourType = AgEFmGfxContourType.eSmoothFill;
                contours.ColorMethod = AgEFmGfxColorMethod.eExplicit;
                contours.LevelAttributes.RemoveAll();

                IAgFmGfxLevelAttributesElement level1 = contours.LevelAttributes.AddLevel(1);
                IAgFmGfxLevelAttributesElement level2 = contours.LevelAttributes.AddLevel(2);
                IAgFmGfxLevelAttributesElement level3 = contours.LevelAttributes.AddLevel(3);
                IAgFmGfxLevelAttributesElement level4 = contours.LevelAttributes.AddLevel(4);

                level1.Color = Color.Khaki;
                level2.Color = Color.Gold;
                level3.Color = Color.Orange;
                level4.Color = Color.Red;

                root.ExecuteCommand("Graphics */CoverageDefinition/CovDef/FigureOfMerit/Likelihood SmoothFillParameters NNSampleMode Smooth");
            }
            catch (Exception)
            {
                throw new Exception();
            }
        }