McFeatures Interface |
![]() |
Namespace: MediaCy.IQL.Features
Public Interface McFeatures Inherits IMcFeatures
VERSION 5.00 Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} McFeaturesEventsSample Caption = "AOI Events" ClientHeight = 2685 ClientLeft = 45 ClientTop = 330 ClientWidth = 4710 OleObjectBlob = "McFeaturesEventsSample.frx":0000 ShowModal = 0 'False StartUpPosition = 1 'CenterOwner End 'This is McFeaturesEventsSample.frm 'This file illustrates tracking McFeatures events. 'Here we track the AOI of the ActiveImage (a McRegions, 'which is derived from McFeatures) and display what is going on. ' 'To use this sample, just create a simple form with a multiline 'TextBox control named "Output". The form's ShowModal property 'should be set to False. Then import or paste this entire file 'in as the form's code. ' Option Explicit Private WithEvents theImages As McImages Attribute theImages.VB_VarHelpID = -1 Private WithEvents theAOI As McRegions Attribute theAOI.VB_VarHelpID = -1 '--- Utilities ---- Private Sub SetupActiveImage() If ActiveImage Is Nothing Then Output.Text = "No Active Image." Set theAOI = Nothing Exit Sub End If 'ELSE we have an ActiveImage Set theAOI = ActiveImage.Aoi Output.Text = "The Active Image is " & ActiveImage.DisplayName End Sub 'SetupActiveImage '--- UserForm Event Handlers ---- Private Sub UserForm_Initialize() Set theImages = Images SetupActiveImage End Sub 'UserForm_Initialize Private Sub UserForm_Terminate() Set theAOI = Nothing Set theImages = Nothing End Sub 'UserForm_Terminate '--- Images Event Handler ---- Private Sub theImages_Activate(ByVal Image As McImage) SetupActiveImage End Sub 'theImages_Activate '--- McFeatures Event Handlers ---- Private Sub theAOI_ChangeMade(ByVal FeaturesObject As IMcFeatures, _ ByVal PropertyChangedID As mcRegionLibPropertyIDs, ByVal ChangeFlags As mcFeaturesChangeMadeEnum, ByVal FeatureAffected As Long) 'We would usually only track this event or one of the others but not both, 'because this ChangeMade event is always sent before the others. However for 'this sample, we will track all of the McFeaturesEvents Dim strT As String Select Case PropertyChangedID Case ID_IMcFeatures_Selected strT = "McFeatures_Selected" Case ID_IMcFeatures_FeatureStatusFlags strT = "McFeatures_FeatureStatusFlags" Case ID_IMcFeatures_RemoveFeature strT = "McFeatures_RemoveFeature" Case ID_IMcFeatures_SetFeaturePoints strT = "McFeatures_SetFeaturePoints" Case ID_IMcFeatures_Reset strT = "McFeatures_Reset" Case ID_IMcFeatures_Move strT = "McFeatures_Move" Case ID_IMcFeatures_Clip strT = "McFeatures_Clip" Case ID_IMcFeatures_Merge strT = "McFeatures_Merge" Case ID_IMcFeatures_MaskOff strT = "McFeatures_MaskOff" Case ID_IMcFeatures_Intersect strT = "McFeatures_Intersect" Case ID_IMcFeatures_CleanUpBordersAndNoise strT = "McFeatures_CleanUpBordersAndNoise" Case ID_IMcFeatures_IMcSpatialCalib strT = "McFeatures_IMcSpatialCalib" Case ID_IMcFeatures_CopyFrom strT = "McFeatures_CopyFrom" Case ID_IMcFeatures_SourceFlags strT = "McFeatures_SourceFlags" Case ID_IMcFeatures_SourceData strT = "McFeatures_SourceData" Case ID_IMcFeatures_SetFromMask strT = "McFeatures_SetFromMask" Case ID_IMcFeatures_SetFromMaskMethod strT = "McFeatures_SetFromMaskMethod" Case ID_IMcRegions_SetBox strT = "McRegions_SetBox" Case ID_IMcRegions_SetEllipse strT = "McRegions_SetEllipse" Case ID_IMcRegions_FillHoles strT = "McRegions_FillHoles" Case ID_IMcRegions_FilterOutlines strT = "McRegions_FilterOutlines" Case ID_IMcRegions_Holes strT = "McRegions_Holes" Case ID_IDisplayedObjects_RemoveGraphObj strT = "DisplayedObjects_RemoveGraphObj" Case ID_IDisplayedObjects_SetPointShape strT = "DisplayedObjects_SetPointShape" Case ID_IDisplayedObjects_SetLabelText strT = "DisplayedObjects_SetLabelText" Case ID_IDisplayedObjects_SetLabelOffset strT = "DisplayedObjects_SetLabelOffset" Case ID_IDisplayedObjects_ImportProperties strT = "DisplayedObjects_ImportProperties" Case ID_IDisplayedObjects_SetColors strT = "DisplayedObjects_SetColors" Case ID_IDisplayedObjects_SetStyle strT = "DisplayedObjects_SetStyle" Case ID_IDisplayedObjects_SetBorderWidth strT = "DisplayedObjects_SetBorderWidth" Case ID_IDisplayedObjects_SetFillStyle strT = "DisplayedObjects_SetFillStyle" Case ID_IDisplayedObjects_SetBorderStyle strT = "DisplayedObjects_SetBorderStyle" Case ID_IDisplayedObjects_SetSelected strT = "DisplayedObjects_SetSelected" Case ID_IDisplayedObjects_SetLineEnding strT = "DisplayedObjects_SetLineEnding" Case ID_IMcThreshold_Execute strT = "McThreshold_Execute" Case Else End Select If (ChangeFlags And mcfcmUserEdit) <> 0 Then strT = strT + " from User Edit" End If 'event was caused by a user edit operation Output.Text = Output.Text + vbCrLf + strT End Sub 'theAOI_ChangeMade Private Sub theAOI_FeatureAdded(ByVal FeaturesObject As IMcFeatures, ByVal FirstIndex As Long, ByVal AddedCount As Long) Output.Text = Output.Text + vbCrLf + _ Str(AddedCount) + " features Added at index " + Str(FirstIndex) End Sub 'theAOI_FeatureAdded Private Sub theAOI_FeatureRemoved(ByVal FeaturesObject As IMcFeatures, ByVal Index As Long) Output.Text = Output.Text + vbCrLf + _ "Feature(s) Removed at index " & Str(Index) End Sub 'theAOI_FeatureRemoved Private Sub theAOI_Restructured(ByVal FeaturesObject As IMcFeatures, ByVal FeatureCount As Long) Output.Text = Output.Text + vbCrLf + _ "Feature(s) Restructured, leaving " & Str(FeatureCount) & " features." End Sub 'theAOI_Restructured Private Sub theAOI_CoordinatesChanged(ByVal FeaturesObject As IMcFeatures, ByVal Index As Long) Dim strT As String If Index >= 0 Then strT = "Feature " & Str(Index) & " coordinates changed. New bounds are:" + vbCrLf _ + McToText(FeaturesObject.BoundingRect(Index)) Else strT = "Multiple features moved." End If Output.Text = Output.Text + vbCrLf + strT End Sub 'theAOI_CoordinatesChanged Private Sub theAOI_PropertyChanged(ByVal FeaturesObject As IMcFeatures, ByVal PropertyChangedID As mcRegionLibPropertyIDs, ByVal AppearanceOnly As Boolean, ByVal FeatureAffected As Long) 'In this example, the PropertyChangedID is displayed by theAOI_ChangeMade event handler If AppearanceOnly Then Output.Text = Output.Text + " affects appearance only." End If End Sub 'theAOI_PropertyChanged