Click or drag to resize

IMcFeaturesList2Add Method

Makes a copy of a supplied McFeatures-derived object and adds it to the list or replaces an existing list item with the copy.

Namespace:  MediaCy.IQL.Features
Assembly:  MediaCy.IQL.Features (in MediaCy.IQL.Features.dll) Version: 10.0.6912.0
Syntax
VB
Function Add ( 
	McFeaturesToAdd As IMcFeatures,
	Name As String
) As Integer

Parameters

McFeaturesToAdd
Type: MediaCy.IQL.FeaturesIMcFeatures
The McFeatures-derived object instance to add. Depending on the TypeOfList property this may be an McRegions, McLines or McPoints object.
Name
Type: SystemString
The name to give the new list item or the name of an existing list item to be replaced. This name must be one that the ValidateName method will accept without change; you may use the ValidateName method to create a valid name from most source strings.

Return Value

Type: Int32
The list index (0 being the first) of the new or replaced list item. The Count property will have changed only if a new list item is added, in which case the returned index value will equal Count-1 (see Examples).

Implements

IMcFeaturesListAdd(IMcFeatures, String)
Remarks
The copy of the supplied McFeatures-derived operator will lose any existing parent McObject; the copy's parent McObject will be that backing the McFeaturesList operator instance.
Examples
VB
' Add an AOI to AoiList
Dim lAddedIndex As Long
lAddedIndex = AoiList.Add ThisApplication.ActiveImage.Aoi, "SomeName"
if lAddedIndex <> AoiList.Count-1 Then
MsgBox "An item named " & AoiList(lAddedIndex,True) & " was already in the list."
Else
MsgBox "A new item was added to the list."
End If
'Add all image AOI's to AoiList without overwriting existing list items
Dim mcimageNext As McImage
For Each mcimageNext In Images
Dim strValidated As String
AoiList.ValidateName mcimageNext.Name, strValidated, True
AoiList.Add mcimageNext.Aoi, strValidated
Next mcimageNext
See Also