Click or drag to resize

IDisplayOverlaysAdd Method

Add an McGraphOverlay instance to the collection.

Namespace:  MediaCy.IQL.Features
Assembly:  MediaCy.IQL.Features (in MediaCy.IQL.Features.dll) Version: 10.0.6912.0
Syntax
VB
Function Add ( 
	varIMcGraphOverlayToAdd As Object
) As McGraphOverlay

Parameters

varIMcGraphOverlayToAdd
Type: SystemObject

Return Value

Type: McGraphOverlay
The McGraphOverlay added (or existing) collection instance.
Remarks
An existing McGraphOverlay instance can be added to the collection, or a new one with a given name may be created and then added. The newly added McGraphOverlay instance will have an index value in the collection equal to the Count property at the time of the call. This index value will remain valid so long as no call is made to the Remove method, but it is best keep a reference to the McGraphOverlay instance itself and to not rely on the index. The McGraphOverlay.Name property is a more reliable way to look up instances, where you don't have the actual instance. Overlays Add'ed to the DisplayOverlays collection by name and the default overlay named "DefaultOverlay" have a Template with TemplateID mcgtStandardAutoDisplay automatically created. This template is given a standard color (Red) with no fill. The mcgsVisible bit of the McGraphObj.Style property in this template is cleared, so if you create a McGraphObj-derived object directly, you will need to set this bit (see Samples). However, you will normally not add McGraphObj instances except by calling McGraphOverlay.SelectTool to allow the user to place features, and this makes the created graph object visible automatically. These overlays have the McGraphOverlay.Views.ViewerGroupsToTrack property set to vgMDIImageWindow and vgImageMcDisplay, so by default, they will display on MDI child Image windows and on McImage.Display displays when made visible (see below). Note that this automatic display will only occur if the Parent McFeatures is itself a child of some McImage and if the AutoDisplayTemplateID has been assigned (normally the value of mcgtStandardAutoDisplay). The "DefaultOverlay" is the initial MasterGraphOverlay and it is initially Visible. However other overlays created by name (e.g., DisplayOverlays.Add "MyOverlayName") will be initially not visible. Normally, overlays are made visible by making them the MasterGraphOverlay (which makes all other overlays in the collection non-Visible). But you can assign TRUE directly to the McGraphOverlay.Visible property if you are prepared to deal with the possiblility the multple overlays might be showing the same features.
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
Examples
VB
'Add a new overlay to show the Aoi in some non-default way
Dim mdisplayoverlaysAoi As McDisplayOverlays
mdisplayoverlaysAoi = ThisApplication.ActiveImage.Aoi.DisplayOverlays
' Add a new overlay named "SpecialAoi"
Dim mgovlSpecialAoi As McGraphOverlay
Set mgovlSpecialAoi = mdisplayoverlaysAoi.Add "SpecialAoi"
'Set up an AutoDisplayTemplateID
mdisplayoverlaysAoi.AutoDisplayTemplateID = mcgtStandardAutoDisplay
' Set properties of the mcgtStandardAutoDisplay Template
Dim goTemplate As McGraphObj
Set goTemplate = mgovlSpecialAoi.Template "McGraphObj", mcgtStandardAutoDisplay
' Set display properties
goTemplate.BorderColor = &H00FF00    ' Green
goTemplate.FillStyle = mcgfsBorderNoFill    ' No fill
Set goTemplate = Nothing
' Now make our new overlay the master (and thus Visible)
mdisplayoverlaysAoi.MasterGraphOverlay = mgovlSpecialAoi
'Show the Aoi in the SpecialAoi overlay
Dim mrAoi As McRegions
Set mrAoi = ThisApplication.ActiveImage.Aoi
mrAoi.SetBox 0, 10, 10, 100, 100    ' make a mcftBox region
MsgBox "Look where the Aoi is now."
mrAoi.Move 20, 20    'move the Aoi region, see the display move too
Set mrAoi = Nothing ' clean up
' Put things back
mdisplayoverlaysAoi.MasterGraphOverlay =
mdisplayoverlaysAoi.Item "DefaultOverlay"
' Remove the "SpecialAoi" McGraphOverlay the we created
Set mgovlSpecialAoi = Nothing
mdisplayoverlaysAoi.Remove  "SpecialAoi"
Set mdisplayoverlaysAoi = Nothing
See Also