Synopsis
define a module to edit a 2D mesh
GDedit_mesh_notify_templ
group GDedit_mesh_notify_templ
{
int+IPort2 state;
int+IPort2 done;
int+IPort2 remove;
GDobject_templ+IPort2 *picked_obj;
method+notify_inst init_func = "GDedit_mesh_create";
method+notify_deinst del_func = "GDedit_mesh_delete";
method+notify_val upd_func = "GDedit_mesh_update";
};
GDedit_mesh_templ
GDedit_mesh_notify_templ GDedit_mesh_templ
{
int+IPort2 x;
int+IPort2 y;
int mode;
int immed;
float red, green, blue;
GDview_templ+IPort2 &view_in;
GDcamera_templ+IPort2 &cam_in;
ptr+nonotify+nosave local_ptr;
};
GDedit_mesh
GDedit_mesh_templ GDedit_mesh {
mode = 1;
immed = 1;
red = 1.0;
green = 0.0;
blue = 0.0;
};
Description
These templates define a module to edit a 2D mesh. This mesh is typically created by the GDmap2d_ss module but it could be generated in other ways as well. GDedit_mesh_notify_templ defines the elements that cause the module's update method to execute. GDedit_mesh_templ defines the additional elements that are used at execution time but do not trigger an activation. GDedit_mesh provides initial values to some of the elements. This is the template that should be instanced.
The GDedit_mesh module allows you to edit 2D unstructured meshes. Editing a mesh is a two stage process. First, you must select the object to edit using the normal pick process. When the selection occurs, all or part of the object is highlighted. Then, you can move the highlighted section of the object around. In order to work as just described, this module connects to the picked object output port from one of the standard viewers in the Graphics Display Kit. In this way, when an object is picked, the edit mesh module runs and gets an opportunity to highlight the item that was picked. The field that is attached to the object is what is edited.
Input Ports
state
This input indicates that an edit operation is in progress: 1 means that the operation is beginning; 2 means that the operation is in progress; and 3 means that the operation is completed. You typically connect this to a UItwoPoint's state subobject.
done
This input when set causes the point, primitive, or cell being edited to be updated in the picked object's field. This confirmation is needed only if the immed parameter is set to a value of 0.
remove
This parameter when set causes the point, primitive or cell being edited to be deleted from the mesh.
picked_obj
The Graphics Display Kit object whose field is being edited. You typically connect picked_obj to the view's picked object.
x
y
These inputs are the x and y screen space coordinates that control the edit.. You typically connect them to the x and y parameters of the UItwoPoint connected to state.
view_in
A connection to a view.
cam_in
A connection to a camera, typically the view's picked camera.
Parameters
mode
This parameter controls if the point, primitive, or cell is edited when the mesh is selected: 0 means point; 1 means primitive; and 2 means cell.
immed
This parameter controls if the edit done is committed immediately to the mesh or if you need to confirm the edit: 0 means the edit needs a confirmation; 1 commits the edit immediately to the mesh.
red
green
blue
These parameters control the color that the primitive being edited. This is termed the "edit" color.
Example
Libraries.Graphics_Display.Interactivity.UI_Interactivity.EditMesh
File
v/gd.v