AGI STK Objects 11 Send comments on this topic.
MultipleThresholdCrossings Method (IAgDrInterval)
See Also  Example
ElemName
The element name.
Thresholds
An array of the thresholds.





Description

MultipleThresholdCrossings returns an array of two-dimensional arrays. Each two-dimensional array contains start and stop times based on the boundaries passed in. The DataSets property must contain the Time dataset for this method to work correctly.

Syntax

[Visual Basic .NET]
Public Function MultipleThresholdCrossings( _
   ByVal ElemName As String, _
   ByRef Thresholds As System.Array _
) As System.Array

[C#]
public System.Array MultipleThresholdCrossings(
string ElemName,
ref System.Array Thresholds
);

[Managed C++]
public: System::Array MultipleThresholdCrossings(
String __gc ^ ElemName,
System::Array ^^ Thresholds
);

[Java]
public Object[] multipleThresholdCrossings(
String ElemName,
Object[] Thresholds
);

[Unmanaged C++]
public: HRESULT MultipleThresholdCrossings(
BSTR ElemName,
SAFEARRAY ** Thresholds,
SAFEARRAY ** Array
);

Parameters

ElemName
The element name.
Thresholds
An array of the thresholds.

Return Type

An array of two-dimensional arrays. Each two-dimensional array contains start and stop times. Some indexes may not contain any data.

Example

Execute an object coverage data provider and dump its result
[C#] Copy Code
IAgStkObject aircraft = root.CurrentScenario.Children["aircraft340"]; 
 
IAgStkObjectCoverage objectCoverage = aircraft.ObjectCoverage; 
objectCoverage.Clear(); 
objectCoverage.Assets.Add("Constellation/gps_const"); 
objectCoverage.Compute(); 
 
IAgDataPrvTimeVar provider = objectCoverage.DataProviders["FOM by Time"as IAgDataPrvTimeVar; 
 
IAgDrResult result = provider.Exec("1 Jan 2012 12:00:00.00""1 Jan 2012 13:00:00.00"1); 
 
foreach (IAgDrSubSection section in result.Sections) 

    foreach (IAgDrInterval interval in section.Intervals) 
    { 
        Array arBoundaries = new object[] 
                             { 
                                 1.02.03.04.05.0 
                             }; 
 
        // MultipleThresholdCrossings expects the second parameter 
        // to be a one demensional array of boundary index values 
        Array arRanges = interval.MultipleThresholdCrossings("FOM Value"ref arBoundaries); 
 
        for (int iRange = 0; iRange < arRanges.GetLength(0); iRange++) 
        { 
            Console.Write("\nRange: {0}\n", iRange); 
 
            Array arTimeSpans = arRanges.GetValue(iRange) as Array
            for (int iSpan = 0; iSpan < arTimeSpans.GetLength(0); iSpan++) 
            { 
                string strStart = arTimeSpans.GetValue(iSpan, 0).ToString(); 
                string strStop = arTimeSpans.GetValue(iSpan, 1).ToString(); 
 
                Console.Write("Start: {0}    Stop: {1}\n", strStart, strStop); 
            } 
        } 
    } 

 

Execute an object coverage data provider and dump its result
[Visual Basic .NET] Copy Code
Dim aircraft As IAgStkObject = root.CurrentScenario.Children("aircraft340")

Dim objectCoverage As IAgStkObjectCoverage = aircraft.ObjectCoverage
objectCoverage.Clear()
objectCoverage.Assets.Add("Constellation/gps_const")
objectCoverage.Compute()

Dim provider As IAgDataPrvTimeVar = TryCast(objectCoverage.DataProviders("FOM by Time"), IAgDataPrvTimeVar)

Dim result As IAgDrResult = provider.Exec("1 Jan 2012 12:00:00.00", "1 Jan 2012 13:00:00.00", 1)

For Each section As IAgDrSubSection In result.Sections
    For Each interval As IAgDrInterval In section.Intervals
        #If Not CSToJava Then
        #Else
        #End If
        Dim arBoundaries As Array = New Object() {1, 2, 3, 4, 5}

        ' MultipleThresholdCrossings expects the second parameter
        ' to be a one demensional array of boundary index values
        #If Not CSToJava Then
        Dim arRanges As Array = interval.MultipleThresholdCrossings("FOM Value", arBoundaries)
        #Else
        #End If

        Dim iRange As Integer = 0
        While iRange < arRanges.GetLength(0)
            Console.Write(vbLf & "Range: {0}" & vbLf, iRange)

            Dim arTimeSpans As Array = TryCast(arRanges.GetValue(iRange), Array)
            Dim iSpan As Integer = 0
            While iSpan < arTimeSpans.GetLength(0)
                Dim strStart As String = arTimeSpans.GetValue(iSpan, 0).ToString()
                Dim strStop As String = arTimeSpans.GetValue(iSpan, 1).ToString()

                Console.Write("Start: {0}" & vbTab & "Stop: {1}" & vbLf, strStart, strStop)
                System.Math.Max(System.Threading.Interlocked.Increment(iSpan),iSpan - 1)
            End While
            System.Math.Max(System.Threading.Interlocked.Increment(iRange),iRange - 1)
        End While
    Next
Next

See Also

© 2016 Analytical Graphics, Inc. All Rights Reserved.

STK Programming Interface 11.0.1