Click or drag to resize

IMcProfileEdgesAddEdges Method

Add one or more edges to selected profiles

Namespace:  MediaCy.IQL.Features
Assembly:  MediaCy.IQL.Features (in MediaCy.IQL.Features.dll) Version: 10.0.6912.0
Syntax
VB
Function AddEdges ( 
	Distances As Object,
	<OptionalAttribute> Selector As Object,
	<OptionalAttribute> Attributes As Object
) As Integer

Parameters

Distances
Type: SystemObject
A single scalar value, an array of values or an array of variant, each holding one or an array of values. If the Selector argument is anything other than a single index value, then the Distances must be organized as an array of Variants. For the same Selector argument, the EdgeDistances property is exposed in the proper format to be used as this argument. For each distance, an edge is added at that distance from the start of the profile. If the ProfilesAncestor McLineProfiles.CalibratedLength property is True, then distances must be given in calibrated units. If an existing edge exists at a given distance, it will NOT be replaced (and the returned count will reflect this). To ensure that an edge was replaced you would need to call RemoveEdges first.
Selector (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 Selector argument is a non-negative scalar index value, then edges are added for just the indicated profile. In this case, the Distances and Attributes arguments may be either scalar values or an array of values. The index value must fall between zero and ProfilesAncestor.CountOfProfiles-1. If the Selector argument is Empty, Error or Null, or any negative scalar value, then edges are added to all ProfilesAncestor.CountOfProfiles profiles. In this case, the Distances (and Attributes if given) arguments must be an array of Variant, where each Variant is a 1-D array that gives the Distance and Attributes for the edges to be added to the profile at the same index. If Selector is an array, then zero or positive values are treated as indices into the ProfilesAncestor profiles, negative values are legal but ignored. In this case, the Distances (and Attributes if given) arguments must be an array of Variant, where each Variant is a 1-D array that gives the Distance and Attributes for the edges to be added to the profile at the selected index. Index values greater or equal to the ProfilesAncestor.CountOfProfiles property are illegal.
Attributes (Optional)
Type: SystemObject
If given it must be either a single value (which is used for all added edges), or it must be shaped shaped to parallel the Distance argument. For the same Selector argument, the EdgeAttributes property is exposed in the proper format to be used as this argument. If not given, then mcpeeaAddedEdgeFlag is assumed for each added edge. The mcpeeaEdgeQualityMask bits are filled with a measure of edge quality.

Return Value

Type: Int32
The total number of edges added to all profiles.
Remarks
This method adds one or more edges to selected profiles. Normally, one edge will be added at a time to one profile, but occasionally you may want to add many edges to one profile or many edges to many profiles. A special case where edges are added to all profiles can be used to restore edges to some captured state (see Example). If any edges are added then an McObjMgr McObjStandardNotify.SpecialNotify is fired on the McObject backing this McProfileEdges. The notify code will be SNC_NOTIFY_HO_PROPERTYCHANGED and the notify data will be ID_IMcProfileEdges_EdgeCounts. You can use an instance of McNotifySink WithEvents in VBA to track these notifies.
Examples
VB
'Capture edges for restore after user edits edges
With ThisApplication.ActiveImage.LineFeatures.Profiles.ProfileEdges
'Capture current edges on
Dim varOldDistances As Variant
Dim varOldAttributes As Variant
varOldDistances = .EdgeDistances
varOldAttributes = .EdgeAttributes
'Allow the user to add or remove edges
Dim dDistance As Double, lWhichProfile As Long
Do
dDistance = GetEdgeDistanceFromUser
lWhichProfile = GetWhichProfileToEditFromUser
If lWhichProfile < 0 Then Exit Do
if dDistance > 0 Then
.AddEdges dDistance, lWhichProfile 'Add edge to the profile
ElseIf dDistance < 0 Then 'negative distance?
.RemoveEdges -dDistance, lWhichProfile 'Remove the edge
End If
Loop While True
If MsgBox("Keep the edge edits?",vbOKCancel) = vbCancel Then 'abandon edits?
.RemoveEdges 'remove all edges from all profiles
.AddEdges varOldDistances,,varOldAttributes 'restore original edges
End If 'we abort our changes
'else keep the changes
End With
See Also