Description
AgIntervalCollection used to access the Intervals Collection interface.
Public Methods
Add | Adds an interval to the collection and returns the index. Start/Stop use DateFormat Dimension. |
ChangeInterval | Updates interval with specified start and stop times at a given index. Start/Stop use DateFormat Dimension. |
Deconflict | Deconflict display intervals. |
GetInterval | Returns start and stop times of the interval at a given index. Start/Stop use DateFormat Dimension. |
LoadIntervals | Load an interval file. |
RemoveAll | Removes all items in the collection. |
RemoveIndex | Removes an item by the index. |
RemoveInterval | Removes an interval using the interval interface. Start/Stop use DateFormat Dimension. |
ToArray | Returns a two-dimensional array of intervals beginning at a given position and having specified number of rows. |
Public Properties
Count | Number of items in the collection. |
Interfaces
CoClasses that Implement IAgIntervalCollection
Example
Compute and extract access interval times
[C#] |
---|
// Get and display the Computed Access Intervals
IAgIntervalCollection intervalCollection = access.ComputedAccessIntervalTimes;
// Set the intervals to use to the Computed Access Intervals
Array computedIntervals = intervalCollection.ToArray(0, -1);
access.SpecifyAccessIntervals(ref computedIntervals);
|
|
Compute an access and get constraint data from data provider
[C#] |
---|
// 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, 60, ref 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();
}
|
|
Set STK Object Display to use intervals mode
[C#] |
---|
// Attempt to cast STK Object to the IAgDisplayTm interface
IAgDisplayTm display = stkObject as IAgDisplayTm;
if (display != null)
{
// Configure display intervals
if (display.IsDisplayStatusTypeSupported(AgEDisplayTimesType.eUseIntervals))
{
display.SetDisplayStatusType(AgEDisplayTimesType.eUseIntervals);
// Get IAgIntervalCollection interface
IAgIntervalCollection intervalCollection = display.DisplayTimesData as IAgIntervalCollection;
intervalCollection.RemoveAll();
// Add subsequent intervals
intervalCollection.Add(
"1 Jan 2012 12:00:00.00",
"1 Jan 2012 13:00:00.000");
}
}
|
|
Compute and extract access interval times
[Visual Basic .NET] |
---|
' Get and display the Computed Access Intervals
Dim intervalCollection As IAgIntervalCollection = access.ComputedAccessIntervalTimes
' Set the intervals to use to the Computed Access Intervals
Dim computedIntervals As Array = intervalCollection.ToArray(0, -1)
access.SpecifyAccessIntervals(computedIntervals)
|
|
Compute an access and get constraint data from data provider
[Visual Basic .NET] |
---|
' 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
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 < accessIntervals.Count
Dim startTime As Object = Nothing, stopTime As Object = Nothing
accessIntervals.GetInterval(index0, startTime, stopTime)
Console.WriteLine("Access Interval #{0} - Start={1} Stop={2}", index0, startTime, stopTime)
Dim result As IAgDrResult = dp.ExecElements(startTime, stopTime, 60, dataPrvElements)
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 < timeValues.GetLength(0)
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
|
|
Set STK Object Display to use intervals mode
[Visual Basic .NET] |
---|
' Attempt to cast STK Object to the IAgDisplayTm interface
Dim display As IAgDisplayTm = TryCast(stkObject, IAgDisplayTm)
If display IsNot Nothing Then
' Configure display intervals
If display.IsDisplayStatusTypeSupported(AgEDisplayTimesType.eUseIntervals) Then
display.SetDisplayStatusType(AgEDisplayTimesType.eUseIntervals)
' Get IAgIntervalCollection interface
Dim intervalCollection As IAgIntervalCollection = TryCast(display.DisplayTimesData, IAgIntervalCollection)
intervalCollection.RemoveAll()
' Add subsequent intervals
intervalCollection.Add("1 Jan 2012 12:00:00.00", "1 Jan 2012 13:00:00.000")
End If
End If
|
|