public static void ShowLegend() { try { int index = CommonData.CoverageList[CommonData.CoverageIndex].FomType; string oaName = CommonData.CoverageList[CommonData.CoverageIndex].CdName; if (index == 0 || index == 5) { IAgFigureOfMerit fom = CommonData.StkRoot.GetObjectFromPath("CoverageDefinition/" + oaName + "/FigureOfMerit/" + oaName + "_FOM") as IAgFigureOfMerit; fom.Graphics.Static.IsVisible = true; if (index != 5) { CommonData.StkRoot.ExecuteCommand("VO */CoverageDefinition/" + oaName + "/FigureOfMerit/" + oaName + "_FOM FOMAttributes StaticLegendShow On"); CommonData.StkRoot.ExecuteCommand("Graphics */CoverageDefinition/" + oaName + "/FigureOfMerit/" + oaName + "_FOM Legend Static Title " + "\"" + "Coverage Time (% of Coverage Interval)" + "\""); } } else { CommonData.StkRoot.ExecuteCommand("VO */CoverageDefinition/" + oaName + "/FigureOfMerit/" + oaName + "_FOM FOMAttributes DynamicLegendShow On"); IAgFigureOfMerit fom = CommonData.StkRoot.GetObjectFromPath("CoverageDefinition/" + oaName + "/FigureOfMerit/" + oaName + "_FOM") as IAgFigureOfMerit; fom.Graphics.Static.IsVisible = false; } } catch (Exception) { } }
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); }
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; } } }
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(); } }