AGI STK Objects 11 Send comments on this topic.
IAgDrResult Interface





Description

Provides methods to access the results returned by the data provider.

Object Model





Public Properties

Public Property Category Returns a value representing the category of the result.
Public Property DataSets Returns a collection of Datasets.
Public Property Intervals Returns a collection of intervals.
Public Property Message Returns the message returned with the result.
Public Property Sections Returns a collection of sections.
Public Property Value Returns the reference to the object containing the actual results returned by the data provider. The type of the object returned depends on the category. The categories currently defined are: Interval, SubSection and TextMessage

Example

Compute an access and get constraint data from data provider
[C#] Copy Code
// Compute Access between the facility and the satellite 
IAgStkObject sat1 = root.GetObjectFromPath("Satellite/Satellite1"); 
IAgStkObject fac1 = root.GetObjectFromPath("Facility/Facility1"); 
IAgStkAccess access = sat1.GetAccessToObject(fac1); 
access.ComputeAccess(); 
 
// Get the access intervals 
IAgIntervalCollection accessIntervals = access.ComputedAccessIntervalTimes; 
 
// Set unit preferences - change to get your preferred units 
root.UnitPreferences.SetCurrentUnit("Distance""km"); 
root.UnitPreferences.SetCurrentUnit("Angle""deg"); 
root.UnitPreferences.SetCurrentUnit("Time""sec"); 
root.UnitPreferences.SetCurrentUnit("DateFormat""UTCG"); 
 
// Extract the access intervals and the range information for each access interval 
Array dataPrvElements = new object[] 
    { 
        "Time""FromAngularRate""FromRange" 
    }; 
 
IAgDataPrvTimeVar dp = access.DataProviders["Constraint Data"as IAgDataPrvTimeVar; 
 
for (int index0 = 0; index0 < accessIntervals.Count; ++index0) 

    object startTime = null, stopTime = null
 
    accessIntervals.GetInterval(index0, out startTime, out stopTime); 
 
    Console.WriteLine("Access Interval #{0} - Start={1} Stop={2}", index0, startTime, stopTime); 
 
    IAgDrResult result = dp.ExecElements(startTime, stopTime, 60ref dataPrvElements); 
 
    Array timeValues = result.DataSets[0].GetValues(); 
    Array fromAngularRateValues = result.DataSets[1].GetValues(); 
    Array fromRangeValues = result.DataSets[2].GetValues(); 
 
    for (int index1 = 0; index1 < timeValues.GetLength(0); ++index1) 
    { 
        Console.WriteLine("{0}: FromAngularRate={1} FromRange={2}"
            timeValues.GetValue(index1), 
            fromAngularRateValues.GetValue(index1), 
            fromRangeValues.GetValue(index1)); 
    } 
 
    Console.WriteLine(); 

 

Extract data from IAgDrResult based on its category (generic)
[C#] Copy Code
// Look at the Category property to find out which interface to use 
switch (result.Category) 

    case AgEDrCategories.eDrCatDataSetList: 
        IAgDrDataSetCollection datasets = result.DataSets; 
        // See IAgDrDataSetCollection inteface 
        break
    case AgEDrCategories.eDrCatIntervalList: 
        IAgDrIntervalCollection intervals = result.Intervals; 
        // See IAgDrIntervalCollection interface 
        break
    case AgEDrCategories.eDrCatMessage: 
        IAgDrTextMessage message = result.Message; 
        // See IAgDrTextMessage interface 
        break
    case AgEDrCategories.eDrCatSubSectionList: 
        IAgDrSubSectionCollection section = result.Sections; 
        // See IAgDrSubSectionCollection interface 
        break

 

Compute an access and get constraint data from data provider
[Visual Basic .NET] Copy Code
' Compute Access between the facility and the satellite
Dim sat1 As IAgStkObject = root.GetObjectFromPath("Satellite/Satellite1")
Dim fac1 As IAgStkObject = root.GetObjectFromPath("Facility/Facility1")
Dim access As IAgStkAccess = sat1.GetAccessToObject(fac1)
access.ComputeAccess()

' Get the access intervals
Dim accessIntervals As IAgIntervalCollection = access.ComputedAccessIntervalTimes

' Set unit preferences - change to get your preferred units
root.UnitPreferences.SetCurrentUnit("Distance", "km")
root.UnitPreferences.SetCurrentUnit("Angle", "deg")
root.UnitPreferences.SetCurrentUnit("Time", "sec")
root.UnitPreferences.SetCurrentUnit("DateFormat", "UTCG")

' Extract the access intervals and the range information for each access interval
#If Not CSToJava Then
#Else
#End If
Dim dataPrvElements As Array = New Object() {"Time", "FromAngularRate", "FromRange"}

Dim dp As IAgDataPrvTimeVar = TryCast(access.DataProviders("Constraint Data"), IAgDataPrvTimeVar)

Dim index0 As Integer = 0
While index0 <>
    Dim startTime As Object = Nothing, stopTime As Object = Nothing

    #If Not CSToJava Then
    accessIntervals.GetInterval(index0, startTime, stopTime)
    #Else
    #End If

    Console.WriteLine("Access Interval #{0} - Start={1} Stop={2}", index0, startTime, stopTime)

    #If Not CSToJava Then
    Dim result As IAgDrResult = dp.ExecElements(startTime, stopTime, 60, dataPrvElements)
    #Else
    #End If

    Dim timeValues As Array = result.DataSets(0).GetValues()
    Dim fromAngularRateValues As Array = result.DataSets(1).GetValues()
    Dim fromRangeValues As Array = result.DataSets(2).GetValues()

    Dim index1 As Integer = 0
    While index1 <>
        Console.WriteLine("{0}: FromAngularRate={1} FromRange={2}", timeValues.GetValue(index1), fromAngularRateValues.GetValue(index1), fromRangeValues.GetValue(index1))
        System.Threading.Interlocked.Increment(index1)
    End While

    Console.WriteLine()
    System.Threading.Interlocked.Increment(index0)
End While

Extract data from IAgDrResult based on its category (generic)
[Visual Basic .NET] Copy Code
' Look at the Category property to find out which interface to use
Select Case result.Category
    Case AgEDrCategories.eDrCatDataSetList
        Dim datasets As IAgDrDataSetCollection = result.DataSets
        ' See IAgDrDataSetCollection inteface
        Exit Select
    Case AgEDrCategories.eDrCatIntervalList
        Dim intervals As IAgDrIntervalCollection = result.Intervals
        ' See IAgDrIntervalCollection interface
        Exit Select
    Case AgEDrCategories.eDrCatMessage
        Dim message As IAgDrTextMessage = result.Message
        ' See IAgDrTextMessage interface
        Exit Select
    Case AgEDrCategories.eDrCatSubSectionList
        Dim section As IAgDrSubSectionCollection = result.Sections
        ' See IAgDrSubSectionCollection interface
        Exit Select
End Select

© 2016 Analytical Graphics, Inc. All Rights Reserved.

STK Programming Interface 11.0.1