38 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
42 #include <Xm/ToggleB.h>
46 void G4OpenGLXmViewer::zoom_callback (Widget
w,
50 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
51 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
56 XmNdecimalPoints, &dp,
76 pView->fVP.SetZoomFactor (zoomBy);
82 void G4OpenGLXmViewer::dolly_callback (Widget w,
86 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
87 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
92 XmNdecimalPoints, &dp,
108 pView->fVP.SetDolly (dolly);
115 void G4OpenGLXmViewer::pan_left_right_callback (Widget w,
116 XtPointer clientData,
119 XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
120 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
122 pView->pan_right = get_boolean_userData (w);
124 if (cbs->reason == XmCR_ARM) {
125 left_right_pan_callback (pView,NULL);
126 }
else if (cbs->reason == XmCR_DISARM) {
127 XtRemoveTimeOut (pView->pan_timer);
131 void G4OpenGLXmViewer::left_right_pan_callback (XtPointer clientData,
132 XtIntervalId* timer_id)
135 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
138 if (pView->pan_right) {
139 delta = pView->fPan_sens;
141 delta = -pView->fPan_sens;
145 = pView -> GetSceneHandler()->GetScene()->GetStandardTargetPoint();
147 G4Point3D tp = stp + pView -> fVP.GetCurrentTargetPoint ();
149 const G4Vector3D& upVector = pView->fVP.GetUpVector ();
150 const G4Vector3D& vpVector = pView->fVP.GetViewpointDirection ();
155 tp += delta * unitRight;
156 pView->fVP.SetCurrentTargetPoint (tp - stp);
162 pView->pan_timer = XtAppAddTimeOut
164 timer_id == NULL ? 500 : 1,
165 left_right_pan_callback,
169 void G4OpenGLXmViewer::pan_up_down_callback (Widget w,
170 XtPointer clientData,
173 XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
174 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
176 pView->pan_up = get_boolean_userData (w);
178 if (cbs->reason == XmCR_ARM) {
179 up_down_pan_callback (pView,NULL);
180 }
else if (cbs->reason == XmCR_DISARM) {
181 XtRemoveTimeOut (pView->pan_timer);
185 void G4OpenGLXmViewer::up_down_pan_callback (XtPointer clientData,
186 XtIntervalId* timer_id)
188 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
192 delta = pView->fPan_sens;
194 delta = -(pView->fPan_sens);
198 = pView -> GetSceneHandler()->GetScene()->GetStandardTargetPoint();
199 G4Point3D tp = stp + pView -> fVP.GetCurrentTargetPoint ();
200 const G4Vector3D& upVector = pView->fVP.GetUpVector ();
201 const G4Vector3D& vpVector = pView->fVP.GetViewpointDirection ();
205 tp += delta * unitUp;
206 pView->fVP.SetCurrentTargetPoint (tp - stp);
212 pView->pan_timer = XtAppAddTimeOut
214 timer_id == NULL ? 500 : 1,
215 up_down_pan_callback,
219 void G4OpenGLXmViewer::set_pan_sens_callback (Widget w,
220 XtPointer clientData,
223 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
224 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
229 XmNdecimalPoints, &dp,
234 }
else if ( dp > 0) {
236 ten_to_the_dp *= 10.;
243 pView->fPan_sens = (
G4double)((cbs->value) / ten_to_the_dp);
BasicVector3D< T > cross(const BasicVector3D< T > &v) const
G4GLOB_DLL std::ostream G4cout