MCPcopy Create free account
hub / github.com/Geant4/geant4 / zoom_callback

Method zoom_callback

source/visualization/OpenGL/src/G4OpenGLXmPanningCallbacks.cc:43–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41#include "G4Scene.hh"
42
43void G4OpenGLXmViewer::zoom_callback (Widget w,
44 XtPointer clientData,
45 XtPointer callData)
46{
47 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
48 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
49 short dp = -1;
50 G4float ten_to_the_dp = 10.;
51
52 XtVaGetValues (w,
53 XmNdecimalPoints, &dp,
54 NULL);
55
56 if (dp == 0) {
57 ten_to_the_dp = 1.;
58 } else if ( dp > 0) {
59 for (G4int i = 1; i < (G4int)dp; i++) {
60 ten_to_the_dp *= 10.;
61 }
62 } else {
63 G4cout << "dp is " << dp << G4endl;
64 return;
65 }
66
67
68 G4double zoomBy = (G4double)(cbs->value) / ten_to_the_dp;
69 if (zoomBy <= 0.01) {
70 zoomBy = 0.01;
71 }
72
73 pView->fVP.SetZoomFactor (zoomBy);
74 pView->SetView ();
75 pView->ClearView ();
76 pView -> DrawView ();
77}
78
79void G4OpenGLXmViewer::dolly_callback (Widget w,
80 XtPointer clientData,

Callers

nothing calls this directly

Calls 3

SetViewMethod · 0.45
ClearViewMethod · 0.45
DrawViewMethod · 0.45

Tested by

no test coverage detected