Description
Provides accesses to the global unit
table.
Object Model
Public Methods
Public Properties
Example
Isolate Unit
Preferences when using multiple IAgStkObjectRoot objects
| [C#] |
Copy Code
|
|
|
Isolate Unit
Preferences when using multiple IAgStkObjectRoot objects
| [Visual Basic .NET] |
Copy Code
|
Dim root1 As IAgStkObjectRoot = New AgStkObjectRootClass()
root1.UnitPreferences.SetCurrentUnit("Distance", "km")
Dim root2 As IAgStkObjectRoot = New AgStkObjectRootClass()
root2.Isolate()
root2.UnitPreferences.SetCurrentUnit("Distance", "mi")
If root1.CurrentScenario IsNot
Nothing Then
root1.CloseScenario()
End If
root1.NewScenario("Test")
root1.CurrentScenario.Children.[New](AgESTKObjectType.eShip,
"Ship1")
Dim shipFromRoot1 As IAgShip =
TryCast(root1.GetObjectFromPath("Ship/Ship1"), IAgShip)
Dim shipFromRoot2 As IAgShip =
TryCast(root2.GetObjectFromPath("Ship/Ship1"), IAgShip)
shipFromRoot1.SetRouteType(AgEVePropagatorType.ePropagatorGreatArc)
Dim greatArcFromRoot1 As IAgVePropagatorGreatArc =
TryCast(shipFromRoot1.Route, IAgVePropagatorGreatArc)
Dim greatArcFromRoot2 As IAgVePropagatorGreatArc =
TryCast(shipFromRoot2.Route, IAgVePropagatorGreatArc)
Dim waypointsFromRoot1 As IAgVeWaypointsElement =
greatArcFromRoot1.Waypoints.Add()
waypointsFromRoot1.Altitude = 1
Dim waypointsFromRoot2 As IAgVeWaypointsElement =
greatArcFromRoot2.Waypoints.Add()
waypointsFromRoot2.Altitude = 1
greatArcFromRoot1.Propagate()
Dim i As
Integer = 1
For Each
wpt As IAgVeWaypointsElement
In greatArcFromRoot1.Waypoints
Console.WriteLine("Point #{0} Altitude {1} {2}", i, wpt.Altitude,
root1.UnitPreferences.GetCurrentUnitAbbrv("Distance"))
System.Threading.Interlocked.Increment(i)
Next
Console.WriteLine()
i = 1
For Each
wpt As IAgVeWaypointsElement
In greatArcFromRoot2.Waypoints
Console.WriteLine("Point #{0} Altitude {1} {2}", i, wpt.Altitude,
root2.UnitPreferences.GetCurrentUnitAbbrv("Distance"))
System.Threading.Interlocked.Increment(i)
Next
root1.CloseScenario()
|
|