| MIL 10 Reference
| Customize Help
| Save Settings

MgraInteractive



See also
Availability
Available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
Synopsis
Change the state of interactivity of graphics in a graphics list.
Syntax
void MgraInteractive(
MIL_ID ContextGraId, //in
MIL_ID ListGraId, //in
MIL_INT64 GraphicType, //in
MIL_INT64 InitFlag, //in
MIL_INT64 ControlFlag //in
)
Description

This function changes the state of interactivity (M_INTERACTIVE_GRAPHIC_STATE) of graphics in a graphics list. It is primarily used to change the state of interactivity of the graphics such that a user can interactively add a graphic of the specified type to the graphics list (M_STATE_WAITING_FOR_CREATION). In addition, the function can end any interactive manipulations occuring in the display and return to an idle state (M_STATE_IDLE).

When in the waiting for creation state (GraphicType set to an M_GRAPHIC_TYPE_... value), the user is expected to define a graphic interactively in the display. Note, however, that MgraInteractive() is asynchronous and only changes the state of interactivity; it will not wait for the user to define the graphic. You should have your application wait for the user to finish defining the graphic, before calling further functions; to do so, hook a function to the change in state of interactivity using MgraHookFunction() with M_INTERACTIVE_GRAPHIC_STATE_MODIFIED. When the user begins defining the graphic, the state of interactivity of the graphics list (MgraInquireList() or MgraGetHookInfo() with M_INTERACTIVE_GRAPHIC_STATE) changes to M_STATE_BEING_CREATED. After a user has defined the graphic interactively, the state of interactivity returns to M_STATE_IDLE and you can continue your application from that moment.

This function is especially useful if your application uses toolbars for a graphical user interface. For example, you can use another API to create a toolbar, with one of its buttons calling MgraInteractive() with M_GRAPHIC_TYPE_RECT. After clicking on the toolbar button, the user can define a rectangle in the display to specify where to perform processing or analysis in the image.

Unlike most other functions that modify a MIL object, you can call this function concurrently from multiple threads on the same MIL graphics list (ListGraId) without using an M_MUTEX object, as long as all the other parameters of the concurrent calls do not also share data.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
ContextGraId

Specifies the identifier of the graphics context. This parameter must be set to one of the following values:

function map For specifying the graphics context
CollapseValue Description
Collapse M_DEFAULT

Specifies to use the default graphics context of the current MIL application context.

Note that there is a different default graphics context for each thread.

(summarize)
Collapse M_NULL

Specifies a graphics context is not necessary; you should use this setting only when GraphicType is set to M_CANCEL or M_STOP.

Collapse MIL graphics context identifier

Specifies a valid graphics context identifier, which you have allocated using MgraAlloc().

ListGraId

Specifies the identifier of a valid graphics list whose state of interactivity must be changed. You must have allocated the graphics list using MgraAllocList().

GraphicType

Specifies the type of graphic to allow the user to define interactively before adding it to the list; alternatively, you can specify to cancel or stop any user interaction occuring in the display.

The following values will change MgraInquireList() with M_INTERACTIVE_GRAPHIC_STATE to M_STATE_WAITING_FOR_CREATION and allow the user to add a graphic to the graphics list by defining it interactively in the display.

function map For specifying the type of graphic
CollapseValue Description
Collapse M_GRAPHIC_TYPE_ARC

Changes the state of interactivity to M_STATE_WAITING_FOR_CREATION so that the user can interactively add an arc to the graphics list. Once in this state, the user can define an arc by clicking in the display on the position of the center of the ellipse from which the arc is defined, and then draggging to define both radii of the ellipse from which the arc is defined.

(summarize)
Collapse M_GRAPHIC_TYPE_DOT

Changes the state of interactivity to M_STATE_WAITING_FOR_CREATION so that the user can interactively add a dot to the graphics list. Once in this state, the user can define a dot by clicking in the display on the position where the dot should be placed.

(summarize)
Collapse M_GRAPHIC_TYPE_LINE

Changes the state of interactivity to M_STATE_WAITING_FOR_CREATION so that the user can interactively add a line to the graphics list. Once in this state, the user can define a line by clicking in the display on the start point, and then dragging to the end point.

(summarize)
Collapse M_GRAPHIC_TYPE_POLYGON

Changes the state of interactivity to M_STATE_WAITING_FOR_CREATION so that the user can interactively add a polygon to the graphics list. Once in this state, the user can define a polygon by defining each polygon vertex with a left mouse button click in the display, except for the last vertex, which is defined with a right mouse button click.

(summarize)
Collapse M_GRAPHIC_TYPE_POLYLINE

Changes the state of interactivity to M_STATE_WAITING_FOR_CREATION so that the user can interactively add a polyline to the graphics list. Once in this state, the user can define a polyline by defining each polyline vertex with a left mouse button click in the display, except for the last point, which is defined with a right mouse button click.

(summarize)
Collapse M_GRAPHIC_TYPE_RECT

Changes the state of interactivity to M_STATE_WAITING_FOR_CREATION so that the user can interactively add a rectangle to the graphics list. Once in this state, the user can define a rectangle by clicking in the display on one of the rectangle's corners, and then dragging to the opposite corner.

(summarize)

The following values change the graphics list's state of interactivity to idle (M_STATE_IDLE) and will cancel or stop any user manipulations in progress.

function map For ending user interaction
CollapseValue Description
Collapse M_CANCEL

Changes the graphics list's state of interactivity to idle (M_STATE_IDLE) and cancels any user manipulations in progress. A cancel operation will stop any user manipulation in progress and undo any changes that occurred. If, for example, a user was rotating a graphic with the rotate handle, cancelling will stop the user from rotating it further and return the graphic to the angle it was set to before the user started manipulating it. If a user is interactively defining a graphic to add to the graphics list, cancelling will stop the defining process and not add any graphic to the list.

(summarize)
Collapse M_STOP

Changes the graphics list's state of interactivity to idle (M_STATE_IDLE) and stops any user manipulations in progress. A stop operation ends any user manipulations in progress and leaves any changes made to the graphic. If, for example, a user was rotating a graphic with the rotate handle, stopping will prevent the user from rotating it further and leave the graphic at that angle. If a user is interactively defining a graphic to add to the graphics list, stopping will prevent the user from defining it further and adds the graphic to the list with the current dimensions.

(summarize)
InitFlag

Specifies optional behavior. If this behavior is not required or supported, set this parameter to M_DEFAULT. This parameter can be set to one or a combination of the following values. If the value is not supported for the graphic being created, an error is generated.

function map For specifying optional behavior
CollapseValue Description
Collapse M_FILLED

Specifies that the graphic the user defines in the display will be filled (MgraControlList() with M_FILLED set to M_TRUE).

This setting only applies to arcs (M_GRAPHIC_TYPE_ARC), polygons (M_GRAPHIC_TYPE_POLYGON), and rectangles (M_GRAPHIC_TYPE_RECT).

INQ(summarize)
Collapse M_FORCE_ASPECT_RATIO_1

Specifies that the graphic the user defines in the display will have an aspect ratio of 1 (MgraControlList() with M_CONSTRAIN_ASPECT_RATIO set to 1.0).

This setting only applies to arcs (M_GRAPHIC_TYPE_ARC) and rectangles (M_GRAPHIC_TYPE_RECT).

INQ(summarize)
Collapse M_SECTOR

Specifies that the arc the user defines in the display will be drawn as a sector instead (MgraControlList() with M_ARC_STYLE set to M_SECTOR).

This setting only applies to arcs (M_GRAPHIC_TYPE_ARC).

INQ(summarize)
ControlFlag

Reserved for future expansion and must be set to M_DEFAULT.

Compilation information
Header Include mil.h.
Library Use mil.lib.
DLL Requires mil.dll.
DEFAULT NULL GRAPHIC TYPE ARC GRAPHIC TYPE DOT GRAPHIC TYPE LINE GRAPHIC TYPE POLYGON GRAPHIC TYPE POLYLINE GRAPHIC TYPE RECT CANCEL STOP FILLED FORCE ASPECT RATIO 1 SECTOR