00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2019 The Board of Trustees of the 00004 *cr University of Illinois 00005 *cr All Rights Reserved 00006 *cr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * RCS INFORMATION: 00011 * 00012 * $RCSfile: P_UIVR.h,v $ 00013 * $Author: johns $ $Locker: $ $State: Exp $ 00014 * $Revision: 1.75 $ $Date: 2020年10月28日 17:42:35 $ 00015 * 00016 *************************************************************************** 00017 * DESCRIPTION: 00018 * This is Paul's simplified Tracker code -- pgrayson@ks.uiuc.edu 00019 * 00020 * The UIVR is the Virtual Reality User Interface. It should 00021 * coordinate multiple tools, taking manipulation commands from them 00022 * and giving them back various messages and flags. UIVR is the thing 00023 * which has to know about the different kinds of tools. 00024 * 00025 ***************************************************************************/ 00026 00027 #include "NameList.h" 00028 #include "Matrix4.h" 00029 #include "UIObject.h" 00030 #include <stdio.h> 00031 00032 class JString; 00033 class AtomSel; 00034 class Tool; 00035 class VMDTracker; 00036 class Feedback; 00037 class Buttons; 00038 class SensorConfig; 00039 00044 class UIVR : public UIObject { 00045 public: 00046 UIVR(VMDApp *); 00047 ~UIVR(); 00048 00050 int add_tool_with_USL(const char *type, int argc, const char **USL); 00051 00053 int change_type(int toolnum, const char *type); 00054 00056 int remove_tool(int i); 00057 00058 int check_event(); 00059 Tool *gettool(int i); 00060 inline int num_tools() { return int(tools.num()); } 00061 00062 const char *tool_name(int i) { 00063 if(i<tool_types.num()) return tool_types.name(i); 00064 else return "<error>"; 00065 } 00066 00067 int tool_type(const char *nm) { 00068 return tool_types.typecode(nm); 00069 } 00070 00071 int num_tool_types() { return tool_types.num(); } 00072 00073 virtual int act_on_command(int, Command *); 00074 00076 static ResizeArray<JString *> *get_device_names(); 00077 00082 ResizeArray<JString *> *get_tracker_names(); 00083 ResizeArray<JString *> *get_feedback_names(); 00084 ResizeArray<JString *> *get_button_names(); 00085 00089 int set_tracker(int toolnum, const char *device); 00090 int set_feedback(int toolnum, const char *device); 00091 int set_buttons(int toolnum, const char *device); 00092 00093 int set_position_scale(int toolnum, float newval); 00094 int set_force_scale(int toolnum, float newval); 00095 int set_spring_scale(int toolnum, float newval); 00096 00097 private: 00098 ResizeArray<Tool *> tools; 00099 NameList<int> tool_types; 00100 00102 int tool_serialno; 00103 00105 Tool *create_tool(const char *type); 00106 00109 int add_tool(const char *type); 00110 00112 NameList<VMDTracker *> trackerList; 00113 NameList<Feedback *> feedbackList; 00114 NameList<Buttons *> buttonList; 00115 00119 void update_device_lists(); 00120 00122 int add_device_to_tool(const char *devicename, Tool *tool); 00123 }; 00124