STK UI CoreSend comments on this topic.
GetServiceByType Method (IAgUiWindow)
See Also
ServiceType
Windows





Windows & Linux

Description

Returns a service object that can be accessed at runtime. The method returns null if no service object is associated with the specified service type.

Syntax

[Visual Basic .NET]
Public Function GetServiceByType( _
    ByVal ServiceType As AgEWindowService _
) As Object
[C#]
public Object GetServiceByType(
    AgEWindowService ServiceType
);
[Managed C++]
public: IUnknown^ GetServiceByType(
    AgEWindowService ServiceType
);
[Unmanaged C++]
public: HRESULT GetServiceByType(
    AgEWindowService ServiceType,
    IUnknown ** ppRetVal
);
[Java]
public Object getServiceByType(
    AgEWindowService ServiceType
);
[Python - STK API ]
def GetServiceByType(self, ServiceType:"AgEWindowService") -> "IUnknown":

Parameters

ServiceType

See Also

Example

Enumerate all 3D (Globe) windows and print their scene identifiers.
[C#]
foreach (IAgUiWindow window in application.Windows)
{
    object oSvc = window.GetServiceByType(AgEWindowService.eWindowService3DWindow);
    IAgUiWindowGlobeObject globeObject = oSvc as IAgUiWindowGlobeObject;
    if (globeObject != null)
    {
        Console.WriteLine("Window Title: {0}, scene ID: {1}", window.Caption, globeObject.SceneID);
    }
}
Enumerate all 2D (Map) windows and print their map identifiers.
[C#]
foreach (IAgUiWindow window in application.Windows)
{
    object oSvc = window.GetServiceByType(AgEWindowService.eWindowService2DWindow);
    IAgUiWindowMapObject mapObject = oSvc as IAgUiWindowMapObject;
    if (mapObject != null)
    {
        Console.WriteLine("Window Title: {0}, scene ID: {1}", window.Caption, mapObject.MapID);
    }
}
Enumerate all 3D (Globe) windows and print their scene identifiers.
[Visual Basic .NET]
For Each window As IAgUiWindow In application.Windows
	Dim oSvc As Object = window.GetServiceByType(AgEWindowService.eWindowService3DWindow)
	Dim globeObject As IAgUiWindowGlobeObject = TryCast(oSvc, IAgUiWindowGlobeObject)
	If globeObject IsNot Nothing Then
		Console.WriteLine("Window Title: {0}, scene ID: {1}", window.Caption, globeObject.SceneID)
	End If
Next
Enumerate all 2D (Map) windows and print their map identifiers.
[Visual Basic .NET]
For Each window As IAgUiWindow In application.Windows
	Dim oSvc As Object = window.GetServiceByType(AgEWindowService.eWindowService2DWindow)
	Dim mapObject As IAgUiWindowMapObject = TryCast(oSvc, IAgUiWindowMapObject)
	If mapObject IsNot Nothing Then
		Console.WriteLine("Window Title: {0}, scene ID: {1}", window.Caption, mapObject.MapID)
	End If
Next
© 2024 Analytical Graphics, Inc. All Rights Reserved.