Click or drag to resize

IMcRegionsDisplayedObjects Property

A DisplayedObjects collection of McGraphObj instances.

Namespace:  MediaCy.IQL.Features
Assembly:  MediaCy.IQL.Features (in MediaCy.IQL.Features.dll) Version: 10.0.6912.0
Syntax
VB
ReadOnly Property DisplayedObjects ( 
	<OptionalAttribute> varFeatureSelector As Object,
	<OptionalAttribute> varMcGraphOverlay As Object,
	<OptionalAttribute> varTemplateIDs As Object,
	Optional mcdoFlags As mcDisplayedObjectsFlags = mcDisplayedObjectsFlags.mcdoNoFlags
) As McDisplayedObjects
	Get

Parameters

varFeatureSelector (Optional)
Type: SystemObject
An empty variant, a single negative value, a single index value, or an array of zero or more index values (negative index values are legal but will be ignored). If the varFeatureSelector argument is a non-negative scalar value, then the only McGraphObj links to that indexed feature are included in the DisplayedObjects collection. If the varFeatureSelector argument is missing or any negative value, then McGraphObj links to all features are included in the DisplayedObjects collection. If varFeatureSelector is an array, then zero or positive values are treated as indices into the features collection, negative values are legal but ignored. In this case, McGraphObj links to any of the indexed features are included in the DisplayedObjects collection. If the argument is a McFeatures (i.e., McPoints, McLines or McRegions) or a McBitMask, then features that intersersect the selector's bit mask are selected as if an array of index values were supplied. If the OptionFlags mcofFullCoverageIntersectionTest bit is set, then the test is more stringent and a feature must be fully covered by the selector's bit mask in order to be included in the selection.
varMcGraphOverlay (Optional)
Type: SystemObject
An empty variant or an instance of a McGraphOverlay. If given, this is the McGraphOverlay that McGraphObj instances added to the collection are to have as their Overlay property. If empty or missing, then either the DisplayOverlays.MasterGraphOverlay is assumed, or if DisplayOverlays.MasterGraphOverlay is Nothing or the mcdoAllOverlays mcDisplayedObjectsFlags bit is set, then McGraphObj instances from all overlays in the DisplayOverlays collection are included.
varTemplateIDs (Optional)
Type: SystemObject
An empty variant, a single value of -1, some other single value, or an array of zero or more values. If varTemplateIDs is empty or missing or the scalar value of -1 (i.e., mcgtAnyTemplate), then McGraphObj instances created with any TemplateID value are included in the DisplayedObjects collection. If varTemplateIDs is some scalar value other than mcgtAnyTemplate (i.e., -1) or is an array of values, then McGraphObj instances created with any of the listed TemplateID value are included in the DisplayedObjects collection.
mcdoFlags (Optional)
Type: MediaCy.IQL.FeaturesmcDisplayedObjectsFlags
Flags that can be OR'ed together to control which linked McGraphObj instances are included in the collection. If the mcdoGetTemplates flag is set, then template McGraphObj instances rather tha McGraphObj instances linked to features are added to the collection; in this case, the varFeatureSelector argument is ignored, but any varMcGraphOverlay and/or varTemplateIDs arguments are honored.

Property Value

Type: McDisplayedObjects

Implements

IMcFeaturesDisplayedObjectsObject, Object, Object, mcDisplayedObjectsFlags
Remarks
The DisplayedObjects property exposes a "snapshot" collection of McGraphObj instances that are linked for display to selected features. It may also be used to get some or all of the templates that these McGraphObj instances my be based on. The IDisplayedObjects interface methods allow you to set McGraphObj properties (e.g., BorderColor) or label text for the whole collection with a single call. On access, a new instance of a McDisplayedObjects collection is created and then populated with the current set of McGraphObj instances linked to the features, as filtered by the arguments. Included graph objects must meet all of the filter requirements. Only "Master" McGraphObj instances are included in the collection, any associated "Label" McGraphObjText instances are not included. However, several methods will automatically set properties in these label graph objects, if they exist. Note that unless the mcDisplayedObjectsFlags.mcdoKeepReferences bit is set in the mcdoFlags argument, then no references are held by the created IDisplayedObjects instance on the creator McFeatures, the McGraphObj instances it holds or on their McGraphObj.Overlay(s). In only extremely rare instances would you need to have a McFeatures.DisplayedObjects hold references on these items in order to keep them from being fully Released until the IDisplayedObjects instance is fully released.
Examples
VB
Imports mediacy.IQL.Engine
Imports mediacy.IQL.Features
Imports mediacy.IQL.ObjectManager
Imports mediacy.IQL.Display.Overlays

Public Module OverlayLinkSamples
'This is OverlayLinkSamples.bas
'
'These samples illustrate some aspects of the links between McFeatures features
'and McGraphObj instances linked to them when McFeatures.AutoDisplay is True.


Private Sub luCreateBlankImage()
    ThisApplication.Images.Add( "Test Image", 320, 200, 1, mcImageQuickTypes.mciqtGray)
End Sub 'luCreateBlankImage

Private Function fuTypeAsString(mcftT As mcFeaturesType) As String
    Dim strT As String
    Select Case mcftT

        Case mcFeaturesType.mcftOutline
           strT = "mcftOutline"
        Case mcFeaturesType.mcftBox
           strT = "mcftBox"
        Case mcFeaturesType.mcftSquare
           strT = "mcftSquare"
        Case mcFeaturesType.mcftEllipse
           strT = "mcftEllipse"
        Case mcFeaturesType.mcftCircle
           strT = "mcftCircle"
        Case mcFeaturesType.mcftFreeEllipse
           strT = "mcftFreeEllipse"
        Case mcFeaturesType.mcftScanList
           strT = "mcftScanList"
        Case mcFeaturesType.mcftPolyline
           strT = "mcftPolyline"
        Case mcFeaturesType.mcftLine
           strT = "mcftLine"
        Case mcFeaturesType.mcftPoint
            strT = "mcftPoint"
        Case Else
            strT = String.Format("Mixed Type ({0})", mcftT)
    End Select
    fuTypeAsString = strT
End Function 'fuTypeAsString

'ShowGraphObjClassForAllTypes is a rather tedious example that illustrates how
'each Type of McFeatures feature is displayed by a linked McGraphObj-derived
'object of an appropriate class. The CreateFeaturesFromAllGraphObjClasses Sub, below
'illustrates the back-link from McGraphObj to feature.
'
Public Sub ShowGraphObjClassForAllTypes()
    luCreateBlankImage
    ThisApplication.Output.Show
    ThisApplication.Output.Clear

    Dim mcgoLinked As McGraphObj, mcdisplayedobjs As McDisplayedObjects
    Dim strClassName As String, nF As Long

    With ThisApplication.ActiveImage.PointFeatures
        .AutoDisplay = True 'True by default for McImage.PointFeatures
        .SetFeaturePoints( -1, New Integer() {10, 10, 20, 10, 30, 10})
        mcdisplayedobjs = .DisplayedObjects
        strClassName = mcdisplayedobjs(0).ClassName
        ThisApplication.Output.PrintMessage ("The" + Str(.Count) + " McPoints features of Type " + fuTypeAsString(.Type(0)) + _
            " are backed by" + Str(mcdisplayedobjs.Count) + " " + strClassName)
    End With 'ActiveImage.PointFeatures

    With ThisApplication.ActiveImage.LineFeatures
        .AutoDisplay = True 'True by default for McImage.LineFeatures
            'Feature 0 is a single segment horizontal line
        .SetFeaturePoints 0, New Integer() {10, 20, 30, 20}
            'Feature 1 is a two segment polyline
        .SetFeaturePoints 1, New Integer() {40, 20, 60, 10, 80, 20}
            'Feature 2 is a single segment polyline
        .SetFeaturePoints 2, New Integer() {90, 20, 110, 20}
        'Debug.Assert (.Type(2) = mcftLine) 'it is not a polyline yet
        .FeatureStatusFlags(2, mcFeatureStatusFlags.mcfsfPolyline) = mcFeatureStatusFlags.mcfsfPolyline 'make it a polyline
        'Debug.Assert (.Type(2) = mcftPolyline) 'it is now a polyline
            'Feature 3 is a single segment polyline, set by the mcofDefaultPolyline OptionFlag
        .OptionFlags(mcOptionFlags.mcofDefaultPolyline) = mcOptionFlags.mcofDefaultPolyline
        .SetFeaturePoints 3, New Integer() {120, 20, 140, 20}
        'Debug.Assert (.Type(3) = mcftPolyline)
            'Feature 4 is a single segment line, overriding the mcofDefaultPolyline OptionFlag
        .OptionFlags(mcOptionFlags.mcofDefaultPolyline) = mcOptionFlags.mcofDefaultPolyline
        .SetFeaturePoints 4, New Integer() {150, 20, 170, 20}
        'Debug.Assert (.Type(4) = mcftPolyline)
        .FeatureStatusFlags(4, mcFeatureStatusFlags.mcfsfPolyline) = mcFeatureStatusFlags.mcfsfNoFlags 'make it a line
        'Debug.Assert (.Type(4) = mcftLine) 'it is now a line

        mcdisplayedobjs = .DisplayedObjects
        'Debug.Assert (mcdisplayedobjs.Count = .Count)
        For nF = 0 To .Count - 1
            strClassName = mcdisplayedobjs(nF).ClassName
            ThisApplication.Output.PrintMessage ("The McLines feature at index" + Str(nF) + _
                " of Type " + fuTypeAsString(.Type(nF)) + _
                " is displayed as a " + strClassName)
        Next nF
    End With 'ActiveImage.LineFeatures

    With ThisApplication.ActiveImage.RegionFeatures
        .AutoDisplay = True 'True by default for McImage.RegionFeatures

            'Feature 0 is a polygon
        .SetFeaturePoints 0, New Integer() {10, 30, 30, 30, 20, 50}
        'Debug.Assert (.Type(0) = mcftOutline) 'polygon

            'Feature 1 is a rectangular box
        .SetBox( 1, 40, 30, 70, 50)
        'Debug.Assert (.Type(1) = mcftBox)
            'Feature 2 is a square rectangle
        .SetBox( 2, 80, 30, 100, 50)
        'Debug.Assert (.Type(2) = mcftBox)
            'Feature 3 is a square
        .SetBox( 3, 80, 30, 100, 50)
       'Debug.Assert (.Type(3) = mcftBox) 'it is not a square yet
        .FeatureStatusFlags(3, mcFeatureStatusFlags.mcfsfSquare) = mcFeatureStatusFlags.mcfsfSquare 'make it a square
        'Debug.Assert (.Type(3) = mcftSquare) 'it is now a square
            'Feature 4 is a square, set by the mcofDefaultSquare OptionFlag
        .OptionFlags(mcOptionFlags.mcofDefaultSquare) = mcOptionFlags.mcofDefaultSquare
        .SetBox( 4, 110, 30, 130, 50)
        'Debug.Assert (.Type(4) = mcftSquare) 'it is a square when created
            'Feature 5 is a rectangle, in spite of the mcofDefaultSquare OptionFlag
        .OptionFlags(mcOptionFlags.mcofDefaultSquare) = mcOptionFlags.mcofDefaultSquare
        .SetBox( 5, 140, 30, 170, 50)
        'Debug.Assert (.Type(5) = mcftBox) 'it is a rectangle when created

            'Feature 6 is a flat ellipse (not rotatable)
        .SetEllipse( 6, 20, 80, 20, 10)
        'Debug.Assert (.Type(6) = mcftEllipse)
            'Feature 7 is an ellipse at a 45 degree angle
        .SetEllipse( 7, 50, 80, 20, 10, 45)
        'Debug.Assert (.Type(7) = mcftFreeEllipse)
            'Feature 8 is a rotatable ellipse created at a 0 degree angle
        .SetEllipse( 8, 80, 80, 20, 10, 0)
        'Debug.Assert (.Type(8) = mcftEllipse)
        .FeatureStatusFlags(8, mcFeatureStatusFlags.mcfsfFreeEllipse) = mcFeatureStatusFlags.mcfsfFreeEllipse 'make it rotatable
        'Debug.Assert (.Type(8) = mcftFreeEllipse)
            'Feature 9 is a rotatable flat ellipse, set by the mcofDefaultFreeEllipse OptionFlag
        .OptionFlags(mcOptionFlags.mcofDefaultFreeEllipse) = mcOptionFlags.mcofDefaultFreeEllipse
        .SetEllipse( 9, 110, 80, 20, 10, 0)
        'Debug.Assert (.Type(9) = mcftFreeEllipse)

            'Feature 10 is a circular ellipse
        .OptionFlags(mcOptionFlags.mcofDefaultFreeEllipse) = mcOptionFlags.mcofNoFlags
        .SetEllipse( 10, 30, 140, 40, 40)
        'Debug.Assert (.Type(10) = mcftEllipse)
            'Feature 11 is a circle (with radial line at an angle)
        Dim mcgocT As McGraphObjCircle
        mcgocT = .AutoDisplayOverlay.Template("McGraphObjCircle", mcGraphOverlayTemplates.mcgtStandardAutoDisplay)
        mcgocT.ShowLine = True
        mcgocT.CircleType =mcGraphObjCircleType.mcgctRadius
        .SetEllipse( 11, 80, 140, 40, 40, 45)
        'Debug.Assert (.Type(11) = mcftFreeEllipse)
        .FeatureStatusFlags(11, mcFeatureStatusFlags.mcfsfCircle) = mcFeatureStatusFlags.mcfsfCircle 'make it a circle
        'Debug.Assert (.Type(11) = mcftCircle)
            'Feature 12 is a circle, set by the mcofDefaultCircle OptionFlag
        .OptionFlags(mcOptionFlags.mcofDefaultCircle) = mcOptionFlags.mcofDefaultCircle
        mcgocT.CircleType=mcGraphObjCircleType.mcgctDiameter 'show line as diameter
        .SetEllipse( 12, 130, 140, 40, 40, 90) 'virtical line
        'Debug.Assert (.Type(12) = mcftCircle)

        mcdisplayedobjs = .DisplayedObjects
        'Debug.Assert (mcdisplayedobjs.Count = .Count)
        For nF = 0 To .Count - 1
            strClassName = mcdisplayedobjs(nF).ClassName
            Dim strExtra As String
            If strClassName = "McGraphObjRect" Then
                Dim mcgoRect As McGraphObjRect
                mcgoRect = mcdisplayedobjs(nF)
                Dim bSquare As Boolean
                bSquare = mcgoRect.Square
                If bSquare Then
                    strExtra = " square."
                Else
                    strExtra = " not square."
                End If
            ElseIf strClassName = "McGraphObjEllipse" Then
                Dim mcgoEllipse As McGraphObjEllipse
                mcgoEllipse = mcdisplayedobjs(nF)
                Dim bRotatable As Boolean
                bRotatable = mcgoEllipse.Style(mcGraphObjStyle.mcgsAllowRotate)=mcGraphObjStyle.mcgsAllowRotate
                If bRotatable Then
                    strExtra = " rotatable."
                Else
                    strExtra = " not rotatable."
                End If
            Else
                strExtra = ""
            End If
            ThisApplication.Output.PrintMessage( "The McRegions feature at index" + Str(nF) + _
                " of Type " + fuTypeAsString(.Type(nF)) + _
                " is displayed as a " + strClassName + strExtra)
        Next nF
    End With 'ActiveImage.RegionFeatures

    MsgBox "When you press OK, the Test Image will close."
    ThisApplication.ActiveImage.Close
End Sub 'ShowGraphObjClassForAllTypes

'CreateFeaturesFromAllGraphObjClasses illustrates how each class
'of McGraphObj-derived object can create a back-linked McFeatures feature
'of an appropriate Type.  The ShowGraphObjClassForAllTypes sub, above
'illustrates the forward link from feature to McGraphObj.
'
Public Sub CreateFeaturesFromAllGraphObjClasses()
    luCreateBlankImage
    ThisApplication.Output.Show
    ThisApplication.Output.Clear

    Dim mcgoCreated As McGraphObj, mcdisplayedobjs As McDisplayedObjects
    Dim strClassName As String, nF As Long

    With ThisApplication.ActiveImage.PointFeatures
        .AutoDisplay = True 'True by default for McImage.PointFeatures
        .Reset 'empty it, to be sure

        '*** create a McGraphObjPoint
        mcgoCreated = .AutoDisplayOverlay.Add("McGraphObjPoint", mcGraphOverlayTemplates.mcgtStandardAutoDisplay)
        mcgoCreated.SetHandle( 1, 10, 10)
            'The McGraphObj Templates for AutoDisplayOverlay are all non-visible by default
        mcgoCreated.Style(mcGraphObjStyle.mcgsVisible) = mcGraphObjStyle.mcgsVisible 'make it visible
        mcgoCreated.NotifyCreationComplete

        strClassName = mcgoCreated.ClassName
        ThisApplication.Output.PrintMessage("A McPoints feature of Type " + fuTypeAsString(.Type(0)) + _
            " was created by a " + strClassName)
    End With 'ThisApplication.ActiveImage.PointFeatures

    With ThisApplication.ActiveImage.LineFeatures
        .AutoDisplay = True 'True by default for McImage.LineFeatures
        .Reset 'empty it, to be sure

        '*** for feature 0 create a McGraphObjLine
        mcgoCreated = .AutoDisplayOverlay.Add("McGraphObjLine", mcGraphOverlayTemplates.mcgtStandardAutoDisplay)
        mcgoCreated.SetHandle( 1, 10, 20)
        mcgoCreated.SetHandle( 2, 30, 20)
            'The McGraphObj Templates for AutoDisplayOverlay are all non-visible by default
        mcgoCreated.Style(mcGraphObjStyle.mcgsVisible) = mcGraphObjStyle.mcgsVisible 'make it visible
        mcgoCreated.NotifyCreationComplete

        '*** for feature 1 create a two segment McGraphObjPoly
        Dim mcgopolyCreated As McGraphObjPoly
        mcgopolyCreated = .AutoDisplayOverlay.Add("McGraphObjPoly", mcGraphOverlayTemplates.mcgtStandardAutoDisplay)
        mcgopolyCreated.AddPoints New Integer() {40, 20, 60, 10, 80, 20}
            'The McGraphObj Templates for AutoDisplayOverlay are all non-visible by default
        mcgopolyCreated.Style(mcGraphObjStyle.mcgsVisible) = mcGraphObjStyle.mcgsVisible 'make it visible
        mcgopolyCreated.NotifyCreationComplete

        '*** and for feature 2 a single segment McGraphObjPoly
        mcgopolyCreated = .AutoDisplayOverlay.Add("McGraphObjPoly", mcGraphOverlayTemplates.mcgtStandardAutoDisplay)
        mcgopolyCreated.AddPoints New Integer() {90, 20, 110, 20}
            'The McGraphObj Templates for AutoDisplayOverlay are all non-visible by default
        mcgopolyCreated.Style(mcGraphObjStyle.mcgsVisible) = mcGraphObjStyle.mcgsVisible 'make it visible
        mcgopolyCreated.NotifyCreationComplete

        mcdisplayedobjs = .DisplayedObjects
        'Debug.Assert (mcdisplayedobjs.Count = .Count)
        For nF = 0 To .Count - 1
            strClassName = mcdisplayedobjs(nF).ClassName
            ThisApplication.Output.PrintMessage ("The McLines feature at index" + Str(nF) + _
                " of Type " + fuTypeAsString(.Type(nF)) + _
                " is was created to back a " + strClassName)
        Next nF
    End With 'ThisApplication.ActiveImage.LineFeatures

    With ThisApplication.ActiveImage.RegionFeatures
        .AutoDisplay = True 'True by default for McImage.RegionFeatures

        '*** for feature 0 create a McGraphObjPoly
        mcgopolyCreated = .AutoDisplayOverlay.Add("McGraphObjPoly", mcGraphOverlayTemplates.mcgtStandardAutoDisplay)
        mcgopolyCreated.AddPoints New Integer() {10, 30, 30, 30, 20, 50}
            'The McGraphObj Templates for AutoDisplayOverlay are all non-visible by default
        mcgopolyCreated.Style(mcGraphObjStyle.mcgsVisible) = mcGraphObjStyle.mcgsVisible 'make it visible
        mcgopolyCreated.NotifyCreationComplete

        '*** for feature 1 create a square shaped rectangle McGraphObjRect
        Dim mcgorectCreated As McGraphObjRect
        mcgorectCreated = .AutoDisplayOverlay.Add("McGraphObjRect", mcGraphOverlayTemplates.mcgtStandardAutoDisplay)
        mcgorectCreated.SetHandle( 1, 40, 30)
        mcgorectCreated.SetHandle( 5, 60, 50) 'make it a square rectangle
            'The McGraphObj Templates for AutoDisplayOverlay are all non-visible by default
        mcgorectCreated.Style(mcGraphObjStyle.mcgsVisible) = mcGraphObjStyle.mcgsVisible 'make it visible
        mcgorectCreated.NotifyCreationComplete
        'Debug.Assert (.Type(1) = mcftBox) 'it's square, but still a rectangle

        '*** for feature 2 create a square McGraphObjRect
        mcgorectCreated = .AutoDisplayOverlay.Add("McGraphObjRect", mcGraphOverlayTemplates.mcgtStandardAutoDisplay)
        mcgorectCreated.SetHandle( 1, 80, 30)
        mcgorectCreated.SetHandle( 5, 100, 50) 'make it square
        mcgorectCreated.Square = True 'tell's McRegions to create a mcftSquare
            'The McGraphObj Templates for AutoDisplayOverlay are all non-visible by default
        mcgorectCreated.Style(mcGraphObjStyle.mcgsVisible) = mcGraphObjStyle.mcgsVisible 'make it visible
        mcgorectCreated.NotifyCreationComplete
        'Debug.Assert (.Type(2) = mcftSquare) 'it's a square

        '*** for feature 3 create a flat McGraphObjEllipse
        Dim mcgoellipseCreated As McGraphObjEllipse
        mcgoellipseCreated = .AutoDisplayOverlay.Add("McGraphObjEllipse", mcGraphOverlayTemplates.mcgtStandardAutoDisplay)
        mcgoellipseCreated.SetHandle( 1, 20, 80)
        mcgoellipseCreated.SetHandle( 5, 40, 90) 'make it a flat ellipse
            'The McGraphObj Templates for AutoDisplayOverlay are all non-visible by default
        mcgoellipseCreated.Style(mcGraphObjStyle.mcgsVisible) = mcGraphObjStyle.mcgsVisible 'make it visible
        mcgoellipseCreated.NotifyCreationComplete
        'Debug.Assert (.Type(3) = mcftEllipse) 'it's flat, and cannot rotate

        '*** for feature 4 create a McGraphObjEllipse at an angle
        mcgoellipseCreated = .AutoDisplayOverlay.Add("McGraphObjEllipse", mcGraphOverlayTemplates.mcgtStandardAutoDisplay)
        mcgoellipseCreated.SetHandle( 1, 50, 80)
        mcgoellipseCreated.SetHandle( 5, 70, 90) 'make an ellipse
        mcgoellipseCreated.AngleOfRotation = 45 'rotated 45 degrees counterclockwise
            'The McGraphObj Templates for AutoDisplayOverlay are all non-visible by default
        mcgoellipseCreated.Style(mcGraphObjStyle.mcgsVisible) = mcGraphObjStyle.mcgsVisible 'make it visible
        mcgoellipseCreated.NotifyCreationComplete
        'Debug.Assert (.Type(4) = mcftFreeEllipse) 'it's not flat, so it's a free ellipse

        '*** for feature 5 create a flat, but rotatable McGraphObjEllipse
        mcgoellipseCreated = .AutoDisplayOverlay.Add("McGraphObjEllipse", mcGraphOverlayTemplates.mcgtStandardAutoDisplay)
        mcgoellipseCreated.SetHandle( 1, 80, 80)
        mcgoellipseCreated.SetHandle( 5, 100, 90) 'make it a flat ellipse
        mcgoellipseCreated.Style(mcGraphObjStyle.mcgsAllowRotate) =mcGraphObjStyle.mcgsAllowRotate 'but allow it to be rotated
            'The McGraphObj Templates for AutoDisplayOverlay are all non-visible by default
        mcgoellipseCreated.Style(mcGraphObjStyle.mcgsVisible) = mcGraphObjStyle.mcgsVisible 'make it visible
        mcgoellipseCreated.NotifyCreationComplete
        'Debug.Assert (.Type(5) = mcftFreeEllipse) 'it's flat, but rotatable

        '*** for feature 6 create a circular McGraphObjEllipse
        mcgoellipseCreated = .AutoDisplayOverlay.Add("McGraphObjEllipse", mcGraphOverlayTemplates.mcgtStandardAutoDisplay)
        mcgoellipseCreated.SetHandle( 1, 10, 120)
        mcgoellipseCreated.SetHandle( 5, 50, 160) 'make it a flat ellipse
            'The McGraphObj Templates for AutoDisplayOverlay are all non-visible by default
        mcgoellipseCreated.Style(mcGraphObjStyle.mcgsVisible) = mcGraphObjStyle.mcgsVisible 'make it visible
        mcgoellipseCreated.NotifyCreationComplete
        'Debug.Assert (.Type(6) = mcftEllipse) 'it's circular, but still an ellipse

        '*** for feature 7 create a McGraphObjCircle based on center-radius
        Dim mcgocircleCreated As McGraphObjCircle
        mcgocircleCreated = .AutoDisplayOverlay.Add("McGraphObjCircle", mcGraphOverlayTemplates.mcgtStandardAutoDisplay)
        mcgocircleCreated.CircleType = mcGraphObjCircleType.mcgctRadius 'this is actually the default
        mcgocircleCreated.ShowLine = True
        mcgocircleCreated.SetHandle( 1, 80, 140) 'center point
        mcgocircleCreated.SetHandle( 2, 100, 140) 'point on the circumference
            'The McGraphObj Templates for AutoDisplayOverlay are all non-visible by default
        mcgocircleCreated.Style(mcGraphObjStyle.mcgsVisible) = mcGraphObjStyle.mcgsVisible 'make it visible
        mcgocircleCreated.NotifyCreationComplete
        'Debug.Assert (.Type(7) = mcftCircle) 'it's a circle

        Dim dCx As Double, dCy As Double, dMajAx As Double, dMinAx As Double, dAngle As Double
        .GetEllipse 7, dCx, dCy, dMajAx, dMinAx, dAngle
        'Debug.Assert (dMajAx = dMinAx And dMajAx = 40)
        'Debug.Assert (dAngle = 0)

        '*** for feature 8 create a McGraphObjCircle based on two circumferencial points
        mcgocircleCreated = .AutoDisplayOverlay.Add("McGraphObjCircle", mcGraphOverlayTemplates.mcgtStandardAutoDisplay)
        mcgocircleCreated.CircleType =mcGraphObjCircleType.mcgctDiameter
        mcgocircleCreated.ShowLine = True
        mcgocircleCreated.SetHandle( 1, 130, 160) 'bottom point
        mcgocircleCreated.SetHandle( 2, 130, 120) 'top point
            'The McGraphObj Templates for AutoDisplayOverlay are all non-visible by default
        mcgocircleCreated.Style(mcGraphObjStyle.mcgsVisible) = mcGraphObjStyle.mcgsVisible 'make it visible
        mcgocircleCreated.NotifyCreationComplete
        'Debug.Assert (.Type(8) = mcftCircle) 'it's a circle

        .GetEllipse 8, dCx, dCy, dMajAx, dMinAx, dAngle
        'Debug.Assert (dMajAx = dMinAx And dMajAx = 40)
        'Debug.Assert (dAngle = 90)

        'Now show some link results

        mcdisplayedobjs = .DisplayedObjects
        'Debug.Assert (mcdisplayedobjs.Count = .Count)
        For nF = 0 To .Count - 1
            strClassName = mcdisplayedobjs(nF).ClassName
            Dim strExtra As String
            If strClassName = "McGraphObjRect" Then
                Dim mcgoRect As McGraphObjRect
                mcgoRect = mcdisplayedobjs(nF)
                Dim bSquare As Boolean
                bSquare = mcgoRect.Square
                If bSquare Then
                    strExtra = " square."
                Else
                    strExtra = " not square."
                End If
            ElseIf strClassName = "McGraphObjEllipse" Then
                Dim mcgoEllipse As McGraphObjEllipse
                mcgoEllipse = mcdisplayedobjs(nF)
                Dim bRotatable As Boolean
                bRotatable = mcgoEllipse.Style(mcGraphObjStyle.mcgsAllowRotate) =mcGraphObjStyle.mcgsAllowRotate
                If bRotatable Then
                    strExtra = " rotatable."
                Else
                    strExtra = " not rotatable."
                End If
            Else
                strExtra = ""
            End If
            ThisApplication.Output.PrintMessage( "The McRegions feature at index" + Str(nF) + _
                " of Type " + fuTypeAsString(.Type(nF)) + _
                " is displayed as a " + strClassName + strExtra)
        Next nF
    End With 'ThisApplication.ActiveImage.RegionFeatures

    MsgBox "When you press OK, the Test Image will close."
    ThisApplication.ActiveImage.Close
End Sub 'CreateFeaturesFromAllGraphObjClasses

'StartToolToLetUserDrawCircles starts a tool to allow the user
'to create McGraphObjCircle's on the AutoDisplayOverlay of
'the ThisApplication.ActiveImage.RegionFeatures.
'
'Run the ReportOnCircles sub, below, to see what the user has done.
'
Public Sub StartToolToLetUserDrawCircles()
    If ThisApplication.ActiveImage Is Nothing Then
        MsgBox "This example needs to have an ActiveImage"
        Exit Sub
    End If

    ThisApplication.Output.Show
    ThisApplication.Output.Clear
    ThisApplication.Output.PrintMessage( "*** Draw circles on the active image ****")

    ThisApplication.ActiveImage.RegionFeatures.Reset 'start with no features

    With ThisApplication.ActiveImage.RegionFeatures.AutoDisplayOverlay
            'First set up the McGraphObjCircle template so that it shows a line
        Dim mcgocircleTemplate As McGraphObjCircle
        mcgocircleTemplate = .Template("McGraphObjCircle", mcGraphOverlayTemplates.mcgtStandardAutoDisplay)
        mcgocircleTemplate.CircleType =mcGraphObjCircleType.mcgctRadius 'mcgctDiameter is the other choice
        mcgocircleTemplate.ShowLine = True 'let the user see the radial line

            'Now start the tool to create circles linked to McRegions features
        .SelectTool , "McGraphObjCircle", mcGraphOverlayTemplates.mcgtStandardAutoDisplay
    End With 'ThisApplication.ActiveImage.RegionFeatures.AutoDisplayOverlay

    '--- Run the ReportOnCircles sub, below, to see what circles the user has placed.  ----

End Sub 'StartToolToLetUserDrawCircles

'ReportOnCircles reports on the circles that the user placed after running
'the StartToolToLetUserDrawCircles sub, above.  ReportOnCircles stops the tool
'and then reports on the number, size and position of

Public Sub ReportOnCircles()
    If ThisApplication.ActiveImage Is Nothing Then
        MsgBox "This example needs to have an ActiveImage"
        Exit Sub
    End If
    Dim nFeatures As Long, nF As Long
    With ThisApplication.ActiveImage.RegionFeatures
        nFeatures = .Count
        If nFeatures = 0 Then
            MsgBox "You must run StartToolToLetUserDrawCircles first and place some circles on the ActiveImage."
            Exit Sub
        End If
        If ThisApplication.ActiveImage.RegionFeatures.Type(0) <> mcFeaturesType.mcftCircle Then
            MsgBox "You must run StartToolToLetUserDrawCircles first and place some circles on the ActiveImage."
            Exit Sub
        End If

        .AutoDisplayOverlay.SelectTool 'stop any tool

        ThisApplication.Output.Show
        ThisApplication.Output.Clear

        For nF = 0 To nFeatures - 1
            If .Type(nF) <> mcFeaturesType.mcftCircle Then
                ThisApplication.Output.PrintMessage( "Feature" + Str(nF) + " is not a circle.")
            Else
                Dim dCx As Double, dCy As Double, dMajAx As Double, dMinAx As Double, dAngle As Double
                .GetEllipse nF, dCx, dCy, dMajAx, dMinAx, dAngle
                ThisApplication.Output.PrintMessage String.Format("Circular feature {0} is centered at {1:1f}, {2:1f} with radius {3:1f}.", nF, dCx, dCy, dMajAx)
               ThisApplication.Output.PrintMessage String.Format("   The radius was drawn at {0:1f} degrees counterclockwise.", dAngle)
            End If 'have circle
        Next nF

        MsgBox "When you press OK, all circles will be cleared." + vbCrLf + _
            "Run StartToolToLetUserDrawCircles again to place more."
        .Reset
    End With 'ThisApplication.ActiveImage.RegionFeatures
End Sub 'ReportOnCircles

End Module
See Also