Description

Registers or unregisters an instance of McUserMeasure as a named measurement

Return Type

None  

Syntax

object.RegisterUserMeasurement Name, McUserMeasureObject, [AllowedParent]

The RegisterUserMeasurement Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McEngine.
NameRequired. A String value.
McUserMeasureObjectRequired. An Unknown object.
AllowedParentOptional. A mcMeasurementParentAllowed enumeration, as described in settings.

Settings

The settings for AllowedParent are:

ConstantValueDescription
 mcmpaAnyParent0

mcmpAnyParent or mcmpaAnyParent. any parent is allowed

 mcmpaChildOfEngine1

an immediate child of McEngine

 mcmpaChildOfImages2

an immediate child of McEngine.Images (note the plural)

 mcmpaChildOfImage3

an immediate child of an McImage (note the singular)

 mcmpaChildOfLines4

an immediate child of an McLines

 mcmpaChildOfPoints5

an immediate child of an McPoints

 mcmpaChildOfRegions6

an immediate child of an McRegions

 mcmpaChildOfFeatures10

an immediate child of any McFeatures (an McPoints, McLines or McRegions)

 mcmpaChildOfRefFeatures11

an immediate child of McRefFeatures

 mcmpaDescendentOfFeatures12

an McFeatures descendent (descendended from an McPoints, McLines or McRegions)

 mcmpaDescendentOfImages13

any McEngine.Images descendent

 mcmpaDescendentOfImage14

any McImage descendent

 mcmpaNoParent20

no parent (i.e., global)

 mcmpaOtherParent21

some other parent type than ones listed

Remarks

The two examples illustrate two ways to supply the McUserMeasureObject argument, an instance of the McUserMeasure dual interface. The approach shown in Example 1 requires that you implement all five methods of the McUserMeasure interface in a separate class module. Example 1 is slightly more complex than Example 2, and this approach means that you have to add a Tools->References to the "Media Cybernetics Regions Operators Library" named McRegionLib. On the other hand, execution of these methods is faster, since several layers of overhead are eliminated. And as shown, only the ComputeValue method must be supplied; the others can be left empty.

The WithEvents method illustrated in Example 2 is simpler, since no extra type library reference is required, and you only have to supply the event methods that you want to implement (and of those only the ComputeValue method is required). However, this method is substantially slower than supplying a full implementation of McUserMeasure.

When a measurement is unregistered, all existing instances of the measurement are released.

When a measurement is registered or unregistered, a SNC_NOTIFY_HO_PROPERTYCHANGED SpecialNotify is fired with data ID_IMcEngine_RegisterUserMeasurement. This notify can be tracked to populate or depopulate lists of available measurements.

Exceptions

It is illegal to attempt to register a measurement name that is already registered. Call GetRegisteredUserMeasurement to see if a measurement name is already registered.