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 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); }