AGI STK Objects 11 Send comments on this topic.
ToArray Method (IAgAreaTypePatternCollection)
See Also  Example





Description

Returns the lat lons as a two dimensional array.

Syntax

[Visual Basic .NET]
Public Function ToArray() As System.Array

[C#]
public System.Array ToArray();

[Managed C++]
public: System::Array ToArray();

[Java]
public Object[] toArray();

[Unmanaged C++]
public: HRESULT ToArray(
SAFEARRAY ** Array
);

Example

List all points in an area target
[C#] Copy Code
if (areaTarget.AreaType == AgEAreaType.ePattern) 

    // Get IAgAreaTypePatternCollection interface from AreaTypeData 
    IAgAreaTypePatternCollection patternPoints = areaTarget.AreaTypeData as IAgAreaTypePatternCollection; 
 
    // ToArray returns a two dimensional array of latitude and longitude points 
    Array areaTargetPoints = patternPoints.ToArray(); 
 
    Console.WriteLine("All points in Area Target"); 
    for (int i = 0; i < areaTargetPoints.GetLength(0); ++i) 
    { 
        Console.WriteLine("  Latitude {0} Longitude: {1}"
            Convert.ToDouble(areaTargetPoints.GetValue(i, 0)), 
            Convert.ToDouble(areaTargetPoints.GetValue(i, 1))); 
    } 

 

List all points in an area target
[Visual Basic .NET] Copy Code
If areaTarget.AreaType = AgEAreaType.ePattern Then
    ' Get IAgAreaTypePatternCollection interface from AreaTypeData
    Dim patternPoints As IAgAreaTypePatternCollection = TryCast(areaTarget.AreaTypeData, IAgAreaTypePatternCollection)

    ' ToArray returns a two dimensional array of latitude and longitude points
    Dim areaTargetPoints As Array = patternPoints.ToArray()

    Console.WriteLine("All points in Area Target")
    Dim i As Integer = 0
    While i < areaTargetPoints.GetLength(0)
        Console.WriteLine(" Latitude {0} Longitude: {1}", Convert.ToDouble(areaTargetPoints.GetValue(i, 0)), Convert.ToDouble(areaTargetPoints.GetValue(i, 1)))
        System.Threading.Interlocked.Increment(i)
    End While
End If

See Also

© 2016 Analytical Graphics, Inc. All Rights Reserved.

STK Programming Interface 11.0.1