#include <P_Tool.h>
Inheritance diagram for Tool:
Public Methods | |
Tool (int id, VMDApp *, Displayable *aParentDisplayable) | |
virtual | ~Tool () |
int | id () const |
return unqiue id. More... | |
int | steal_sensor (Tool *from) |
steal devices from another tool. More... | |
int | add_tracker (VMDTracker *, const SensorConfig *) |
int | add_feedback (Feedback *, const SensorConfig *) |
int | add_buttons (Buttons *, const SensorConfig *) |
int | remove_device (const char *device) |
Remove the device with the given name. For backwards compatibility only. More... | |
void | getdevices (char **ret) |
Get the names of the devices used by this tool. More... | |
const char * | get_tracker () const |
const char * | get_feedback () const |
const char * | get_buttons () const |
float | getscale () |
Get/set the coordinate scaling used by this tool's Tracker. More... | |
void | setscale (float scale) |
float | getspringscale () const |
The spring scaling controls the stiffness of the force feedback device. Its units should be real N/m. More... | |
void | setspringscale (float s) |
float | getforcescale () |
The force scaling scales the _exported force, i.e. the force which is sent to UIVR and/or an external simulation. It is a spring constant, in
. More... | |
void | setforcescale (float f) |
const float * | getoffset () |
Get/set the position offset used by this tool's tracker. More... | |
void | setoffset (float *offset) |
virtual const float * | position () const |
return the position of this tool. More... | |
virtual const Matrix4 * | orientation () |
return the orientation of this tool. More... | |
virtual int | isgrabbing () |
True iff the tool is grabbing something. More... | |
int | alive () const |
True iff there is a valid sensor for this tool. More... | |
void | kill () |
Invalidate sensor/tool. More... | |
virtual const char * | type_name () const=0 |
return the name of this tool. Must be unique to all Tool subclasses! More... | |
virtual int | check_event () |
check for an event, and queue it if found. Return TRUE if an event was generated. More... | |
void | dograb () |
void | ungrab () |
int | assign_rep (int mol, int rep) |
Use the given rep as the targeted atoms, overriding picked atoms. Return success. More... | |
int | get_rep_molid () const |
Get the molid of the currently selected rep; -1 if none. More... | |
const char * | get_rep_name () const |
Get the name of the currently selected rep; NULL if none. More... | |
void | clear_rep () |
Clear the selection and go back to picking atoms by hand. More... | |
Public Attributes | |
int | grabs |
Protected Methods | |
virtual void | do_event () |
Subclasses should override this method to perform tool-specific actions every display loop. More... | |
int | target (int target_type, float *mpos, int just_checking) |
See if we're currently picking anything, and if so, update the pick variables. Return true if anything was picked. More... | |
void | let_go () |
Cease picking. More... | |
int | is_targeted () const |
Test for picking. More... | |
int | get_targeted_atom (int *molret, int *atomret) const |
See what was picked last without acquiring a new target. More... | |
void | tool_location_update () |
Trigger callbacks based on current position. More... | |
float | getTargetScale () |
Returns the scale factor of the currently picked molecule. More... | |
void | tug (const float *) |
Apply the given force to the current target. More... | |
int | dimension () |
Dimension of the tracker device in use. More... | |
void | setplaneconstraint (float k, const float *point, const float *normal) |
Set force field parameters. More... | |
void | addplaneconstraint (float k, const float *point, const float *normal) |
void | setconstraint (float k, const float *point) |
void | setforcefield (const float *origin, const float *force, const float *jacobian) |
void | sendforce () |
Deliver specified force to the feedback device. XXX Maybe this should be taken care of automatically in the update loop. More... | |
void | forceoff () |
Stop applying force. More... | |
Protected Attributes | |
float | forcescale |
scales force sent to the atoms. More... | |
float | springscale |
scales force sent to the feedback device. More... | |
Displayable * | dtool |
The visual representation of this tool. It's not private because for some reason the TugTool needs access to some of its members. More... | |
int | wasgrabbing |
XXX Should be private variable; gets set to isgrabbing() by RotateTool. More... |
Definition at line 38 of file P_Tool.h.
|
Definition at line 66 of file P_Tool.C. References dtool, forcescale, NULL, springscale, and wasgrabbing. |
|
Definition at line 88 of file P_Tool.C. References dtool. |
|
Definition at line 123 of file P_Tool.C. References SensorConfig::getdevice, and Buttons::start. Referenced by UIVR::set_buttons. |
|
Definition at line 114 of file P_Tool.C. References SensorConfig::getdevice, and Feedback::start. Referenced by UIVR::set_feedback. |
|
Add a device. Also starts the device. Add a NULL device to remove the item. Return success, defined as either successful removal or starting of the device. Definition at line 105 of file P_Tool.C. References SensorConfig::getdevice, and VMDTracker::start. Referenced by UIVR::set_tracker. |
|
Definition at line 520 of file P_Tool.C. References Feedback::addplaneconstraint, VMDTracker::get_offset, VMDTracker::get_scale, n, and springscale. Referenced by RotateTool::do_event. |
|
True iff there is a valid sensor for this tool.
Definition at line 95 of file P_Tool.h. Referenced by ToolFltkMenu::reset_tool_list, and ToolFltkMenu::select_tool. |
|
Use the given rep as the targeted atoms, overriding picked atoms. Return success.
Definition at line 239 of file P_Tool.C. References UIObject::app, DrawMolItem::atomSel, clear_rep, DrawMolecule::component, AtomSel::firstsel, AtomSel::lastsel, BaseMolecule::mass, MoleculeList::mol_from_id, VMDApp::moleculeList, DrawMolItem::name, AtomSel::on, PickList::pick_callback_clear, VMDApp::pickList, and stringdup. Referenced by UIVR::act_on_command. |
|
check for an event, and queue it if found. Return TRUE if an event was generated.
Reimplemented from UIObject. Definition at line 205 of file P_Tool.C. References do_event, dtool, Displayable::glob_trans_off, Displayable::glob_trans_on, orientation, position, Displayable::rot_off, Displayable::rot_on, Displayable::set_glob_trans, and Displayable::set_rot. |
|
Clear the selection and go back to picking atoms by hand.
Definition at line 153 of file P_Tool.h. Referenced by UIVR::act_on_command, assign_rep, and target. |
|
Dimension of the tracker device in use.
Definition at line 502 of file P_Tool.C. References VMDTracker::dimension, and dimension. Referenced by dimension, RotateTool::do_event, and JoystickTool::do_event. |
|
Subclasses should override this method to perform tool-specific actions every display loop.
Reimplemented in GrabTool. Definition at line 168 of file P_Tool.h. Referenced by check_event. |
|
Definition at line 417 of file P_Tool.C. References UIObject::app, Displayable::fix, Displayable::globt, BaseMolecule::id, id, Matrix4::inverse, Matrix4::mat, MoleculeList::mol_from_id, MoleculeList::molecule, VMDApp::molecule_fix, VMDApp::moleculeList, Matrix4::multmatrix, Matrix4::multpoint3d, NULL, MoleculeList::num, orientation, position, VMDApp::scene_rotate_by, VMDApp::scene_translate_by, Displayable::unfix, vec_add, and vec_sub. |
|
Stop applying force.
Definition at line 563 of file P_Tool.C. References Feedback::forceoff. Referenced by SpringTool::do_event, TugTool::do_event, RotateTool::do_event, PinchTool::do_event, JoystickTool::do_event, and GrabTool::do_event. |
|
Definition at line 64 of file P_Tool.h. References NULL. Referenced by ToolFltkMenu::select_tool. |
|
Definition at line 63 of file P_Tool.h. References NULL. Referenced by ToolFltkMenu::select_tool. |
|
Get the molid of the currently selected rep; -1 if none.
Definition at line 147 of file P_Tool.h. Referenced by ToolFltkMenu::update_toolrep_choosers. |
|
Get the name of the currently selected rep; NULL if none.
Definition at line 150 of file P_Tool.h. Referenced by ToolFltkMenu::update_toolrep_choosers. |
|
See what was picked last without acquiring a new target.
Definition at line 265 of file P_Tool.C. References NULL. Referenced by SpringTool::do_event. |
|
Definition at line 62 of file P_Tool.h. References NULL. Referenced by ToolFltkMenu::select_tool. |
|
Get the names of the devices used by this tool.
Definition at line 163 of file P_Tool.C. References NULL. Referenced by text_cmd_tool. |
|
The force scaling scales the _exported force, i.e. the force which is sent to UIVR and/or an external simulation. It is a spring constant, in .
Definition at line 78 of file P_Tool.h. References forcescale. Referenced by ToolFltkMenu::select_tool. |
|
Get/set the position offset used by this tool's tracker.
Definition at line 234 of file P_Tool.C. References VMDTracker::get_offset, and NULL. Referenced by ToolFltkMenu::select_tool, and text_cmd_tool. |
|
Get/set the coordinate scaling used by this tool's Tracker.
Definition at line 226 of file P_Tool.C. References VMDTracker::get_scale. Referenced by ToolFltkMenu::select_tool, and text_cmd_tool. |
|
The spring scaling controls the stiffness of the force feedback device. Its units should be real N/m.
Definition at line 72 of file P_Tool.h. References springscale. Referenced by ToolFltkMenu::select_tool. |
|
Returns the scale factor of the currently picked molecule.
Definition at line 495 of file P_Tool.C. References UIObject::app, MoleculeList::mol_from_id, VMDApp::moleculeList, and Displayable::scale. Referenced by SpringTool::do_event, and TugTool::do_event. |
|
return unqiue id.
Definition at line 44 of file P_Tool.h. Referenced by PrintTool::do_event, dograb, and ungrab. |
|
Test for picking.
Definition at line 180 of file P_Tool.h. Referenced by SpringTool::do_event, and TugTool::do_event. |
|
True iff the tool is grabbing something.
Reimplemented in PinchTool. Definition at line 171 of file P_Tool.C. References Buttons::state. Referenced by RotateTool::do_event, JoystickTool::do_event, and GrabTool::do_event. |
|
Invalidate sensor/tool.
|
|
Cease picking.
Definition at line 177 of file P_Tool.h. Referenced by clear_rep, SpringTool::do_event, TugTool::do_event, RotateTool::do_event, PinchTool::do_event, JoystickTool::do_event, and target. |
|
return the orientation of this tool.
Reimplemented in RotateTool. Definition at line 181 of file P_Tool.C. References NULL. Referenced by check_event, PrintTool::do_event, PinchTool::do_event, GrabTool::do_event, dograb, RotateTool::orientation, and text_cmd_tool. |
|
return the position of this tool.
Reimplemented in JoystickTool. Definition at line 176 of file P_Tool.C. References NULL. Referenced by check_event, SpringTool::do_event, TugTool::do_event, RotateTool::do_event, PrintTool::do_event, PinchTool::do_event, JoystickTool::do_event, GrabTool::do_event, dograb, RotateTool::position, JoystickTool::position, sendforce, target, text_cmd_tool, and tool_location_update. |
|
Remove the device with the given name. For backwards compatibility only.
Definition at line 133 of file P_Tool.C. References NULL. Referenced by UIVR::act_on_command. |
|
Deliver specified force to the feedback device. XXX Maybe this should be taken care of automatically in the update loop.
Definition at line 560 of file P_Tool.C. References position, and Feedback::sendforce. Referenced by RotateTool::do_event, PinchTool::do_event, JoystickTool::do_event, and GrabTool::do_event. |
|
Definition at line 532 of file P_Tool.C. References Feedback::addconstraint, VMDTracker::get_offset, VMDTracker::get_scale, springscale, and Feedback::zeroforce. Referenced by JoystickTool::do_event. |
|
Definition at line 545 of file P_Tool.C. References Feedback::addforcefield, force, VMDTracker::get_scale, springscale, and Feedback::zeroforce. Referenced by GrabTool::do_event. |
|
Definition at line 79 of file P_Tool.h. References forcescale. Referenced by UIVR::set_force_scale. |
|
Definition at line 231 of file P_Tool.C. References VMDTracker::set_offset. Referenced by UIVR::act_on_command. |
|
Set force field parameters.
Definition at line 507 of file P_Tool.C. References Feedback::addplaneconstraint, VMDTracker::get_offset, VMDTracker::get_scale, n, springscale, and Feedback::zeroforce. Referenced by RotateTool::do_event, and PinchTool::do_event. |
|
Definition at line 223 of file P_Tool.C. References VMDTracker::set_scale. Referenced by UIVR::set_position_scale. |
|
Reimplemented in PinchTool. Definition at line 73 of file P_Tool.h. References springscale. Referenced by UIVR::set_spring_scale, SpringTool::setspringscale, TugTool::setspringscale, and PinchTool::setspringscale. |
|
steal devices from another tool.
Definition at line 149 of file P_Tool.C. References buttonDev, buttons, feedback, feedbackDev, forcescale, lost_sensor, springscale, tracker, and trackerDev. Referenced by UIVR::change_type. |
|
See if we're currently picking anything, and if so, update the pick variables. Return true if anything was picked.
Definition at line 282 of file P_Tool.C. References UIObject::app, DrawMolItem::atomSel, MoleculeList::check_pickable, clear_rep, DrawMolecule::component, DrawMolecule::current, VMDApp::display, AtomSel::firstsel, Displayable::globt, BaseMolecule::id, AtomSel::lastsel, let_go, BaseMolecule::mass, MoleculeList::mol_from_id, VMDApp::molecule_numframes, VMDApp::moleculeList, VMDApp::molrep_get_by_name, Matrix4::multpoint3d, NULL, AtomSel::on, PickList::pick_check, VMDApp::pickList, Timestep::pos, position, TARGET_GRAB, TARGET_TUG, Displayable::tm, Matrix4::translate, vec_copy, and vec_scale. Referenced by SpringTool::do_event, TugTool::do_event, RotateTool::do_event, PinchTool::do_event, JoystickTool::do_event, and GrabTool::do_event. |
|
Trigger callbacks based on current position.
Definition at line 273 of file P_Tool.C. References UIObject::app, UIObject::make_callbacks, NULL, PickList::pick_check, VMDApp::pickList, and position. Referenced by SpringTool::do_event, and TugTool::do_event. |
|
Apply the given force to the current target.
Definition at line 387 of file P_Tool.C. References Molecule::addForce, UIObject::app, DrawMolItem::atomSel, DrawMolecule::component, AtomSel::firstsel, force, AtomSel::lastsel, BaseMolecule::mass, MoleculeList::mol_from_id, VMDApp::moleculeList, VMDApp::molrep_get_by_name, Matrix4::multpoint3d, AtomSel::on, Displayable::rotm, Matrix4::transpose, and vec_scale. Referenced by PinchTool::do_event. |
|
return the name of this tool. Must be unique to all Tool subclasses!
Implemented in GrabTool. Referenced by ToolFltkMenu::reset_tool_list, ToolFltkMenu::select_tool, and text_cmd_tool. |
|
Definition at line 478 of file P_Tool.C. References UIObject::app, BaseMolecule::id, id, MoleculeList::molecule, VMDApp::molecule_fix, VMDApp::moleculeList, MoleculeList::num, and Displayable::unfix. |
|
The visual representation of this tool. It's not private because for some reason the TugTool needs access to some of its members.
Definition at line 164 of file P_Tool.h. Referenced by check_event, SpringTool::do_event, TugTool::do_event, Tool, and ~Tool. |
|
scales force sent to the atoms.
Definition at line 106 of file P_Tool.h. Referenced by SpringTool::do_event, TugTool::do_event, PinchTool::do_event, getforcescale, setforcescale, steal_sensor, and Tool. |
|
|
|
scales force sent to the feedback device.
Definition at line 107 of file P_Tool.h. Referenced by addplaneconstraint, getspringscale, setconstraint, setforcefield, setplaneconstraint, setspringscale, steal_sensor, and Tool. |
|
XXX Should be private variable; gets set to isgrabbing() by RotateTool.
Definition at line 212 of file P_Tool.h. Referenced by RotateTool::do_event, GrabTool::do_event, and Tool. |