COVERAGE WITH STK OBJECT MODEL Follow the instructions in the accompanying tutorial (a PDF file) to enter the following code into your Visual Studio project. The code is organized (1) by sections of the tutorial, then (2) by programming language. NOTE: Code fragments are tabbed in such a way that the indentation should be correct when you copy them into your project. When copying a line, be sure to select the entire line, starting from the left margin of the page. * ------------------------------------------------------------- * * SECTION: Add the Core of the STK Object Model to your Project * * ------------------------------------------------------------- * LANGUAGE: C# ------------ 1) Add the following using statements to the beginning of Form1.cs: using AGI.STKObjects; using AGI.STKUtil; 2) Add this declaration to the beginning of the Form1 class definition: private AGI.STKObjects.AgStkObjectRoot root; 3) In the Form1 class constructor, after the InitializeComponent() method, add: root = new AGI.STKObjects.AgStkObjectRoot(); 4) Subscribe FormClosing Event and close STK Object root properly by adding: if (root != null) { if (root.CurrentScenario != null) { root.CloseScenario(); } System.Runtime.InteropServices.Marshal.ReleaseComObject(root); root = null; } LANGUAGE: VB.NET ---------------- 1) Add the following Imports statements to the beginning of Form1.vb: Imports AGI.STKObjects Imports AGI.STKUtil Imports System.Runtime.InteropServices 2) Add this declaration to the beginning of the Form1 class definition: Friend WithEvents root As AGI.STKObjects.AgStkObjectRoot 3) In the Form1 class constructor, after the InitializeComponent() method, add: root = New AGI.STKObjects.AgStkObjectRoot 4) Overload OnFormClosing to close STK Object root properly, add: Protected Overrides Sub OnFormClosing(ByVal e As FormClosingEventArgs) If (Not Me.root Is Nothing) Then If (Not Me.root.CurrentScenario Is Nothing) Then Me.root.CloseScenario End If Marshal.ReleaseComObject(Me.root) Me.root = Nothing End If MyBase.OnFormClosing(e) End Sub * ------------------------------------------------ * * SECTION: SET THE SCENE FOR THE COVERAGE ANALYSIS * * ------------------------------------------------ * LANGUAGE: C# ------------ 1) Create a scenario named "Coverage" and populate it with 2 satellites public void NewScenario() { //Set the scene by creating a scenario and populating it with 2 satellites try { //If you are using the 4DX Application Framework, you can comment out //the following two lines and use the Framework's functionality to //create the scenario instead. root.CloseScenario(); root.NewScenario("Coverage"); //Add a polar satellite IAgSatellite polarSat = (IAgSatellite)root.CurrentScenario.Children.New(AgESTKObjectType.eSatellite, "PolarSat"); //Assign a J4 propagator to propagate it polarSat.SetPropagatorType(AgEVePropagatorType.ePropagatorJ4Perturbation); IAgVePropagatorJ4Perturbation j4 = (IAgVePropagatorJ4Perturbation)polarSat.Propagator; //Define PolarSat's orbit using classical (Keplerian) elements IAgOrbitStateClassical classical = (IAgOrbitStateClassical)j4.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical); //Use apogee & perigee altitude to define the size and shape of the orbit classical.SizeShapeType = AgEClassicalSizeShape.eSizeShapeAltitude; IAgClassicalSizeShapeAltitude altitude = (IAgClassicalSizeShapeAltitude)classical.SizeShape; altitude.ApogeeAltitude = 400.00; altitude.PerigeeAltitude = 400.00; //Use argument of perigee, inclination and RAAN to define the orientation // of the orbit classical.Orientation.ArgOfPerigee = 0.0; classical.Orientation.AscNodeType = AgEOrientationAscNode.eAscNodeRAAN; IAgOrientationAscNodeRAAN raan = (IAgOrientationAscNodeRAAN)classical.Orientation.AscNode; raan.Value = 0; classical.Orientation.Inclination = 97.30; //Use true anomaly to specify the position of the satellite in orbit classical.LocationType = AgEClassicalLocation.eLocationTrueAnomaly; IAgClassicalLocationTrueAnomaly trueAnomaly = (IAgClassicalLocationTrueAnomaly)classical.Location; trueAnomaly.Value = 0.0; //Assign the orbital elements to PolarSat's propagator and propagate //the orbit j4.InitialState.Representation.Assign(classical); j4.Propagate(); //Get an interface to the PolarSat's basic 2D graphics attributes and use //it to set the color to magenta polarSat.Graphics.SetAttributesType(AgEVeGfxAttributes.eAttributesBasic); IAgVeGfxAttributesBasic basicAtt = (IAgVeGfxAttributesBasic)polarSat.Graphics.Attributes; basicAtt.Color = System.Drawing.Color.Magenta; //Add a shuttle IAgSatellite shuttle = (IAgSatellite)root.CurrentScenario.Children.New(AgESTKObjectType.eSatellite, "Shuttle"); //Again, we're using the J4 propagator, and we're using the same //classical orbital elements (but with different values) shuttle.SetPropagatorType(AgEVePropagatorType. ePropagatorJ4Perturbation); j4 = (IAgVePropagatorJ4Perturbation)shuttle.Propagator; classical = (IAgOrbitStateClassical)j4.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical); classical.SizeShapeType = AgEClassicalSizeShape.eSizeShapeAltitude; altitude = (IAgClassicalSizeShapeAltitude)classical.SizeShape; altitude.ApogeeAltitude = 500.00; altitude.PerigeeAltitude = 500.00; classical.Orientation.ArgOfPerigee = 0.0; classical.Orientation.AscNodeType = AgEOrientationAscNode.eAscNodeRAAN; raan = (IAgOrientationAscNodeRAAN)classical.Orientation.AscNode; raan.Value = 340; classical.Orientation.Inclination = 45.00; classical.LocationType = AgEClassicalLocation.eLocationTrueAnomaly; trueAnomaly = (IAgClassicalLocationTrueAnomaly)classical.Location; trueAnomaly.Value = 0.0; j4.InitialState.Representation.Assign(classical); j4.Propagate(); //Color the shuttle cyan shuttle.Graphics.SetAttributesType(AgEVeGfxAttributes.eAttributesBasic); basicAtt = (IAgVeGfxAttributesBasic)shuttle.Graphics.Attributes; basicAtt.Color = System.Drawing.Color.Cyan; //Now that we've set the scene, we can begin using the actions in the //combo box to develop the coverage analysis comboBox1.Enabled = true; button2.Enabled = true; button3.Enabled = true; button4.Enabled = true; button5.Enabled = true; button6.Enabled = true; button7.Enabled = true; } catch (Exception e) { MessageBox.Show(e.Message); } } 2) Add to the Click event procedure for the New Scenario button: NewScenario(); LANGUAGE: VB.NET ---------------- 1) Create a scenario named "Coverage" and populate it with 2 satellites Public Sub NewScenario() 'Set the scene by creating a scenario and populating it with 2 satellites Try 'If you are using the 4DX Application Framework, you can comment out 'the following two lines and use the Framework's functionality to 'create the scenario instead. root.CloseScenario() root.NewScenario("Coverage") 'Add a polar satellite Dim polarSat As IAgSatellite = CType(root.CurrentScenario.Children.New(AgESTKObjectType.eSatellite, "PolarSat"), IAgSatellite) 'Assign a J4 propagator to propagate it polarSat.SetPropagatorType(AgEVePropagatorType.ePropagatorJ4Perturbation) Dim j4 As IAgVePropagatorJ4Perturbation = CType(polarSat.Propagator, IAgVePropagatorJ4Perturbation) 'Define PolarSat's orbit using classical (Keplerian) elements Dim classical As IAgOrbitStateClassical = CType(j4.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical), IAgOrbitStateClassical) 'Use apogee & perigee altitude to define the size and shape of the orbit classical.SizeShapeType = AgEClassicalSizeShape.eSizeShapeAltitude Dim altitude As IAgClassicalSizeShapeAltitude = CType(classical.SizeShape, IAgClassicalSizeShapeAltitude) altitude.ApogeeAltitude = 400.0 altitude.PerigeeAltitude = 400.0 'Use argument of perigee, inclination and RAAN to define the orientation 'of the orbit classical.Orientation.ArgOfPerigee = 0.0 classical.Orientation.AscNodeType = AgEOrientationAscNode.eAscNodeRAAN Dim raan As IAgOrientationAscNodeRAAN = CType(classical.Orientation.AscNode, IAgOrientationAscNodeRAAN) raan.Value = 0 classical.Orientation.Inclination = 97.3 'Use true anomaly to specify the position of the satellite in orbit classical.LocationType = AgEClassicalLocation.eLocationTrueAnomaly Dim trueAnomaly As IAgClassicalLocationTrueAnomaly = CType(classical.Location, IAgClassicalLocationTrueAnomaly) trueAnomaly.Value = 0.0 'Assign the orbital elements to PolarSat's propagator and propagate 'the orbit j4.InitialState.Representation.Assign(classical) j4.Propagate() 'Get an interface to the PolarSat's basic 2D graphics attributes and use 'it to set the color to magenta polarSat.Graphics.SetAttributesType(AgEVeGfxAttributes.eAttributesBasic) Dim basicAtt As IAgVeGfxAttributesBasic = CType(polarSat.Graphics.Attributes, IAgVeGfxAttributesBasic) basicAtt.Color = System.Drawing.Color.Magenta 'Add a shuttle Dim shuttle As IAgSatellite = CType(root.CurrentScenario.Children.New(AgESTKObjectType.eSatellite, "Shuttle"), IAgSatellite) 'Again, we're using the J4 propagator, and we're using the same 'classical orbital elements (but with different values) shuttle.SetPropagatorType(AgEVePropagatorType.ePropagatorJ4Perturbation) j4 = CType(shuttle.Propagator, IAgVePropagatorJ4Perturbation) classical = CType(j4.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical), IAgOrbitStateClassical) classical.SizeShapeType = AgEClassicalSizeShape.eSizeShapeAltitude altitude = CType(classical.SizeShape, IAgClassicalSizeShapeAltitude) altitude.ApogeeAltitude = 500.0 altitude.PerigeeAltitude = 500.0 classical.Orientation.ArgOfPerigee = 0.0 classical.Orientation.AscNodeType = AgEOrientationAscNode.eAscNodeRAAN raan = CType(classical.Orientation.AscNode, IAgOrientationAscNodeRAAN) raan.Value = 340 classical.Orientation.Inclination = 45.0 classical.LocationType = AgEClassicalLocation.eLocationTrueAnomaly trueAnomaly = CType(classical.Location, IAgClassicalLocationTrueAnomaly) trueAnomaly.Value = 0.0 j4.InitialState.Representation.Assign(classical) j4.Propagate() 'Color the shuttle cyan shuttle.Graphics.SetAttributesType(AgEVeGfxAttributes.eAttributesBasic) basicAtt = CType(shuttle.Graphics.Attributes, IAgVeGfxAttributesBasic) basicAtt.Color = System.Drawing.Color.Cyan 'Now that we've set the scene, we can begin using the actions in the 'combo box to develop the coverage analysis ComboBox1.Enabled = True Button2.Enabled = True Button3.Enabled = True Button4.Enabled = True Button5.Enabled = True Button6.Enabled = True Button7.Enabled = True Catch e As Exception MessageBox.Show(e.Message) End Try End Sub 'NewScenario 2) Add to the Click event procedure for the New Scenario button: NewScenario() * ------------------------------------- * * SECTION: CREATE A COVERAGE DEFINITION * * ------------------------------------- * LANGUAGE: C# ------------ 1) Create a coverage definition object: public void CreateCovDef() { //Create a coverage definition and name it "Tropics" try { //Note that the coverage definition is a child of the scenario object tropics = (IAgCoverageDefinition)root.CurrentScenario.Children.New(AgESTKObjectType.eCoverageDefinition, "Tropics"); } catch (Exception e) { MessageBox.Show(e.Message); } } 2) Add the following to the variable declarations for the Form1 class (after the declaration of root): private IAgCoverageDefinition tropics; 3) In the Form1 class constructor, after the line where you initialize the root reference, add: comboBox1.Items.Add("Create Coverage Definition"); comboBox1.Items.Add("Set Coverage Bounds"); comboBox1.Items.Add("Set Coverage Resolution"); comboBox1.Items.Add("Compute Coverage"); comboBox1.Items.Add("Create Figure of Merit"); comboBox1.Items.Add("At Least Two"); comboBox1.Items.Add("Contours"); 4) In the SelectedIndexChanged() method for the combo box, add: int item = comboBox1.SelectedIndex; string action = comboBox1.Items[item].ToString(); root.BeginUpdate(); //suspends graphics updates until //called method is executed if (action == "Create Coverage Definition") { CreateCovDef(); } root.EndUpdate(); LANGUAGE: VB.NET ---------------- 1) Create a coverage definition object: Public Sub CreateCovDef() 'Create a coverage definition and name it "Tropics" Try 'Note that the coverage definition is a child of the scenario object tropics = CType(root.CurrentScenario.Children.New(AgESTKObjectType.eCoverageDefinition, "Tropics"), IAgCoverageDefinition) Catch e As Exception MessageBox.Show(e.Message) End Try End Sub 'CreateCovDef 2) Add the following to the variable declarations for the Form1 class (after the declaration of root): Private tropics As IAgCoverageDefinition 3) In the Form1 class constructor, after the line where you initialize the root reference, add: ComboBox1.Items.Add("Create Coverage Definition") ComboBox1.Items.Add("Set Coverage Bounds") ComboBox1.Items.Add("Set Coverage Resolution") ComboBox1.Items.Add("Compute Coverage") ComboBox1.Items.Add("Create Figure of Merit") ComboBox1.Items.Add("At Least Two") ComboBox1.Items.Add("Contours") 4) In the SelectedIndexChanged() method for the combo box, add: Dim item As Integer = ComboBox1.SelectedIndex Dim action As String = ComboBox1.Items(item).ToString() 'suspends graphics updates until called method is executed root.BeginUpdate() If action = "Create Coverage Definition" Then CreateCovDef() End If root.EndUpdate() * ---------------------------- * * SECTION: SET COVERAGE BOUNDS * * ---------------------------- * LANGUAGE: C# ------------ 1) Set bounds for the coverage object: //Set latitude bounds to +/- 23.5 deg to define a tropical region public void CoverageBounds() { try { grid = (IAgCvGrid)tropics.Grid; IAgCvBoundsLat bounds = (IAgCvBoundsLat)grid.Bounds; bounds.MaxLatitude = 23.5; bounds.MinLatitude = -23.5; } catch (Exception e) { MessageBox.Show(e.Message); } } 2) Add the following to the variable declarations for the Form1 class: private IAgCvGrid grid; 3) In the SelectedIndexChanged() method for the combo box, add: else if(action == "Set Coverage Bounds") { CoverageBounds(); } LANGUAGE: VB.NET ---------------- 1) Set bounds for the coverage object: Public Sub CoverageBounds() 'Set latitude bounds to +/- 23.5 deg to define a tropical region Try grid = CType(tropics.Grid, IAgCvGrid) Dim bounds As IAgCvBoundsLat = CType(grid.Bounds, IAgCvBoundsLat) bounds.MaxLatitude = 23.5 bounds.MinLatitude = -23.5 Catch e As Exception MessageBox.Show(e.Message) End Try End Sub 'CoverageBounds 2) Add the following to the variable declarations for the Form1 class: Private grid As IAgCvGrid 3) In the SelectedIndexChanged() method for the combo box, add (before the End If): ElseIf action = "Set Coverage Bounds" Then CoverageBounds() * ----------------------------------- * * SECTION: SET COVERAGE RESOLUTION * * ----------------------------------- * LANGUAGE: C# ------------ 1) Set the resolution of the coverage grid: //Increase the resolution of the grid by reducing the spacing //between grid points to 3 deg public void CoverageResolution() { try { IAgCvResolutionLatLon res = (IAgCvResolutionLatLon)grid.Resolution; res.LatLon = 3; } catch (Exception e) { MessageBox.Show(e.Message); } } 2) In the SelectedIndexChanged() method for the combo box, add: else if (action == "Set Coverage Resolution") { CoverageResolution(); } LANGUAGE: VB.NET ---------------- 1) Set the resolution of the coverage grid: 'Increase the resolution of the grid by reducing the spacing 'between grid points to 3 deg Public Sub CoverageResolution() Try Dim res As IAgCvResolutionLatLon = CType(grid.Resolution, IAgCvResolutionLatLon) res.LatLon = 3 Catch e As Exception MessageBox.Show(e.Message) End Try End Sub 'CoverageResolution 2) In the SelectedIndexChanged() method for the combo box, add: ElseIf action = "Set Coverage Resolution" Then CoverageResolution() * ------------------------- * * SECTION: COMPUTE COVERAGE * * ------------------------- * LANGUAGE: C# ------------ 1) Compute coverage: //Assign the satellites as coverage assets, configure graphics properties, //and compute coverage public void ComputeCoverage() { try { //Define coverage assets IAgCvAssetListCollection assets = tropics.AssetList; IAgCvAssetListElement sat1 = assets.Add("Satellite/PolarSat"); IAgCvAssetListElement sat2 = assets.Add("Satellite/Shuttle"); foreach (IAgCvAssetListElement sat in assets) { sat.AssetStatus = AgECvAssetStatus.eActive; } //Set graphics properties for CoverageDefinition object covStatGfx = tropics.Graphics.Static; covStatGfx.IsRegionVisible = true; covStatGfx.IsLabelsVisible = true; covStatGfx.IsPointsVisible = true; covStatGfx.FillPoints = true; IAgCvGfxProgress covProgGfx = tropics.Graphics.Progress; covProgGfx.IsVisible = true; IAgCvGfxAnimation covAnimGfx = tropics.Graphics.Animation; covAnimGfx.IsSatisfactionVisible = false; IAgCvVOAttributes cov3dGfx = (IAgCvVOAttributes)tropics.VO.Static; cov3dGfx.IsVisible = true; cov3dGfx.Translucency = 30; cov3dGfx = (IAgCvVOAttributes)tropics.VO.Animation; cov3dGfx.IsVisible = true; //Compute coverage - comment the following code line and uncomment //uncomment the ones below it if you are using STK 8.0 tropics.ComputeAccesses(); //Compute coverage using Connect - comment the preceding code line and //line and uncomment the following 2 lines if you are using STK 8.0: //string command = "Cov */CoverageDefinition/Tropics Access Compute"; //root.ExecuteCommand(command); } catch (Exception e) { MessageBox.Show(e.Message); } } 2) Add the following to the variable declarations for the Form1 class: private IAgCvGfxStatic covStatGfx; 3) In the SelectedIndexChanged() method for the combo box, add: else if (action == "Compute Coverage") { ComputeCoverage(); } LANGUAGE: VB.NET ---------------- 1) Compute coverage: 'Assign the satellites as coverage assets, configure graphics properties, 'and compute coverage Public Sub ComputeCoverage() Try 'Define coverage assets Dim assets As IAgCvAssetListCollection = tropics.AssetList Dim sat1 As IAgCvAssetListElement = assets.Add("Satellite/PolarSat") Dim sat2 As IAgCvAssetListElement = assets.Add("Satellite/Shuttle") Dim sat As IAgCvAssetListElement For Each sat In assets sat.AssetStatus = AgECvAssetStatus.eActive Next sat 'Set graphics properties for CoverageDefinition object covStatGfx = tropics.Graphics.Static covStatGfx.IsRegionVisible = True covStatGfx.IsLabelsVisible = True covStatGfx.IsPointsVisible = True covStatGfx.FillPoints = True Dim covProgGfx As IAgCvGfxProgress = tropics.Graphics.Progress covProgGfx.IsVisible = True Dim covAnimGfx As IAgCvGfxAnimation = tropics.Graphics.Animation covAnimGfx.IsSatisfactionVisible = False Dim cov3dGfx As IAgCvVOAttributes = CType(tropics.VO.Static, IAgCvVOAttributes) cov3dGfx.IsVisible = True cov3dGfx.Translucency = 30 cov3dGfx = CType(tropics.VO.Animation, IAgCvVOAttributes) cov3dGfx.IsVisible = True tropics.ComputeAccesses() 'Compute coverage - comment the following code line and uncomment 'uncomment the ones below it if you are using STK 8.0 tropics.ComputeAccesses() 'Compute coverage using Connect - comment the preceding code line and 'line and uncomment the following 2 lines if you are using STK 8.0: 'Dim command As String = "Cov */CoverageDefinition/Tropics Access Compute" 'root.ExecuteCommand(command) Catch e As Exception MessageBox.Show(e.Message) End Try End Sub 'ComputeCoverage 2) Add the following to the variable declarations for the Form1 class: Private covStatGfx As IAgCvGfxStatic 3) In the SelectedIndexChanged() method for the combo box, add: ElseIf action = "Compute Coverage" Then ComputeCoverage() * ------------------------------- * * SECTION: DEFINE FIGURE OF MERIT * * ------------------------------- * LANGUAGE: C# ------------ 1) Define FOM object as child of the coverage definition: //Define a figure of merit of the N Asset Coverage type, turn off //coverage definition graphics and turn on figure of merit graphics public void CreateFOM() { try { twoEyes = (IAgFigureOfMerit)root.CurrentScenario.Children["Tropics"].Children.New(AgESTKObjectType.eFigureOfMerit, "TwoEyes"); //Set type to N Asset Coverage and compute option to Maximum twoEyes.SetDefinitionType(AgEFmDefinitionType.eFmNAssetCoverage); IAgFmDefCompute compute = (IAgFmDefCompute)twoEyes.Definition; compute.SetComputeType(AgEFmCompute.eMaximum); //Turn off display of CoverageDefinition graphics covStatGfx = tropics.Graphics.Static; covStatGfx.IsRegionVisible = false; covStatGfx.IsPointsVisible = false; //Set graphics properties for FOM object IAgFmGfxAttributes fomStatGfx = (IAgFmGfxAttributes)twoEyes.Graphics.Static; fomStatGfx.IsVisible = true; fomStatGfx.FillPoints = false; fomStatGfx.MarkerStyle = "Circle"; IAgFmGfxAttributes fomAnimGfx = (IAgFmGfxAttributes)twoEyes.Graphics.Animation; fomAnimGfx.IsVisible = true; fomAnimGfx.FillPoints = false; fomAnimGfx.MarkerStyle = "Star"; twoEyes.Graphics.Animation.Accumulation = AgEFmGfxAccumulation.eCurrentTime; } catch (Exception e) { MessageBox.Show(e.Message); } } 2) Add the following to the variable declarations for the Form1 class: private IAgFigureOfMerit twoEyes; 3) In the SelectedIndexChanged() method for the combo box, add: else if (action == "Create Figure of Merit") { CreateFOM(); } LANGUAGE: VB.NET ---------------- 1) Define FOM object as child of the coverage definition: 'Define a figure of merit of the N Asset Coverage type, turn off 'coverage definition graphics and turn on figure of merit graphics Public Sub CreateFOM() Try twoEyes = CType(root.CurrentScenario.Children("Tropics").Children.New(AgESTKObjectType.eFigureOfMerit, "TwoEyes"), IAgFigureOfMerit) 'Set type to N Asset Coverage and compute option to Maximum twoEyes.SetDefinitionType(AgEFmDefinitionType.eFmNAssetCoverage) Dim compute As IAgFmDefCompute = CType(twoEyes.Definition, IAgFmDefCompute) compute.SetComputeType(AgEFmCompute.eMaximum) 'Turn off display of CoverageDefinition graphics covStatGfx = tropics.Graphics.Static covStatGfx.IsRegionVisible = False covStatGfx.IsPointsVisible = False 'Set graphics properties for FOM object Dim fomStatGfx As IAgFmGfxAttributes = CType(twoEyes.Graphics.Static, IAgFmGfxAttributes) fomStatGfx.IsVisible = True fomStatGfx.FillPoints = False fomStatGfx.MarkerStyle = "Circle" Dim fomAnimGfx As IAgFmGfxAttributes = CType(twoEyes.Graphics.Animation, IAgFmGfxAttributes) fomAnimGfx.IsVisible = True fomAnimGfx.FillPoints = False fomAnimGfx.MarkerStyle = "Star" twoEyes.Graphics.Animation.Accumulation = AgEFmGfxAccumulation.eCurrentTime Catch e As Exception MessageBox.Show(e.Message) End Try End Sub 'CreateFOM 2) Add the following to the variable declarations for the Form1 class: Private twoEyes As IAgFigureOfMerit 3) In the SelectedIndexChanged() method for the combo box, add: ElseIf action = "Create Figure of Merit" Then CreateFOM() * ----------------------------------- * * SECTION: SET SATISFACTION CRITERION * * ----------------------------------- * LANGUAGE: C# ------------ 1) Set a satisfaction criterion for the figure of merit: //Define the satisfaction criterion for the figure of merit to require //that at least 2 assets (satellites) have access to a grid point public void AtLeastTwo() { try { twoEyes.Definition.Satisfaction.EnableSatisfaction = true; twoEyes.Definition.Satisfaction.SatisfactionType = AgEFmSatisfactionType.eFmAtLeast; twoEyes.Definition.Satisfaction.SatisfactionThreshold = 2; } catch (Exception e) { MessageBox.Show(e.Message); } } 2) In the SelectedIndexChanged() method for the combo box, add: else if (action == "At Least Two") { AtLeastTwo(); } LANGUAGE: VB.NET ---------------- 1) Set a satisfaction criterion for the figure of merit: 'Define the satisfaction criterion for the figure of merit to require 'that at least 2 assets (satellites) have access to a grid point Public Sub AtLeastTwo() Try twoEyes.Definition.Satisfaction.EnableSatisfaction = True twoEyes.Definition.Satisfaction.SatisfactionType = AgEFmSatisfactionType.eFmAtLeast twoEyes.Definition.Satisfaction.SatisfactionThreshold = 2 Catch e As Exception MessageBox.Show(e.Message) End Try End Sub 'AtLeastTwo 2) In the SelectedIndexChanged() method for the combo box, add: ElseIf action = "At Least Two" Then AtLeastTwo() * ---------------------------------- * * SECTION: DISPLAY COVERAGE CONTOURS * * ---------------------------------- * LANGUAGE: C# ------------ 1) Define animation contours: //Turn off static graphics and define animation contours to show the //degree of satisfaction of the figure of merit (by one or both //satellites) dynamically public void Contours() { try { twoEyes.Graphics.Static.IsVisible = false; IAgFmGfxContours contours = (IAgFmGfxContours)twoEyes.Graphics.Animation.Contours; contours.IsVisible = true; contours.ColorMethod = AgEFmGfxColorMethod.eExplicit; contours.LevelAttributes.AddLevel(1); contours.LevelAttributes.AddLevel(2); IAgFmGfxLevelAttributesCollection levelAtts = (IAgFmGfxLevelAttributesCollection)contours.LevelAttributes; levelAtts[0].Color = System.Drawing.Color.Orange; levelAtts[1].Color = System.Drawing.Color.LightBlue; } catch (Exception e) { MessageBox.Show(e.Message); } } 2) In the SelectedIndexChanged() method for the combo box, add: else if (action == "Contours") { Contours(); } LANGUAGE: VB.NET ---------------- 1) Define animation contours: 'Turn off static graphics and define animation contours to show the 'degree of satisfaction of the figure of merit (by one or both 'satellites) dynamically Public Sub Contours() Try twoEyes.Graphics.Static.IsVisible = False Dim contours As IAgFmGfxContours = CType(twoEyes.Graphics.Animation.Contours, IAgFmGfxContours) contours.IsVisible = True contours.ColorMethod = AgEFmGfxColorMethod.eExplicit contours.LevelAttributes.AddLevel(1) contours.LevelAttributes.AddLevel(2) Dim levelAtts As IAgFmGfxLevelAttributesCollection = CType(contours.LevelAttributes, IAgFmGfxLevelAttributesCollection) levelAtts(0).Color = System.Drawing.Color.Orange levelAtts(1).Color = System.Drawing.Color.LightBlue Catch e As Exception MessageBox.Show(e.Message) End Try End Sub 'Contours 2) In the SelectedIndexChanged() method for the combo box, add: ElseIf action = "Contours" Then Contours()