28 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
44 G4OpenGLXmViewerMessenger* G4OpenGLXmViewerMessenger::fpInstance = 0;
48 if (!fpInstance) fpInstance =
new G4OpenGLXmViewerMessenger;
52 G4OpenGLXmViewerMessenger::G4OpenGLXmViewerMessenger()
57 fpDirectory->SetGuidance(
"G4OpenGLXmViewer commands.");
60 fpDirectorySet->SetGuidance(
"G4OpenGLXmViewer set commands.");
62 fpCommandSetDollyHigh =
64 fpCommandSetDollyHigh->SetGuidance(
"Higher limit of dolly slider.");
65 fpCommandSetDollyHigh->SetParameterName(
"dolly-high", omitable =
false);
67 fpCommandSetDollyLow =
69 fpCommandSetDollyLow->SetGuidance(
"Lower limit of dolly slider.");
70 fpCommandSetDollyLow->SetParameterName(
"dolly-low", omitable =
false);
74 fpCommandSetPanHigh->SetGuidance(
"Higher limit of pan slider.");
75 fpCommandSetPanHigh->SetParameterName(
"pan-high", omitable =
false);
77 fpCommandSetRotationHigh =
79 fpCommandSetRotationHigh->SetGuidance(
"Higher limit of rotation slider.");
80 fpCommandSetRotationHigh->SetParameterName(
"rotation-high", omitable =
false);
82 fpCommandSetZoomHigh =
84 fpCommandSetZoomHigh->SetGuidance(
"Higher limit of zoom slider.");
85 fpCommandSetZoomHigh->SetParameterName(
"zoom-high", omitable =
false);
89 fpCommandSetZoomLow->SetGuidance(
"Lower limit of zoom slider.");
90 fpCommandSetZoomLow->SetParameterName(
"zoom-low", omitable =
false);
93 G4OpenGLXmViewerMessenger::~G4OpenGLXmViewerMessenger ()
95 delete fpCommandSetZoomLow;
96 delete fpCommandSetZoomHigh;
97 delete fpCommandSetRotationHigh;
98 delete fpCommandSetPanHigh;
99 delete fpCommandSetDollyLow;
100 delete fpCommandSetDollyHigh;
101 delete fpDirectorySet;
105 void G4OpenGLXmViewerMessenger::SetNewValue
114 "G4OpenGLXmViewerMessenger::SetNewValue: No current viewer."
115 "\n \"/vis/open\", or similar, to get one."
120 G4OpenGLXmViewer* pViewer =
dynamic_cast<G4OpenGLXmViewer*
>(pVViewer);
124 "G4OpenGLXmViewerMessenger::SetNewValue: Current viewer is not of type"
125 "\n OGLIXm or OGLSXm. Use \"/vis/viewer/select\" or \"/vis/open\"."
130 G4bool panningControlPanel =
true;
131 G4bool rotationControlPanel =
true;
133 if (command == fpCommandSetDollyHigh)
135 if (pViewer->fpdolly_slider)
137 pViewer->dolly_high =
138 fpCommandSetDollyHigh->GetNewDoubleValue(newValue);
139 pViewer->fpdolly_slider->SetMaxValue (pViewer->dolly_high);
140 if (pViewer->fVP.GetDolly() > pViewer->dolly_high)
142 pViewer->fpdolly_slider->SetInitialValue (pViewer->dolly_high);
143 pViewer->fVP.SetDolly(pViewer->dolly_high);
147 pViewer->fpdolly_slider->SetInitialValue (pViewer->fVP.GetDolly());
152 panningControlPanel =
false;
156 else if (command == fpCommandSetDollyLow)
158 if (pViewer->fpdolly_slider)
161 fpCommandSetDollyLow->GetNewDoubleValue(newValue);
162 pViewer->fpdolly_slider->SetMinValue (pViewer->dolly_low);
163 if (pViewer->fVP.GetDolly() < pViewer->dolly_low)
165 pViewer->fpdolly_slider->SetInitialValue (pViewer->dolly_low);
166 pViewer->fVP.SetDolly(pViewer->dolly_low);
170 pViewer->fpdolly_slider->SetInitialValue (pViewer->fVP.GetDolly());
175 panningControlPanel =
false;
179 else if (command == fpCommandSetPanHigh)
181 if (pViewer->fppanning_slider)
183 pViewer->pan_sens_limit =
184 fpCommandSetPanHigh->GetNewDoubleValue(newValue);
185 pViewer->fppanning_slider->SetMaxValue (pViewer->pan_sens_limit);
186 pViewer->fppanning_slider->SetInitialValue (pViewer->pan_sens_limit / 2.);
190 panningControlPanel =
false;
194 else if (command == fpCommandSetRotationHigh)
196 if (pViewer->fprotation_slider)
199 pViewer->rot_sens_limit =
200 fpCommandSetRotationHigh->GetNewDoubleValue(newValue) /
deg;
201 pViewer->fprotation_slider->SetMaxValue (pViewer->rot_sens_limit);
202 pViewer->fprotation_slider->SetInitialValue (pViewer->rot_sens_limit / 2.);
206 rotationControlPanel =
false;
210 else if (command == fpCommandSetZoomHigh)
212 if (pViewer->fpzoom_slider)
215 fpCommandSetZoomHigh->GetNewDoubleValue(newValue);
216 pViewer->fpzoom_slider->SetMaxValue (pViewer->zoom_high);
217 pViewer->fpzoom_slider->SetInitialValue (pViewer->fVP.GetZoomFactor());
218 if (pViewer->fVP.GetZoomFactor() > pViewer->zoom_high)
220 pViewer->fpzoom_slider->SetInitialValue (pViewer->zoom_high);
221 pViewer->fVP.SetZoomFactor(pViewer->zoom_high);
225 pViewer->fpzoom_slider->SetInitialValue (pViewer->fVP.GetZoomFactor());
230 panningControlPanel =
false;
234 else if (command == fpCommandSetZoomLow)
236 if (pViewer->fpzoom_slider)
239 fpCommandSetZoomLow->GetNewDoubleValue(newValue);
240 pViewer->fpzoom_slider->SetMinValue (pViewer->zoom_low);
241 pViewer->fpzoom_slider->SetInitialValue (pViewer->fVP.GetZoomFactor());
242 if (pViewer->fVP.GetZoomFactor() < pViewer->zoom_low)
244 pViewer->fpzoom_slider->SetInitialValue (pViewer->zoom_low);
245 pViewer->fVP.SetZoomFactor(pViewer->zoom_low);
249 pViewer->fpzoom_slider->SetInitialValue (pViewer->fVP.GetZoomFactor());
254 panningControlPanel =
false;
258 if (!panningControlPanel)
261 "G4OpenGLXmViewerMessenger::SetNewValue: pull down panning"
262 "\n control panel and re-issue command."
267 if (!rotationControlPanel)
270 "G4OpenGLXmViewerMessenger::SetNewValue: pull down rotation"
271 "\n control panel and re-issue command."