Click or drag to resize

IMcEngineAncestorOfOperator Method

Find an ancestor operator of a given type for some operator.

Namespace:  MediaCy.IQL.Engine
Assembly:  MediaCy.IQL.Engine (in MediaCy.IQL.Engine.dll) Version: 10.0.6912.0
Syntax
VB
Function AncestorOfOperator ( 
	Operator As Object,
	ProgIDorCLSIDofAncestor As String
) As Object

Parameters

Operator
Type: SystemObject
The operator instance for which the ancestor operator is desired. This must be an interface implementing IMcHasObject or it must be the McObject of such an interface.
ProgIDorCLSIDofAncestor
Type: SystemString
Registered Prog ID of the "coclass" of the ancestor operator. Or the CLSID in a form like "{DC2F6FCB-08A7-40c0-BBDB-D3894B1C5F68}"; the braces are required. If the class has already been registered with the McObjects object manager (as it generally will have been), then just the registered type name is required. The registered type name is the portion of the ProgID after the first period up to any second period. All coclasses in the IQL type library are registered at start up, so as illustrated in the examples, you can just use the type name for virtually all operators. You may also use the name of a "base-type", such as "McFeatures" (which will match any McPoints, McLines or McRegions ancestor).

Return Value

Type: Object
The ancestor operator of the given class, or Nothing if no such ancestor exists.
Remarks
This function provides a convenient way to determine if an "operator" (an interface implementing IMcHasObject) has an ancestor operator of a given type and returns the ancestor if so. Use ParentOfOperator to get the immediate parent of an operator.
Examples
VB
'Example, Find an ancestor McImage of any operator
Function FindAncestorMcImageOfAnyOperator(myOperator As Object) As McImage
Set FindAncestorMcImageOfAnyOperator = _
AncestorOfOperator(myOperator, "McImage")
If FindAncestorMcImageOfAnyOperator Is Nothing Then
Debug.Print ThisApplication.McObject(myOperator).Name & " is not descended from any McImage."
Else
Debug.Print ThisApplication.McObject(myOperator).Name & "'s ancestor image is named: " & _
FindAncestorMcImageOfAnyOperator.Name
End If
End Function
Sub TestAncestorOfOperator()
Dim myImage As McImage
Set myImage = FindAncestorMcImageOfAnyOperator(ActiveImage.LineFeatures.Profiles)
Set myImage = FindAncestorMcImageOfAnyOperator(Engine.AoiList) 'Nothing
End Sub
See Also