define a module to create a 2D drawing with successive mouse clicks
group GDroi2d_click_notify_templ
{
int+IPort2 add;
int+IPort2 erase;
int+IPort2 close;
int+IPort2 clear;
int+IPort2 done;
int+IPort2 redraw;
method+notify_inst init_func = "GDroi2d_click_create";
method+notify_deinst del_func = "GDroi2d_click_delete";
method+notify_val upd_func = "GDroi2d_click_update";
};
GDroi2d_click_notify_templ GDroi2d_click_templ
{
GDview_templ+IPort2 &view_in;
int+IPort2 x;
int+IPort2 y;
int mode;
int option;
int immed;
float red, green, blue;
GDroi2d_buffer+OPort2 out_buf;
ptr+nonotify+nosave local_ptr;
};
GDroi2d_click_templ GDroi2d_click {
mode = 1;
option = 3;
red = 1.0;
green = 0.0;
blue = 0.0;
};
These templates define a module to create a 2D drawing with a series of mouse clicks. GDroi2d_click_notify_templ defines the elements that cause the module's update method to execute. GDroi2d_click_templ defines the additional elements that are used at execution time but do not trigger an activation. GDroi2d_click provides initial values to some of the elements. This is the template that should be instanced.
The GDroi2d_click module generates a drawing with screen space XY positions provided one at a time typically from a UIonePoint interactor. With this method, you have the opportunity to more accurately place each point in the drawing and to erase points as needed during the construction process. The add, erase, and close elements are typically connected to UIonePoint interactors.
When this is set, it indicates that a point has been selected. You typically connect this to a UIonePoint's state subobject. The XY inputs are also valid at this time.
When this is set, it indicates that the previous point that was added should be erased. You typically connect this to a UIonePoint's state subobject.
When this is set, it indicates that the primitive in progress should be marked as completed. This parameter is used when a polyline or polygon is being drawn. You typically connect this to a UIonePoint's state subobject.
When this is set, it indicates that you want to clear the screen and internal drawing buffer without writing it to out_buf. You typically connect this to a UI widget, like a button.
When this is set, it indicates that you want to submit the current drawing or drawings. This causes the internal drawing buffer to be written to out_buf. You typically connect this to a UI widget, like a button.
When this is set, it indicates that you want to redraw the drawing. This is useful when the view has been rerendered while drawing is in progress. You typically connect this to a UI widget or to the trigger parameter of a view so redrawing occurs automatically whenever the view is re-rendered.
These inputs are the x and y screen space coordinates of the selected point. You typically connect these to the x and y parameters of the UIonePoint connected to the add parameter.
This parameter controls whether the contents of the internal drawing buffer replace or are appended to out_buf: 0 means replace; 1 means append. You typically connect this to a UI widget, such as a toggle.
This parameter controls the type of primitive to drawn. Valid values are: 0 means point; 1 means line; 2 means box; 3 means polyline; and 4 means polygon.
This parameter controls if the primitive being built is immediately written to the output buffer or if a confirmation is needed. A value of 0 means that you must supply a confirmation. A value of 1 means that the primitive is written immediately to the output buffer.
These parameters control the color in which the primitives being built are drawn. This is termed the "build" color.
The ouput buffer containing the screen space coordinates of the primitives.
Libraries.Graphics_Display.Interactivity.UI_Interactivity.ContinuousSketch