Geant4-11
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | Friends
G4OpenGLXmViewer Class Referenceabstract

#include <G4OpenGLXmViewer.hh>

Inheritance diagram for G4OpenGLXmViewer:
G4OpenGLXViewer G4OpenGLViewer G4VViewer G4OpenGLImmediateXmViewer G4OpenGLStoredXmViewer

Public Member Functions

void ClearView ()
 
void ClearViewWithoutFlush ()
 
std::vector< G4ThreeVectorComputeFlyThrough (G4Vector3D *)
 
void DrawText (const G4Text &)
 
virtual void DrawView ()=0
 
virtual bool exportImage (std::string name="", int width=-1, int height=-1)
 
virtual void FinishView ()
 
 G4OpenGLXmViewer (G4OpenGLSceneHandler &scene)
 
const G4VisAttributesGetApplicableVisAttributes (const G4VisAttributes *) const
 
const G4ViewParametersGetDefaultViewParameters () const
 
const G4StringGetName () const
 
virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers () const
 
G4VSceneHandlerGetSceneHandler () const
 
const G4StringGetShortName () const
 
G4int GetViewId () const
 
const G4ViewParametersGetViewParameters () const
 
virtual void Initialise ()
 
void NeedKernelVisit ()
 
void ProcessView ()
 
void RefreshView ()
 
void SetDefaultViewParameters (const G4ViewParameters &vp)
 
bool setExportImageFormat (std::string format, bool quiet=false)
 
void SetName (const G4String &)
 
void SetNeedKernelVisit (G4bool need)
 
void SetView ()
 
void SetViewParameters (const G4ViewParameters &vp)
 
virtual ~G4OpenGLXmViewer ()
 

Static Public Member Functions

static void actions_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void Add_four_arrow_buttons (G4OpenGLXmViewer *pView, XtCallbackRec **arrow_callbacks, Widget *parent_widget)
 
static void Add_radio_box (char *label_string, Widget *parent_frame_widget, XtCallbackRec *radio_box_cb, G4int num_buttons, G4int default_button, char *radio_box_name, char **button_names, G4OpenGLXmViewer *pView)
 
static void Add_set_field (char *widget, char *widget_text, Widget *row_col_box, Widget *wid, G4double *val, G4OpenGLXmViewer *pView)
 
static void Add_slider_box (char *label_string, G4int num_sliders, char **slider_name, G4OpenGLXmViewer *pView, G4double *min_array, G4double *max_array, G4double *value_array, G4bool *show, short *decimals, unsigned char *orientation, unsigned char *direction, XtCallbackRec **slider_box_cb, Widget *parent_frame_widget)
 
static void antialias_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void aux_edge_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void background_color_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void dolly_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void drawing_style_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void expose_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static G4bool get_boolean_userData (Widget w)
 
static void get_double_value_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static G4int get_int_userData (Widget w)
 
static void get_text_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void haloing_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void left_right_pan_callback (XtPointer clientData, XtIntervalId *timer_id)
 
static void misc_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void pan_left_right_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void pan_up_down_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void phi_rotation_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void print_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void projection_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void reset_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void resize_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void rotate_in_phi (XtPointer clientData, XtIntervalId *timer_id)
 
static void rotate_in_theta (XtPointer clientData, XtIntervalId *timer_id)
 
static void set_pan_sens_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void set_print_colour_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void set_print_style_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void set_rot_sens_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void set_rot_subject_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void set_wob_sens_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void theta_rotation_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void transparency_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void up_down_pan_callback (XtPointer clientData, XtIntervalId *timer_id)
 
static void update_panels_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void wobble_callback (Widget w, XtPointer clientData, XtPointer callData)
 
static void wobble_timer_callback (XtPointer clientData, XtIntervalId *timerid)
 
static void zoom_callback (Widget w, XtPointer clientData, XtPointer callData)
 

Protected Member Functions

void addExportImageFormat (std::string format)
 
void ChangeLineWidth (G4double width)
 
void ChangePointSize (G4double size)
 
virtual void CreateFontLists ()
 
void CreateGLXContext (XVisualInfo *vi)
 
virtual void CreateMainWindow ()
 
void g4GlFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
 
void g4GlOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
 
void g4GluLookAt (GLdouble eyex, GLdouble eyey, GLdouble eyez, GLdouble centerx, GLdouble centery, GLdouble centerz, GLdouble upx, GLdouble upy, GLdouble upz)
 
void g4GluPickMatrix (GLdouble x, GLdouble y, GLdouble width, GLdouble height, GLint viewport[4])
 
const std::vector< G4OpenGLViewerPickMap * > & GetPickDetails (GLdouble x, GLdouble y)
 
std::string getRealPrintFilename ()
 
GLdouble getSceneDepth ()
 
GLdouble getSceneFarWidth ()
 
GLdouble getSceneNearWidth ()
 
unsigned int getWinHeight () const
 
unsigned int getWinWidth () const
 
void GetXConnection ()
 
void GetXmConnection ()
 
void HaloingFirstPass ()
 
void HaloingSecondPass ()
 
void HLRFirstPass ()
 
void HLRSecondPass ()
 
void HLRThirdPass ()
 
void InitializeGLView ()
 
G4bool isFramebufferReady ()
 
G4bool isGl2psWriting ()
 
virtual G4String Pick (GLdouble x, GLdouble y)
 
void ResetView ()
 
void ResizeGLView ()
 
void ResizeWindow (unsigned int, unsigned int)
 
void rotateScene (G4double dx, G4double dy)
 
void rotateSceneToggle (G4double dx, G4double dy)
 
bool setExportFilename (G4String name, G4bool inc=true)
 
void setExportSize (G4int, G4int)
 
void SetTouchable (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath)
 
virtual void ShowView ()
 
G4bool sizeHasChanged ()
 
void TouchableSetColour (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, const G4Colour &)
 
void TouchableSetVisibility (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, G4bool visibility)
 

Protected Attributes

Widget actions_cascade
 
XmString actions_str
 
XmString anti_str
 
Widget antialias_pullright
 
G4bool antialiasing_enabled
 
XtAppContext app
 
G4intattributeList
 
Widget aux_edge_pullright
 
XmString aux_edge_str
 
G4Colour background
 
Widget background_color_pullright
 
Pixel bgnd
 
XmString bgnd_str
 
XmString black_str
 
Pixel borcol
 
char charViewName [100]
 
XClassHint * class_hints
 
Colormap cmap
 
GLXContext cxMaster
 
G4double dolly_high
 
G4double dolly_low
 
Display * dpy
 
XmString draw_str
 
Widget drawing_style_pullright
 
G4int errorBase
 
XEvent event
 
G4int eventBase
 
XmString exit_str
 
std::string fDefaultExportImageFormat
 
G4ViewParameters fDefaultVP
 
int fExportFilenameIndex
 
std::string fExportImageFormat
 
std::vector< std::string > fExportImageFormatVector
 
G4OpenGL2PSActionfGL2PSAction
 
G4String fName
 
G4bool fNeedKernelVisit
 
G4OpenGLSceneHandlerfOpenGLSceneHandler
 
G4double fov
 
G4double fPan_sens
 
G4OpenGLXmFramedBoxfpdolly_box
 
G4OpenGLXmTextFieldfpdolly_lower
 
G4OpenGLXmSliderBarfpdolly_slider
 
G4OpenGLXmTextFieldfpdolly_upper
 
G4OpenGLXmTextFieldfpfov_text
 
G4OpenGLXmTopLevelShellfpmiscellany_top
 
G4OpenGLXmPushButtonfpok_button
 
G4OpenGLXmRadioButtonfporthogonal_button
 
G4OpenGLXmTextFieldfppan_set
 
G4OpenGLXmFourArrowButtonsfppanning_arrows
 
G4OpenGLXmFramedBoxfppanning_box
 
G4OpenGLXmSliderBarfppanning_slider
 
G4OpenGLXmTopLevelShellfppanning_top
 
G4OpenGLXmRadioButtonfpperspective_button
 
G4OpenGLXmFramedBoxfpprint_box
 
G4OpenGLXmPushButtonfpprint_button
 
G4OpenGLXmFramedBoxfpprint_col_box
 
G4OpenGLXmRadioButtonfpprint_col_radio1
 
G4OpenGLXmRadioButtonfpprint_col_radio2
 
G4OpenGLXmSeparatorfpprint_line
 
G4OpenGLXmFramedBoxfpprint_style_box
 
G4OpenGLXmRadioButtonfpprint_style_radio1
 
G4OpenGLXmRadioButtonfpprint_style_radio2
 
G4OpenGLXmTextFieldfpprint_text
 
G4OpenGLXmTopLevelShellfpprint_top
 
G4OpenGLXmFramedBoxfpproj_style_box
 
G4OpenGLXmFramedBoxfpreset_box
 
G4OpenGLXmPushButtonfpreset_button
 
G4bool fPrintColour
 
G4int fPrintSizeX
 
G4int fPrintSizeY
 
G4OpenGLXmTextFieldfprot_set
 
G4OpenGLXmFourArrowButtonsfprotation_arrow
 
G4OpenGLXmBoxfprotation_arrow_box
 
G4OpenGLXmRadioButtonfprotation_button1
 
G4OpenGLXmRadioButtonfprotation_button2
 
G4OpenGLXmBoxfprotation_button_box
 
G4OpenGLXmSliderBarfprotation_slider
 
G4OpenGLXmBoxfprotation_slider_box
 
G4OpenGLXmTopLevelShellfprotation_top
 
G4OpenGLXmFramedBoxfpsetting_box
 
G4OpenGLXmTopLevelShellfpsetting_top
 
G4OpenGLXmFramedBoxfpwobble_box
 
G4OpenGLXmPushButtonfpwobble_button
 
G4OpenGLXmSliderBarfpwobble_slider
 
G4OpenGLXmFramedBoxfpzoom_box
 
G4OpenGLXmTextFieldfpzoom_lower
 
G4OpenGLXmSliderBarfpzoom_slider
 
G4OpenGLXmTextFieldfpzoom_upper
 
Widget frame
 
G4int frameNo
 
G4double fRot_sens
 
G4VSceneHandlerfSceneHandler
 
G4String fShortName
 
G4bool fVectoredPs
 
G4int fViewId
 
G4ViewParameters fVP
 
unsigned int fWinSize_x
 
unsigned int fWinSize_y
 
Widget glxarea
 
XmString halo_str
 
G4bool haloing_enabled
 
Widget haloing_pullright
 
XmString hlhsr_str
 
XmString hlr_str
 
XmString hsr_str
 
Pixmap icon_pixmap
 
XTextProperty iconName
 
Widget main_win
 
G4int major
 
Widget menubar
 
G4int minor
 
Widget misc_cascade
 
XmString misc_str
 
XSizeHints * norm_hints
 
XmString off_str
 
XmString on_str
 
G4Vector3D original_vp
 
G4double pan_high
 
G4double pan_low
 
G4bool pan_right
 
G4double pan_sens_limit
 
XmString pan_str
 
XtIntervalId pan_timer
 
G4bool pan_up
 
XmString polyhedron_str
 
XmString print_str
 
XmString quit_str
 
G4double rot_sens_limit
 
XmString rot_str
 
G4bool rotate_right
 
G4bool rotate_up
 
XtIntervalId rotation_timer
 
XmString set_str
 
Widget shell
 
XSizeHints * size_hints
 
Widget spec_cascade
 
XmString spec_str
 
Widget style_cascade
 
XmString style_str
 
XSetWindowAttributes swa
 
Widget toplevel
 
XmString trans_str
 
G4bool transparency_enabled
 
Widget transparency_pullright
 
XVisualInfo * vi
 
XVisualInfo * vi_immediate
 
XVisualInfo * vi_stored
 
XmString white_str
 
GLXDrawable win
 
XTextProperty windowName
 
XmString wireframe_str
 
XWMHints * wm_hints
 
G4double wob_high
 
G4double wob_low
 
G4double wob_sens
 
XtIntervalId wobble_timer
 
XtWorkProcId workId
 
Atom Xatom
 
XWindowAttributes xwa
 
G4double zoom_high
 
G4double zoom_low
 

Static Protected Attributes

static int dblBuf_RGBA [13]
 
static int snglBuf_RGBA [12]
 
static XVisualInfo * vi_double_buffer = 0
 
static XVisualInfo * vi_single_buffer = 0
 

Private Member Functions

 G4OpenGLXmViewer (const G4OpenGLXmViewer &)
 
G4int getRealExportHeight ()
 
G4int getRealExportWidth ()
 
GLubyte * grabPixels (int inColor, unsigned int width, unsigned int height)
 
G4OpenGLXmVieweroperator= (const G4OpenGLXmViewer &)
 
bool printGl2PS ()
 
bool printNonVectoredEPS ()
 
bool printVectoredEPS ()
 
void rotateSceneInViewDirection (G4double dx, G4double dy)
 
void rotateSceneThetaPhi (G4double dx, G4double dy)
 
void UpdateControlPanel ()
 

Private Attributes

G4String fDefaultExportFilename
 
G4String fExportFilename
 
int fGl2psDefaultLineWith
 
int fGl2psDefaultPointSize
 
bool fGlViewInitialized
 
bool fIsGettingPickInfos
 
G4float fPointSize
 
G4bool fSizeHasChanged
 
GLXContext tmp_cx
 

Friends

class G4OpenGLXmViewerMessenger
 
class G4OpenGLXmVWidgetObject
 

Detailed Description

Definition at line 51 of file G4OpenGLXmViewer.hh.

Constructor & Destructor Documentation

◆ G4OpenGLXmViewer() [1/2]

G4OpenGLXmViewer::G4OpenGLXmViewer ( G4OpenGLSceneHandler scene)

Definition at line 667 of file G4OpenGLXmViewer.cc.

667 :
668G4VViewer (scene, -1),
669G4OpenGLViewer (scene),
670G4OpenGLXViewer (scene),
671toplevel (0),
672shell (0),
673main_win (0),
674menubar (0),
675style_cascade (0),
677misc_cascade (0),
678spec_cascade (0),
685frame (0),
686glxarea (0),
687style_str (0),
688actions_str (0),
689misc_str (0),
690spec_str (0),
691draw_str (0),
693wireframe_str (0),
694hlr_str (0),
695hsr_str (0),
696hlhsr_str (0),
697set_str (0),
698rot_str (0),
699pan_str (0),
700exit_str (0),
701quit_str (0),
702print_str (0),
703white_str (0),
704black_str (0),
705anti_str (0),
706trans_str (0),
707halo_str (0),
708aux_edge_str (0),
709bgnd_str (0),
710off_str (0),
711on_str (0),
712zoom_high (0.0),
713zoom_low (0.0),
714pan_low (0.0),
715pan_high (0.0),
716dolly_low (0.0),
717dolly_high (0.0),
718fov (0.0),
719rot_sens_limit (0.0),
720pan_sens_limit (0.0),
721wob_high (0.0),
722wob_low (0.0),
723wob_sens (0.0),
724pan_right (false),
725rotate_right (false),
726pan_up (false),
727rotate_up (false),
729frameNo (0),
738fppanning_top (0),
739fppanning_box (0),
742fpzoom_box (0),
743fpzoom_slider (0),
744fpdolly_box (0),
746fpsetting_top (0),
747fpsetting_box (0),
748fppan_set (0),
749fprot_set (0),
750fpzoom_upper (0),
751fpzoom_lower (0),
752fpdolly_upper (0),
753fpdolly_lower (0),
754fpok_button (0),
756fpwobble_box (0),
759fpreset_box (0),
764fpfov_text (0),
765fpprint_top (0),
766fpprint_box (0),
769fpprint_text (0),
771fpprint_line (0),
776{
778 ResetView();
779 if (fViewId < 0) return;
780}
G4OpenGLViewer(G4OpenGLSceneHandler &scene)
G4OpenGLXViewer(G4OpenGLSceneHandler &scene)
G4OpenGLXmPushButton * fpok_button
G4OpenGLXmTopLevelShell * fpmiscellany_top
G4OpenGLXmFramedBox * fpprint_style_box
G4OpenGLXmPushButton * fpwobble_button
G4OpenGLXmBox * fprotation_slider_box
G4OpenGLXmSliderBar * fppanning_slider
G4OpenGLXmSliderBar * fprotation_slider
G4OpenGLXmTextField * fpfov_text
G4OpenGLXmTextField * fprot_set
G4OpenGLXmBox * fprotation_button_box
G4OpenGLXmTopLevelShell * fpsetting_top
G4OpenGLXmTextField * fpdolly_lower
G4OpenGLXmTextField * fpzoom_lower
G4OpenGLXmRadioButton * fpperspective_button
G4OpenGLXmSeparator * fpprint_line
G4OpenGLXmRadioButton * fpprint_style_radio1
G4OpenGLXmFramedBox * fpproj_style_box
G4OpenGLXmPushButton * fpreset_button
G4OpenGLXmRadioButton * fporthogonal_button
G4OpenGLXmTextField * fpprint_text
G4OpenGLXmTopLevelShell * fpprint_top
G4OpenGLXmFramedBox * fpzoom_box
G4OpenGLXmFramedBox * fpprint_box
G4OpenGLXmPushButton * fpprint_button
G4OpenGLXmRadioButton * fpprint_style_radio2
Widget drawing_style_pullright
G4OpenGLXmTextField * fpdolly_upper
G4OpenGLXmRadioButton * fprotation_button1
G4OpenGLXmFramedBox * fppanning_box
G4OpenGLXmBox * fprotation_arrow_box
G4OpenGLXmFramedBox * fpprint_col_box
G4OpenGLXmSliderBar * fpwobble_slider
G4OpenGLXmTopLevelShell * fppanning_top
G4OpenGLXmRadioButton * fpprint_col_radio1
G4OpenGLXmSliderBar * fpzoom_slider
G4OpenGLXmFramedBox * fpsetting_box
G4OpenGLXmTopLevelShell * fprotation_top
G4OpenGLXmSliderBar * fpdolly_slider
G4OpenGLXmRadioButton * fprotation_button2
G4OpenGLXmFramedBox * fpdolly_box
G4OpenGLXmTextField * fpzoom_upper
G4OpenGLXmRadioButton * fpprint_col_radio2
Widget background_color_pullright
G4OpenGLXmFramedBox * fpwobble_box
G4OpenGLXmFourArrowButtons * fprotation_arrow
G4OpenGLXmFramedBox * fpreset_box
G4OpenGLXmTextField * fppan_set
G4OpenGLXmFourArrowButtons * fppanning_arrows
G4int fViewId
Definition: G4VViewer.hh:216
G4ViewParameters fVP
Definition: G4VViewer.hh:219
G4VViewer(G4VSceneHandler &, G4int id, const G4String &name="")
Definition: G4VViewer.cc:46
const G4Vector3D & GetViewpointDirection() const

References G4VViewer::fViewId, GetXmConnection(), and ResetView().

◆ ~G4OpenGLXmViewer()

G4OpenGLXmViewer::~G4OpenGLXmViewer ( )
virtual

Definition at line 839 of file G4OpenGLXmViewer.cc.

840{
841 XtDestroyWidget (shell);
842 win = 0; // ...to avoid XDestroyWindow in G4OpenGLXViewer base class
843 // because XtDestroyWidget has already destroyed it.
845
846/******************************
847 if (fprotation_top) {
848 delete fprotation_top;
849 }
850
851 if (fppanning_top) {
852 delete fppanning_top;
853 }
854
855 if (fpsetting_top) {
856 delete fpsetting_top;
857 }
858
859 if (fpmiscellany_top) {
860 delete fpmiscellany_top;
861 }
862******************************/
863
864}
void RemoveShell(G4Interactor)
static G4Xt * getInstance()
Definition: G4Xt.cc:55

References G4Xt::getInstance(), G4VInteractorManager::RemoveShell(), shell, and G4OpenGLXViewer::win.

◆ G4OpenGLXmViewer() [2/2]

G4OpenGLXmViewer::G4OpenGLXmViewer ( const G4OpenGLXmViewer )
private

Member Function Documentation

◆ actions_callback()

void G4OpenGLXmViewer::actions_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 58 of file G4OpenGLXmMainMenubarCallbacks.cc.

61{
62
63 G4OpenGLXmViewer* pView;
64 G4long choice = (G4long)clientData;
65
66
67 XtVaGetValues (XtParent(w),
68 XmNuserData, &pView,
69 NULL);
70
71 switch (choice) {
72
73 case 0:
74
75 {
76
77 if (!pView->fprotation_top) {
78 std::ostringstream rot_Name;
79 rot_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
80
81 pView->fprotation_top = new G4OpenGLXmTopLevelShell (pView,
82 (char*)rot_Name.str().c_str());
83 pView->fprotation_button_box = new G4OpenGLXmBox ("Rotation button box", True);
84
86
87 XtCallbackRec* rot_cb_list = new XtCallbackRec[2];
88 rot_cb_list[0].callback = set_rot_subject_callback;
89 rot_cb_list[0].closure = pView;
90 rot_cb_list[1].callback = NULL;
91
93 ("Object",
94 rot_cb_list,
96 0);
97
99 ("Camera",
100 rot_cb_list,
102 1);
103
106
107 pView->fprotation_slider_box = new G4OpenGLXmBox ("Rotation slider box", False);
109
110 XtCallbackRec* rot_slider_list = new XtCallbackRec[2];
111 rot_slider_list[0].callback = set_rot_sens_callback;
112 rot_slider_list[0].closure = pView;
113 rot_slider_list[1].callback = NULL;
114
115 pView->fprotation_slider = new G4OpenGLXmSliderBar ("Rotation slider",
116 rot_slider_list,
117 True,
118 2,
119 pView->fRot_sens,
120 pView->rot_sens_limit,
121 0);
123
124 pView->fprotation_arrow_box = new G4OpenGLXmBox ("Rotation arrow box", False);
126
127 XtCallbackRec** rotation_callbacks = new XtCallbackRec*[4];
128 for (G4int i = 0; i < 4; i++) {
129 rotation_callbacks[i] = new XtCallbackRec[2];
130 }
131 rotation_callbacks[0][0].callback = phi_rotation_callback;
132 rotation_callbacks[0][0].closure = pView;
133 rotation_callbacks[0][1].callback = NULL;
134
135 rotation_callbacks[1][0].callback = phi_rotation_callback;
136 rotation_callbacks[1][0].closure = pView;
137 rotation_callbacks[1][1].callback = NULL;
138
139 rotation_callbacks[2][0].callback = theta_rotation_callback;
140 rotation_callbacks[2][0].closure = pView;
141 rotation_callbacks[2][1].callback = NULL;
142
143 rotation_callbacks[3][0].callback = theta_rotation_callback;
144 rotation_callbacks[3][0].closure = pView;
145 rotation_callbacks[3][1].callback = NULL;
146
147 pView->fprotation_arrow = new G4OpenGLXmFourArrowButtons (rotation_callbacks);
148
150
151 pView->fprotation_top->Realize ();
152 }
153 break;
154
155 }
156
157
158 case 1:
159 {
160 if (!pView->GetSceneHandler()->GetScene()) {
161 break;
162 }
163 if (!pView->fppanning_top) {
164 std::ostringstream pan_Name;
165 pan_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
166
167 pView->fppanning_top = new G4OpenGLXmTopLevelShell (pView,
168 (char*)pan_Name.str().c_str());
169
170 pView->fppanning_box = new G4OpenGLXmFramedBox ("Pan up-down-left-right",
171 False);
172
173 pView->fppanning_top->AddChild (pView->fppanning_box);
174
175 XtCallbackRec** pan_callbacks = new XtCallbackRec*[4];
176 for (G4int i = 0; i < 4; i++) {
177 pan_callbacks[i] = new XtCallbackRec[2];
178 }
179 pan_callbacks[0][0].callback = pan_up_down_callback;
180 pan_callbacks[0][0].closure = pView;
181 pan_callbacks[0][1].callback = NULL;
182
183 pan_callbacks[1][0].callback = pan_up_down_callback;
184 pan_callbacks[1][0].closure = pView;
185 pan_callbacks[1][1].callback = NULL;
186
187 pan_callbacks[2][0].callback = pan_left_right_callback;
188 pan_callbacks[2][0].closure = pView;
189 pan_callbacks[2][1].callback = NULL;
190
191 pan_callbacks[3][0].callback = pan_left_right_callback;
192 pan_callbacks[3][0].closure = pView;
193 pan_callbacks[3][1].callback = NULL;
194
195 pView->fppanning_arrows = new G4OpenGLXmFourArrowButtons (pan_callbacks);
196
197 pView->fppanning_box->AddChild (pView->fppanning_arrows);
198
199 XtCallbackRec* pan_slider_list = new XtCallbackRec[2];
200 pan_slider_list[0].callback = set_pan_sens_callback;
201 pan_slider_list[0].closure = pView;
202 pan_slider_list[1].callback = NULL;
203
204 pView->fppanning_slider = new G4OpenGLXmSliderBar ("Panning slider",
205 pan_slider_list,
206 True,
207 2,
208 pView->fPan_sens = pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius() / 10.0,
210 0);
211 pView->fppanning_box->AddChild (pView->fppanning_slider);
212
213 pView->fpzoom_box = new G4OpenGLXmFramedBox ("Zoom",
214 False);
215 pView->fppanning_top->AddChild (pView->fpzoom_box);
216
217 XtCallbackRec* zoom_slider_list = new XtCallbackRec[2];
218 zoom_slider_list[0].callback = zoom_callback;
219 zoom_slider_list[0].closure = pView;
220 zoom_slider_list[1].callback = NULL;
221
222 pView->fpzoom_slider = new G4OpenGLXmSliderBar ("Zoom slider",
223 zoom_slider_list,
224 True,
225 2,
226 pView->fVP.GetZoomFactor(),
227 pView->zoom_high,
228 pView->zoom_low);
229 pView->fpzoom_box->AddChild (pView->fpzoom_slider);
230
231 pView->fpdolly_box = new G4OpenGLXmFramedBox ("Dolly",
232 False);
233 pView->fppanning_top->AddChild (pView->fpdolly_box);
234
235 XtCallbackRec* dolly_slider_list = new XtCallbackRec[2];
236 dolly_slider_list[0].callback = dolly_callback;
237 dolly_slider_list[0].closure = pView;
238 dolly_slider_list[1].callback = NULL;
239
240 pView->fpdolly_slider = new G4OpenGLXmSliderBar ("Dolly slider",
241 dolly_slider_list,
242 True,
243 2,
244 pView->fVP.GetDolly(),
246 pView->dolly_low = -(pView->GetSceneHandler()->GetScene()->GetExtent().GetExtentRadius()));
247 // pView->dolly_high,
248 // pView->dolly_low);
249 pView->fpdolly_box->AddChild (pView->fpdolly_slider);
250
251 pView->fppanning_top->Realize ();
252 pView->UpdateControlPanel ();
253 }
254
255 break;
256
257 }
258 case 2:
259 {
260
261 if (!pView->fpsetting_top) {
262 std::ostringstream set_Name;
263 set_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
264
265 pView->fpsetting_top = new G4OpenGLXmTopLevelShell(pView,
266 (char*)set_Name.str().c_str());
267
268 pView->fpsetting_box = new G4OpenGLXmFramedBox ("Set values for control panels",
269 False);
270 pView->fpsetting_top->AddChild (pView->fpsetting_box);
271
272 pView->fppan_set = new G4OpenGLXmTextField ("Upper limit of pan sensitivity",
273 &(pView->pan_sens_limit));
274
275 pView->fprot_set = new G4OpenGLXmTextField ("Upper limit of rotation sensitivity",
276 &(pView->rot_sens_limit));
277
278 pView->fpzoom_upper = new G4OpenGLXmTextField ("Upper limit of zoom",
279 &(pView->zoom_high));
280
281 pView->fpzoom_lower = new G4OpenGLXmTextField ("Lower limit of zoom",
282 &(pView->zoom_low));
283
284 pView->fpdolly_upper = new G4OpenGLXmTextField ("Upper limit of dolly",
285 &(pView->dolly_high));
286
287 pView->fpdolly_lower = new G4OpenGLXmTextField ("Lower limit of dolly",
288 &(pView->dolly_low));
289
290 XtCallbackRec* ok_list = new XtCallbackRec[2];
291 ok_list[0].callback = update_panels_callback;
292 ok_list[0].closure = pView;
293 ok_list[1].callback = NULL;
294
295
296 pView->fpok_button = new G4OpenGLXmPushButton ("ok",
297 ok_list);
298
299 pView->fpsetting_box->AddChild (pView->fppan_set);
300 pView->fpsetting_box->AddChild (pView->fprot_set);
301 pView->fpsetting_box->AddChild (pView->fpzoom_upper);
302 pView->fpsetting_box->AddChild (pView->fpzoom_lower);
303 pView->fpsetting_box->AddChild (pView->fpdolly_upper);
304 pView->fpsetting_box->AddChild (pView->fpdolly_lower);
305 pView->fpsetting_box->AddChild (pView->fpok_button);
306
307 pView->fpsetting_top->Realize ();
308
309 }
310
311 break;
312 }
313
314 default:
316 ("G4OpenGLXmViewer::actions_callback",
317 "opengl2001", FatalException,
318 "Unrecognised widget child of control_callback");
319 }
320
321 return;
322}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
long G4long
Definition: G4Types.hh:87
int G4int
Definition: G4Types.hh:85
void AddChild(G4OpenGLXmVWidgetComponent *)
void AddChild(G4OpenGLXmVWidgetComponent *)
void AddChild(G4OpenGLXmVWidgetContainer *)
static void set_pan_sens_callback(Widget w, XtPointer clientData, XtPointer callData)
static void phi_rotation_callback(Widget w, XtPointer clientData, XtPointer callData)
static void set_rot_sens_callback(Widget w, XtPointer clientData, XtPointer callData)
static void pan_up_down_callback(Widget w, XtPointer clientData, XtPointer callData)
static void pan_left_right_callback(Widget w, XtPointer clientData, XtPointer callData)
static void set_rot_subject_callback(Widget w, XtPointer clientData, XtPointer callData)
static void zoom_callback(Widget w, XtPointer clientData, XtPointer callData)
static void dolly_callback(Widget w, XtPointer clientData, XtPointer callData)
static void theta_rotation_callback(Widget w, XtPointer clientData, XtPointer callData)
static void update_panels_callback(Widget w, XtPointer clientData, XtPointer callData)
const G4VisExtent & GetExtent() const
G4Scene * GetScene() const
G4int GetSceneHandlerId() const
const G4ViewParameters & GetViewParameters() const
G4VSceneHandler * GetSceneHandler() const
G4double GetZoomFactor() const
G4bool GetLightsMoveWithCamera() const
G4double GetDolly() const
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:75

References G4OpenGLXmBox::AddChild(), G4OpenGLXmFramedBox::AddChild(), G4OpenGLXmTopLevelShell::AddChild(), dolly_callback(), dolly_high, dolly_low, FatalException, G4OpenGLViewer::fPan_sens, fpdolly_box, fpdolly_lower, fpdolly_slider, fpdolly_upper, fpok_button, fppan_set, fppanning_arrows, fppanning_box, fppanning_slider, fppanning_top, fprot_set, fprotation_arrow, fprotation_arrow_box, fprotation_button1, fprotation_button2, fprotation_button_box, fprotation_slider, fprotation_slider_box, fprotation_top, fpsetting_box, fpsetting_top, fpzoom_box, fpzoom_lower, fpzoom_slider, fpzoom_upper, G4OpenGLViewer::fRot_sens, G4VViewer::fViewId, G4VViewer::fVP, G4Exception(), G4ViewParameters::GetDolly(), G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4ViewParameters::GetLightsMoveWithCamera(), G4VSceneHandler::GetScene(), G4VViewer::GetSceneHandler(), G4VSceneHandler::GetSceneHandlerId(), G4VViewer::GetViewParameters(), G4ViewParameters::GetZoomFactor(), pan_left_right_callback(), pan_sens_limit, pan_up_down_callback(), phi_rotation_callback(), G4OpenGLXmTopLevelShell::Realize(), rot_sens_limit, set_pan_sens_callback(), set_rot_sens_callback(), set_rot_subject_callback(), theta_rotation_callback(), update_panels_callback(), UpdateControlPanel(), zoom_callback(), zoom_high, and zoom_low.

Referenced by CreateMainWindow().

◆ Add_four_arrow_buttons()

void G4OpenGLXmViewer::Add_four_arrow_buttons ( G4OpenGLXmViewer pView,
XtCallbackRec **  arrow_callbacks,
Widget *  parent_widget 
)
static

Definition at line 49 of file G4OpenGLXmConvenienceRoutines.cc.

51 {
52
53 Widget arrow_form = XtVaCreateWidget
54 ("arrow_form",
55 xmFormWidgetClass,
56 *parent_widget,
57 XmNfractionBase, 3,
58 XtNvisual, pView->vi->visual,
59 XtNdepth, pView->vi->depth,
60 XtNcolormap, pView->cmap,
61 XtNborderColor, pView->borcol,
62 XtNbackground, pView->bgnd,
63 NULL);
64
65 Widget arrow = XtVaCreateManagedWidget
66 ("up_arrow",
67 xmArrowButtonGadgetClass,
68 arrow_form,
69 XmNtopAttachment, XmATTACH_POSITION,
70 XmNtopPosition, 0,
71 XmNbottomAttachment, XmATTACH_POSITION,
72 XmNbottomPosition, 1,
73 XmNleftAttachment, XmATTACH_POSITION,
74 XmNleftPosition, 1,
75 XmNrightAttachment, XmATTACH_POSITION,
76 XmNrightPosition, 2,
77 XmNarrowDirection, XmARROW_UP,
78 NULL);
79
80 XtVaSetValues (arrow,
81 XmNuserData, True,
82 NULL);
83
84 XtAddCallbacks (arrow,
85 XmNactivateCallback,
86 arrow_callbacks[0]);
87
88 XtAddCallbacks (arrow,
89 XmNarmCallback,
90 arrow_callbacks[0]);
91
92 XtAddCallbacks (arrow,
93 XmNdisarmCallback,
94 arrow_callbacks[0]);
95
96 arrow = XtVaCreateManagedWidget
97 ("down_arrow",
98 xmArrowButtonGadgetClass,
99 arrow_form,
100 XmNtopAttachment, XmATTACH_POSITION,
101 XmNtopPosition, 2,
102 XmNbottomAttachment, XmATTACH_POSITION,
103 XmNbottomPosition, 3,
104 XmNleftAttachment, XmATTACH_POSITION,
105 XmNleftPosition, 1,
106 XmNrightAttachment, XmATTACH_POSITION,
107 XmNrightPosition, 2,
108 XmNarrowDirection, XmARROW_DOWN,
109 NULL);
110
111 XtVaSetValues (arrow,
112 XmNuserData, False,
113 NULL);
114
115 XtAddCallbacks (arrow,
116 XmNactivateCallback,
117 arrow_callbacks[1]);
118
119 XtAddCallbacks (arrow,
120 XmNarmCallback,
121 arrow_callbacks[1]);
122
123 XtAddCallbacks (arrow,
124 XmNdisarmCallback,
125 arrow_callbacks[1]);
126
127 arrow = XtVaCreateManagedWidget
128 ("left_arrow",
129 xmArrowButtonGadgetClass,
130 arrow_form,
131 XmNtopAttachment, XmATTACH_POSITION,
132 XmNtopPosition, 1,
133 XmNbottomAttachment, XmATTACH_POSITION,
134 XmNbottomPosition, 2,
135 XmNleftAttachment, XmATTACH_POSITION,
136 XmNleftPosition, 0,
137 XmNrightAttachment, XmATTACH_POSITION,
138 XmNrightPosition, 1,
139 XmNarrowDirection, XmARROW_LEFT,
140 NULL);
141
142 XtVaSetValues (arrow,
143 XmNuserData, False,
144 NULL);
145
146 XtAddCallbacks (arrow,
147 XmNactivateCallback,
148 arrow_callbacks[2]);
149
150 XtAddCallbacks (arrow,
151 XmNarmCallback,
152 arrow_callbacks[2]);
153
154 XtAddCallbacks (arrow,
155 XmNdisarmCallback,
156 arrow_callbacks[2]);
157
158 arrow = XtVaCreateManagedWidget
159 ("right_arrow",
160 xmArrowButtonGadgetClass,
161 arrow_form,
162 XmNtopAttachment, XmATTACH_POSITION,
163 XmNtopPosition, 1,
164 XmNbottomAttachment, XmATTACH_POSITION,
165 XmNbottomPosition, 2,
166 XmNleftAttachment, XmATTACH_POSITION,
167 XmNleftPosition, 2,
168 XmNrightAttachment, XmATTACH_POSITION,
169 XmNrightPosition, 3,
170 XmNarrowDirection, XmARROW_RIGHT,
171 NULL);
172
173 XtVaSetValues (arrow,
174 XmNuserData, True,
175 NULL);
176
177 XtAddCallbacks (arrow,
178 XmNactivateCallback,
179 arrow_callbacks[3]);
180
181 XtAddCallbacks (arrow,
182 XmNarmCallback,
183 arrow_callbacks[3]);
184
185 XtAddCallbacks (arrow,
186 XmNdisarmCallback,
187 arrow_callbacks[3]);
188
189 XtManageChild (arrow_form);
190
191}
XVisualInfo * vi

References bgnd, borcol, G4OpenGLXViewer::cmap, and G4OpenGLXViewer::vi.

◆ Add_radio_box()

void G4OpenGLXmViewer::Add_radio_box ( char *  label_string,
Widget *  parent_frame_widget,
XtCallbackRec *  radio_box_cb,
G4int  num_buttons,
G4int  default_button,
char *  radio_box_name,
char **  button_names,
G4OpenGLXmViewer pView 
)
static

Definition at line 193 of file G4OpenGLXmConvenienceRoutines.cc.

201{
202 XmString button_str = XmStringCreateLocalized((char*) ""); // ...to
203 // initialise to something to avoid pedantic warning.
204 Arg** args;
205 args = new Arg* [num_buttons];
206 Widget button;
207
208 G4int i;
209 for (i = 0; i < num_buttons; i++) {
210
211 args[i] = new Arg[7];
212 button_str = XmStringCreateLocalized (button_names[i]);
213
214 XtSetArg (args[i][0], XtNvisual, pView->vi->visual);
215 XtSetArg (args[i][1], XtNdepth, pView->vi->depth);
216 XtSetArg (args[i][2], XtNcolormap, pView->cmap);
217 XtSetArg (args[i][3], XtNborderColor, pView->borcol);
218 XtSetArg (args[i][4], XtNbackground, pView->bgnd);
219 XtSetArg (args[i][5], XmNlabelString, button_str);
220
221 if (i == default_button) {
222 XtSetArg (args[i][6], XmNset, True);
223 } else {
224 XtSetArg (args[i][6], XmNset, False);
225 }
226 }
227
228 Widget radio_box = XtVaCreateWidget (radio_box_name,
229 xmRowColumnWidgetClass,
230 *parent_widget,
231 XmNisHomogeneous, False,
232 XmNradioBehavior, True,
233 XmNradioAlwaysOne, True,
234 XmNuserData, pView,
235 XtNvisual, pView->vi->visual,
236 XtNdepth, pView->vi->depth,
237 XtNcolormap, pView->cmap,
238 XtNborderColor, pView->borcol,
239 XtNbackground, pView->bgnd,
240 NULL);
241
242 XmString lab = XmStringCreateLocalized (label_string);
243
244 // Unused!
245 //Widget label = XtVaCreateManagedWidget ("radio_label",
246 // xmLabelWidgetClass,
247 // radio_box,
248 // XmNalignment, XmALIGNMENT_CENTER,
249 // XmNlabelString, lab,
250 // XtNvisual, pView->vi->visual,
251 // XtNdepth, pView->vi->depth,
252 // XtNcolormap, pView->cmap,
253 // XtNborderColor, pView->borcol,
254 // XtNbackground, pView->bgnd,
255 // NULL);
256
257 XmStringFree (lab);
258
259 for (i = 0; i < num_buttons; i++) {
260 button = XtCreateManagedWidget (button_names[i],
261 xmToggleButtonWidgetClass,
262 radio_box,
263 args[i],
264 7);
265 XtVaSetValues (button,
266 XmNuserData, i,
267 NULL);
268
269 XtAddCallbacks (button,
270 XmNarmCallback,
271 radio_box_callback);
272 }
273
274 XtManageChild (radio_box);
275
276 XmStringFree (button_str);
277
278 for (i = 0; i < num_buttons; i++) {
279
280 delete[] args[i];
281
282 }
283
284 delete[] args;
285}
static char ** args
Definition: G4Xt.cc:51

References args, bgnd, borcol, G4OpenGLXViewer::cmap, and G4OpenGLXViewer::vi.

◆ Add_set_field()

void G4OpenGLXmViewer::Add_set_field ( char *  widget,
char *  widget_text,
Widget *  row_col_box,
Widget *  wid,
G4double val,
G4OpenGLXmViewer pView 
)
static

Definition at line 287 of file G4OpenGLXmConvenienceRoutines.cc.

293{
294
295 char local_w_text[50];
296 strcpy (local_w_text, w_text);
297
298 char label_name[50];
299 strcpy (label_name, w_name);
300 strcat (label_name, "_label");
301
302 char text_field_name[50];
303 strcpy (text_field_name, w_name);
304 strcat (text_field_name, "_text_field");
305
306 XmString local_text = XmStringCreateLocalized (local_w_text);
307
308 // Unused!
309 // Widget label = XtVaCreateManagedWidget (label_name,
310 // xmLabelWidgetClass,
311 // *row_col_box,
312 // XmNlabelString, local_text,
313 // XtNvisual, pView->vi->visual,
314 // XtNdepth, pView->vi->depth,
315 // XtNcolormap, pView->cmap,
316 // XtNborderColor, pView->borcol,
317 // XtNbackground, pView->bgnd,
318 // NULL);
319
320 XmStringFree (local_text);
321
322 char initial[50];
323 sprintf (initial, "%6.2f", *val);
324
325 *wid = XtVaCreateManagedWidget (text_field_name,
326 xmTextFieldWidgetClass,
327 *row_col_box,
328 XmNvalue, (String)initial,
329 XtNvisual, pView->vi->visual,
330 XtNdepth, pView->vi->depth,
331 XtNcolormap, pView->cmap,
332 XtNborderColor, pView->borcol,
333 XtNbackground, pView->bgnd,
334 NULL);
335
336 XtAddCallback (*wid,
337 XmNvalueChangedCallback,
339 val);
340
341 /* Not actually used - comment out to prevent compiler warnings.
342 Instead, just in case it matters, just invoke
343 XtVaCreateManagedWidget (JA)
344 Widget sep = XtVaCreateManagedWidget ("sep",
345 xmSeparatorWidgetClass,
346 *row_col_box,
347 XmNorientation, XmHORIZONTAL,
348 XtNvisual, pView->vi->visual,
349 XtNdepth, pView->vi->depth,
350 XtNcolormap, pView->cmap,
351 XtNborderColor, pView->borcol,
352 XtNbackground, pView->bgnd,
353 NULL);
354 sep = XtVaCreateManagedWidget ("sep",
355 xmSeparatorWidgetClass,
356 *row_col_box,
357 XmNseparatorType, XmNO_LINE,
358 XmNmargin, 1,
359 XmNorientation, XmHORIZONTAL,
360 XtNvisual, pView->vi->visual,
361 XtNdepth, pView->vi->depth,
362 XtNcolormap, pView->cmap,
363 XtNborderColor, pView->borcol,
364 XtNbackground, pView->bgnd,
365 NULL);
366 */
367 XtVaCreateManagedWidget ("sep",
368 xmSeparatorWidgetClass,
369 *row_col_box,
370 XmNseparatorType, XmNO_LINE,
371 XmNmargin, 1,
372 XmNorientation, XmHORIZONTAL,
373 XtNvisual, pView->vi->visual,
374 XtNdepth, pView->vi->depth,
375 XtNcolormap, pView->cmap,
376 XtNborderColor, pView->borcol,
377 XtNbackground, pView->bgnd,
378 NULL);
379}
const G4DNABoundingBox initial
static void get_double_value_callback(Widget w, XtPointer clientData, XtPointer callData)

References bgnd, borcol, G4OpenGLXViewer::cmap, get_double_value_callback(), initial, and G4OpenGLXViewer::vi.

◆ Add_slider_box()

void G4OpenGLXmViewer::Add_slider_box ( char *  label_string,
G4int  num_sliders,
char **  slider_name,
G4OpenGLXmViewer pView,
G4double min_array,
G4double max_array,
G4double value_array,
G4bool show,
short *  decimals,
unsigned char *  orientation,
unsigned char *  direction,
XtCallbackRec **  slider_box_cb,
Widget *  parent_frame_widget 
)
static

Definition at line 381 of file G4OpenGLXmConvenienceRoutines.cc.

394{
395 XmString slider_name_str = XmStringCreateLocalized((char*) ""); // ...to
396 // initialise to something to avoid pedantic warning.
397 Arg** slider_args;
398 slider_args = new Arg*[num_sliders];
399 Widget slider;
400 G4int j = 0;
401
402 G4int i;
403 for (i = 0; i < num_sliders; i++) {
404 j = 0;
405 slider_args[i] = new Arg[13];
406 slider_name_str = XmStringCreateLtoR (slider_names[i],
407 XmFONTLIST_DEFAULT_TAG);
408
409 XtSetArg (slider_args[i][j],
410 XtNvisual, pView->vi->visual); j++;
411 XtSetArg (slider_args[i][j],
412 XtNdepth, pView->vi->depth); j++;
413 XtSetArg (slider_args[i][j],
414 XtNcolormap, pView->cmap); j++;
415 XtSetArg (slider_args[i][j],
416 XtNborderColor, pView->borcol); j++;
417 XtSetArg (slider_args[i][j],
418 XtNbackground, pView->bgnd); j++;
419
420 XtSetArg (slider_args[i][j],
421 XmNtitleString, slider_name_str); j++;
422
423 XtSetArg (slider_args[i][j],
424 XmNmaximum, G4int(max_array[i] * std::pow(10.0, (G4double)decimals[i]))); j++;
425 XtSetArg (slider_args[i][j],
426 XmNminimum, G4int(min_array[i] * std::pow(10.0, (G4double)decimals[i]))); j++;
427 XtSetArg (slider_args[i][j],
428 XmNvalue, G4int(value_array[i] * std::pow(10.0, (G4double)decimals[i]))); j++;
429 XtSetArg (slider_args[i][j],
430 XmNshowValue, show[i]); j++;
431 XtSetArg (slider_args[i][j],
432 XmNdecimalPoints, decimals[i]); j++;
433
434 XtSetArg (slider_args[i][j],
435 XmNorientation, orientation[i]); j++;
436 XtSetArg (slider_args[i][j],
437 XmNprocessingDirection, direction[i]); j++;
438
439 }
440
441 Widget slider_box = XtVaCreateWidget ("slider_box",
442 xmRowColumnWidgetClass,
443 *parent_widget,
444 XmNisHomogeneous, False,
445 XtNvisual, pView->vi->visual,
446 XtNdepth, pView->vi->depth,
447 XtNcolormap, pView->cmap,
448 XtNborderColor, pView->borcol,
449 XtNbackground, pView->bgnd,
450 NULL);
451
452 XmString lab = XmStringCreateLocalized (label_string);
453
454 // Unused!
455 //Widget label = XtVaCreateManagedWidget ("slider_label",
456 // xmLabelWidgetClass,
457 // slider_box,
458 // XmNlabelString, lab,
459 // XmNalignment, XmALIGNMENT_CENTER,
460 // XtNvisual, pView->vi->visual,
461 // XtNdepth, pView->vi->depth,
462 // XtNcolormap, pView->cmap,
463 // XtNborderColor, pView->borcol,
464 // XtNbackground, pView->bgnd,
465 // NULL);
466
467 XmStringFree (lab);
468
469 for (i = 0; i < num_sliders; i++) {
470
471 slider = XtCreateManagedWidget (slider_names[i],
472 xmScaleWidgetClass,
473 slider_box,
474 slider_args[i],
475 j);
476
477 XtAddCallbacks (slider,
478 XmNvalueChangedCallback,
479 slider_box_callbacks[i]);
480
481 XtAddCallbacks (slider,
482 XmNdragCallback,
483 slider_box_callbacks[i]);
484
485 }
486
487 XtManageChild (slider_box);
488 XmStringFree (slider_name_str);
489
490 for (i = 0; i < num_sliders; i++) {
491
492 delete[] slider_args[i];
493
494 }
495
496 delete[] slider_args;
497
498}
double G4double
Definition: G4Types.hh:83

References bgnd, borcol, G4OpenGLXViewer::cmap, and G4OpenGLXViewer::vi.

◆ addExportImageFormat()

void G4OpenGLViewer::addExportImageFormat ( std::string  format)
protectedinherited

Definition at line 1288 of file G4OpenGLViewer.cc.

1288 {
1289 fExportImageFormatVector.push_back(format);
1290}
std::vector< std::string > fExportImageFormatVector

References G4OpenGLViewer::fExportImageFormatVector.

Referenced by G4OpenGLQtViewer::G4OpenGLQtViewer(), and G4OpenGLViewer::G4OpenGLViewer().

◆ antialias_callback()

void G4OpenGLXmViewer::antialias_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 155 of file G4OpenGLXmStyleCallbacks.cc.

158{
159 G4long choice = (G4long)clientData;
160 G4OpenGLXmViewer* pView;
161 XtVaGetValues (XtParent(w),
162 XmNuserData, &pView,
163 NULL);
164
165 switch (choice) {
166
167 case 0:
168 pView->antialiasing_enabled = false;
169 glDisable (GL_LINE_SMOOTH);
170 glDisable (GL_POLYGON_SMOOTH);
171 break;
172
173 case 1:
174 pView->antialiasing_enabled = true;
175 glEnable (GL_LINE_SMOOTH);
176 glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
177 glEnable (GL_POLYGON_SMOOTH);
178 glHint (GL_POLYGON_SMOOTH_HINT, GL_NICEST);
179 break;
180
181 default:
183 ("G4OpenGLXmViewer::antialias_callback",
184 "opengl2010", FatalException,
185 "Unrecognised case in antialiasing_callback.");
186 }
187
188 pView->SetView ();
189 pView->ClearView ();
190 pView->DrawView ();
191}
G4bool antialiasing_enabled
virtual void DrawView()=0

References G4OpenGLViewer::antialiasing_enabled, G4OpenGLViewer::ClearView(), G4VViewer::DrawView(), FatalException, G4Exception(), and G4OpenGLXViewer::SetView().

Referenced by CreateMainWindow().

◆ aux_edge_callback()

void G4OpenGLXmViewer::aux_edge_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 225 of file G4OpenGLXmStyleCallbacks.cc.

228{
229 G4long choice = (G4long)clientData;
230 G4OpenGLXmViewer* pView;
231 XtVaGetValues (XtParent(w),
232 XmNuserData, &pView,
233 NULL);
234
235 switch (choice) {
236
237 case 0:
238 pView->fVP.SetAuxEdgeVisible(false);
239 break;
240
241 case 1:
242 pView->fVP.SetAuxEdgeVisible(true);
243 break;
244
245 default:
247 ("G4OpenGLXmViewer::aux_edge_callback",
248 "opengl2012", FatalException,
249 "Unrecognised case in aux_edge_callback.");
250 }
251
252 pView->SetNeedKernelVisit (true);
253 pView->SetView ();
254 pView->ClearView ();
255 pView->DrawView ();
256}
void SetNeedKernelVisit(G4bool need)
void SetAuxEdgeVisible(G4bool)

References G4OpenGLViewer::ClearView(), G4VViewer::DrawView(), FatalException, G4VViewer::fVP, G4Exception(), G4ViewParameters::SetAuxEdgeVisible(), G4VViewer::SetNeedKernelVisit(), and G4OpenGLXViewer::SetView().

Referenced by CreateMainWindow().

◆ background_color_callback()

void G4OpenGLXmViewer::background_color_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 82 of file G4OpenGLXmStyleCallbacks.cc.

85{
86 G4long choice = (G4long)clientData;
87 G4OpenGLXmViewer* pView;
88 XtVaGetValues (XtParent(w),
89 XmNuserData, &pView,
90 NULL);
91
92
93 //I need to revisit the kernel if the background colour changes and
94 //hidden line removal is enabled, because hlr drawing utilises the
95 //background colour in its drawing...
96 // (Note added by JA 13/9/2005) Background now handled in view
97 // parameters. A kernel visit is triggered on change of background.
98 switch (choice) {
99
100 case 0:
102 SetBackgroundColour(G4Colour(1.,1.,1.)); // White
103 break;
104
105 case 1:
107 SetBackgroundColour(G4Colour(0.,0.,0.)); // Black
108 break;
109
110 default:
112 ("G4OpenGLXmViewer::background_color_callback",
113 "opengl2008", FatalException,
114 "Unrecognised case in background_color_callback.");
115 }
116
117 pView->SetView ();
118 pView->ClearView ();
119 pView->DrawView ();
120}

References G4OpenGLViewer::ClearView(), G4VViewer::DrawView(), FatalException, G4Exception(), G4VViewer::GetViewParameters(), and G4OpenGLXViewer::SetView().

Referenced by CreateMainWindow().

◆ ChangeLineWidth()

void G4OpenGLViewer::ChangeLineWidth ( G4double  width)
protectedinherited

Change LineSize on gl2ps if needed

Definition at line 810 of file G4OpenGLViewer.cc.

810 {
811
812 if (isGl2psWriting()) {
813 fGL2PSAction->setLineWidth(int(width));
814 } else {
815 glLineWidth (width);
816 }
817}
void setLineWidth(int)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
G4OpenGL2PSAction * fGL2PSAction
G4bool isGl2psWriting()

References G4OpenGLViewer::fGL2PSAction, G4OpenGLViewer::isGl2psWriting(), and G4OpenGL2PSAction::setLineWidth().

Referenced by G4OpenGLSceneHandler::AddPrimitive(), G4OpenGLViewer::HaloingFirstPass(), and G4OpenGLViewer::HaloingSecondPass().

◆ ChangePointSize()

void G4OpenGLViewer::ChangePointSize ( G4double  size)
protectedinherited

Change PointSize on gl2ps if needed

Definition at line 798 of file G4OpenGLViewer.cc.

798 {
799
800 if (isGl2psWriting()) {
801 fGL2PSAction->setPointSize(int(size));
802 } else {
803 glPointSize (size);
804 }
805}
void setPointSize(int)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

References G4OpenGLViewer::fGL2PSAction, G4OpenGLViewer::isGl2psWriting(), and G4OpenGL2PSAction::setPointSize().

Referenced by G4OpenGLSceneHandler::AddPrimitive().

◆ ClearView()

void G4OpenGLViewer::ClearView ( void  )
virtualinherited

◆ ClearViewWithoutFlush()

void G4OpenGLViewer::ClearViewWithoutFlush ( )
inherited

Definition at line 214 of file G4OpenGLViewer.cc.

214 {
215 // Ready for clear ?
216 // See : http://lists.apple.com/archives/mac-opengl/2012/Jul/msg00038.html
217 if(!isFramebufferReady()) {
218 return;
219 }
220
221 glClearColor (background.GetRed(),
224 1.);
225 glClearDepth (1.0);
226 //Below line does not compile with Mesa includes.
227 //glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
228 glClear (GL_COLOR_BUFFER_BIT);
229 glClear (GL_DEPTH_BUFFER_BIT);
230 glClear (GL_STENCIL_BUFFER_BIT);
231}
G4double GetBlue() const
Definition: G4Colour.hh:154
G4double GetRed() const
Definition: G4Colour.hh:152
G4double GetGreen() const
Definition: G4Colour.hh:153

References G4OpenGLViewer::background, G4Colour::GetBlue(), G4Colour::GetGreen(), G4Colour::GetRed(), and G4OpenGLViewer::isFramebufferReady().

Referenced by G4OpenGLViewer::ClearView().

◆ ComputeFlyThrough()

std::vector< G4ThreeVector > G4VViewer::ComputeFlyThrough ( G4Vector3D )
inherited

Definition at line 215 of file G4VViewer.cc.

216{
217 enum CurveType {
218 Bezier,
219 G4SplineTest};
220
221 // Choose a curve type (for testing)
222// int myCurveType = Bezier;
223
224 // number if step points
225 int stepPoints = 500;
226
227
228 G4Spline spline;
229
230
231 // At the moment we don't use the aVect parameters, but build it here :
232 // Good step points for exampleB5
233 spline.AddSplinePoint(G4Vector3D(0,1000,-14000));
234 spline.AddSplinePoint(G4Vector3D(0,1000,0));
235 spline.AddSplinePoint(G4Vector3D(-4000,1000,4000));
236
237
238 std::vector <G4ThreeVector> viewVect;
239
240// if(myCurveType == Bezier) {
241
242
243 // Draw the spline
244
245 for (int i = 0; i < stepPoints; i++) {
246 float t = (float)i / (float)stepPoints;
247 G4Vector3D cameraPosition = spline.GetInterpolatedSplinePoint(t);
248 // G4Vector3D targetPoint = spline.GetInterpolatedSplinePoint(t);
249
250 // viewParam->SetViewAndLights(G4ThreeVector (cameraPosition.x(), cameraPosition.y(), cameraPosition.z()));
251 // viewParam->SetCurrentTargetPoint(targetPoint);
252 G4cout << "FLY CR("<< i << "):" << cameraPosition << G4endl;
253 viewVect.push_back(G4ThreeVector (cameraPosition.x(), cameraPosition.y(), cameraPosition.z()));
254 }
255
256// } else if (myCurveType == G4SplineTest) {
257 /*
258 This method is a inspire from a Bezier curve. The problem of the Bezier curve is that the path does not go straight between two waypoints.
259 This method add "stay straight" parameter which could be between 0 and 1 where the pass will follow exactly the line between the waypoints
260 Ex : stay straight = 50%
261 m1 = 3*(P1+P0)/2
262
263 Ex : stay straight = 0%
264 m1 = (P1+P0)/2
265
266 P1
267 / \
268 / \
269 a--x--b
270 / ° ° \
271 / ° ° \
272 m1 m2
273 / \
274 / \
275 / \
276 / \
277 P0 P2
278
279 */
280// G4Vector3D a;
281// G4Vector3D b;
282// G4Vector3D m1;
283// G4Vector3D m2;
284// G4Vector3D P0;
285// G4Vector3D P1;
286// G4Vector3D P2;
287// G4double stayStraight = 0;
288// G4double bezierSpeed = 0.4; // Spend 40% time in bezier curve (time between m1-m2 is 40% of time between P0-P1)
289//
290// G4Vector3D firstPoint;
291// G4Vector3D lastPoint;
292//
293// float nbBezierSteps = (stepPoints * bezierSpeed*(1-stayStraight)) * (2./spline.GetNumPoints());
294// float nbFirstSteps = ((stepPoints/2-nbBezierSteps/2) /(1+stayStraight)) * (2./spline.GetNumPoints());
295//
296// // First points
297// firstPoint = spline.GetPoint(0);
298// lastPoint = (firstPoint + spline.GetPoint(1))/2;
299//
300// for( float j=0; j<1; j+= 1/nbFirstSteps) {
301// G4ThreeVector pt = firstPoint + (lastPoint - firstPoint) * j;
302// viewVect.push_back(pt);
303// G4cout << "FLY Bezier A1("<< viewVect.size()<< "):" << pt << G4endl;
304// }
305//
306// for (int i = 0; i < spline.GetNumPoints()-2; i++) {
307// P0 = spline.GetPoint(i);
308// P1 = spline.GetPoint(i+1);
309// P2 = spline.GetPoint(i+2);
310//
311// m1 = P1 - (P1-P0)*(1-stayStraight)/2;
312// m2 = P1 + (P2-P1)*(1-stayStraight)/2;
313//
314// // We have to get straight path from (middile of P0-P1) to (middile of P0-P1 + (dist P0-P1) * stayStraight/2)
315// if (stayStraight >0) {
316//
317// firstPoint = (P0 + P1)/2;
318// lastPoint = (P0 + P1)/2 + (P1-P0)*stayStraight/2;
319//
320// for( float j=0; j<1; j+= 1/(nbFirstSteps*stayStraight)) {
321// G4ThreeVector pt = firstPoint + (lastPoint - firstPoint)* j;
322// viewVect.push_back(pt);
323// G4cout << "FLY Bezier A2("<< viewVect.size()<< "):" << pt << G4endl;
324// }
325// }
326// // Compute Bezier curve
327// for( float delta = 0 ; delta < 1 ; delta += 1/nbBezierSteps)
328// {
329// // The Green Line
330// a = m1 + ( (P1 - m1) * delta );
331// b = P1 + ( (m2 - P1) * delta );
332//
333// // Final point
334// G4ThreeVector pt = a + ((b-a) * delta );
335// viewVect.push_back(pt);
336// G4cout << "FLY Bezier("<< viewVect.size()<< "):" << pt << G4endl;
337// }
338//
339// // We have to get straight path
340// if (stayStraight >0) {
341// firstPoint = (P1 + P2)/2 - (P2-P1)*stayStraight/2;
342// lastPoint = (P1 + P2)/2;
343//
344// for( float j=0; j<1; j+= 1/(nbFirstSteps*stayStraight)) {
345// G4ThreeVector pt = firstPoint + (lastPoint - firstPoint)* j;
346// viewVect.push_back(pt);
347// G4cout << "FLY Bezier B1("<< viewVect.size()<< "):" << pt << G4endl;
348// }
349// }
350// }
351//
352// // last points
353// firstPoint = spline.GetPoint(spline.GetNumPoints()-2);
354// lastPoint = spline.GetPoint(spline.GetNumPoints()-1);
355// for( float j=1; j>0; j-= 1/nbFirstSteps) {
356// G4ThreeVector pt = lastPoint - ((lastPoint-firstPoint)*((1-stayStraight)/2) * j );
357// viewVect.push_back(pt);
358// G4cout << "FLY Bezier B2("<< viewVect.size()<< "):" << pt << G4endl;
359// }
360// }
361 return viewVect;
362}
HepGeom::Vector3D< G4double > G4Vector3D
Definition: G4Vector3D.hh:34
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

References G4VViewer::G4Spline::AddSplinePoint(), G4cout, G4endl, G4VViewer::G4Spline::GetInterpolatedSplinePoint(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ CreateFontLists()

void G4OpenGLXViewer::CreateFontLists ( )
protectedvirtualinherited

Reimplemented from G4OpenGLViewer.

Definition at line 356 of file G4OpenGLXViewer.cc.

357{
358 std::map<G4double,G4String> fonts; // G4VMarker screen size and font name.
359 fonts[10.] = "-adobe-courier-bold-r-normal--10-100-75-75-m-60-iso8859-1";
360 fonts[11.] = "-adobe-courier-bold-r-normal--11-80-100-100-m-60-iso8859-1";
361 fonts[12.] = "-adobe-courier-bold-r-normal--12-120-75-75-m-70-iso8859-1";
362 fonts[13.] = "fixed";
363 fonts[14.] = "-adobe-courier-bold-r-normal--14-100-100-100-m-90-iso8859-1";
364 fonts[17.] = "-adobe-courier-bold-r-normal--17-120-100-100-m-100-iso8859-1";
365 fonts[18.] = "-adobe-courier-bold-r-normal--18-180-75-75-m-110-iso8859-1";
366 fonts[20.] = "-adobe-courier-bold-r-normal--20-140-100-100-m-110-iso8859-1";
367 fonts[24.] = "-adobe-courier-bold-r-normal--24-240-75-75-m-150-iso8859-1";
368 fonts[25.] = "-adobe-courier-bold-r-normal--25-180-100-100-m-150-iso8859-1";
369 fonts[34.] = "-adobe-courier-bold-r-normal--34-240-100-100-m-200-iso8859-1";
370 std::map<G4double,G4String>::const_iterator i;
371 for (i = fonts.begin(); i != fonts.end(); ++i) {
372 XFontStruct* font_info = XLoadQueryFont(dpy, i->second);
373 if (!font_info) {
374 G4cerr <<
375 "G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font\n "
376 << i->second
377 << G4endl;
378 continue;
379 }
380 G4int font_base = glGenLists(256);
381 if (!font_base) {
382 G4cerr <<
383 "G4OpenGLXViewer::CreateFontLists out of display lists for fonts."
384 << G4endl;
385 continue;
386 }
387 G4int first = font_info->min_char_or_byte2;
388 G4int last = font_info->max_char_or_byte2;
389 glXUseXFont(font_info->fid, first, last-first+1, font_base + first);
390 G4int width = font_info->max_bounds.width;
392 (this, font_base, i->first, i->second, width);
393 }
394}
G4GLOB_DLL std::ostream G4cerr
static void AddFontBase(G4VViewer *, G4int fontBase, G4double size, const G4String &fontName, G4int width)

References G4OpenGLFontBaseStore::AddFontBase(), G4OpenGLXViewer::dpy, G4cerr, and G4endl.

Referenced by G4OpenGLImmediateXViewer::Initialise(), and G4OpenGLStoredXViewer::Initialise().

◆ CreateGLXContext()

void G4OpenGLXViewer::CreateGLXContext ( XVisualInfo *  vi)
protectedinherited

Definition at line 172 of file G4OpenGLXViewer.cc.

172 {
173
174 vi = v;
175// get window's attributes
176 if (!XGetWindowAttributes(dpy, XRootWindow (dpy, vi -> screen), &xwa)) {
177 fViewId = -1; // This flags an error.
178 G4cerr << "G4OpenGLXViewer::G4OpenGLXViewer couldn't return window attributes"
179 << G4endl;
180 return;
181 }
182
183// create the master GLX context
184 cxMaster = glXCreateContext (dpy, vi, 0, true);
185 if (!cxMaster) {
186 fViewId = -1; // This flags an error.
187 G4cerr << "G4OpenGLXViewer::G4OpenGLXViewer couldn't create context."
188 << G4endl;
189 return;
190 }
191
192// New stab at getting a colormap
193
194 Status status;
195 int i, numCmaps;
196
197 status = XmuLookupStandardColormap (dpy,
198 vi -> screen,
199 vi -> visualid,
200 vi -> depth,
201 XA_RGB_BEST_MAP,
202 False,
203 True);
204
205 if (status == 1) {
206 cmap = 0;
207 XStandardColormap* standardCmaps = XAllocStandardColormap ();
208 status = XGetRGBColormaps (dpy,
209 XRootWindow (dpy, vi -> screen),
210 &standardCmaps,
211 &numCmaps,
212 XA_RGB_BEST_MAP);
213 if (status == 1) {
214 for (i = 0; i < numCmaps; i++) {
215 if (standardCmaps[i].visualid == vi -> visualid) {
216 cmap = standardCmaps[i].colormap;
217 break;
218 }
219 }
220 }
221 XFree (standardCmaps);
222 if(cmap) {
224 G4cout << "Got standard cmap" << G4endl;
225 } else {
226 //if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
227 // G4cerr << "G4OpenGLXViewer::G4OpenGLXViewer failed to allocate a standard colormap."
228 // << G4endl;
229 cmap = XCreateColormap (dpy,
230 XRootWindow(dpy, vi -> screen),
231 vi -> visual,
232 AllocNone);
233 if(cmap) {
235 G4cout << "Created own cmap" << G4endl;
236 }
237 //G.Barrand : at end, we should do a XFreeColormap(dpy,cmap) when cmap is no more used.
238 }
239 } else {
240 cmap = XCreateColormap (dpy,
241 XRootWindow(dpy, vi -> screen),
242 vi -> visual,
243 AllocNone);
244 if(cmap) {
246 G4cout << "Created own cmap" << G4endl;
247 }
248 //G.Barrand : at end, we should do a XFreeColormap(dpy,cmap) when cmap is no more used.
249 }
250
251 if (!cmap) {
252 fViewId = -1; // This flags an error.
254 G4cout << "G4OpenGLXViewer::G4OpenGLXViewer failed to allocate a Colormap."
255 << G4endl;
256 return;
257 }
258
259}
static G4String Status(G4StepStatus stps)
XWindowAttributes xwa
GLXContext cxMaster
static Verbosity GetVerbosity()

References G4OpenGLXViewer::cmap, G4VisManager::confirmations, G4OpenGLXViewer::cxMaster, G4OpenGLXViewer::dpy, G4VisManager::errors, G4VViewer::fViewId, G4cerr, G4cout, G4endl, G4VisManager::GetVerbosity(), Status(), G4OpenGLXViewer::vi, and G4OpenGLXViewer::xwa.

Referenced by G4OpenGLImmediateXmViewer::Initialise(), G4OpenGLImmediateXViewer::Initialise(), G4OpenGLStoredXmViewer::Initialise(), and G4OpenGLStoredXViewer::Initialise().

◆ CreateMainWindow()

void G4OpenGLXmViewer::CreateMainWindow ( )
protectedvirtual

Reimplemented from G4OpenGLXViewer.

Definition at line 173 of file G4OpenGLXmViewer.cc.

173 {
174
175 bgnd = XWhitePixelOfScreen (XtScreen(shell));
176 borcol = XBlackPixelOfScreen (XtScreen(shell));
177
179
180 G4int x_origin = fVP.GetWindowAbsoluteLocationHintX(DisplayWidth(dpy, vi -> screen));
181
182 // FIXME, screen size != window size on MAC, but I don't know have to get the menuBar
183 // size on MAC. L.Garnier 01/2009
184 G4int y_origin = fVP.GetWindowAbsoluteLocationHintY(DisplayHeight(dpy, vi -> screen));
185
187 XtVaSetValues (shell,
188 XtNvisual, vi -> visual,
189 XtNdepth, vi -> depth,
190 XtNcolormap, cmap,
191 XtNwidth, getWinWidth(),
192 XtNheight, getWinHeight(),
193 XtNx, x_origin,
194 XtNy, y_origin,
195 XtNborderColor, &borcol,
196 XtNbackground, &bgnd,
197 XmNtitle, fName.data(),
198 NULL);
200 XtVaSetValues (shell,
201 XtNvisual, vi -> visual,
202 XtNdepth, vi -> depth,
203 XtNcolormap, cmap,
204 XtNwidth, getWinWidth(),
205 XtNheight, getWinHeight(),
206 XtNborderColor, &borcol,
207 XtNbackground, &bgnd,
208 XmNtitle, fName.data(),
209 NULL);
211 XtVaSetValues (shell,
212 XtNvisual, vi -> visual,
213 XtNdepth, vi -> depth,
214 XtNcolormap, cmap,
215 XtNx, x_origin,
216 XtNy, y_origin,
217 XtNborderColor, &borcol,
218 XtNbackground, &bgnd,
219 XmNtitle, fName.data(),
220 NULL);
221 } else {
222 XtVaSetValues (shell,
223 XtNvisual, vi -> visual,
224 XtNdepth, vi -> depth,
225 XtNcolormap, cmap,
226 XtNborderColor, &borcol,
227 XtNbackground, &bgnd,
228 XmNtitle, fName.data(),
229 NULL);
230 }
231
232
233 main_win = XtVaCreateManagedWidget ("main_win",
234 xmMainWindowWidgetClass,
235 shell,
236 XtNvisual, vi -> visual,
237 XtNdepth, vi -> depth,
238 XtNcolormap, cmap,
239 XtNborderColor, borcol,
240 XtNbackground, bgnd,
241 NULL);
242
243 //*********Create a menu bar for the window********
244 style_str = XmStringCreateLocalized ((char*)"Style");
245 actions_str = XmStringCreateLocalized ((char*)"Actions");
246 misc_str = XmStringCreateLocalized ((char*)"Miscellany");
247 spec_str = XmStringCreateLocalized ((char*)"Special");
248
249 menubar = XmVaCreateSimpleMenuBar (main_win,
250 (char*)"menubar",
251 XmVaCASCADEBUTTON, style_str, (KeySym)XK_S, /*G.Barrand : cast to KeySym and use XK_*/
252 XmVaCASCADEBUTTON, actions_str, (KeySym)XK_A,
253 XmVaCASCADEBUTTON, misc_str, (KeySym)XK_M,
254 XmVaCASCADEBUTTON, spec_str, (KeySym)XK_p,
255 XtNvisual, vi -> visual,
256 XtNdepth, vi -> depth,
257 XtNcolormap, cmap,
258 XtNborderColor, borcol,
259 XtNbackground, bgnd,
260 NULL);
261
262 XmStringFree (style_str);
263 XmStringFree (actions_str);
264 XmStringFree (misc_str);
265 XmStringFree (spec_str);
266
267 G4cout << "Created menubar" << G4endl;
268
269
270 //*********Create style pulldown menu on menubar*********
271 draw_str = XmStringCreateLocalized ((char*)"Drawing");
272 bgnd_str = XmStringCreateLocalized ((char*)"Background color");
273
274 style_cascade = XmVaCreateSimplePulldownMenu
275 (menubar,
276 (char*)"style",
277 0,
278 NULL,
279 XmVaCASCADEBUTTON, draw_str, (KeySym)XK_D,
280 XmVaCASCADEBUTTON, bgnd_str, (KeySym)XK_B,
281 XtNvisual, vi -> visual,
282 XtNdepth, vi -> depth,
283 XtNcolormap, cmap,
284 XtNborderColor, borcol,
285 XtNbackground, bgnd,
286 NULL);
287
288 XmStringFree (draw_str);
289 XmStringFree (bgnd_str);
290
291 // G4cout << "Created Style pulldown menu" << G4endl;
292
293 //Add Drawing pullright menu to style cascade...
294 wireframe_str = XmStringCreateLocalized ((char*)"Wireframe");
295 hlr_str = XmStringCreateLocalized ((char*)"Hidden line removal");
296 hsr_str = XmStringCreateLocalized ((char*)"Hidden surface removal");
297 hlhsr_str = XmStringCreateLocalized ((char*)"Hidden line and surface removal");
298
299 drawing_style_pullright = XmVaCreateSimplePulldownMenu
301 (char*)"drawing_style",
302 1,
304 XmVaRADIOBUTTON, wireframe_str, (KeySym)XK_W, NULL, NULL,
305 XmVaRADIOBUTTON, hlr_str, (KeySym)XK_L, NULL, NULL,
306 XmVaRADIOBUTTON, hsr_str, (KeySym)XK_S, NULL, NULL,
307 XmVaRADIOBUTTON, hlhsr_str, (KeySym)XK_H, NULL, NULL,
308 XmNradioBehavior, True,
309 XmNradioAlwaysOne, True,
310 XmNuserData, this,
311 XtNvisual, vi -> visual,
312 XtNdepth, vi -> depth,
313 XtNcolormap, cmap,
314 XtNborderColor, borcol,
315 XtNbackground, bgnd,
316 NULL);
317
318 Widget special_widget;
319
321 d_style = fVP.GetDrawingStyle();
322
323 if (d_style == G4ViewParameters::wireframe) {
324 special_widget = XtNameToWidget(drawing_style_pullright, "button_0");
325 if(special_widget) {
326 XtVaSetValues (special_widget, XmNset, True, NULL);
327 }
328 } else if (d_style == G4ViewParameters::hlr) {
329 special_widget = XtNameToWidget(drawing_style_pullright, "button_1");
330 if(special_widget) {
331 XtVaSetValues (special_widget, XmNset, True, NULL);
332 }
333 } else if (d_style == G4ViewParameters::hsr) {
334 special_widget = XtNameToWidget(drawing_style_pullright, "button_2");
335 if(special_widget) {
336 XtVaSetValues (special_widget, XmNset, True, NULL);
337 }
338 } else if (d_style == G4ViewParameters::hlhsr) {
339 special_widget = XtNameToWidget(drawing_style_pullright, "button_3");
340 if(special_widget) {
341 XtVaSetValues (special_widget, XmNset, True, NULL);
342 }
343 } else {
345 ("G4OpenGLXmViewer::CreateMainWindow",
346 "opengl2015", FatalException,
347 "Invalid Drawing style in G4OpenGLXmViewer::CreateContext");
348 }
349
350 XmStringFree (wireframe_str);
351 XmStringFree (hlr_str);
352 XmStringFree (hsr_str);
353 XmStringFree (hlhsr_str);
354
355 // G4cout << "Created Drawing pullright menu" << G4endl;
356
357 //Add Drawing pullright menu to style cascade...
358 white_str = XmStringCreateLocalized ((char*)"White");
359 black_str = XmStringCreateLocalized ((char*)"Black");
360
361 background_color_pullright = XmVaCreateSimplePulldownMenu
363 (char*)"background_color",
364 2,
366 XmVaRADIOBUTTON, white_str, (KeySym)XK_W, NULL, NULL,
367 XmVaRADIOBUTTON, black_str, (KeySym)XK_B, NULL, NULL,
368 XmNradioBehavior, True,
369 XmNradioAlwaysOne, True,
370 XmNuserData, this,
371 XtNvisual, vi -> visual,
372 XtNdepth, vi -> depth,
373 XtNcolormap, cmap,
374 XtNborderColor, borcol,
375 XtNbackground, bgnd,
376 NULL);
377
378 if (background.GetRed() == 1. &&
379 background.GetGreen() == 1. &&
380 background.GetBlue() == 1.) {
381 special_widget = XtNameToWidget(background_color_pullright, "button_0");
382 if(special_widget) {
383 XtVaSetValues (special_widget, XmNset, True, NULL);
384 }
385 } else {
386 special_widget = XtNameToWidget(background_color_pullright, "button_1");
387 if(special_widget) {
388 XtVaSetValues (special_widget, XmNset, True, NULL);
389 }
390 }
391
392 XmStringFree (white_str);
393 XmStringFree (black_str);
394
395 // G4cout << "Created Background color pullright menu" << G4endl;
396
397 //*********Create actions pulldown menu on menubar*********
398 rot_str = XmStringCreateLocalized ((char*)"Rotation control panel");
399 pan_str = XmStringCreateLocalized ((char*)"Panning control panel");
400 set_str = XmStringCreateLocalized ((char*)"Set control panel limits");
401
402 actions_cascade = XmVaCreateSimplePulldownMenu
403 (menubar,
404 (char*)"actions",
405 1,
407 XmVaPUSHBUTTON, rot_str, (KeySym)XK_R, NULL, NULL,
408 XmVaPUSHBUTTON, pan_str, (KeySym)XK_P, NULL, NULL,
409 XmVaPUSHBUTTON, set_str, (KeySym)XK_S, NULL, NULL,
410 XmNuserData, this,
411 XtNvisual, vi -> visual,
412 XtNdepth, vi -> depth,
413 XtNcolormap, cmap,
414 XtNborderColor, borcol,
415 XtNbackground, bgnd,
416 NULL);
417
418 XmStringFree (rot_str);
419 XmStringFree (pan_str);
420 XmStringFree (set_str);
421 G4cout << "Created Actions pulldown menu" << G4endl;
422
423 misc_str = XmStringCreateLocalized ((char*)"Miscellany control panel");
424 exit_str = XmStringCreateLocalized ((char*)"Exit to G4Vis>");
425 print_str = XmStringCreateLocalized ((char*)"Create .eps file");
426
427 //*********Create miscellany pulldown menu on menubar*********
428 misc_cascade = XmVaCreateSimplePulldownMenu
429 (menubar,
430 (char*)"miscellany",
431 2,
433 XmVaPUSHBUTTON, misc_str, (KeySym)XK_M, NULL, NULL,
434 XmVaPUSHBUTTON, exit_str, (KeySym)XK_E, NULL, NULL,
435 XmVaPUSHBUTTON, print_str, (KeySym)XK_P, NULL, NULL,
436 XmNuserData, this,
437 XtNvisual, vi -> visual,
438 XtNdepth, vi -> depth,
439 XtNcolormap, cmap,
440 XtNborderColor, borcol,
441 XtNbackground, bgnd,
442 NULL);
443
444 XmStringFree (misc_str);
445 XmStringFree (exit_str);
446 XmStringFree (print_str);
447 G4cout << "Created Miscellany pulldown menu" << G4endl;
448
449 trans_str = XmStringCreateLocalized ((char*)"Transparency");
450 anti_str = XmStringCreateLocalized ((char*)"Antialiasing");
451 halo_str = XmStringCreateLocalized ((char*)"Haloing");
452 aux_edge_str = XmStringCreateLocalized ((char*)"Auxiliary edges");
453
454 //*********Create special pulldown menu on menubar*********
455 spec_cascade = XmVaCreateSimplePulldownMenu
456 (menubar,
457 (char*)"special",
458 3,
459 NULL,
460 XmVaCASCADEBUTTON, trans_str, (KeySym)XK_T,
461 XmVaCASCADEBUTTON, anti_str, (KeySym)XK_A,
462 XmVaCASCADEBUTTON, halo_str, (KeySym)XK_H,
463 XmVaCASCADEBUTTON, aux_edge_str, (KeySym)XK_E,
464 XtNvisual, vi -> visual,
465 XtNdepth, vi -> depth,
466 XtNcolormap, cmap,
467 XtNborderColor, borcol,
468 XtNbackground, bgnd,
469 NULL);
470
471 XmStringFree (trans_str);
472 XmStringFree (anti_str);
473 XmStringFree (halo_str);
474 XmStringFree (aux_edge_str);
475
476 // G4cout << "Created Special pulldown menu" << G4endl;
477
478 //Add Transparency pullright menu to special cascade...
479 off_str = XmStringCreateLocalized ((char*)"Off");
480 on_str = XmStringCreateLocalized ((char*)"On");
481
482 transparency_pullright = XmVaCreateSimplePulldownMenu
484 (char*)"transparency",
485 0,
487 XmVaRADIOBUTTON, off_str, (KeySym)XK_f, NULL, NULL,
488 XmVaRADIOBUTTON, on_str, (KeySym)XK_n, NULL, NULL,
489 XmNradioBehavior, True,
490 XmNradioAlwaysOne, True,
491 XmNuserData, this,
492 XtNvisual, vi -> visual,
493 XtNdepth, vi -> depth,
494 XtNcolormap, cmap,
495 XtNborderColor, borcol,
496 XtNbackground, bgnd,
497 NULL);
498
499 if (transparency_enabled == false) {
500 special_widget = XtNameToWidget(transparency_pullright, "button_0");
501 if(special_widget) {
502 XtVaSetValues (special_widget, XmNset, True, NULL);
503 }
504 } else if (transparency_enabled == true) {
505 special_widget = XtNameToWidget(transparency_pullright, "button_1");
506 if(special_widget) {
507 XtVaSetValues (special_widget, XmNset, True, NULL);
508 }
509 } else {
511 ("G4OpenGLXmViewer::CreateMainWindow",
512 "opengl2016", FatalException,
513 "transparency_enabled in G4OpenGLXmViewer is neither true nor false!!");
514 }
515
516 //Add antialias pullright menu to special cascade...
517 antialias_pullright = XmVaCreateSimplePulldownMenu
519 (char*)"antialias",
520 1,
522 XmVaRADIOBUTTON, off_str, (KeySym)XK_f, NULL, NULL,
523 XmVaRADIOBUTTON, on_str, (KeySym)XK_n, NULL, NULL,
524 XmNradioBehavior, True,
525 XmNradioAlwaysOne, True,
526 XmNuserData, this,
527 XtNvisual, vi -> visual,
528 XtNdepth, vi -> depth,
529 XtNcolormap, cmap,
530 XtNborderColor, borcol,
531 XtNbackground, bgnd,
532 NULL);
533
534 if (antialiasing_enabled == false) {
535 special_widget = XtNameToWidget(antialias_pullright, "button_0");
536 if(special_widget) {
537 XtVaSetValues (special_widget, XmNset, True, NULL);
538 }
539 } else if (antialiasing_enabled == true) {
540 special_widget = XtNameToWidget(antialias_pullright, "button_1");
541 if(special_widget) {
542 XtVaSetValues (special_widget, XmNset, True, NULL);
543 }
544 } else {
546 ("G4OpenGLXmViewer::CreateMainWindow",
547 "opengl2017", FatalException,
548 "antialiasing_enabled in G4OpenGLXmViewer is neither true nor false!!");
549 }
550
551 //Add Haloing pullright menu to special cascade...
552 haloing_pullright = XmVaCreateSimplePulldownMenu
554 (char*)"haloing",
555 2,
557 XmVaRADIOBUTTON, off_str, (KeySym)XK_f, NULL, NULL,
558 XmVaRADIOBUTTON, on_str, (KeySym)XK_n, NULL, NULL,
559 XmNradioBehavior, True,
560 XmNradioAlwaysOne, True,
561 XmNuserData, this,
562 XtNvisual, vi -> visual,
563 XtNdepth, vi -> depth,
564 XtNcolormap, cmap,
565 XtNborderColor, borcol,
566 XtNbackground, bgnd,
567 NULL);
568
569 if (haloing_enabled == false) {
570 special_widget = XtNameToWidget(haloing_pullright, "button_0");
571 if(special_widget) {
572 XtVaSetValues (special_widget, XmNset, True, NULL);
573 }
574 } else if (haloing_enabled == true) {
575 special_widget = XtNameToWidget(haloing_pullright, "button_1");
576 if(special_widget) {
577 XtVaSetValues (special_widget, XmNset, True, NULL);
578 }
579 } else {
581 ("G4OpenGLXmViewer::CreateMainWindow",
582 "opengl2018", FatalException,
583 "haloing_enabled in G4OpenGLXmViewer is neither true nor false!!");
584 }
585
586 //Add Aux_Edge pullright menu to special cascade...
587 aux_edge_pullright = XmVaCreateSimplePulldownMenu
589 (char*)"aux_edge",
590 3,
592 XmVaRADIOBUTTON, off_str, (KeySym)XK_f, NULL, NULL,
593 XmVaRADIOBUTTON, on_str, (KeySym)XK_n, NULL, NULL,
594 XmNradioBehavior, True,
595 XmNradioAlwaysOne, True,
596 XmNuserData, this,
597 XtNvisual, vi -> visual,
598 XtNdepth, vi -> depth,
599 XtNcolormap, cmap,
600 XtNborderColor, borcol,
601 XtNbackground, bgnd,
602 NULL);
603
604 if (!fVP.IsAuxEdgeVisible()) {
605 special_widget = XtNameToWidget(aux_edge_pullright, "button_0");
606 if(special_widget) {
607 XtVaSetValues (special_widget, XmNset, True, NULL);
608 }
609 } else {
610 special_widget = XtNameToWidget(aux_edge_pullright, "button_1");
611 if(special_widget) {
612 XtVaSetValues (special_widget, XmNset, True, NULL);
613 }
614 }
615
616 XtManageChild (menubar);
617 frame = XtVaCreateManagedWidget ((char*)"frame",
618 xmFrameWidgetClass, main_win,
619 XtNvisual, vi -> visual,
620 XtNdepth, vi -> depth,
621 XtNcolormap, cmap,
622 XtNborderColor, borcol,
623 XtNbackground, bgnd,
624 NULL);
625
626 glxarea = XtVaCreateManagedWidget ((char*)"glxarea",
627 xmDrawingAreaWidgetClass,
628 frame,
629 XtNvisual, vi -> visual,
630 XtNdepth, vi -> depth,
631 XtNcolormap, cmap,
632 XtNborderColor, borcol,
633 XtNbackground, bgnd,
634 NULL);
635
636
637 XmMainWindowSetAreas (main_win, // main widget, children are specified
638 menubar, // widget to use as menu bar
639 NULL, // widget to use as command window
640 NULL, // widget for horizontal scroll bar
641 NULL, // widget for vertical scroll bar
642 frame // widget to be used for work window
643 );
644
645 XtRealizeWidget(shell);
646
647 // Once widget is realized (ie, associated with a created X window), we
648 // can bind the OpenGL rendering context to the window.
649
650 win = XtWindow (glxarea);
651
652 glXMakeCurrent (dpy, win, cxMaster);
653
654 // This should be add AFTER glXMakeCurrent done because it will fire a resizeCallback
655 XtAddCallback (glxarea,
656 XmNresizeCallback,
658 this);
659
660 XtAddCallback (glxarea,
661 XmNexposeCallback,
663 this);
664
665}
unsigned int getWinHeight() const
void ResizeWindow(unsigned int, unsigned int)
unsigned int getWinWidth() const
G4bool transparency_enabled
static void background_color_callback(Widget w, XtPointer clientData, XtPointer callData)
static void antialias_callback(Widget w, XtPointer clientData, XtPointer callData)
static void drawing_style_callback(Widget w, XtPointer clientData, XtPointer callData)
static void resize_callback(Widget w, XtPointer clientData, XtPointer callData)
static void haloing_callback(Widget w, XtPointer clientData, XtPointer callData)
static void expose_callback(Widget w, XtPointer clientData, XtPointer callData)
static void aux_edge_callback(Widget w, XtPointer clientData, XtPointer callData)
static void misc_callback(Widget w, XtPointer clientData, XtPointer callData)
static void actions_callback(Widget w, XtPointer clientData, XtPointer callData)
static void transparency_callback(Widget w, XtPointer clientData, XtPointer callData)
G4String fName
Definition: G4VViewer.hh:217
bool IsWindowLocationHintY() const
G4int GetWindowAbsoluteLocationHintY(G4int) const
bool IsWindowLocationHintX() const
unsigned int GetWindowSizeHintX() const
bool IsWindowSizeHintX() const
G4int GetWindowAbsoluteLocationHintX(G4int) const
unsigned int GetWindowSizeHintY() const
DrawingStyle GetDrawingStyle() const
G4bool IsAuxEdgeVisible() const

References actions_callback(), actions_cascade, actions_str, anti_str, antialias_callback(), antialias_pullright, G4OpenGLViewer::antialiasing_enabled, aux_edge_callback(), aux_edge_pullright, aux_edge_str, G4OpenGLViewer::background, background_color_callback(), background_color_pullright, bgnd, bgnd_str, black_str, borcol, G4OpenGLXViewer::cmap, G4OpenGLXViewer::cxMaster, G4OpenGLXViewer::dpy, draw_str, drawing_style_callback(), drawing_style_pullright, exit_str, expose_callback(), FatalException, G4VViewer::fName, frame, G4VViewer::fVP, G4cout, G4endl, G4Exception(), G4Colour::GetBlue(), G4ViewParameters::GetDrawingStyle(), G4Colour::GetGreen(), G4Colour::GetRed(), G4ViewParameters::GetWindowAbsoluteLocationHintX(), G4ViewParameters::GetWindowAbsoluteLocationHintY(), G4ViewParameters::GetWindowSizeHintX(), G4ViewParameters::GetWindowSizeHintY(), G4OpenGLViewer::getWinHeight(), G4OpenGLViewer::getWinWidth(), glxarea, halo_str, haloing_callback(), G4OpenGLViewer::haloing_enabled, haloing_pullright, G4ViewParameters::hlhsr, hlhsr_str, G4ViewParameters::hlr, hlr_str, G4ViewParameters::hsr, hsr_str, G4ViewParameters::IsAuxEdgeVisible(), G4ViewParameters::IsWindowLocationHintX(), G4ViewParameters::IsWindowLocationHintY(), G4ViewParameters::IsWindowSizeHintX(), main_win, menubar, misc_callback(), misc_cascade, misc_str, off_str, on_str, pan_str, print_str, resize_callback(), G4OpenGLViewer::ResizeWindow(), rot_str, set_str, shell, spec_cascade, spec_str, style_cascade, style_str, trans_str, transparency_callback(), G4OpenGLViewer::transparency_enabled, transparency_pullright, G4OpenGLXViewer::vi, white_str, G4OpenGLXViewer::win, G4ViewParameters::wireframe, and wireframe_str.

Referenced by G4OpenGLImmediateXmViewer::Initialise(), and G4OpenGLStoredXmViewer::Initialise().

◆ dolly_callback()

void G4OpenGLXmViewer::dolly_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 79 of file G4OpenGLXmPanningCallbacks.cc.

82{
83 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
84 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
85 short dp = -1;
86 G4float ten_to_the_dp = 10.;
87
88 XtVaGetValues (w,
89 XmNdecimalPoints, &dp,
90 NULL);
91
92 if (dp == 0) {
93 ten_to_the_dp = 1.;
94 } else if ( dp > 0) {
95 for (G4int i = 1; i < (G4int)dp; i++) {
96 ten_to_the_dp *= 10.;
97 }
98 } else {
99 G4cout << "dp is " << dp << G4endl;
100 return;
101 }
102
103 G4double dolly = (G4double)(cbs->value) / ten_to_the_dp;
104
105 pView->fVP.SetDolly (dolly);
106 pView->SetView ();
107 pView->ClearView ();
108 pView->DrawView ();
109
110}
float G4float
Definition: G4Types.hh:84
void SetDolly(G4double dolly)

References G4OpenGLViewer::ClearView(), G4VViewer::DrawView(), G4VViewer::fVP, G4cout, G4endl, G4ViewParameters::SetDolly(), and G4OpenGLXViewer::SetView().

Referenced by actions_callback().

◆ drawing_style_callback()

void G4OpenGLXmViewer::drawing_style_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 38 of file G4OpenGLXmStyleCallbacks.cc.

41{
42 G4long choice = (G4long)clientData;
43 G4OpenGLXmViewer* pView;
44 XtVaGetValues (XtParent(w),
45 XmNuserData, &pView,
46 NULL);
48
49 switch (choice) {
50
51 case 0:
53 break;
54
55 case 1:
57 break;
58
59 case 2:
61 break;
62
63 case 3:
65 break;
66
67 default:
70 ("G4OpenGLXmViewer::drawing_style_callback",
71 "opengl2006", FatalException,
72 "Unrecognised case in drawing_style_callback.");
73 }
74
75 pView->fVP.SetDrawingStyle (style);
76
77 pView->SetView ();
78 pView->ClearView ();
79 pView->DrawView ();
80}
void SetDrawingStyle(G4ViewParameters::DrawingStyle style)

References G4OpenGLViewer::ClearView(), G4VViewer::DrawView(), FatalException, G4VViewer::fVP, G4Exception(), G4ViewParameters::hlhsr, G4ViewParameters::hlr, G4ViewParameters::hsr, G4ViewParameters::SetDrawingStyle(), G4OpenGLXViewer::SetView(), and G4ViewParameters::wireframe.

Referenced by CreateMainWindow().

◆ DrawText()

void G4OpenGLXViewer::DrawText ( const G4Text g4text)
virtualinherited

Reimplemented from G4OpenGLViewer.

Definition at line 396 of file G4OpenGLXViewer.cc.

397{
398 if (isGl2psWriting()) {
399
401
402 } else {
403
405 G4double size = fSceneHandler.GetMarkerSize(g4text,sizeType);
406
407 const G4OpenGLFontBaseStore::FontInfo& fontInfo =
409 if (fontInfo.fFontBase < 0) {
410 static G4int callCount = 0;
411 ++callCount;
412 //if (callCount <= 10 || callCount%100 == 0) {
413 if (callCount <= 1) {
414 G4cout <<
415 "G4OpenGLXViewer::DrawText: No fonts available for \""
416 << fName <<
417 "\"\n Called with "
418 << g4text
419 << G4endl;
420 }
421 return;
422 }
423
424 const G4Colour& c = fSceneHandler.GetTextColour(g4text);
425 glColor4d(c.GetRed(),c.GetGreen(),c.GetBlue(),c.GetAlpha());
426
427 G4Point3D position = g4text.GetPosition();
428
429 G4String textString = g4text.GetText();
430 const char* textCString = textString.c_str();
431
432 // Set position for raster-style drawers (X, Xm)
433 glRasterPos3d(position.x(),position.y(),position.z());
434
435 glPushAttrib(GL_LIST_BIT);
436
437 // Calculate move for centre and right adjustment
438 G4double span = textString.size() * fontInfo.fWidth;
439 G4double xmove = 0., ymove = 0.;
440 switch (g4text.GetLayout()) {
441 case G4Text::left: break;
442 case G4Text::centre: xmove -= span / 2.; break;
443 case G4Text::right: xmove -= span;
444 }
445
446 //Add offsets
447 xmove += g4text.GetXOffset();
448 ymove += g4text.GetYOffset();
449
450 // Do move
451 glBitmap(0,0,0,0,xmove,ymove,0);
452
453 // Write characters
454 glListBase(fontInfo.fFontBase);
455 glCallLists(strlen(textCString),GL_UNSIGNED_BYTE,(GLubyte*)textCString);
456 glPopAttrib();
457 }
458}
G4double GetAlpha() const
Definition: G4Colour.hh:155
static const FontInfo & GetFontInfo(G4VViewer *, G4double size)
virtual void DrawText(const G4Text &)
Layout GetLayout() const
G4double GetYOffset() const
G4double GetXOffset() const
G4String GetText() const
@ centre
Definition: G4Text.hh:76
@ right
Definition: G4Text.hh:76
@ left
Definition: G4Text.hh:76
G4Point3D GetPosition() const
const G4Colour & GetTextColour(const G4Text &)
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
G4VSceneHandler & fSceneHandler
Definition: G4VViewer.hh:215

References G4Text::centre, G4OpenGLViewer::DrawText(), G4OpenGLFontBaseStore::FontInfo::fFontBase, G4VViewer::fName, G4VViewer::fSceneHandler, G4OpenGLFontBaseStore::FontInfo::fWidth, G4cout, G4endl, G4Colour::GetAlpha(), G4Colour::GetBlue(), G4OpenGLFontBaseStore::GetFontInfo(), G4Colour::GetGreen(), G4Text::GetLayout(), G4VSceneHandler::GetMarkerSize(), G4VMarker::GetPosition(), G4Colour::GetRed(), G4Text::GetText(), G4VSceneHandler::GetTextColour(), G4Text::GetXOffset(), G4Text::GetYOffset(), G4OpenGLViewer::isGl2psWriting(), G4Text::left, and G4Text::right.

◆ DrawView()

virtual void G4VViewer::DrawView ( )
pure virtualinherited

◆ exportImage()

bool G4OpenGLViewer::exportImage ( std::string  name = "",
int  width = -1,
int  height = -1 
)
virtualinherited

Export image with the given name with width and height Several cases : If name is "", filename will have the default value If name is "toto.png", set the name to "toto" and the format to "png". No incremented suffix is added. If name is "toto", set the name to "toto" and the format to default (or current format if specify). Will also add an incremented suffix at the end of the file

Reimplemented in G4OpenGLQtViewer.

Definition at line 827 of file G4OpenGLViewer.cc.

827 {
828
829 if (! setExportFilename(name)) {
830 return false;
831 }
832
833 if ((width != -1) && (height != -1)) {
834 setExportSize(width, height);
835 }
836
837 if (fExportImageFormat == "eps") {
839 } else if (fExportImageFormat == "ps") {
841 } else if (fExportImageFormat == "svg") {
843 } else if (fExportImageFormat == "pdf") {
845 } else {
846 setExportImageFormat(fExportImageFormat,true); // will display a message if this format is not correct for the current viewer
847 return false;
848 }
849
850 bool res;
851
852 // Change the LC_NUMERIC value in order to have "." separtor and not ","
853 // This case is only useful for French, Canadien...
854 size_t len = strlen(setlocale(LC_NUMERIC,NULL));
855 char* oldLocale = (char*)(malloc(len+1));
856 if(oldLocale!=NULL) strncpy(oldLocale,setlocale(LC_NUMERIC,NULL),len);
857 setlocale(LC_NUMERIC,"C");
858
859 if (((fExportImageFormat == "eps") || (fExportImageFormat == "ps")) && (!fVectoredPs)) {
860 res = printNonVectoredEPS();
861 } else {
862 res = printVectoredEPS();
863 }
864
865 // restore the local
866 if (oldLocale) {
867 setlocale(LC_NUMERIC,oldLocale);
868 free(oldLocale);
869 }
870
871 if (res == false) {
872 G4cerr << "Error saving file... " << getRealPrintFilename().c_str() << G4endl;
873 } else {
874 G4cout << "File " << getRealPrintFilename().c_str() << " size: " << getRealExportWidth() << "x" << getRealExportHeight() << " has been saved " << G4endl;
875
876 // increment index if necessary
877 if ( fExportFilenameIndex != -1) {
879 }
880 }
881
882 return res;
883}
void setExportImageFormat(unsigned int)
G4int getRealExportHeight()
bool setExportImageFormat(std::string format, bool quiet=false)
std::string fExportImageFormat
bool setExportFilename(G4String name, G4bool inc=true)
bool printNonVectoredEPS()
void setExportSize(G4int, G4int)
G4int getRealExportWidth()
std::string getRealPrintFilename()
#define GL2PS_SVG
Definition: gl2ps.h:133
#define GL2PS_EPS
Definition: gl2ps.h:130
#define GL2PS_PDF
Definition: gl2ps.h:132
#define GL2PS_PS
Definition: gl2ps.h:129
const char * name(G4int ptype)

References G4OpenGLViewer::fExportFilenameIndex, G4OpenGLViewer::fExportImageFormat, G4OpenGLViewer::fGL2PSAction, free, G4OpenGLViewer::fVectoredPs, G4cerr, G4cout, G4endl, G4OpenGLViewer::getRealExportHeight(), G4OpenGLViewer::getRealExportWidth(), G4OpenGLViewer::getRealPrintFilename(), GL2PS_EPS, GL2PS_PDF, GL2PS_PS, GL2PS_SVG, G4InuclParticleNames::name(), G4OpenGLViewer::printNonVectoredEPS(), G4OpenGLViewer::printVectoredEPS(), G4OpenGLViewer::setExportFilename(), G4OpenGLViewer::setExportImageFormat(), G4OpenGL2PSAction::setExportImageFormat(), and G4OpenGLViewer::setExportSize().

Referenced by G4OpenGLQtViewer::exportImage(), print_callback(), and G4OpenGLViewerMessenger::SetNewValue().

◆ expose_callback()

void G4OpenGLXmViewer::expose_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 45 of file G4OpenGLXmWindowHandlingCallbacks.cc.

48{
49 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
50 Dimension width, height;
51
52 XtVaGetValues (w,
53 XmNwidth, &width,
54 XmNheight, &height,
55 NULL);
56
57 pView->ResizeWindow(width,height);
58
59//??????????????????????????? This might be a problem in MT mode.
60// glXMakeCurrent (pView->dpy, XtWindow(pView->glxarea), pView->cxMaster);
61// pView->SetView ();
62// pView->ClearView ();
63// pView->DrawView ();
64//???????????????????????????? Commented out 14/06/16 JA
65}

References G4OpenGLViewer::ResizeWindow().

Referenced by CreateMainWindow(), and resize_callback().

◆ FinishView()

void G4VViewer::FinishView ( void  )
virtualinherited

◆ g4GlFrustum()

void G4OpenGLViewer::g4GlFrustum ( GLdouble  left,
GLdouble  right,
GLdouble  bottom,
GLdouble  top,
GLdouble  near,
GLdouble  far 
)
protectedinherited

Definition at line 1467 of file G4OpenGLViewer.cc.

1467 {
1468 // glFrustum (left, right, bottom, top, near, far);
1469
1470 GLdouble deltaX = right - left;
1471 GLdouble deltaY = top - bottom;
1472 GLdouble deltaZ = zFar - zNear;
1473
1474 GLdouble a = 2.0f * zNear / deltaX;
1475 GLdouble b = 2.0f * zNear / deltaY;
1476 GLdouble c = (right + left) / deltaX;
1477 GLdouble d = (top + bottom) / deltaY;
1478 GLdouble e = -(zFar + zNear) / (zFar - zNear);
1479 GLdouble f = -2.0f * zFar * zNear / deltaZ;
1480
1481 GLdouble proj[16] = {
1482 a, 0, 0, 0,
1483 0, b, 0, 0,
1484 c, d, e, -1.0f,
1485 0, 0, f, 0
1486 };
1487
1488 glMultMatrixd(proj);
1489
1490}

Referenced by G4OpenGLViewer::SetView().

◆ g4GlOrtho()

void G4OpenGLViewer::g4GlOrtho ( GLdouble  left,
GLdouble  right,
GLdouble  bottom,
GLdouble  top,
GLdouble  near,
GLdouble  far 
)
protectedinherited

Definition at line 1445 of file G4OpenGLViewer.cc.

1445 {
1446 // glOrtho (left, right, bottom, top, near, far);
1447
1448 GLdouble a = 2.0 / (right - left);
1449 GLdouble b = 2.0 / (top - bottom);
1450 GLdouble c = -2.0 / (zFar - zNear);
1451
1452 GLdouble tx = - (right + left)/(right - left);
1453 GLdouble ty = - (top + bottom)/(top - bottom);
1454 GLdouble tz = - (zFar + zNear)/(zFar - zNear);
1455
1456 GLdouble ortho[16] = {
1457 a, 0, 0, 0,
1458 0, b, 0, 0,
1459 0, 0, c, 0,
1460 tx, ty, tz, 1
1461 };
1462 glMultMatrixd(ortho);
1463
1464}

Referenced by G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(), G4OpenGLImmediateSceneHandler::BeginPrimitives2D(), G4OpenGLStoredViewer::DrawDisplayLists(), and G4OpenGLViewer::SetView().

◆ g4GluLookAt()

void G4OpenGLViewer::g4GluLookAt ( GLdouble  eyex,
GLdouble  eyey,
GLdouble  eyez,
GLdouble  centerx,
GLdouble  centery,
GLdouble  centerz,
GLdouble  upx,
GLdouble  upy,
GLdouble  upz 
)
protectedinherited

Definition at line 1365 of file G4OpenGLViewer.cc.

1369{
1370 GLdouble mat[16];
1371 GLdouble x[3], y[3], z[3];
1372 GLdouble mag;
1373
1374 /* Make rotation matrix */
1375
1376 /* Z vector */
1377 z[0] = eyex - centerx;
1378 z[1] = eyey - centery;
1379 z[2] = eyez - centerz;
1380 mag = std::sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]);
1381 if (mag) { /* mpichler, 19950515 */
1382 z[0] /= mag;
1383 z[1] /= mag;
1384 z[2] /= mag;
1385 }
1386
1387 /* Y vector */
1388 y[0] = upx;
1389 y[1] = upy;
1390 y[2] = upz;
1391
1392 /* X vector = Y cross Z */
1393 x[0] = y[1] * z[2] - y[2] * z[1];
1394 x[1] = -y[0] * z[2] + y[2] * z[0];
1395 x[2] = y[0] * z[1] - y[1] * z[0];
1396
1397 /* Recompute Y = Z cross X */
1398 y[0] = z[1] * x[2] - z[2] * x[1];
1399 y[1] = -z[0] * x[2] + z[2] * x[0];
1400 y[2] = z[0] * x[1] - z[1] * x[0];
1401
1402 /* mpichler, 19950515 */
1403 /* cross product gives area of parallelogram, which is < 1.0 for
1404 * non-perpendicular unit-length vectors; so normalize x, y here
1405 */
1406
1407 mag = std::sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
1408 if (mag) {
1409 x[0] /= mag;
1410 x[1] /= mag;
1411 x[2] /= mag;
1412 }
1413
1414 mag = std::sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]);
1415 if (mag) {
1416 y[0] /= mag;
1417 y[1] /= mag;
1418 y[2] /= mag;
1419 }
1420
1421#define M(row,col) mat[col*4+row]
1422 M(0, 0) = x[0];
1423 M(0, 1) = x[1];
1424 M(0, 2) = x[2];
1425 M(0, 3) = 0.0;
1426 M(1, 0) = y[0];
1427 M(1, 1) = y[1];
1428 M(1, 2) = y[2];
1429 M(1, 3) = 0.0;
1430 M(2, 0) = z[0];
1431 M(2, 1) = z[1];
1432 M(2, 2) = z[2];
1433 M(2, 3) = 0.0;
1434 M(3, 0) = 0.0;
1435 M(3, 1) = 0.0;
1436 M(3, 2) = 0.0;
1437 M(3, 3) = 1.0;
1438#undef M
1439 glMultMatrixd(mat);
1440
1441 /* Translate Eye to Origin */
1442 glTranslated(-eyex, -eyey, -eyez);
1443}
#define M(row, col)

References M.

Referenced by G4OpenGLViewer::SetView().

◆ g4GluPickMatrix()

void G4OpenGLViewer::g4GluPickMatrix ( GLdouble  x,
GLdouble  y,
GLdouble  width,
GLdouble  height,
GLint  viewport[4] 
)
protectedinherited

Definition at line 1323 of file G4OpenGLViewer.cc.

1325 {
1326 GLdouble mat[16];
1327 GLdouble sx, sy;
1328 GLdouble tx, ty;
1329
1330 sx = viewport[2] / width;
1331 sy = viewport[3] / height;
1332 tx = (viewport[2] + 2.0 * (viewport[0] - x)) / width;
1333 ty = (viewport[3] + 2.0 * (viewport[1] - y)) / height;
1334
1335#define M(row, col) mat[col*4+row]
1336 M(0, 0) = sx;
1337 M(0, 1) = 0.0;
1338 M(0, 2) = 0.0;
1339 M(0, 3) = tx;
1340 M(1, 0) = 0.0;
1341 M(1, 1) = sy;
1342 M(1, 2) = 0.0;
1343 M(1, 3) = ty;
1344 M(2, 0) = 0.0;
1345 M(2, 1) = 0.0;
1346 M(2, 2) = 1.0;
1347 M(2, 3) = 0.0;
1348 M(3, 0) = 0.0;
1349 M(3, 1) = 0.0;
1350 M(3, 2) = 0.0;
1351 M(3, 3) = 1.0;
1352#undef M
1353
1354 glMultMatrixd(mat);
1355}

References M.

Referenced by G4OpenGLViewer::GetPickDetails().

◆ get_boolean_userData()

G4bool G4OpenGLXmViewer::get_boolean_userData ( Widget  w)
static

Definition at line 530 of file G4OpenGLXmConvenienceRoutines.cc.

531{
532 XtPointer userData;
533 XtVaGetValues (w,XmNuserData,&userData,NULL);
534 return (G4bool)(((unsigned long)userData)&0xffff);
535}
bool G4bool
Definition: G4Types.hh:86
#define userData
Definition: xmlparse.cc:572

References userData.

Referenced by pan_left_right_callback(), pan_up_down_callback(), phi_rotation_callback(), and theta_rotation_callback().

◆ get_double_value_callback()

void G4OpenGLXmViewer::get_double_value_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 500 of file G4OpenGLXmConvenienceRoutines.cc.

503{
504 G4double* val = (G4double*) clientData;
505 String string;
506
507 XtVaGetValues (w,
508 XmNvalue, &string,
509 NULL);
510
511// sscanf (string, "%lg", val);
512 std::istringstream iss(string);
513 iss >> *val;
514}

Referenced by Add_set_field(), and G4OpenGLXmTextField::AddYourselfTo().

◆ get_int_userData()

G4int G4OpenGLXmViewer::get_int_userData ( Widget  w)
static

Definition at line 537 of file G4OpenGLXmConvenienceRoutines.cc.

538{
539 XtPointer userData;
540 XtVaGetValues (w,XmNuserData,&userData,NULL);
541 return (G4int)(unsigned long)userData;
542}

References userData.

Referenced by projection_callback(), set_print_colour_callback(), set_print_style_callback(), and set_rot_subject_callback().

◆ get_text_callback()

void G4OpenGLXmViewer::get_text_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 516 of file G4OpenGLXmConvenienceRoutines.cc.

519{
520 char* txt = (char*)clientData;
521 String string;
522
523 XtVaGetValues (w,
524 XmNvalue, &string,
525 NULL);
526
527 strcpy(txt, string);
528}

Referenced by G4OpenGLXmTextField::AddYourselfTo().

◆ GetApplicableVisAttributes()

const G4VisAttributes * G4VViewer::GetApplicableVisAttributes ( const G4VisAttributes ) const
inherited

◆ GetDefaultViewParameters()

const G4ViewParameters & G4VViewer::GetDefaultViewParameters ( ) const
inherited

◆ GetName()

const G4String & G4VViewer::GetName ( ) const
inherited

◆ GetPickDetails()

const std::vector< G4OpenGLViewerPickMap * > & G4OpenGLViewer::GetPickDetails ( GLdouble  x,
GLdouble  y 
)
protectedinherited

Definition at line 488 of file G4OpenGLViewer.cc.

489{
490 static std::vector < G4OpenGLViewerPickMap* > pickMapVector;
491 for (auto pickMap: pickMapVector) {
492 delete pickMap;
493 }
494 pickMapVector.clear();
495
496 const G4int BUFSIZE = 512;
497 GLuint selectBuffer[BUFSIZE];
498 glSelectBuffer(BUFSIZE, selectBuffer);
499 glRenderMode(GL_SELECT);
500 glInitNames();
501 glPushName(0);
502 glMatrixMode(GL_PROJECTION);
503 G4double currentProjectionMatrix[16];
504 glGetDoublev(GL_PROJECTION_MATRIX, currentProjectionMatrix);
505 glPushMatrix();
506 glLoadIdentity();
507 GLint viewport[4];
508 glGetIntegerv(GL_VIEWPORT, viewport);
509/* G4cout
510 << "viewport, x,y: "
511 << viewport[0] << ',' << viewport[1] << ',' << viewport[2] << ',' << viewport[3]
512 << ", " << x << ',' << y
513 << G4endl;
514*/
515 fIsGettingPickInfos = true;
516 // Define 5x5 pixel pick area
517 g4GluPickMatrix(x, viewport[3] - y, 5., 5., viewport);
518 glMultMatrixd(currentProjectionMatrix);
519 glMatrixMode(GL_MODELVIEW);
520 DrawView();
521 GLint hits = glRenderMode(GL_RENDER);
522 fIsGettingPickInfos = false;
523 if (hits < 0) {
524 G4cout << "Too many hits. Zoom in to reduce overlaps." << G4endl;
525 goto restoreMatrices;
526 }
527 if (hits > 0) {
528 GLuint* p = selectBuffer;
529 for (GLint i = 0; i < hits; ++i) {
530 GLuint nnames = *p++;
531 // This bit of debug code or...
532 //GLuint zmin = *p++;
533 //GLuint zmax = *p++;
534 //G4cout << "Hit " << i << ": " << nnames << " names"
535 // << "\nzmin: " << zmin << ", zmax: " << zmax << G4endl;
536 // ...just increment the pointer
537 p++;
538 p++;
539 for (GLuint j = 0; j < nnames; ++j) {
540 GLuint name = *p++;
541 std::map<GLuint, G4AttHolder*>::iterator iter =
543 if (iter != fOpenGLSceneHandler.fPickMap.end()) {
544 G4AttHolder* attHolder = iter->second;
545 if(attHolder && attHolder->GetAttDefs().size()) {
546 for (size_t iAtt = 0;
547 iAtt < attHolder->GetAttDefs().size(); ++iAtt) {
548 std::ostringstream oss;
549 oss << G4AttCheck(attHolder->GetAttValues()[iAtt],
550 attHolder->GetAttDefs()[iAtt]);
552// G4cout
553// << "i,j, attHolder->GetAttDefs().size(): "
554// << i << ',' << j
555// << ", " << attHolder->GetAttDefs().size()
556// << G4endl;
557// G4cout << "G4OpenGLViewer::GetPickDetails: " << oss.str() << G4endl;
558 pickMap->addAttributes(oss.str());
559 pickMap->setHitNumber(i);
560 pickMap->setSubHitNumber(j);
561 pickMap->setPickName(name);
562 pickMapVector.push_back(pickMap);
563 }
564 }
565 }
566 }
567 }
568 }
569
570restoreMatrices:
571 glMatrixMode(GL_PROJECTION);
572 glPopMatrix();
573 glMatrixMode(GL_MODELVIEW);
574
575 return pickMapVector;
576}
const std::vector< const std::vector< G4AttValue > * > & GetAttValues() const
Definition: G4AttHolder.hh:59
const std::vector< const std::map< G4String, G4AttDef > * > & GetAttDefs() const
Definition: G4AttHolder.hh:61
std::map< GLuint, G4AttHolder * > fPickMap
void setSubHitNumber(G4int n)
void setHitNumber(G4int n)
void addAttributes(G4String att)
void setPickName(G4int n)
void g4GluPickMatrix(GLdouble x, GLdouble y, GLdouble width, GLdouble height, GLint viewport[4])
G4OpenGLSceneHandler & fOpenGLSceneHandler
#define BUFSIZE
Definition: liblist.c:40

References G4OpenGLViewerPickMap::addAttributes(), BUFSIZE, G4VViewer::DrawView(), G4OpenGLViewer::fIsGettingPickInfos, G4OpenGLViewer::fOpenGLSceneHandler, G4OpenGLSceneHandler::fPickMap, G4cout, G4endl, G4OpenGLViewer::g4GluPickMatrix(), G4AttHolder::GetAttDefs(), G4AttHolder::GetAttValues(), G4InuclParticleNames::name(), G4OpenGLViewerPickMap::setHitNumber(), G4OpenGLViewerPickMap::setPickName(), and G4OpenGLViewerPickMap::setSubHitNumber().

Referenced by G4OpenGLViewer::Pick(), and G4OpenGLQtViewer::updatePickInfosWidget().

◆ GetPrivateVisAttributesModifiers()

virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * G4VViewer::GetPrivateVisAttributesModifiers ( ) const
virtualinherited

◆ getRealExportHeight()

G4int G4OpenGLViewer::getRealExportHeight ( )
privateinherited

Definition at line 1004 of file G4OpenGLViewer.cc.

1004 {
1005 if (fPrintSizeY == -1) {
1006 return fWinSize_y;
1007 }
1008 GLint dims[2];
1009 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
1010
1011 // L.Garnier 01-2010: Some problems with mac 10.6
1012 if ((dims[0] !=0 ) && (dims[1] !=0)) {
1013 if (fPrintSizeY > dims[1]){
1014 return dims[1];
1015 }
1016 }
1017 if (fPrintSizeY < -1){
1018 return 0;
1019 }
1020 return fPrintSizeY;
1021}
unsigned int fWinSize_y

References G4OpenGLViewer::fPrintSizeY, and G4OpenGLViewer::fWinSize_y.

Referenced by G4OpenGLViewer::exportImage(), G4OpenGLViewer::printGl2PS(), and G4OpenGLViewer::printNonVectoredEPS().

◆ getRealExportWidth()

G4int G4OpenGLViewer::getRealExportWidth ( )
privateinherited

Definition at line 985 of file G4OpenGLViewer.cc.

985 {
986 if (fPrintSizeX == -1) {
987 return fWinSize_x;
988 }
989 GLint dims[2];
990 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
991
992 // L.Garnier 01-2010: Some problems with mac 10.6
993 if ((dims[0] !=0 ) && (dims[1] !=0)) {
994 if (fPrintSizeX > dims[0]){
995 return dims[0];
996 }
997 }
998 if (fPrintSizeX < -1){
999 return 0;
1000 }
1001 return fPrintSizeX;
1002}
unsigned int fWinSize_x

References G4OpenGLViewer::fPrintSizeX, and G4OpenGLViewer::fWinSize_x.

Referenced by G4OpenGLViewer::exportImage(), G4OpenGLViewer::printGl2PS(), and G4OpenGLViewer::printNonVectoredEPS().

◆ getRealPrintFilename()

std::string G4OpenGLViewer::getRealPrintFilename ( )
protectedinherited

Definition at line 1066 of file G4OpenGLViewer.cc.

1066 {
1067 std::string temp = fExportFilename;
1068 if (fExportFilenameIndex != -1) {
1069 temp += std::string("_");
1070 std::ostringstream os;
1071 os << std::setw(4) << std::setfill('0') << fExportFilenameIndex;
1072 std::string nb_str = os.str();
1073 temp += nb_str;
1074 }
1075 temp += "."+fExportImageFormat;
1076 return temp;
1077}
G4String fExportFilename

References G4OpenGLViewer::fExportFilename, G4OpenGLViewer::fExportFilenameIndex, and G4OpenGLViewer::fExportImageFormat.

Referenced by G4OpenGLQtViewer::exportImage(), G4OpenGLViewer::exportImage(), misc_callback(), G4OpenGLViewer::printGl2PS(), G4OpenGLViewer::printNonVectoredEPS(), and G4OpenGLViewer::setExportFilename().

◆ getSceneDepth()

GLdouble G4OpenGLViewer::getSceneDepth ( )
protectedinherited

Definition at line 1111 of file G4OpenGLViewer.cc.

1112{
1113 if (!fSceneHandler.GetScene()) {
1114 return 0;
1115 }
1116 const G4Point3D targetPoint
1120 if(radius<=0.) radius = 1.;
1121 const G4double cameraDistance = fVP.GetCameraDistance (radius);
1122 const GLdouble pnear = fVP.GetNearDistance (cameraDistance, radius);
1123 return fVP.GetFarDistance (cameraDistance, pnear, radius)- pnear;
1124}
const G4Point3D & GetStandardTargetPoint() const
G4double GetCameraDistance(G4double radius) const
const G4Point3D & GetCurrentTargetPoint() const
G4double GetFarDistance(G4double cameraDistance, G4double nearDistance, G4double radius) const
G4double GetNearDistance(G4double cameraDistance, G4double radius) const

References G4VViewer::fSceneHandler, G4VViewer::fVP, G4ViewParameters::GetCameraDistance(), G4ViewParameters::GetCurrentTargetPoint(), G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4ViewParameters::GetFarDistance(), G4ViewParameters::GetNearDistance(), G4VSceneHandler::GetScene(), and G4Scene::GetStandardTargetPoint().

Referenced by G4OpenGLQtViewer::moveScene().

◆ getSceneFarWidth()

GLdouble G4OpenGLViewer::getSceneFarWidth ( )
protectedinherited

Definition at line 1094 of file G4OpenGLViewer.cc.

1095{
1096 if (!fSceneHandler.GetScene()) {
1097 return 0;
1098 }
1099 const G4Point3D targetPoint
1103 if(radius<=0.) radius = 1.;
1104 const G4double cameraDistance = fVP.GetCameraDistance (radius);
1105 const GLdouble pnear = fVP.GetNearDistance (cameraDistance, radius);
1106 const GLdouble pfar = fVP.GetFarDistance (cameraDistance, pnear, radius);
1107 return 2 * fVP.GetFrontHalfHeight (pfar, radius);
1108}
G4double GetFrontHalfHeight(G4double nearDistance, G4double radius) const

References G4VViewer::fSceneHandler, G4VViewer::fVP, G4ViewParameters::GetCameraDistance(), G4ViewParameters::GetCurrentTargetPoint(), G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4ViewParameters::GetFarDistance(), G4ViewParameters::GetFrontHalfHeight(), G4ViewParameters::GetNearDistance(), G4VSceneHandler::GetScene(), and G4Scene::GetStandardTargetPoint().

◆ GetSceneHandler()

G4VSceneHandler * G4VViewer::GetSceneHandler ( ) const
inherited

◆ getSceneNearWidth()

GLdouble G4OpenGLViewer::getSceneNearWidth ( )
protectedinherited

◆ GetShortName()

const G4String & G4VViewer::GetShortName ( ) const
inherited

◆ GetViewId()

G4int G4VViewer::GetViewId ( ) const
inherited

◆ GetViewParameters()

const G4ViewParameters & G4VViewer::GetViewParameters ( ) const
inherited

Referenced by actions_callback(), G4OpenInventorSceneHandler::AddCircleSquare(), G4Qt3DSceneHandler::AddPrimitive(), G4ToolsSGSceneHandler::AddPrimitive(), G4OpenInventorSceneHandler::AddPrimitive(), G4OpenGLSceneHandler::AddPrimitive(), G4OpenGLImmediateSceneHandler::AddPrimitivePreambleInternal(), G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(), G4OpenInventorSceneHandler::AddTransform(), background_color_callback(), G4OpenGLImmediateQtViewer::ComputeView(), G4OpenGLStoredQtViewer::ComputeView(), G4VSceneHandler::CreateSectionSolid(), G4VisManager::CreateViewer(), G4OpenGLImmediateWin32Viewer::DrawView(), G4OpenGLImmediateXmViewer::DrawView(), G4OpenGLImmediateXViewer::DrawView(), G4OpenGLStoredWin32Viewer::DrawView(), G4OpenGLStoredXmViewer::DrawView(), G4OpenGLStoredXViewer::DrawView(), G4OpenGLStoredSceneHandler::EndModeling(), G4VisManager::EndOfRun(), G4VSceneHandler::GetAuxEdgeVisible(), G4VSceneHandler::GetColour(), G4VSceneHandler::GetDrawingStyle(), G4VSceneHandler::GetNoOfSides(), G4VSceneHandler::GetNumberOfCloudPoints(), G4VSceneHandler::GetTextColour(), G4VVisCommand::RefreshIfRequired(), G4VSceneHandler::RequestPrimitives(), G4VisCommandDrawView::SetNewValue(), G4VisCommandDrawLogicalVolume::SetNewValue(), G4VisCommandGeometrySetDaughtersInvisible::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValue(), G4VisCommandSceneNotifyHandlers::SetNewValue(), G4VisCommandSceneAddLogo::SetNewValue(), G4VisCommandSceneAddScale::SetNewValue(), G4VisCommandSceneHandlerCreate::SetNewValue(), G4VisCommandsTouchable::SetNewValue(), G4VisCommandsTouchableSet::SetNewValue(), G4VisCommandViewerAddCutawayPlane::SetNewValue(), G4VisCommandViewerCentreOn::SetNewValue(), G4VisCommandViewerChangeCutawayPlane::SetNewValue(), G4VisCommandViewerClearCutawayPlanes::SetNewValue(), G4VisCommandViewerClearVisAttributesModifiers::SetNewValue(), G4VisCommandViewerClone::SetNewValue(), G4VisCommandViewerColourByDensity::SetNewValue(), G4VisCommandViewerCopyViewFrom::SetNewValue(), G4VisCommandViewerCreate::SetNewValue(), G4VisCommandViewerDolly::SetNewValue(), G4VisCommandViewerInterpolate::SetNewValue(), G4VisCommandViewerPan::SetNewValue(), G4VisCommandViewerSave::SetNewValue(), G4VisCommandViewerScale::SetNewValue(), G4VisCommandViewerZoom::SetNewValue(), G4VisCommandsViewerSet::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValueOnLV(), G4OpenInventorViewer::SetReducedWireFrame(), G4OpenInventorViewer::SetSolid(), and G4OpenInventorViewer::SetWireFrame().

◆ getWinHeight()

unsigned int G4OpenGLViewer::getWinHeight ( ) const
protectedinherited

◆ getWinWidth()

unsigned int G4OpenGLViewer::getWinWidth ( ) const
protectedinherited

◆ GetXConnection()

void G4OpenGLXViewer::GetXConnection ( )
protectedinherited

Definition at line 153 of file G4OpenGLXViewer.cc.

153 {
154// get a connection.
155 dpy = XOpenDisplay (0); // Uses DISPLAY environment variable.
156 if (!dpy) {
157 fViewId = -1; // This flags an error.
158 G4cerr << "G4OpenGLXViewer::G4OpenGLXViewer couldn't open display." << G4endl;
159 return;
160 }
161
162// make sure OpenGL is supported and installed properly.
163 if (!glXQueryExtension (dpy, &errorBase, &eventBase)) {
164 fViewId = -1; // This flags an error.
165 G4cerr << "G4OpenGLXViewer::G4OpenGLXViewer X Server has no GLX extension."
166 << G4endl;
167 return;
168 }
169
170}

References G4OpenGLXViewer::dpy, G4OpenGLXViewer::errorBase, G4OpenGLXViewer::eventBase, G4VViewer::fViewId, G4cerr, and G4endl.

Referenced by G4OpenGLXViewer::G4OpenGLXViewer().

◆ GetXmConnection()

void G4OpenGLXmViewer::GetXmConnection ( )
protected

Definition at line 110 of file G4OpenGLXmViewer.cc.

110 {
111
112 G4Xt* interactorManager = G4Xt::getInstance ();
113 toplevel = (Widget)interactorManager->GetMainInteractor();
114 app = XtWidgetToApplicationContext(toplevel);
115
116 if (!toplevel) {
117 fViewId = -1; // This flags an error.
118 G4cerr << "G4OpenGLXmViewer::GetXmConnection unable to Initialize"
119 " application context." << G4endl;
120 return;
121 }
122
123 // Better to put this in an X11 resource file !!!
124 std::ostringstream oss;
125 oss <<
126 "*glxarea*width: " << fVP.GetWindowSizeHintX() << "\n"
127 "*glxarea*height: " << fVP.GetWindowSizeHintY() << "\n"
128 /*
129 // Tried this as a replacement for the above two lines, but
130 // sub-windows (rotation, etc.) came same size!!
131 "*geometry: " << fVP.GetXGeometryString() << "\n"
132 */
133 "*frame*x: 10\n"
134 "*frame*y: 10\n"
135 "*frame*topOffset: 10\n"
136 "*frame*bottomOffset: 10\n"
137 "*frame*rightOffset: 10\n"
138 "*frame*leftOffset: 10\n"
139 "*frame*shadowType: SHADOW_IN\n"
140 "*frame*useColorObj: False\n"
141 "*frame*primaryColorSetId: 3\n"
142 "*frame*secondaryColorSetId: 3\n"
143 "*menubar*useColorObj: False\n"
144 "*menubar*primaryColorSetId: 3\n"
145 "*menubar*secondaryColorSetId: 3\n"
146 "*toplevel*useColorObj: False\n"
147 "*toplevel*primaryColorSetId: 3\n"
148 "*toplevel*secondaryColorSetId: 3\n";
149 interactorManager->PutStringInResourceDatabase ((char*)oss.str().c_str());
150
151 // interactorManager->AddSecondaryLoopPostAction ((G4SecondaryLoopAction)G4OpenGLXmViewerSecondaryLoopPostAction);
152
153 shell = XtAppCreateShell ((String)fName.data(),(String)fName.data(),topLevelShellWidgetClass,XtDisplay(toplevel),NULL,0);
154 interactorManager->AddShell (shell);
155
156 dpy = XtDisplay (shell);
157
158 if (!dpy) {
159 fViewId = -1; // This flags an error.
160 G4cerr << "G4OpenGLXmViewer::GetXmConnection unable to connect to display."
161 << G4endl;
162 return;
163 }
164
165 if (!glXQueryExtension (dpy, &errorBase, &eventBase)) {
166 fViewId = -1; // This flags an error.
167 G4cerr << "G4OpenGLXmViewer::GetXmConnection. X Server has no GLX extension."
168 << G4endl;;
169 return;
170 }
171}
G4Interactor GetMainInteractor()
void AddShell(G4Interactor)
Definition: G4Xt.hh:48
void PutStringInResourceDatabase(char *)
Definition: G4Xt.cc:162

References G4VInteractorManager::AddShell(), app, G4OpenGLXViewer::dpy, G4OpenGLXViewer::errorBase, G4OpenGLXViewer::eventBase, G4VViewer::fName, G4VViewer::fViewId, G4VViewer::fVP, G4cerr, G4endl, G4Xt::getInstance(), G4VInteractorManager::GetMainInteractor(), G4ViewParameters::GetWindowSizeHintX(), G4ViewParameters::GetWindowSizeHintY(), G4Xt::PutStringInResourceDatabase(), shell, and toplevel.

Referenced by G4OpenGLXmViewer().

◆ grabPixels()

GLubyte * G4OpenGLViewer::grabPixels ( int  inColor,
unsigned int  width,
unsigned int  height 
)
privateinherited

Definition at line 578 of file G4OpenGLViewer.cc.

579 {
580
581 GLubyte* buffer;
582 GLint swapbytes, lsbfirst, rowlength;
583 GLint skiprows, skippixels, alignment;
584 GLenum format;
585 int size;
586
587 if (inColor) {
588 format = GL_RGB;
589 size = width*height*3;
590 } else {
591 format = GL_LUMINANCE;
592 size = width*height*1;
593 }
594
595 buffer = new GLubyte[size];
596 if (buffer == NULL)
597 return NULL;
598
599 glGetIntegerv (GL_UNPACK_SWAP_BYTES, &swapbytes);
600 glGetIntegerv (GL_UNPACK_LSB_FIRST, &lsbfirst);
601 glGetIntegerv (GL_UNPACK_ROW_LENGTH, &rowlength);
602
603 glGetIntegerv (GL_UNPACK_SKIP_ROWS, &skiprows);
604 glGetIntegerv (GL_UNPACK_SKIP_PIXELS, &skippixels);
605 glGetIntegerv (GL_UNPACK_ALIGNMENT, &alignment);
606
607 glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE);
608 glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
609 glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
610
611 glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
612 glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
613 glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
614
615 glReadBuffer(GL_FRONT);
616 glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer);
617
618 glPixelStorei (GL_UNPACK_SWAP_BYTES, swapbytes);
619 glPixelStorei (GL_UNPACK_LSB_FIRST, lsbfirst);
620 glPixelStorei (GL_UNPACK_ROW_LENGTH, rowlength);
621
622 glPixelStorei (GL_UNPACK_SKIP_ROWS, skiprows);
623 glPixelStorei (GL_UNPACK_SKIP_PIXELS, skippixels);
624 glPixelStorei (GL_UNPACK_ALIGNMENT, alignment);
625
626 return buffer;
627}
#define buffer
Definition: xmlparse.cc:628

References buffer.

Referenced by G4OpenGLViewer::printNonVectoredEPS().

◆ haloing_callback()

void G4OpenGLXmViewer::haloing_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 193 of file G4OpenGLXmStyleCallbacks.cc.

196{
197 G4long choice = (G4long)clientData;
198 G4OpenGLXmViewer* pView;
199 XtVaGetValues (XtParent(w),
200 XmNuserData, &pView,
201 NULL);
202
203 switch (choice) {
204
205 case 0:
206 pView->haloing_enabled = false;
207 break;
208
209 case 1:
210 pView->haloing_enabled = true;
211 break;
212
213 default:
215 ("G4OpenGLXmViewer::haloing_callback",
216 "opengl2011", FatalException,
217 "Unrecognised case in haloing_callback.");
218 }
219
220 pView->SetView ();
221 pView->ClearView ();
222 pView->DrawView ();
223}

References G4OpenGLViewer::ClearView(), G4VViewer::DrawView(), FatalException, G4Exception(), G4OpenGLViewer::haloing_enabled, and G4OpenGLXViewer::SetView().

Referenced by CreateMainWindow().

◆ HaloingFirstPass()

void G4OpenGLViewer::HaloingFirstPass ( )
protectedinherited

Definition at line 441 of file G4OpenGLViewer.cc.

441 {
442
443 //To perform haloing, first Draw all information to the depth buffer
444 //alone, using a chunky line width, and then Draw all info again, to
445 //the colour buffer, setting a thinner line width an the depth testing
446 //function to less than or equal, so if two lines cross, the one
447 //passing behind the other will not pass the depth test, and so not
448 //get rendered either side of the infront line for a short distance.
449
450 //First, disable writing to the colo(u)r buffer...
451 glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
452
453 //Now enable writing to the depth buffer...
454 glDepthMask (GL_TRUE);
455 glDepthFunc (GL_LESS);
456 glClearDepth (1.0);
457
458 //Finally, set the line width to something wide...
459 ChangeLineWidth(3.0);
460
461}
void ChangeLineWidth(G4double width)

References G4OpenGLViewer::ChangeLineWidth().

Referenced by G4OpenGLImmediateQtViewer::ComputeView(), G4OpenGLStoredQtViewer::ComputeView(), G4OpenGLImmediateWin32Viewer::DrawView(), G4OpenGLImmediateXmViewer::DrawView(), G4OpenGLImmediateXViewer::DrawView(), G4OpenGLStoredWin32Viewer::DrawView(), G4OpenGLStoredXmViewer::DrawView(), and G4OpenGLStoredXViewer::DrawView().

◆ HaloingSecondPass()

void G4OpenGLViewer::HaloingSecondPass ( )
protectedinherited

Definition at line 463 of file G4OpenGLViewer.cc.

463 {
464
465 //And finally, turn the colour buffer back on with a sesible line width...
466 glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
467 glDepthFunc (GL_LEQUAL);
468 ChangeLineWidth(1.0);
469
470}

References G4OpenGLViewer::ChangeLineWidth().

Referenced by G4OpenGLImmediateQtViewer::ComputeView(), G4OpenGLStoredQtViewer::ComputeView(), G4OpenGLImmediateWin32Viewer::DrawView(), G4OpenGLImmediateXmViewer::DrawView(), G4OpenGLImmediateXViewer::DrawView(), G4OpenGLStoredWin32Viewer::DrawView(), G4OpenGLStoredXmViewer::DrawView(), and G4OpenGLStoredXViewer::DrawView().

◆ HLRFirstPass()

void G4OpenGLViewer::HLRFirstPass ( )
protectedinherited

◆ HLRSecondPass()

void G4OpenGLViewer::HLRSecondPass ( )
protectedinherited

◆ HLRThirdPass()

void G4OpenGLViewer::HLRThirdPass ( )
protectedinherited

◆ Initialise()

virtual void G4VViewer::Initialise ( )
virtualinherited

◆ InitializeGLView()

void G4OpenGLViewer::InitializeGLView ( )
protectedinherited

Definition at line 127 of file G4OpenGLViewer.cc.

128{
129#ifdef G4OPENGL_VERSION_2
130 if (fVboDrawer) {
131
132 // First, load a simple shader
133 fShaderProgram = glCreateProgram();
134 Shader vertexShader = glCreateShader(GL_VERTEX_SHADER);
135 const char * vSrc = fVboDrawer->getVertexShaderSrc();
136 glShaderSource(vertexShader, 1, &vSrc, NULL);
137 glCompileShader(vertexShader);
138 glAttachShader(fShaderProgram, vertexShader);
139
140 Shader fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
141 const char * fSrc = fVboDrawer->getFragmentShaderSrc();
142 glShaderSource(fragmentShader, 1, &fSrc, NULL);
143 glCompileShader(fragmentShader);
144
145 glAttachShader(fShaderProgram, fragmentShader);
146 glLinkProgram(fShaderProgram);
147 glUseProgram(fShaderProgram);
148
149 // UniformLocation uColor = getUniformLocation(fShaderProgram, "uColor");
150 // uniform4fv(uColor, [0.0, 0.3, 0.0, 1.0]);
151
152 // Extract the references to the attributes from the shader.
153
154 fVertexPositionAttribute =
155 glGetAttribLocation(fShaderProgram, "aVertexPosition");
156
157
158 glEnableVertexAttribArray(fVertexPositionAttribute);
159
160 // Extract the references the uniforms from the shader
161 fpMatrixUniform = glGetUniformLocation(fShaderProgram, "uPMatrix");
162 fcMatrixUniform = glGetUniformLocation(fShaderProgram, "uCMatrix");
163 fmvMatrixUniform = glGetUniformLocation(fShaderProgram, "uMVMatrix");
164 fnMatrixUniform = glGetUniformLocation(fShaderProgram, "uNMatrix");
165 ftMatrixUniform = glGetUniformLocation(fShaderProgram, "uTMatrix");
166
167 /* glUniformMatrix4fv(fcMatrixUniform, 1, 0, identity);
168 glUniformMatrix4fv(fpMatrixUniform, 1, 0, identity);
169 glUniformMatrix4fv(ftMatrixUniform, 1, 0, identity);
170 glUniformMatrix4fv(fmvMatrixUniform, 1, 0, identity);
171 */
172 // We have to set that in order to avoid calls on opengl commands before all is ready
173 fGlViewInitialized = true;
174 }
175#endif
176
177 if (fWinSize_x == 0) {
179 }
180 if (fWinSize_y == 0) {
182 }
183
184 glClearColor (0.0, 0.0, 0.0, 0.0);
185 glClearDepth (1.0);
186#ifndef G4OPENGL_VERSION_2
187 glDisable (GL_LINE_SMOOTH);
188 glDisable (GL_POLYGON_SMOOTH);
189#endif
190
191// clear the buffers and window?
192 ClearView ();
193 FinishView ();
194
195 glDepthFunc (GL_LEQUAL);
196 glDepthMask (GL_TRUE);
197
198 glEnable (GL_BLEND);
199 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
200
201}
virtual void FinishView()
Definition: G4VViewer.cc:101

References G4OpenGLViewer::ClearView(), G4OpenGLViewer::fGlViewInitialized, G4VViewer::FinishView(), G4VViewer::fVP, G4OpenGLViewer::fWinSize_x, G4OpenGLViewer::fWinSize_y, G4ViewParameters::GetWindowSizeHintX(), and G4ViewParameters::GetWindowSizeHintY().

Referenced by G4OpenGLImmediateXmViewer::Initialise(), G4OpenGLImmediateXViewer::Initialise(), G4OpenGLStoredXmViewer::Initialise(), G4OpenGLStoredXViewer::Initialise(), G4OpenGLImmediateQtViewer::initializeGL(), and G4OpenGLStoredQtViewer::initializeGL().

◆ isFramebufferReady()

G4bool G4OpenGLViewer::isFramebufferReady ( )
protectedinherited

Definition at line 730 of file G4OpenGLViewer.cc.

730 {
731 bool check = false;
732#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
733 check = true;
734#endif
735#ifdef G4VIS_BUILD_OPENGLX_DRIVER
736 check = false;
737#endif
738#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
739 check = false;
740#endif
741#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
742 check = false;
743#endif
744
745#if GL_ARB_framebuffer_object
746 if (check) {
747// if ( glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_UNDEFINED) {
748// return false;
749// }
750 }
751#endif
752 return true;
753}

Referenced by G4OpenGLViewer::ClearView(), G4OpenGLViewer::ClearViewWithoutFlush(), G4OpenGLImmediateQtViewer::paintEvent(), and G4OpenGLStoredQtViewer::paintEvent().

◆ isGl2psWriting()

bool G4OpenGLViewer::isGl2psWriting ( )
protectedinherited

Return if gl2ps is currently writing

Definition at line 720 of file G4OpenGLViewer.cc.

720 {
721
722 if (!fGL2PSAction) return false;
724 return true;
725 }
726 return false;
727}
bool fileWritingEnabled() const
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

References G4OpenGLViewer::fGL2PSAction, and G4OpenGL2PSAction::fileWritingEnabled().

Referenced by G4OpenGLViewer::ChangeLineWidth(), G4OpenGLViewer::ChangePointSize(), G4OpenGLQtViewer::DrawText(), G4OpenGLViewer::DrawText(), and G4OpenGLXViewer::DrawText().

◆ left_right_pan_callback()

void G4OpenGLXmViewer::left_right_pan_callback ( XtPointer  clientData,
XtIntervalId *  timer_id 
)
static

Definition at line 128 of file G4OpenGLXmPanningCallbacks.cc.

131{
132 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
133 G4double delta;
134
135 if (pView->pan_right) {
136 delta = pView->fPan_sens;
137 } else {
138 delta = -pView->fPan_sens;
139 }
140
141 G4Point3D stp
143
144 G4Point3D tp = stp + pView -> fVP.GetCurrentTargetPoint ();
145
146 const G4Vector3D& upVector = pView->fVP.GetUpVector ();
147 const G4Vector3D& vpVector = pView->fVP.GetViewpointDirection ();
148
149 G4Vector3D unitRight = (upVector.cross (vpVector)).unit();
150 G4Vector3D unitUp = (vpVector.cross (unitRight)).unit();
151
152 tp += delta * unitRight;
153 pView->fVP.SetCurrentTargetPoint (tp - stp);
154
155 pView->SetView ();
156 pView->ClearView ();
157 pView->DrawView ();
158
159 pView->pan_timer = XtAppAddTimeOut
160 (pView->app,
161 timer_id == NULL ? 500 : 1,
163 pView);
164}
static void left_right_pan_callback(XtPointer clientData, XtIntervalId *timer_id)
XtIntervalId pan_timer
void SetCurrentTargetPoint(const G4Point3D &currentTargetPoint)
const G4Vector3D & GetUpVector() const
BasicVector3D< T > cross(const BasicVector3D< T > &v) const

References app, G4OpenGLViewer::ClearView(), HepGeom::BasicVector3D< T >::cross(), G4VViewer::DrawView(), G4OpenGLViewer::fPan_sens, G4VViewer::fVP, G4ViewParameters::GetCurrentTargetPoint(), G4VSceneHandler::GetScene(), G4VViewer::GetSceneHandler(), G4Scene::GetStandardTargetPoint(), G4ViewParameters::GetUpVector(), G4ViewParameters::GetViewpointDirection(), left_right_pan_callback(), pan_right, pan_timer, G4ViewParameters::SetCurrentTargetPoint(), G4OpenGLXViewer::SetView(), and G4InuclParticleNames::tp.

Referenced by left_right_pan_callback(), and pan_left_right_callback().

◆ misc_callback()

void G4OpenGLXmViewer::misc_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

ajw

Definition at line 326 of file G4OpenGLXmMainMenubarCallbacks.cc.

329{
330 G4OpenGLXmViewer* pView;
331 G4long choice = (G4long)clientData;
332 XtVaGetValues (XtParent(w),
333 XmNuserData, &pView,
334 NULL);
335
336 switch (choice) {
337
338 case 0:
339 {
340
341 if (!pView->fpmiscellany_top) {
342
343 std::ostringstream misc_Name;
344 misc_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
345
346 pView->fpmiscellany_top = new G4OpenGLXmTopLevelShell (pView,
347 (char*)misc_Name.str().c_str());
348 pView->fpwobble_box = new G4OpenGLXmFramedBox ("Wobble view",
349 True);
350 pView->fpmiscellany_top->AddChild (pView->fpwobble_box);
351
352 XtCallbackRec* wob_cb_list = new XtCallbackRec[2];
353 wob_cb_list[0].callback = wobble_callback;
354 wob_cb_list[0].closure = pView;
355 wob_cb_list[1].callback = NULL;
356
357
358 pView->fpwobble_button = new G4OpenGLXmPushButton ("Wobble",
359 wob_cb_list);
360
361 XtCallbackRec* wobble_slider_list = new XtCallbackRec[2];
362 wobble_slider_list[0].callback = set_wob_sens_callback;
363 wobble_slider_list[0].closure = pView;
364 wobble_slider_list[1].callback = NULL;
365
366 pView->fpwobble_slider = new G4OpenGLXmSliderBar ("Wobble slider",
367 wobble_slider_list,
368 True,
369 0,
370 pView->wob_sens,
371 pView->wob_high,
372 pView->wob_low);
373 pView->fpwobble_box->AddChild (pView->fpwobble_button);
374 pView->fpwobble_box->AddChild (pView->fpwobble_slider);
375
376 pView->fpreset_box = new G4OpenGLXmFramedBox ("Reset view",
377 True);
378 pView->fpmiscellany_top->AddChild (pView->fpreset_box);
379
380 XtCallbackRec* rst_cb_list = new XtCallbackRec[3];
381 rst_cb_list[0].callback = reset_callback;
382 rst_cb_list[0].closure = pView;
383 rst_cb_list[1].callback = update_panels_callback;
384 rst_cb_list[1].closure = pView;
385 rst_cb_list[2].callback = NULL;
386
387 pView->fpreset_button = new G4OpenGLXmPushButton ("Reset",
388 rst_cb_list);
389
390 pView->fpreset_box->AddChild (pView->fpreset_button);
391
392 pView->fpproj_style_box = new G4OpenGLXmFramedBox ("Projection style",
393 True);
395
396 XtCallbackRec* proj_cb_list = new XtCallbackRec[2];
397 proj_cb_list[0].callback = projection_callback;
398 proj_cb_list[0].closure = pView;
399 proj_cb_list[1].callback = NULL;
400
401 pView->fporthogonal_button = new G4OpenGLXmRadioButton ("Orthographic",
402 proj_cb_list,
403 pView->fVP.GetFieldHalfAngle() > 0. ? False : True,
404 0);
405
406 pView->fpperspective_button = new G4OpenGLXmRadioButton ("Perspective",
407 proj_cb_list,
408 pView->fVP.GetFieldHalfAngle() > 0. ? True : False,
409 1);
410
411 pView->fpfov_text = new G4OpenGLXmTextField ("Field of view 0.1 -> 89.5 degrees.",
412 &(pView->fov));
413
416 pView->fpproj_style_box->AddChild (pView->fpfov_text);
417
418 pView->fpmiscellany_top->Realize ();
419
420 }
421
422 break;
423 }
424
425 case 1:
426 {
427 G4Xt::getInstance () -> RequireExitSecondaryLoop (OGL_EXIT_CODE);
428 break;
429 }
430
431 case 2:
432 {
433 if (!pView->fpprint_top) {
434
435 std::ostringstream print_Name;
436 print_Name << pView->GetSceneHandler()->GetSceneHandlerId() << '-' << pView->fViewId;
437
438 pView->fpprint_top = new G4OpenGLXmTopLevelShell (pView,
439 (char*)print_Name.str().c_str());
440
441 pView->fpprint_box = new G4OpenGLXmFramedBox ("Create EPS file of current view",
442 False);
443
444 pView->fpprint_top->AddChild (pView->fpprint_box);
445
446 pView->fpprint_col_box = new G4OpenGLXmFramedBox ("Colour choice",
447 True);
448 pView->fpprint_top->AddChild (pView->fpprint_col_box);
449
450 XtCallbackRec* prcol_cb_list = new XtCallbackRec[2];
451 prcol_cb_list[0].callback = set_print_colour_callback;
452 prcol_cb_list[0].closure = pView;
453 prcol_cb_list[1].callback = NULL;
454
455 pView->fpprint_col_radio1 = new G4OpenGLXmRadioButton ("Black and white",
456 prcol_cb_list,
457 pView->fPrintColour==false ? True : False,
458 0);
459
460 pView->fpprint_col_radio2 = new G4OpenGLXmRadioButton ("Colour",
461 prcol_cb_list,
462 pView->fPrintColour==true ? True : False,
463 1);
464
467
468 pView->fpprint_style_box = new G4OpenGLXmFramedBox ("File type",
469 True);
470 pView->fpprint_top->AddChild (pView->fpprint_style_box);
471
472 XtCallbackRec* prsty_cb_list = new XtCallbackRec[2];
473 prsty_cb_list[0].callback = set_print_style_callback;
474 prsty_cb_list[0].closure = pView;
475 prsty_cb_list[1].callback = NULL;
476
477 pView->fpprint_style_radio1 = new G4OpenGLXmRadioButton ("Screen dump (pixmap)",
478 prsty_cb_list,
479 pView->fVectoredPs==false ? True : False,
480 0);
481
482 pView->fpprint_style_radio2 = new G4OpenGLXmRadioButton ("PostScript",
483 prsty_cb_list,
484 pView->fVectoredPs==true ? True : False,
485 1);
486
489
490 pView->fpprint_text = new G4OpenGLXmTextField ("Name of .eps file to save",
491 (pView->getRealPrintFilename().c_str()));
492 pView->fpprint_box->AddChild (pView->fpprint_text);
493
494 pView->fpprint_line = new G4OpenGLXmSeparator ();
495 pView->fpprint_box->AddChild (pView->fpprint_line);
496
497 XtCallbackRec* pri_cb_list = new XtCallbackRec[2];
498 pri_cb_list[0].callback = print_callback;
499 pri_cb_list[0].closure = pView;
500 pri_cb_list[1].callback = NULL;
501
502
503 pView->fpprint_button = new G4OpenGLXmPushButton ("Create EPS file",
504 pri_cb_list);
505
506 pView->fpprint_box->AddChild (pView->fpprint_button);
507 pView->fpprint_top->Realize ();
508
509 }
510
512 break;
513 }
514
515 default:
517 ("G4OpenGLXmViewer::misc_callback",
518 "opengl2002", FatalException,
519 "Unrecognised widget child of misc_callback.");
520 }
521
522 return;
523
524}
#define OGL_EXIT_CODE
static void set_wob_sens_callback(Widget w, XtPointer clientData, XtPointer callData)
static void set_print_colour_callback(Widget w, XtPointer clientData, XtPointer callData)
static void print_callback(Widget w, XtPointer clientData, XtPointer callData)
static void set_print_style_callback(Widget w, XtPointer clientData, XtPointer callData)
static void projection_callback(Widget w, XtPointer clientData, XtPointer callData)
static void reset_callback(Widget w, XtPointer clientData, XtPointer callData)
static void wobble_callback(Widget w, XtPointer clientData, XtPointer callData)
G4double GetFieldHalfAngle() const

References G4OpenGLXmFramedBox::AddChild(), G4OpenGLXmTopLevelShell::AddChild(), FatalException, fov, fpfov_text, fpmiscellany_top, fporthogonal_button, fpperspective_button, fpprint_box, fpprint_button, fpprint_col_box, fpprint_col_radio1, fpprint_col_radio2, fpprint_line, fpprint_style_box, fpprint_style_radio1, fpprint_style_radio2, fpprint_text, fpprint_top, fpproj_style_box, fpreset_box, fpreset_button, G4OpenGLViewer::fPrintColour, fpwobble_box, fpwobble_button, fpwobble_slider, G4OpenGLViewer::fVectoredPs, G4VViewer::fViewId, G4VViewer::fVP, G4Exception(), G4ViewParameters::GetFieldHalfAngle(), G4Xt::getInstance(), G4OpenGLViewer::getRealPrintFilename(), G4VViewer::GetSceneHandler(), G4VSceneHandler::GetSceneHandlerId(), OGL_EXIT_CODE, print_callback(), projection_callback(), G4OpenGLXmTopLevelShell::Realize(), reset_callback(), set_print_colour_callback(), set_print_style_callback(), set_wob_sens_callback(), update_panels_callback(), wob_high, wob_low, wob_sens, and wobble_callback().

Referenced by CreateMainWindow().

◆ NeedKernelVisit()

void G4VViewer::NeedKernelVisit ( )
inherited

Definition at line 78 of file G4VViewer.cc.

78 {
79
80 fNeedKernelVisit = true;
81
82 // At one time I thought we'd better notify all viewers. But I guess
83 // each viewer can take care of itself, so the following code is
84 // redundant (but keep it commented out for now). (John Allison)
85 // Notify all viewers that a kernel visit is required.
86 // const G4ViewerList& viewerList = fSceneHandler.GetViewerList ();
87 // G4ViewerListConstIterator i;
88 // for (i = viewerList.begin(); i != viewerList.end(); i++) {
89 // (*i) -> SetNeedKernelVisit ();
90 // }
91 // ??...but, there's a problem in OpenGL Stored which seems to
92 // require *all* viewers to revisit the kernel, so...
93 // const G4ViewerList& viewerList = fSceneHandler.GetViewerList ();
94 // G4ViewerListConstIterator i;
95 // for (i = viewerList.begin(); i != viewerList.end(); i++) {
96 // (*i) -> SetNeedKernelVisit (true);
97 // }
98 // Feb 2005 - commented out. Let's fix OpenGL if necessary.
99}
G4bool fNeedKernelVisit
Definition: G4VViewer.hh:224

References G4VViewer::fNeedKernelVisit.

Referenced by G4OpenGLImmediateQtViewer::ComputeView(), G4DAWNFILEViewer::DrawView(), G4GMocrenFileViewer::DrawView(), G4HepRepFileViewer::DrawView(), G4OpenGLImmediateWin32Viewer::DrawView(), G4OpenGLImmediateXmViewer::DrawView(), G4OpenGLImmediateXViewer::DrawView(), G4VTreeViewer::DrawView(), G4VRML2FileViewer::DrawView(), G4VtkViewer::DrawView(), G4VisManager::GeometryHasChanged(), G4OpenGLStoredViewer::KernelVisitDecision(), G4OpenInventorViewer::KernelVisitDecision(), G4Qt3DViewer::KernelVisitDecision(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::KernelVisitDecision(), G4VisManager::NotifyHandlers(), G4OpenGLImmediateViewer::ProcessView(), G4VisCommandViewerRebuild::SetNewValue(), G4OpenInventorViewer::SetPreview(), G4OpenInventorViewer::SetPreviewAndFull(), G4OpenInventorViewer::SetReducedWireFrame(), and G4OpenInventorViewer::UpdateScene().

◆ operator=()

G4OpenGLXmViewer & G4OpenGLXmViewer::operator= ( const G4OpenGLXmViewer )
private

◆ pan_left_right_callback()

void G4OpenGLXmViewer::pan_left_right_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 112 of file G4OpenGLXmPanningCallbacks.cc.

115{
116 XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
117 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
118
119 pView->pan_right = get_boolean_userData (w);
120
121 if (cbs->reason == XmCR_ARM) {
122 left_right_pan_callback (pView,NULL);
123 } else if (cbs->reason == XmCR_DISARM) {
124 XtRemoveTimeOut (pView->pan_timer);
125 }
126}
static G4bool get_boolean_userData(Widget w)

References get_boolean_userData(), left_right_pan_callback(), pan_right, and pan_timer.

Referenced by actions_callback().

◆ pan_up_down_callback()

void G4OpenGLXmViewer::pan_up_down_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 166 of file G4OpenGLXmPanningCallbacks.cc.

169{
170 XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
171 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
172
173 pView->pan_up = get_boolean_userData (w);
174
175 if (cbs->reason == XmCR_ARM) {
176 up_down_pan_callback (pView,NULL);
177 } else if (cbs->reason == XmCR_DISARM) {
178 XtRemoveTimeOut (pView->pan_timer);
179 }
180}
static void up_down_pan_callback(XtPointer clientData, XtIntervalId *timer_id)

References get_boolean_userData(), pan_timer, pan_up, and up_down_pan_callback().

Referenced by actions_callback().

◆ phi_rotation_callback()

void G4OpenGLXmViewer::phi_rotation_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 119 of file G4OpenGLXmRotationCallbacks.cc.

122{
123 XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
124 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
125
126 pView->rotate_up = get_boolean_userData (w);
127
128 if (cbs->reason == XmCR_ARM) {
129 rotate_in_phi (pView, NULL);
130 } else if (cbs->reason == XmCR_DISARM) {
131 XtRemoveTimeOut (pView->rotation_timer);
132 }
133}
XtIntervalId rotation_timer
static void rotate_in_phi(XtPointer clientData, XtIntervalId *timer_id)

References get_boolean_userData(), rotate_in_phi(), rotate_up, and rotation_timer.

Referenced by actions_callback().

◆ Pick()

G4String G4OpenGLViewer::Pick ( GLdouble  x,
GLdouble  y 
)
protectedvirtualinherited

Definition at line 472 of file G4OpenGLViewer.cc.

473{
474 const std::vector < G4OpenGLViewerPickMap* > & pickMap = GetPickDetails(x,y);
475 G4String txt = "";
476 if (pickMap.size() == 0) {
477// txt += "No hits recorded.";;
478 } else {
479 for (unsigned int a=0; a < pickMap.size(); a++) {
480 if (pickMap[a]->getAttributes().size() > 0) {
481 txt += pickMap[a]->print();
482 }
483 }
484 }
485 return txt;
486}
const std::vector< G4OpenGLViewerPickMap * > & GetPickDetails(GLdouble x, GLdouble y)

References G4OpenGLViewer::GetPickDetails().

Referenced by G4OpenGLXViewer::ShowView().

◆ print_callback()

void G4OpenGLXmViewer::print_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 67 of file G4OpenGLXmWindowHandlingCallbacks.cc.

70{
71 G4OpenGLXViewer* pView = (G4OpenGLXmViewer*) clientData;
72 pView->exportImage();
73}
virtual bool exportImage(std::string name="", int width=-1, int height=-1)

References G4OpenGLViewer::exportImage().

Referenced by misc_callback().

◆ printGl2PS()

bool G4OpenGLViewer::printGl2PS ( )
privateinherited

Definition at line 886 of file G4OpenGLViewer.cc.

886 {
887
888 int width = getRealExportWidth();
889 int height = getRealExportHeight();
890 bool res = true;
891
892 // no need to redraw at each new primitive for printgl2PS
893 G4OpenGLSceneHandler& oglSceneHandler = dynamic_cast<G4OpenGLSceneHandler&>(fSceneHandler);
894 G4OpenGLSceneHandler::FlushAction originalFlushAction = oglSceneHandler.GetFlushAction();
896
897 if (!fGL2PSAction) return false;
898
900 // try to resize
901 int X = fWinSize_x;
902 int Y = fWinSize_y;
903
904 fWinSize_x = width;
905 fWinSize_y = height;
906 // Laurent G. 16/03/10 : Not the good way to do.
907 // We should draw in a new offscreen context instead of
908 // resizing and drawing in current window...
909 // This should be solve when we will do an offscreen method
910 // to render OpenGL
911 // See :
912 // http://developer.apple.com/Mac/library/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_offscreen/opengl_offscreen.html
913 // http://www.songho.ca/opengl/gl_fbo.html
914
915 ResizeGLView();
916 bool extendBuffer = true;
917 bool endWriteAction = false;
918 bool beginWriteAction = true;
919 bool filePointerOk = true;
920 while ((extendBuffer) && (! endWriteAction) && (filePointerOk)) {
921
922 beginWriteAction = fGL2PSAction->enableFileWriting();
923 // 3 cases :
924 // - true
925 // - false && ! fGL2PSAction->fileWritingEnabled() => bad file name
926 // - false && fGL2PSAction->fileWritingEnabled() => buffer size problem ?
927
928 filePointerOk = fGL2PSAction->fileWritingEnabled();
929
930 if (beginWriteAction) {
931
932 // Set the viewport
933 // By default, we choose the line width (trajectories...)
935 // By default, we choose the point size (markers...)
937
938 DrawView ();
939 endWriteAction = fGL2PSAction->disableFileWriting();
940 }
941 if (filePointerOk) {
942 if ((! endWriteAction) || (! beginWriteAction)) {
943 extendBuffer = fGL2PSAction->extendBufferSize();
944 }
945 }
946 }
948
949 if (!extendBuffer ) {
950 G4cerr << "ERROR: gl2ps buffer size is not big enough to print this geometry. Try to extend it. No output produced"<< G4endl;
951 res = false;
952 }
953 if (!beginWriteAction ) {
954 G4cerr << "ERROR: saving file "<<getRealPrintFilename().c_str()<<". Check read/write access. No output produced" << G4endl;
955 res = false;
956 }
957 if (!endWriteAction ) {
958 G4cerr << "gl2ps error. No output produced" << G4endl;
959 res = false;
960 }
961 fWinSize_x = X;
962 fWinSize_y = Y;
963
964 oglSceneHandler.SetFlushAction(originalFlushAction);
965
966 // Reset for next time (useful is size change)
967 // fPrintSizeX = 0;
968 // fPrintSizeY = 0;
969
970 return res;
971}
G4double Y(G4double density)
bool enableFileWriting()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
bool disableFileWriting()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void setFileName(const char *)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
bool extendBufferSize()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void resetBufferSizeParameters()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
static void SetFlushAction(FlushAction action)
static FlushAction GetFlushAction()

References G4OpenGL2PSAction::disableFileWriting(), G4VViewer::DrawView(), G4OpenGL2PSAction::enableFileWriting(), G4OpenGL2PSAction::extendBufferSize(), G4OpenGLViewer::fGL2PSAction, G4OpenGLViewer::fGl2psDefaultLineWith, G4OpenGLViewer::fGl2psDefaultPointSize, G4OpenGL2PSAction::fileWritingEnabled(), G4VViewer::fSceneHandler, G4OpenGLViewer::fWinSize_x, G4OpenGLViewer::fWinSize_y, G4cerr, G4endl, G4OpenGLSceneHandler::GetFlushAction(), G4OpenGLViewer::getRealExportHeight(), G4OpenGLViewer::getRealExportWidth(), G4OpenGLViewer::getRealPrintFilename(), G4OpenGLSceneHandler::never, G4OpenGL2PSAction::resetBufferSizeParameters(), G4OpenGLViewer::ResizeGLView(), G4OpenGL2PSAction::setFileName(), G4OpenGLSceneHandler::SetFlushAction(), G4OpenGL2PSAction::setLineWidth(), G4OpenGL2PSAction::setPointSize(), and Y().

Referenced by G4OpenGLViewer::printVectoredEPS().

◆ printNonVectoredEPS()

bool G4OpenGLViewer::printNonVectoredEPS ( )
privateinherited

Definition at line 633 of file G4OpenGLViewer.cc.

633 {
634
635 int width = getRealExportWidth();
636 int height = getRealExportHeight();
637
638 FILE* fp;
639 GLubyte* pixels;
640 GLubyte* curpix;
641 int components, pos, i;
642
643 pixels = grabPixels (fPrintColour, width, height);
644
645 if (pixels == NULL) {
646 G4cerr << "Failed to get pixels from OpenGl viewport" << G4endl;
647 return false;
648 }
649 if (fPrintColour) {
650 components = 3;
651 } else {
652 components = 1;
653 }
654 std::string name = getRealPrintFilename();
655 fp = fopen (name.c_str(), "w");
656 if (fp == NULL) {
657 G4cerr << "Can't open filename " << name.c_str() << G4endl;
658 return false;
659 }
660
661 fprintf (fp, "%%!PS-Adobe-2.0 EPSF-1.2\n");
662 fprintf (fp, "%%%%Title: %s\n", name.c_str());
663 fprintf (fp, "%%%%Creator: OpenGL pixmap render output\n");
664 fprintf (fp, "%%%%BoundingBox: 0 0 %d %d\n", width, height);
665 fprintf (fp, "%%%%EndComments\n");
666 fprintf (fp, "gsave\n");
667 fprintf (fp, "/bwproc {\n");
668 fprintf (fp, " rgbproc\n");
669 fprintf (fp, " dup length 3 idiv string 0 3 0 \n");
670 fprintf (fp, " 5 -1 roll {\n");
671 fprintf (fp, " add 2 1 roll 1 sub dup 0 eq\n");
672 fprintf (fp, " { pop 3 idiv 3 -1 roll dup 4 -1 roll dup\n");
673 fprintf (fp, " 3 1 roll 5 -1 roll } put 1 add 3 0 \n");
674 fprintf (fp, " { 2 1 roll } ifelse\n");
675 fprintf (fp, " }forall\n");
676 fprintf (fp, " pop pop pop\n");
677 fprintf (fp, "} def\n");
678 fprintf (fp, "systemdict /colorimage known not {\n");
679 fprintf (fp, " /colorimage {\n");
680 fprintf (fp, " pop\n");
681 fprintf (fp, " pop\n");
682 fprintf (fp, " /rgbproc exch def\n");
683 fprintf (fp, " { bwproc } image\n");
684 fprintf (fp, " } def\n");
685 fprintf (fp, "} if\n");
686 fprintf (fp, "/picstr %d string def\n", width * components);
687 fprintf (fp, "%d %d scale\n", width, height);
688 fprintf (fp, "%d %d %d\n", width, height, 8);
689 fprintf (fp, "[%d 0 0 %d 0 0]\n", width, height);
690 fprintf (fp, "{currentfile picstr readhexstring pop}\n");
691 fprintf (fp, "false %d\n", components);
692 fprintf (fp, "colorimage\n");
693
694 curpix = (GLubyte*) pixels;
695 pos = 0;
696 for (i = width*height*components; i>0; i--) {
697 fprintf (fp, "%02hx ", (unsigned short)(*(curpix++)));
698 if (++pos >= 32) {
699 fprintf (fp, "\n");
700 pos = 0;
701 }
702 }
703 if (pos)
704 fprintf (fp, "\n");
705
706 fprintf (fp, "grestore\n");
707 fprintf (fp, "showpage\n");
708 delete [] pixels;
709 fclose (fp);
710
711 // Reset for next time (useful is size change)
712 // fPrintSizeX = -1;
713 // fPrintSizeY = -1;
714
715 return true;
716}
static const G4double pos
GLubyte * grabPixels(int inColor, unsigned int width, unsigned int height)

References G4OpenGLViewer::fPrintColour, G4cerr, G4endl, G4OpenGLViewer::getRealExportHeight(), G4OpenGLViewer::getRealExportWidth(), G4OpenGLViewer::getRealPrintFilename(), G4OpenGLViewer::grabPixels(), G4InuclParticleNames::name(), and pos.

Referenced by G4OpenGLViewer::exportImage().

◆ printVectoredEPS()

bool G4OpenGLViewer::printVectoredEPS ( )
privateinherited

Definition at line 629 of file G4OpenGLViewer.cc.

629 {
630 return printGl2PS();
631}

References G4OpenGLViewer::printGl2PS().

Referenced by G4OpenGLViewer::exportImage().

◆ ProcessView()

void G4VViewer::ProcessView ( )
inherited

Definition at line 105 of file G4VViewer.cc.

106{
107 // If the scene has changed, or if the concrete viewer has decided
108 // that it necessary to visit the kernel, perhaps because the view
109 // parameters have changed significantly (this should be done in the
110 // concrete viewer's DrawView)...
111 if (fNeedKernelVisit) {
112 // Reset flag. This must be done before ProcessScene to prevent
113 // recursive calls when recomputing transients...
114 fNeedKernelVisit = false;
117 }
118}
virtual void ProcessScene()
virtual void ClearStore()

References G4VSceneHandler::ClearStore(), G4VViewer::fNeedKernelVisit, G4VViewer::fSceneHandler, and G4VSceneHandler::ProcessScene().

Referenced by G4OpenGLStoredQtViewer::ComputeView(), G4DAWNFILEViewer::DrawView(), G4GMocrenFileViewer::DrawView(), G4HepRepFileViewer::DrawView(), G4OpenGLStoredWin32Viewer::DrawView(), G4OpenGLStoredXmViewer::DrawView(), G4OpenGLStoredXViewer::DrawView(), G4OpenInventorViewer::DrawView(), G4Qt3DViewer::DrawView(), G4RayTracerViewer::DrawView(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::DrawView(), G4VTreeViewer::DrawView(), G4VRML2FileViewer::DrawView(), G4VtkViewer::DrawView(), and G4OpenGLImmediateViewer::ProcessView().

◆ projection_callback()

void G4OpenGLXmViewer::projection_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 258 of file G4OpenGLXmStyleCallbacks.cc.

261{
262 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
263
264 G4int choice = get_int_userData (w);
265
266 switch (choice) {
267 case 0:
268 {
269 pView->fVP.SetFieldHalfAngle (0.);
270 break;
271 }
272
273 case 1:
274 {
275 if (pView->fov > 89.5 || pView->fov <= 0.0) {
276 G4cout << "Field half angle should be 0 < angle <= 89.5 degrees.";
277 G4cout << G4endl;
278 }
279 else {
280 pView->fVP.SetFieldHalfAngle (pView->fov * deg);
281 }
282 break;
283 }
284 default:
285 {
287 ("G4OpenGLXmViewer::projection_callback",
288 "opengl2013", FatalException,
289 "Unrecognised choice made in projection_callback");
290 }
291 }
292
293 pView->SetView ();
294 pView->ClearView ();
295 pView->DrawView ();
296}
static constexpr double deg
Definition: G4SIunits.hh:132
static G4int get_int_userData(Widget w)
void SetFieldHalfAngle(G4double fieldHalfAngle)

References G4OpenGLViewer::ClearView(), deg, G4VViewer::DrawView(), FatalException, fov, G4VViewer::fVP, G4cout, G4endl, G4Exception(), get_int_userData(), G4ViewParameters::SetFieldHalfAngle(), and G4OpenGLXViewer::SetView().

Referenced by misc_callback().

◆ RefreshView()

void G4VViewer::RefreshView ( )
inherited

◆ reset_callback()

void G4OpenGLXmViewer::reset_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 302 of file G4OpenGLXmRotationCallbacks.cc.

305{
306
307 G4OpenGLXmViewer* pView;
308
309 XtVaGetValues (w,
310 XmNuserData, &pView,
311 NULL);
312
314 pView->fVP.SetZoomFactor(1.0);
315 pView->fVP.SetDolly(0.0);
316 pView->SetView ();
317 pView->ClearView ();
318 pView->DrawView ();
319 pView->zoom_low = 0.1;
320 pView->zoom_high = 10.0;
321
322}
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:34
void SetZoomFactor(G4double zoomFactor)

References G4OpenGLViewer::ClearView(), G4VViewer::DrawView(), G4VViewer::fVP, G4ViewParameters::SetCurrentTargetPoint(), G4ViewParameters::SetDolly(), G4OpenGLXViewer::SetView(), G4ViewParameters::SetZoomFactor(), zoom_high, and zoom_low.

Referenced by misc_callback().

◆ ResetView()

void G4OpenGLXmViewer::ResetView ( )
protectedvirtual

Reimplemented from G4OpenGLViewer.

Definition at line 70 of file G4OpenGLXmViewer.cc.

70 {
71 // reset global parameters
73
74 //reset Xm parameteres
75 zoom_high = fVP.GetZoomFactor() * 10.0;
76 zoom_low = fVP.GetZoomFactor() / 10.0;
77 rot_sens_limit = 90.;
78 wob_low = 0.;
79 wob_high = 50.;
80 wob_sens = 20.;
81
82 bool firstInit = true;
83 if (GetSceneHandler() != NULL) {
84 if (GetSceneHandler()->GetScene() != NULL) {
85 firstInit = false;
86 }
87 }
88 if (firstInit) {
89 pan_sens_limit = 100.;
91 dolly_low = fVP.GetDolly() - 1000.0;
92 dolly_high = fVP.GetDolly() + 1000.0;
93 } else {
96
99 }
100
102
103
104 // FIXME : L.Garnier 12 Oct 2011
105 // Has also to change the Camera/Object, but tricky to do...
106
107}

References dolly_high, dolly_low, G4OpenGLViewer::fPan_sens, G4VViewer::fVP, G4ViewParameters::GetDolly(), G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4VSceneHandler::GetScene(), G4VViewer::GetSceneHandler(), G4ViewParameters::GetZoomFactor(), pan_sens_limit, G4OpenGLViewer::ResetView(), rot_sens_limit, UpdateControlPanel(), wob_high, wob_low, wob_sens, zoom_high, and zoom_low.

Referenced by G4OpenGLXmViewer().

◆ resize_callback()

void G4OpenGLXmViewer::resize_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 36 of file G4OpenGLXmWindowHandlingCallbacks.cc.

39{
40 expose_callback(w,clientData,x);
41}

References expose_callback().

Referenced by CreateMainWindow().

◆ ResizeGLView()

void G4OpenGLViewer::ResizeGLView ( )
protectedinherited

Set the viewport of the scene MAXIMUM SIZE is : GLint dims[2]; glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);

Definition at line 250 of file G4OpenGLViewer.cc.

251{
252 // Check size
253 GLint dims[2];
254 dims[0] = 0;
255 dims[1] = 0;
256
257 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
258
259 if ((dims[0] !=0 ) && (dims[1] !=0)) {
260
261 if (fWinSize_x > (unsigned)dims[0]) {
262 G4cerr << "Try to resize view greater than max X viewport dimension. Desired size "<<fWinSize_x <<" is resize to "<< dims[0] << G4endl;
263 fWinSize_x = dims[0];
264 }
265 if (fWinSize_y > (unsigned)dims[1]) {
266 G4cerr << "Try to resize view greater than max Y viewport dimension. Desired size "<<fWinSize_y <<" is resize to "<< dims[1] << G4endl;
267 fWinSize_y = dims[1];
268 }
269 }
270
271 glViewport(0, 0, fWinSize_x,fWinSize_y);
272
273
274}

References G4OpenGLViewer::fWinSize_x, G4OpenGLViewer::fWinSize_y, G4cerr, and G4endl.

Referenced by G4OpenGLViewer::printGl2PS(), and G4OpenGLViewer::SetView().

◆ ResizeWindow()

void G4OpenGLViewer::ResizeWindow ( unsigned int  aWidth,
unsigned int  aHeight 
)
protectedinherited

◆ rotate_in_phi()

void G4OpenGLXmViewer::rotate_in_phi ( XtPointer  clientData,
XtIntervalId *  timer_id 
)
static

Definition at line 135 of file G4OpenGLXmRotationCallbacks.cc.

137{
138 //phi spin stuff here
139 // G4double delta_alpha;
140 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
141
142 if (pView -> rotate_up) {
143 pView->rotateScene(0,-1);
144 } else {
145 pView->rotateScene(0,1);
146 }
147 /*
148 if (pView->fVP.GetLightsMoveWithCamera()) {
149 if (pView -> rotate_up) {
150 delta_alpha = -(pView->fRot_sens);
151 } else {
152 delta_alpha = pView->fRot_sens;
153 }
154 } else {
155 if (pView -> rotate_up) {
156 delta_alpha = pView->fRot_sens;
157 } else {
158 delta_alpha = -(pView->fRot_sens);
159 }
160 }
161
162 delta_alpha *= deg;
163
164 const G4Vector3D& vp = pView->fVP.GetViewpointDirection ().unit ();
165 const G4Vector3D& up = pView->fVP.GetUpVector ().unit ();
166
167 const G4Vector3D& xprime = vp;
168 G4Vector3D yprime = (up.cross(xprime)).unit();
169 G4Vector3D zprime = (xprime.cross(yprime)).unit();
170
171 G4Vector3D new_vp = std::cos(delta_alpha) * xprime + std::sin(delta_alpha) * zprime;
172
173 pView->fVP.SetViewAndLights (new_vp.unit());
174
175 if (pView->fVP.GetLightsMoveWithCamera()) {
176 G4Vector3D new_up = (new_vp.cross(yprime)).unit();
177 pView->fVP.SetUpVector(new_up);
178 }
179
180 */
181 pView->SetView ();
182 pView->ClearView ();
183 pView->DrawView ();
184
185 pView->rotation_timer = XtAppAddTimeOut
186 (pView->app,
187 timer_id == NULL ? 500 : 1,
189 pView);
190}
void rotateScene(G4double dx, G4double dy)

References app, G4OpenGLViewer::ClearView(), G4VViewer::DrawView(), rotate_in_phi(), rotate_up, G4OpenGLViewer::rotateScene(), rotation_timer, and G4OpenGLXViewer::SetView().

Referenced by phi_rotation_callback(), and rotate_in_phi().

◆ rotate_in_theta()

void G4OpenGLXmViewer::rotate_in_theta ( XtPointer  clientData,
XtIntervalId *  timer_id 
)
static

Definition at line 58 of file G4OpenGLXmRotationCallbacks.cc.

60{
61 //theta spin stuff here
62 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
63
64 if (pView->rotate_right) {
65 pView->rotateScene(1,0);
66 } else {
67 pView->rotateScene(-1,0);
68 }
69 /*
70 G4double delta_theta;
71
72 if (pView->fVP.GetLightsMoveWithCamera()) {
73 if (pView->rotate_right) {
74 delta_theta = -(pView->fRot_sens);
75 } else {
76 delta_theta = pView->fRot_sens;
77 }
78 } else {
79 if (pView->rotate_right) {
80 delta_theta = pView->fRot_sens;
81 } else {
82 delta_theta = -(pView->fRot_sens);
83 }
84 }
85 delta_theta *= deg;
86 // Rotates by fixed azimuthal angle delta_theta.
87
88 const G4Vector3D& vp = pView->fVP.GetViewpointDirection ().unit ();
89 const G4Vector3D& up = pView->fVP.GetUpVector ().unit ();
90 const G4Vector3D& zprime = up;
91 G4double cosalpha = up.dot (vp);
92 G4double sinalpha = std::sqrt (1. - std::pow (cosalpha, 2));
93 G4Vector3D yprime = (zprime.cross (vp)).unit ();
94 G4Vector3D xprime = yprime.cross (zprime);
95 // Projection of vp on plane perpendicular to up...
96 G4Vector3D a1 = sinalpha * xprime;
97 // Required new projection...
98 G4Vector3D a2 =
99 sinalpha * (std::cos (delta_theta) * xprime + std::sin (delta_theta) * yprime);
100 // Required Increment vector...
101 G4Vector3D delta = a2 - a1;
102 // So new viewpoint is...
103 G4Vector3D viewPoint = vp + delta;
104
105 pView->fVP.SetViewAndLights (viewPoint);
106 */
107
108 pView->SetView ();
109 pView->ClearView ();
110 pView->DrawView ();
111
112 pView->rotation_timer = XtAppAddTimeOut
113 (pView->app,
114 timer_id == NULL ? 500 : 1,
116 pView);
117}
static void rotate_in_theta(XtPointer clientData, XtIntervalId *timer_id)

References app, G4OpenGLViewer::ClearView(), G4VViewer::DrawView(), rotate_in_theta(), rotate_right, G4OpenGLViewer::rotateScene(), rotation_timer, and G4OpenGLXViewer::SetView().

Referenced by rotate_in_theta(), and theta_rotation_callback().

◆ rotateScene()

void G4OpenGLViewer::rotateScene ( G4double  dx,
G4double  dy 
)
protectedinherited

Definition at line 1128 of file G4OpenGLViewer.cc.

1129{
1132 } else {
1133 if( dx != 0) {
1134 rotateSceneThetaPhi(dx,0);
1135 }
1136 if( dy != 0) {
1137 rotateSceneThetaPhi(0,dy);
1138 }
1139 }
1140}
void rotateSceneInViewDirection(G4double dx, G4double dy)
void rotateSceneThetaPhi(G4double dx, G4double dy)
RotationStyle GetRotationStyle() const

References G4ViewParameters::freeRotation, G4VViewer::fVP, G4ViewParameters::GetRotationStyle(), G4OpenGLViewer::rotateSceneInViewDirection(), and G4OpenGLViewer::rotateSceneThetaPhi().

Referenced by rotate_in_phi(), rotate_in_theta(), and G4OpenGLQtViewer::rotateQtScene().

◆ rotateSceneInViewDirection()

void G4OpenGLViewer::rotateSceneInViewDirection ( G4double  dx,
G4double  dy 
)
privateinherited

Definition at line 1241 of file G4OpenGLViewer.cc.

1242{
1243 if (!fSceneHandler.GetScene()) {
1244 return;
1245 }
1246
1247 G4Vector3D vp;
1248 G4Vector3D up;
1249
1250 G4Vector3D xprime;
1251 G4Vector3D yprime;
1252 G4Vector3D zprime;
1253
1254 G4Vector3D new_vp;
1255 G4Vector3D new_up;
1256
1257 G4Vector3D a1;
1258 G4Vector3D a2;
1259 G4Vector3D delta;
1260 G4Vector3D viewPoint;
1261
1262 dx = dx/100;
1263 dy = dy/100;
1264
1265 //phi spin stuff here
1266
1267 vp = fVP.GetViewpointDirection ().unit();
1268 up = fVP.GetUpVector ().unit();
1269
1270 G4Vector3D zPrimeVector = G4Vector3D(up.y()*vp.z()-up.z()*vp.y(),
1271 up.z()*vp.x()-up.x()*vp.z(),
1272 up.x()*vp.y()-up.y()*vp.x());
1273
1274 viewPoint = vp/fRot_sens + (zPrimeVector*dx - up*dy) ;
1275 new_up = G4Vector3D(viewPoint.y()*zPrimeVector.z()-viewPoint.z()*zPrimeVector.y(),
1276 viewPoint.z()*zPrimeVector.x()-viewPoint.x()*zPrimeVector.z(),
1277 viewPoint.x()*zPrimeVector.y()-viewPoint.y()*zPrimeVector.x());
1278
1279 G4Vector3D new_upUnit = new_up.unit();
1280
1281
1282
1283 fVP.SetUpVector(new_upUnit);
1284 fVP.SetViewAndLights (viewPoint);
1285}
void SetViewAndLights(const G4Vector3D &viewpointDirection)
void SetUpVector(const G4Vector3D &upVector)
BasicVector3D< T > unit() const

References G4OpenGLViewer::fRot_sens, G4VViewer::fSceneHandler, G4VViewer::fVP, G4VSceneHandler::GetScene(), G4ViewParameters::GetUpVector(), G4ViewParameters::GetViewpointDirection(), G4ViewParameters::SetUpVector(), G4ViewParameters::SetViewAndLights(), HepGeom::BasicVector3D< T >::unit(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

Referenced by G4OpenGLViewer::rotateScene(), and G4OpenGLViewer::rotateSceneToggle().

◆ rotateSceneThetaPhi()

void G4OpenGLViewer::rotateSceneThetaPhi ( G4double  dx,
G4double  dy 
)
privateinherited

Definition at line 1157 of file G4OpenGLViewer.cc.

1158{
1159 if (!fSceneHandler.GetScene()) {
1160 return;
1161 }
1162
1163 G4Vector3D vp;
1164 G4Vector3D up;
1165
1166 G4Vector3D xprime;
1167 G4Vector3D yprime;
1168 G4Vector3D zprime;
1169
1170 G4double delta_alpha;
1171 G4double delta_theta;
1172
1173 G4Vector3D new_vp;
1174 G4Vector3D new_up;
1175
1176 G4double cosalpha;
1177 G4double sinalpha;
1178
1179 G4Vector3D a1;
1180 G4Vector3D a2;
1181 G4Vector3D delta;
1182 G4Vector3D viewPoint;
1183
1184
1185 //phi spin stuff here
1186
1187 vp = fVP.GetViewpointDirection ().unit ();
1188 up = fVP.GetUpVector ().unit ();
1189
1190 yprime = (up.cross(vp)).unit();
1191 zprime = (vp.cross(yprime)).unit();
1192
1194 delta_alpha = dy * fRot_sens;
1195 delta_theta = -dx * fRot_sens;
1196 } else {
1197 delta_alpha = -dy * fRot_sens;
1198 delta_theta = dx * fRot_sens;
1199 }
1200
1201 delta_alpha *= CLHEP::deg;
1202 delta_theta *= CLHEP::deg;
1203
1204 new_vp = std::cos(delta_alpha) * vp + std::sin(delta_alpha) * zprime;
1205
1206 // to avoid z rotation flipping
1207 // to allow more than 360∞ rotation
1208
1210 new_up = (new_vp.cross(yprime)).unit();
1211 if (new_vp.z()*vp.z() <0) {
1212 new_up.set(new_up.x(),-new_up.y(),new_up.z());
1213 }
1214 } else {
1215 new_up = up;
1216 if (new_vp.z()*vp.z() <0) {
1217 new_up.set(new_up.x(),-new_up.y(),new_up.z());
1218 }
1219 }
1220 fVP.SetUpVector(new_up);
1222 // Rotates by fixed azimuthal angle delta_theta.
1223
1224 cosalpha = new_up.dot (new_vp.unit());
1225 sinalpha = std::sqrt (1. - std::pow (cosalpha, 2));
1226 yprime = (new_up.cross (new_vp.unit())).unit ();
1227 xprime = yprime.cross (new_up);
1228 // Projection of vp on plane perpendicular to up...
1229 a1 = sinalpha * xprime;
1230 // Required new projection...
1231 a2 = sinalpha * (std::cos (delta_theta) * xprime + std::sin (delta_theta) * yprime);
1232 // Required Increment vector...
1233 delta = a2 - a1;
1234 // So new viewpoint is...
1235 viewPoint = new_vp.unit() + delta;
1236
1237 fVP.SetViewAndLights (viewPoint);
1238}
void set(T x1, T y1, T z1)
T dot(const BasicVector3D< T > &v) const
static constexpr double deg

References HepGeom::BasicVector3D< T >::cross(), CLHEP::deg, HepGeom::BasicVector3D< T >::dot(), G4OpenGLViewer::fRot_sens, G4VViewer::fSceneHandler, G4VViewer::fVP, G4ViewParameters::GetLightsMoveWithCamera(), G4VSceneHandler::GetScene(), G4ViewParameters::GetUpVector(), G4ViewParameters::GetViewpointDirection(), HepGeom::BasicVector3D< T >::set(), G4ViewParameters::SetUpVector(), G4ViewParameters::SetViewAndLights(), HepGeom::BasicVector3D< T >::unit(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

Referenced by G4OpenGLViewer::rotateScene(), and G4OpenGLViewer::rotateSceneToggle().

◆ rotateSceneToggle()

void G4OpenGLViewer::rotateSceneToggle ( G4double  dx,
G4double  dy 
)
protectedinherited

◆ set_pan_sens_callback()

void G4OpenGLXmViewer::set_pan_sens_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 216 of file G4OpenGLXmPanningCallbacks.cc.

219{
220 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
221 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
222 short dp = -1;
223 G4float ten_to_the_dp = 10.;
224
225 XtVaGetValues (w,
226 XmNdecimalPoints, &dp,
227 NULL);
228
229 if (dp == 0) {
230 ten_to_the_dp = 1.;
231 } else if ( dp > 0) {
232 for (G4int i = 1; i < (G4int)dp; i++) {
233 ten_to_the_dp *= 10.;
234 }
235 } else {
236 G4cout << "dp is " << dp << G4endl;
237 return;
238 }
239
240 pView->fPan_sens = (G4double)((cbs->value) / ten_to_the_dp);
241}

References G4OpenGLViewer::fPan_sens, G4cout, and G4endl.

Referenced by actions_callback().

◆ set_print_colour_callback()

void G4OpenGLXmViewer::set_print_colour_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 75 of file G4OpenGLXmWindowHandlingCallbacks.cc.

78{
79 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
80
81 G4int choice = get_int_userData (w);
82
83 pView->fPrintColour=(G4bool)choice;
84 G4cout << "Print colour set to " << pView->fPrintColour;
85
86}

References G4OpenGLViewer::fPrintColour, G4cout, and get_int_userData().

Referenced by misc_callback().

◆ set_print_style_callback()

void G4OpenGLXmViewer::set_print_style_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 88 of file G4OpenGLXmWindowHandlingCallbacks.cc.

91{
92 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
93
94 G4int choice = get_int_userData (w);
95
96 pView->fVectoredPs=(G4bool)choice;
97 G4cout << "`Produce vectored PostScript ?' set to : " << pView->fPrintColour;
98
99}

References G4OpenGLViewer::fPrintColour, G4OpenGLViewer::fVectoredPs, G4cout, and get_int_userData().

Referenced by misc_callback().

◆ set_rot_sens_callback()

void G4OpenGLXmViewer::set_rot_sens_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 192 of file G4OpenGLXmRotationCallbacks.cc.

195{
196 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
197 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
198 short dp = -1;
199 G4float ten_to_the_dp = 10.;
200
201 XtVaGetValues (w,
202 XmNdecimalPoints, &dp,
203 NULL);
204
205 if (dp == 0) {
206 ten_to_the_dp = 1.;
207 } else if ( dp > 0) {
208 for (G4int i = 1; i < (G4int)dp; i++) {
209 ten_to_the_dp *= 10.;
210 }
211 } else {
213 ("G4OpenGLXmViewer::set_rot_sens_callback",
214 "opengl2004", FatalException,
215 "Bad value returned for dp in set_rot_sens_callback");
216 }
217
218 pView->fRot_sens = (G4float)(cbs->value) / ten_to_the_dp;
219}

References FatalException, G4OpenGLViewer::fRot_sens, and G4Exception().

Referenced by actions_callback().

◆ set_rot_subject_callback()

void G4OpenGLXmViewer::set_rot_subject_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 221 of file G4OpenGLXmRotationCallbacks.cc.

224{
225 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
226
227 G4int choice = get_int_userData (w);
228
229 switch (choice) {
230 case 0:
231 {
232 pView->fVP.SetLightsMoveWithCamera (true);
233 break;
234 }
235 case 1:
236 {
237 pView->fVP.SetLightsMoveWithCamera (false);
238 break;
239 }
240 default:
241 {
243 ("G4OpenGLXmViewer::set_rot_subject_callback",
244 "opengl2005", FatalException,
245 "Unrecognised choice made in set_rot_subject_callback");
246 }
247 }
248}
void SetLightsMoveWithCamera(G4bool moves)

References FatalException, G4VViewer::fVP, G4Exception(), get_int_userData(), and G4ViewParameters::SetLightsMoveWithCamera().

Referenced by actions_callback().

◆ set_wob_sens_callback()

void G4OpenGLXmViewer::set_wob_sens_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 526 of file G4OpenGLXmMainMenubarCallbacks.cc.

529{
530 XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct*) callData;
531 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
532 short dp = -1;
533 G4float ten_to_the_dp = 10.;
534
535 XtVaGetValues (w,
536 XmNdecimalPoints, &dp,
537 NULL);
538
539 if (dp == 0) {
540 ten_to_the_dp = 1.;
541 } else if ( dp > 0) {
542 for (G4int i = 1; i < (G4int)dp; i++) {
543 ten_to_the_dp *= 10.;
544 }
545 } else {
547 ("G4OpenGLXmViewer::set_wob_sens_callback",
548 "opengl2003", FatalException,
549 "Bad value returned for dp in set_rot_sens_callback");
550 }
551
552 pView->wob_sens = (G4float)(cbs->value) / ten_to_the_dp;
553}

References FatalException, G4Exception(), and wob_sens.

Referenced by misc_callback().

◆ SetDefaultViewParameters()

void G4VViewer::SetDefaultViewParameters ( const G4ViewParameters vp)
inherited

◆ setExportFilename()

bool G4OpenGLViewer::setExportFilename ( G4String  name,
G4bool  inc = true 
)
protectedinherited

If name is "" or "!", filename and extension will have the default value. If name is "toto.png", set the name to "toto" and the format to "png". No incremented suffix is added. If name is "toto", set the name to "toto" and the format to default (or current format if specify). If name is the same as previous, do not reset incremented suffix.

Definition at line 1034 of file G4OpenGLViewer.cc.

1034 {
1035 if (name == "!") {
1036 name = "";
1037 }
1038
1039 if (inc) {
1040 if ((name != "") && (fExportFilename != name)) {
1042 }
1043 } else {
1045 }
1046
1047 if (name.size() == 0) {
1048 name = getRealPrintFilename().c_str();
1049 } else {
1050 // guess format by extention
1051 std::string extension = name.substr(name.find_last_of(".") + 1);
1052 // If there is a dot in the name the above might find rubbish, so...
1053 if (extension.size() >= 3 && extension.size() <= 4) { // Possible extension
1054 if (setExportImageFormat(extension, false)) { // Extension found
1055 fExportFilename = name.substr(0,name.find_last_of("."));
1056 } else { // No viable extension found
1057 return false;
1058 }
1059 } else { // Assume name is already the required without-extension part
1061 }
1062 }
1063 return true;
1064}

References G4OpenGLViewer::fExportFilename, G4OpenGLViewer::fExportFilenameIndex, G4OpenGLViewer::getRealPrintFilename(), G4InuclParticleNames::name(), and G4OpenGLViewer::setExportImageFormat().

Referenced by G4OpenGLQtViewer::actionSaveImage(), G4OpenGLQtViewer::exportImage(), G4OpenGLViewer::exportImage(), and G4OpenGLViewerMessenger::SetNewValue().

◆ setExportImageFormat()

bool G4OpenGLViewer::setExportImageFormat ( std::string  format,
bool  quiet = false 
)
inherited

Definition at line 1292 of file G4OpenGLViewer.cc.

1292 {
1293 bool found = false;
1294 std::string list;
1295 for (unsigned int a=0; a<fExportImageFormatVector.size(); a++) {
1296 list +=fExportImageFormatVector.at(a) + " ";
1297
1298 if (fExportImageFormatVector.at(a) == format) {
1299 if (! quiet) {
1300 G4cout << " Changing export format to \"" << format << "\"" << G4endl;
1301 }
1302 if (format != fExportImageFormat) {
1304 fExportImageFormat = format;
1305 }
1306 return true;
1307 }
1308 }
1309 if (! found) {
1310 if (format.size() == 0) {
1311 G4cout << " Current formats availables are : " << list << G4endl;
1312 } else {
1313 G4cerr << " Format \"" << format << "\" is not available for the selected viewer. Current formats availables are : " << list << G4endl;
1314 }
1315 }
1316 return false;
1317}

References G4OpenGLViewer::fExportFilenameIndex, G4OpenGLViewer::fExportImageFormat, G4OpenGLViewer::fExportImageFormatVector, G4cerr, G4cout, and G4endl.

Referenced by G4OpenGLViewer::exportImage(), G4OpenGLImmediateQtViewer::initializeGL(), G4OpenGLStoredQtViewer::initializeGL(), G4OpenGLViewer::setExportFilename(), and G4OpenGLViewerMessenger::SetNewValue().

◆ setExportSize()

void G4OpenGLViewer::setExportSize ( G4int  X,
G4int  Y 
)
protectedinherited

◆ SetName()

void G4VViewer::SetName ( const G4String name)
inherited

Definition at line 72 of file G4VViewer.cc.

72 {
73 fName = name;
74 fShortName = fName.substr(0, fName.find (' '));
76}
G4String fShortName
Definition: G4VViewer.hh:218
void strip(G4String &str, char c=' ')
Remove leading and trailing characters from string.

References G4VViewer::fName, G4VViewer::fShortName, G4InuclParticleNames::name(), and G4StrUtil::strip().

◆ SetNeedKernelVisit()

void G4VViewer::SetNeedKernelVisit ( G4bool  need)
inherited

◆ SetTouchable()

void G4VViewer::SetTouchable ( const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &  fullPath)
protectedinherited

Definition at line 124 of file G4VViewer.cc.

126{
127 // Set the touchable for /vis/touchable/set/... commands.
128 std::ostringstream oss;
129 const auto& pvStore = G4PhysicalVolumeStore::GetInstance();
130 for (const auto& pvNodeId: fullPath) {
131 const auto& pv = pvNodeId.GetPhysicalVolume();
132 auto iterator = find(pvStore->begin(),pvStore->end(),pv);
133 if (iterator == pvStore->end()) {
135 ed << "Volume no longer in physical volume store.";
136 G4Exception("G4VViewer::SetTouchable", "visman0501", JustWarning, ed);
137 } else {
138 oss
139 << ' ' << pvNodeId.GetPhysicalVolume()->GetName()
140 << ' ' << pvNodeId.GetCopyNo();
141 }
142 }
143 G4UImanager::GetUIpointer()->ApplyCommand("/vis/set/touchable" + oss.str());
144}
@ JustWarning
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
static G4PhysicalVolumeStore * GetInstance()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:485
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77

References G4UImanager::ApplyCommand(), G4Exception(), G4PhysicalVolumeStore::GetInstance(), G4UImanager::GetUIpointer(), and JustWarning.

Referenced by G4OpenGLQtViewer::changeColorAndTransparency(), and G4OpenGLQtViewer::setCheckComponent().

◆ SetView()

void G4OpenGLXViewer::SetView ( )
virtualinherited

◆ SetViewParameters()

void G4VViewer::SetViewParameters ( const G4ViewParameters vp)
inherited

◆ ShowView()

void G4OpenGLXmViewer::ShowView ( void  )
protectedvirtual

Reimplemented from G4VViewer.

Definition at line 57 of file G4OpenGLXmViewer.cc.

57 {
58
59// glXWaitGL (); //Wait for effects of all previous OpenGL commands to
60 //be propagated before progressing.
61// JA: Commented out July 2021 - slows rendering down in some cases and I
62// don't see any adverse effects.
63
64 glFlush ();
65
66 G4Xt::getInstance () -> SecondaryLoop ();
67
68}

References G4Xt::getInstance().

◆ sizeHasChanged()

G4bool G4OpenGLViewer::sizeHasChanged ( )
protectedinherited

◆ theta_rotation_callback()

void G4OpenGLXmViewer::theta_rotation_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 42 of file G4OpenGLXmRotationCallbacks.cc.

45{
46 XmArrowButtonCallbackStruct *cbs = (XmArrowButtonCallbackStruct*) callData;
47 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
48
50
51 if (cbs->reason == XmCR_ARM) {
52 rotate_in_theta (pView, NULL);
53 } else if (cbs->reason == XmCR_DISARM) {
54 XtRemoveTimeOut (pView->rotation_timer);
55 }
56}

References get_boolean_userData(), rotate_in_theta(), rotate_right, and rotation_timer.

Referenced by actions_callback().

◆ TouchableSetColour()

void G4VViewer::TouchableSetColour ( const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &  fullPath,
const G4Colour colour 
)
protectedinherited

Definition at line 180 of file G4VViewer.cc.

183{
184 // Changes the Vis Attribute Modifiers WITHOUT triggering a rebuild.
185
186 std::ostringstream oss;
187 oss << "/vis/touchable/set/colour "
188 << colour.GetRed() << ' ' << colour.GetGreen()
189 << ' ' << colour.GetBlue() << ' ' << colour.GetAlpha();
190
191 // The following is equivalent to
192 // G4UImanager::GetUIpointer()->ApplyCommand(oss.str());
193 // (assuming the touchable has already been set), but avoids view rebuild.
194
195 // Instantiate a working copy of a G4VisAttributes object...
196 G4VisAttributes workingVisAtts;
197 // and set the colour.
198 workingVisAtts.SetColour(colour);
199
202 (workingVisAtts,
205 // G4ModelingParameters::VASColour (VAS = Vis Attribute Signifier)
206 // signifies that it is the colour that should be picked out
207 // and merged with the touchable's normal vis attributes.
208
209 // Record on G4cout (with #) for information.
210 if (G4UImanager::GetUIpointer()->GetVerboseLevel() >= 2) {
211 G4cout << "# " << oss.str() << G4endl;
212 }
213}
static G4ModelingParameters::PVNameCopyNoPath GetPVNameCopyNoPath(const std::vector< G4PhysicalVolumeNodeID > &)
void AddVisAttributesModifier(const G4ModelingParameters::VisAttributesModifier &)
void SetColour(const G4Colour &)

References G4ViewParameters::AddVisAttributesModifier(), G4VViewer::fVP, G4cout, G4endl, G4Colour::GetAlpha(), G4Colour::GetBlue(), G4Colour::GetGreen(), G4PhysicalVolumeModel::GetPVNameCopyNoPath(), G4Colour::GetRed(), G4UImanager::GetUIpointer(), G4VisAttributes::SetColour(), and G4ModelingParameters::VASColour.

Referenced by G4OpenGLQtViewer::changeColorAndTransparency().

◆ TouchableSetVisibility()

void G4VViewer::TouchableSetVisibility ( const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &  fullPath,
G4bool  visibility 
)
protectedinherited

Definition at line 146 of file G4VViewer.cc.

149{
150 // Changes the Vis Attribute Modifiers WITHOUT triggering a rebuild.
151
152 std::ostringstream oss;
153 oss << "/vis/touchable/set/visibility ";
154 if (visibiity) oss << "true"; else oss << "false";
155
156 // The following is equivalent to
157 // G4UImanager::GetUIpointer()->ApplyCommand(oss.str());
158 // (assuming the touchable has already been set), but avoids view rebuild.
159
160 // Instantiate a working copy of a G4VisAttributes object...
161 G4VisAttributes workingVisAtts;
162 // and set the visibility.
163 workingVisAtts.SetVisibility(visibiity);
164
167 (workingVisAtts,
170 // G4ModelingParameters::VASVisibility (VAS = Vis Attribute Signifier)
171 // signifies that it is the visibility that should be picked out
172 // and merged with the touchable's normal vis attributes.
173
174 // Record on G4cout (with #) for information.
175 if (G4UImanager::GetUIpointer()->GetVerboseLevel() >= 2) {
176 G4cout << "# " << oss.str() << G4endl;
177 }
178}
void SetVisibility(G4bool=true)

References G4ViewParameters::AddVisAttributesModifier(), G4VViewer::fVP, G4cout, G4endl, G4PhysicalVolumeModel::GetPVNameCopyNoPath(), G4UImanager::GetUIpointer(), G4VisAttributes::SetVisibility(), and G4ModelingParameters::VASVisibility.

Referenced by G4OpenGLQtViewer::setCheckComponent().

◆ transparency_callback()

void G4OpenGLXmViewer::transparency_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 122 of file G4OpenGLXmStyleCallbacks.cc.

125{
126 G4long choice = (G4long)clientData;
127 G4OpenGLXmViewer* pView;
128 XtVaGetValues (XtParent(w),
129 XmNuserData, &pView,
130 NULL);
131
132 switch (choice) {
133
134 case 0:
135 pView->transparency_enabled = false;
136 break;
137
138 case 1:
139 pView->transparency_enabled = true;
140 break;
141
142 default:
144 ("G4OpenGLXmViewer::transparency_callback",
145 "opengl2009", FatalException,
146 "Unrecognised case in transparency_callback.");
147 }
148
149 pView->SetNeedKernelVisit (true);
150 pView->SetView ();
151 pView->ClearView ();
152 pView->DrawView ();
153}

References G4OpenGLViewer::ClearView(), G4VViewer::DrawView(), FatalException, G4Exception(), G4VViewer::SetNeedKernelVisit(), G4OpenGLXViewer::SetView(), and G4OpenGLViewer::transparency_enabled.

Referenced by CreateMainWindow().

◆ up_down_pan_callback()

void G4OpenGLXmViewer::up_down_pan_callback ( XtPointer  clientData,
XtIntervalId *  timer_id 
)
static

Definition at line 182 of file G4OpenGLXmPanningCallbacks.cc.

184{
185 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*) clientData;
186 G4double delta;
187
188 if (pView->pan_up) {
189 delta = pView->fPan_sens;
190 } else {
191 delta = -(pView->fPan_sens);
192 }
193
194 G4Point3D stp
196 G4Point3D tp = stp + pView -> fVP.GetCurrentTargetPoint ();
197 const G4Vector3D& upVector = pView->fVP.GetUpVector ();
198 const G4Vector3D& vpVector = pView->fVP.GetViewpointDirection ();
199
200 G4Vector3D unitRight = (upVector.cross (vpVector)).unit();
201 G4Vector3D unitUp = (vpVector.cross (unitRight)).unit();
202 tp += delta * unitUp;
203 pView->fVP.SetCurrentTargetPoint (tp - stp);
204
205 pView->SetView ();
206 pView->ClearView ();
207 pView->DrawView ();
208
209 pView->pan_timer = XtAppAddTimeOut
210 (pView->app,
211 timer_id == NULL ? 500 : 1,
213 pView);
214}

References app, G4OpenGLViewer::ClearView(), HepGeom::BasicVector3D< T >::cross(), G4VViewer::DrawView(), G4OpenGLViewer::fPan_sens, G4VViewer::fVP, G4ViewParameters::GetCurrentTargetPoint(), G4VSceneHandler::GetScene(), G4VViewer::GetSceneHandler(), G4Scene::GetStandardTargetPoint(), G4ViewParameters::GetUpVector(), G4ViewParameters::GetViewpointDirection(), pan_timer, pan_up, G4ViewParameters::SetCurrentTargetPoint(), G4OpenGLXViewer::SetView(), G4InuclParticleNames::tp, and up_down_pan_callback().

Referenced by pan_up_down_callback(), and up_down_pan_callback().

◆ update_panels_callback()

void G4OpenGLXmViewer::update_panels_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

◆ UpdateControlPanel()

void G4OpenGLXmViewer::UpdateControlPanel ( )
private

Definition at line 783 of file G4OpenGLXmViewer.cc.

References dolly_high, dolly_low, G4OpenGLViewer::fPan_sens, fpdolly_lower, fpdolly_slider, fpdolly_upper, fppan_set, fppanning_slider, fprot_set, fprotation_slider, fpwobble_slider, fpzoom_lower, fpzoom_slider, fpzoom_upper, G4OpenGLViewer::fRot_sens, G4VViewer::fVP, G4ViewParameters::GetDolly(), G4ViewParameters::GetZoomFactor(), pan_sens_limit, rot_sens_limit, G4OpenGLXmSliderBar::SetInitialValue(), G4OpenGLXmSliderBar::SetMaxValue(), G4OpenGLXmSliderBar::SetMinValue(), G4OpenGLXmTextField::SetValue(), zoom_high, and zoom_low.

Referenced by actions_callback(), and ResetView().

◆ wobble_callback()

void G4OpenGLXmViewer::wobble_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 250 of file G4OpenGLXmRotationCallbacks.cc.

253{
254 G4OpenGLXmViewer* pView;
255
256 XtVaGetValues (w,
257 XmNuserData, &pView,
258 NULL);
259
260 pView->original_vp = pView->fVP.GetViewpointDirection();
261 pView->wobble_timer = XtAppAddTimeOut
262 (pView->app,
263 (long unsigned int) (1000. * (1. / pView->wob_sens)),
265 pView);
266}
static void wobble_timer_callback(XtPointer clientData, XtIntervalId *timerid)
XtIntervalId wobble_timer

References app, G4VViewer::fVP, G4ViewParameters::GetViewpointDirection(), original_vp, wob_sens, wobble_timer, and wobble_timer_callback().

Referenced by misc_callback().

◆ wobble_timer_callback()

void G4OpenGLXmViewer::wobble_timer_callback ( XtPointer  clientData,
XtIntervalId *  timerid 
)
static

Definition at line 268 of file G4OpenGLXmRotationCallbacks.cc.

270{
271 G4OpenGLXmViewer* pView = (G4OpenGLXmViewer*)clientData;
272 const G4Vector3D& up = pView->fVP.GetUpVector();
273 G4Vector3D third_axis = up.cross(pView->original_vp);
274 G4double pi_div_by_ten = pi / 10.0;
275 G4Vector3D d_up = 0.1 * (std::sin ((G4double)pView->frameNo * pi_div_by_ten * 2.)) * up;
276 G4Vector3D d_third_axis = 0.1 * (std::sin ((G4double)pView->frameNo * (pi_div_by_ten))) * third_axis;
277
278 pView->fVP.SetViewAndLights (pView->original_vp + d_up + d_third_axis);
279
280 pView->SetView ();
281 pView->ClearView ();
282 pView->DrawView ();
283
284 if (pView->frameNo++ == 20) {
285 if (pView->wobble_timer) {
286 XtRemoveTimeOut (pView->wobble_timer);
287 pView->frameNo = 0;
288 pView->fVP.SetViewAndLights (pView->original_vp);
289 pView->SetView ();
290 pView->ClearView ();
291 pView->DrawView ();
292 }
293 } else {
294 pView->wobble_timer = XtAppAddTimeOut
295 (pView->app,
296 (long unsigned int) (1000. * (1. / pView->wob_sens)),
298 pView);
299 }
300}
static constexpr double pi
Definition: G4SIunits.hh:55

References app, G4OpenGLViewer::ClearView(), HepGeom::BasicVector3D< T >::cross(), G4VViewer::DrawView(), frameNo, G4VViewer::fVP, G4ViewParameters::GetUpVector(), original_vp, pi, G4OpenGLXViewer::SetView(), G4ViewParameters::SetViewAndLights(), wob_sens, wobble_timer, and wobble_timer_callback().

Referenced by wobble_callback(), and wobble_timer_callback().

◆ zoom_callback()

void G4OpenGLXmViewer::zoom_callback ( Widget  w,
XtPointer  clientData,
XtPointer  callData 
)
static

Definition at line 43 of file G4OpenGLXmPanningCallbacks.cc.

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}

References G4OpenGLViewer::ClearView(), G4VViewer::DrawView(), G4VViewer::fVP, G4cout, G4endl, G4OpenGLXViewer::SetView(), and G4ViewParameters::SetZoomFactor().

Referenced by actions_callback().

Friends And Related Function Documentation

◆ G4OpenGLXmViewerMessenger

friend class G4OpenGLXmViewerMessenger
friend

Definition at line 360 of file G4OpenGLXmViewer.hh.

◆ G4OpenGLXmVWidgetObject

friend class G4OpenGLXmVWidgetObject
friend

Definition at line 359 of file G4OpenGLXmViewer.hh.

Field Documentation

◆ actions_cascade

Widget G4OpenGLXmViewer::actions_cascade
protected

Definition at line 70 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ actions_str

XmString G4OpenGLXmViewer::actions_str
protected

Definition at line 83 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ anti_str

XmString G4OpenGLXmViewer::anti_str
protected

Definition at line 100 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ antialias_pullright

Widget G4OpenGLXmViewer::antialias_pullright
protected

Definition at line 76 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ antialiasing_enabled

G4bool G4OpenGLViewer::antialiasing_enabled
protectedinherited

◆ app

XtAppContext G4OpenGLXmViewer::app
protected

◆ attributeList

G4int* G4OpenGLXViewer::attributeList
protectedinherited

Definition at line 89 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::G4OpenGLXViewer().

◆ aux_edge_pullright

Widget G4OpenGLXmViewer::aux_edge_pullright
protected

Definition at line 78 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ aux_edge_str

XmString G4OpenGLXmViewer::aux_edge_str
protected

Definition at line 103 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ background

G4Colour G4OpenGLViewer::background
protectedinherited

◆ background_color_pullright

Widget G4OpenGLXmViewer::background_color_pullright
protected

Definition at line 74 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ bgnd

Pixel G4OpenGLXmViewer::bgnd
protected

◆ bgnd_str

XmString G4OpenGLXmViewer::bgnd_str
protected

Definition at line 104 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ black_str

XmString G4OpenGLXmViewer::black_str
protected

Definition at line 99 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ borcol

Pixel G4OpenGLXmViewer::borcol
protected

◆ charViewName

char G4OpenGLXViewer::charViewName[100]
protectedinherited

Definition at line 102 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::CreateMainWindow().

◆ class_hints

XClassHint* G4OpenGLXViewer::class_hints
protectedinherited

Definition at line 96 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::CreateMainWindow().

◆ cmap

Colormap G4OpenGLXViewer::cmap
protectedinherited

◆ cxMaster

GLXContext G4OpenGLXViewer::cxMaster
protectedinherited

◆ dblBuf_RGBA

int G4OpenGLXViewer::dblBuf_RGBA
staticprotectedinherited
Initial value:
=
{ GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
GLX_DEPTH_SIZE, 1,
GLX_STENCIL_SIZE, 1,
None }

Definition at line 70 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::G4OpenGLXViewer().

◆ dolly_high

G4double G4OpenGLXmViewer::dolly_high
protected

◆ dolly_low

G4double G4OpenGLXmViewer::dolly_low
protected

◆ dpy

Display* G4OpenGLXViewer::dpy
protectedinherited

◆ draw_str

XmString G4OpenGLXmViewer::draw_str
protected

Definition at line 86 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ drawing_style_pullright

Widget G4OpenGLXmViewer::drawing_style_pullright
protected

Definition at line 73 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ errorBase

G4int G4OpenGLXViewer::errorBase
protectedinherited

Definition at line 90 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::GetXConnection(), and GetXmConnection().

◆ event

XEvent G4OpenGLXViewer::event
protectedinherited

◆ eventBase

G4int G4OpenGLXViewer::eventBase
protectedinherited

Definition at line 91 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::GetXConnection(), and GetXmConnection().

◆ exit_str

XmString G4OpenGLXmViewer::exit_str
protected

Definition at line 95 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ fDefaultExportFilename

G4String G4OpenGLViewer::fDefaultExportFilename
privateinherited

Definition at line 220 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::G4OpenGLViewer().

◆ fDefaultExportImageFormat

std::string G4OpenGLViewer::fDefaultExportImageFormat
protectedinherited

Definition at line 210 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLQtViewer::actionSaveImage().

◆ fDefaultVP

G4ViewParameters G4VViewer::fDefaultVP
protectedinherited

◆ fExportFilename

G4String G4OpenGLViewer::fExportFilename
privateinherited

◆ fExportFilenameIndex

int G4OpenGLViewer::fExportFilenameIndex
protectedinherited

◆ fExportImageFormat

std::string G4OpenGLViewer::fExportImageFormat
protectedinherited

◆ fExportImageFormatVector

std::vector< std::string > G4OpenGLViewer::fExportImageFormatVector
protectedinherited

◆ fGL2PSAction

G4OpenGL2PSAction* G4OpenGLViewer::fGL2PSAction
protectedinherited

◆ fGl2psDefaultLineWith

int G4OpenGLViewer::fGl2psDefaultLineWith
privateinherited

Definition at line 222 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::printGl2PS().

◆ fGl2psDefaultPointSize

int G4OpenGLViewer::fGl2psDefaultPointSize
privateinherited

Definition at line 223 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::printGl2PS().

◆ fGlViewInitialized

bool G4OpenGLViewer::fGlViewInitialized
privateinherited

Definition at line 224 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::InitializeGLView().

◆ fIsGettingPickInfos

bool G4OpenGLViewer::fIsGettingPickInfos
privateinherited

Definition at line 241 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::GetPickDetails(), and G4OpenGLViewer::SetView().

◆ fName

G4String G4VViewer::fName
protectedinherited

◆ fNeedKernelVisit

G4bool G4VViewer::fNeedKernelVisit
protectedinherited

◆ fOpenGLSceneHandler

G4OpenGLSceneHandler& G4OpenGLViewer::fOpenGLSceneHandler
protectedinherited

Definition at line 197 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::GetPickDetails().

◆ fov

G4double G4OpenGLXmViewer::fov
protected

Definition at line 114 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback(), and projection_callback().

◆ fPan_sens

G4double G4OpenGLViewer::fPan_sens
protectedinherited

◆ fpdolly_box

G4OpenGLXmFramedBox* G4OpenGLXmViewer::fpdolly_box
protected

Definition at line 152 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback().

◆ fpdolly_lower

G4OpenGLXmTextField* G4OpenGLXmViewer::fpdolly_lower
protected

Definition at line 162 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback(), and UpdateControlPanel().

◆ fpdolly_slider

G4OpenGLXmSliderBar* G4OpenGLXmViewer::fpdolly_slider
protected

◆ fpdolly_upper

G4OpenGLXmTextField* G4OpenGLXmViewer::fpdolly_upper
protected

Definition at line 161 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback(), and UpdateControlPanel().

◆ fpfov_text

G4OpenGLXmTextField* G4OpenGLXmViewer::fpfov_text
protected

Definition at line 174 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpmiscellany_top

G4OpenGLXmTopLevelShell* G4OpenGLXmViewer::fpmiscellany_top
protected

Definition at line 165 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fPointSize

G4float G4OpenGLViewer::fPointSize
privateinherited

Definition at line 218 of file G4OpenGLViewer.hh.

◆ fpok_button

G4OpenGLXmPushButton* G4OpenGLXmViewer::fpok_button
protected

Definition at line 163 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback().

◆ fporthogonal_button

G4OpenGLXmRadioButton* G4OpenGLXmViewer::fporthogonal_button
protected

Definition at line 172 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fppan_set

G4OpenGLXmTextField* G4OpenGLXmViewer::fppan_set
protected

Definition at line 157 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback(), and UpdateControlPanel().

◆ fppanning_arrows

G4OpenGLXmFourArrowButtons* G4OpenGLXmViewer::fppanning_arrows
protected

Definition at line 148 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback().

◆ fppanning_box

G4OpenGLXmFramedBox* G4OpenGLXmViewer::fppanning_box
protected

Definition at line 147 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback().

◆ fppanning_slider

G4OpenGLXmSliderBar* G4OpenGLXmViewer::fppanning_slider
protected

◆ fppanning_top

G4OpenGLXmTopLevelShell* G4OpenGLXmViewer::fppanning_top
protected

Definition at line 146 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback().

◆ fpperspective_button

G4OpenGLXmRadioButton* G4OpenGLXmViewer::fpperspective_button
protected

Definition at line 173 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpprint_box

G4OpenGLXmFramedBox* G4OpenGLXmViewer::fpprint_box
protected

Definition at line 177 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpprint_button

G4OpenGLXmPushButton* G4OpenGLXmViewer::fpprint_button
protected

Definition at line 181 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpprint_col_box

G4OpenGLXmFramedBox* G4OpenGLXmViewer::fpprint_col_box
protected

Definition at line 178 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpprint_col_radio1

G4OpenGLXmRadioButton* G4OpenGLXmViewer::fpprint_col_radio1
protected

Definition at line 183 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpprint_col_radio2

G4OpenGLXmRadioButton* G4OpenGLXmViewer::fpprint_col_radio2
protected

Definition at line 184 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpprint_line

G4OpenGLXmSeparator* G4OpenGLXmViewer::fpprint_line
protected

Definition at line 182 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpprint_style_box

G4OpenGLXmFramedBox* G4OpenGLXmViewer::fpprint_style_box
protected

Definition at line 179 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpprint_style_radio1

G4OpenGLXmRadioButton* G4OpenGLXmViewer::fpprint_style_radio1
protected

Definition at line 185 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpprint_style_radio2

G4OpenGLXmRadioButton* G4OpenGLXmViewer::fpprint_style_radio2
protected

Definition at line 186 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpprint_text

G4OpenGLXmTextField* G4OpenGLXmViewer::fpprint_text
protected

Definition at line 180 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpprint_top

G4OpenGLXmTopLevelShell* G4OpenGLXmViewer::fpprint_top
protected

Definition at line 176 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpproj_style_box

G4OpenGLXmFramedBox* G4OpenGLXmViewer::fpproj_style_box
protected

Definition at line 171 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpreset_box

G4OpenGLXmFramedBox* G4OpenGLXmViewer::fpreset_box
protected

Definition at line 169 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpreset_button

G4OpenGLXmPushButton* G4OpenGLXmViewer::fpreset_button
protected

Definition at line 170 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fPrintColour

G4bool G4OpenGLViewer::fPrintColour
protectedinherited

◆ fPrintSizeX

G4int G4OpenGLViewer::fPrintSizeX
protectedinherited

◆ fPrintSizeY

G4int G4OpenGLViewer::fPrintSizeY
protectedinherited

◆ fprot_set

G4OpenGLXmTextField* G4OpenGLXmViewer::fprot_set
protected

Definition at line 158 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback(), and UpdateControlPanel().

◆ fprotation_arrow

G4OpenGLXmFourArrowButtons* G4OpenGLXmViewer::fprotation_arrow
protected

Definition at line 144 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback().

◆ fprotation_arrow_box

G4OpenGLXmBox* G4OpenGLXmViewer::fprotation_arrow_box
protected

Definition at line 143 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback().

◆ fprotation_button1

G4OpenGLXmRadioButton* G4OpenGLXmViewer::fprotation_button1
protected

Definition at line 139 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback().

◆ fprotation_button2

G4OpenGLXmRadioButton* G4OpenGLXmViewer::fprotation_button2
protected

Definition at line 140 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback().

◆ fprotation_button_box

G4OpenGLXmBox* G4OpenGLXmViewer::fprotation_button_box
protected

Definition at line 138 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback().

◆ fprotation_slider

G4OpenGLXmSliderBar* G4OpenGLXmViewer::fprotation_slider
protected

◆ fprotation_slider_box

G4OpenGLXmBox* G4OpenGLXmViewer::fprotation_slider_box
protected

Definition at line 141 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback().

◆ fprotation_top

G4OpenGLXmTopLevelShell* G4OpenGLXmViewer::fprotation_top
protected

Definition at line 137 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback().

◆ fpsetting_box

G4OpenGLXmFramedBox* G4OpenGLXmViewer::fpsetting_box
protected

Definition at line 156 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback().

◆ fpsetting_top

G4OpenGLXmTopLevelShell* G4OpenGLXmViewer::fpsetting_top
protected

Definition at line 155 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback().

◆ fpwobble_box

G4OpenGLXmFramedBox* G4OpenGLXmViewer::fpwobble_box
protected

Definition at line 166 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpwobble_button

G4OpenGLXmPushButton* G4OpenGLXmViewer::fpwobble_button
protected

Definition at line 167 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback().

◆ fpwobble_slider

G4OpenGLXmSliderBar* G4OpenGLXmViewer::fpwobble_slider
protected

Definition at line 168 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback(), and UpdateControlPanel().

◆ fpzoom_box

G4OpenGLXmFramedBox* G4OpenGLXmViewer::fpzoom_box
protected

Definition at line 150 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback().

◆ fpzoom_lower

G4OpenGLXmTextField* G4OpenGLXmViewer::fpzoom_lower
protected

Definition at line 160 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback(), and UpdateControlPanel().

◆ fpzoom_slider

G4OpenGLXmSliderBar* G4OpenGLXmViewer::fpzoom_slider
protected

◆ fpzoom_upper

G4OpenGLXmTextField* G4OpenGLXmViewer::fpzoom_upper
protected

Definition at line 159 of file G4OpenGLXmViewer.hh.

Referenced by actions_callback(), and UpdateControlPanel().

◆ frame

Widget G4OpenGLXmViewer::frame
protected

Definition at line 79 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ frameNo

G4int G4OpenGLXmViewer::frameNo
protected

Definition at line 135 of file G4OpenGLXmViewer.hh.

Referenced by wobble_timer_callback().

◆ fRot_sens

G4double G4OpenGLViewer::fRot_sens
protectedinherited

◆ fSceneHandler

G4VSceneHandler& G4VViewer::fSceneHandler
protectedinherited

◆ fShortName

G4String G4VViewer::fShortName
protectedinherited

◆ fSizeHasChanged

G4bool G4OpenGLViewer::fSizeHasChanged
privateinherited

◆ fVectoredPs

G4bool G4OpenGLViewer::fVectoredPs
protectedinherited

◆ fViewId

G4int G4VViewer::fViewId
protectedinherited

◆ fVP

G4ViewParameters G4VViewer::fVP
protectedinherited

Definition at line 219 of file G4VViewer.hh.

Referenced by G4OpenGLQtViewer::actionChangeBackgroundColor(), G4OpenGLQtViewer::actionChangeDefaultColor(), G4OpenGLQtViewer::actionChangeTextColor(), actions_callback(), G4OpenGLSceneHandler::AddPrimitive(), G4OpenGLImmediateSceneHandler::AddPrimitivePreambleInternal(), G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(), aux_edge_callback(), G4OpenGLQtViewer::changeDepthInSceneTree(), G4OpenGLStoredQtViewer::CompareForKernelVisit(), G4OpenGLStoredViewer::CompareForKernelVisit(), G4OpenInventorViewer::CompareForKernelVisit(), G4Qt3DViewer::CompareForKernelVisit(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::CompareForKernelVisit(), G4OpenGLStoredQtViewer::ComputeView(), G4OpenGLWin32Viewer::CreateMainWindow(), CreateMainWindow(), G4OpenGLXViewer::CreateMainWindow(), G4OpenGLQtViewer::CreateMainWindow(), G4OpenGLQtViewer::createPopupMenu(), dolly_callback(), G4OpenGLStoredViewer::DrawDisplayLists(), drawing_style_callback(), G4OpenGLStoredWin32Viewer::DrawView(), G4OpenGLStoredXmViewer::DrawView(), G4OpenGLStoredXViewer::DrawView(), G4OpenInventorViewer::DrawView(), G4Qt3DViewer::DrawView(), G4RayTracerViewer::DrawView(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::DrawView(), G4VtkViewer::DrawViewHUD(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::Export(), G4ASCIITreeViewer::G4ASCIITreeViewer(), G4HepRepFileViewer::G4HepRepFileViewer(), G4OpenGLQtViewer::G4keyPressEvent(), G4OpenGLQtViewer::G4MouseMoveEvent(), G4OpenGLQtViewer::G4MousePressEvent(), G4OpenGLQtViewer::G4MouseReleaseEvent(), G4OpenGLViewer::G4OpenGLViewer(), G4OpenInventorViewer::G4OpenInventorViewer(), G4VtkViewer::G4VtkViewer(), G4VViewer::G4VViewer(), G4OpenGLQtViewer::G4wheelEvent(), G4OpenGLViewer::getSceneDepth(), G4OpenGLViewer::getSceneFarWidth(), G4OpenGLViewer::getSceneNearWidth(), GetXmConnection(), G4OpenInventorViewer::GroupCameraSensorCB(), G4OpenInventorQtViewer::Initialise(), G4OpenInventorWinViewer::Initialise(), G4OpenInventorXtExtendedViewer::Initialise(), G4OpenInventorXtViewer::Initialise(), G4Qt3DViewer::Initialise(), G4RayTracerViewer::Initialise(), G4RayTracerXViewer::Initialise(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::Initialise(), G4VtkQtViewer::Initialise(), G4VtkViewer::Initialise(), G4OpenGLViewer::InitializeGLView(), left_right_pan_callback(), misc_callback(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::mouse_move(), G4Qt3DViewer::mouseMoveEvent(), G4OpenGLQtViewer::moveScene(), G4OpenGLImmediateViewer::ProcessView(), projection_callback(), reset_callback(), ResetView(), G4OpenGLViewer::rotateScene(), G4OpenGLViewer::rotateSceneInViewDirection(), G4OpenGLViewer::rotateSceneThetaPhi(), G4OpenGLViewer::rotateSceneToggle(), G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI(), G4DAWNFILEViewer::SendViewParameters(), G4VRML2FileViewer::SendViewParameters(), set_rot_subject_callback(), G4OpenGLViewerMessenger::SetNewValue(), G4OpenGLXmViewerMessenger::SetNewValue(), G4OpenGLWin32Viewer::SetRotation(), G4OpenGLWin32Viewer::SetShift(), G4OpenGLViewer::SetView(), G4OpenInventorQtViewer::SetView(), G4OpenInventorViewer::SetView(), G4OpenInventorWinViewer::SetView(), G4OpenInventorXtExtendedViewer::SetView(), G4OpenInventorXtViewer::SetView(), G4Qt3DViewer::SetView(), G4RayTracerViewer::SetView(), G4ToolsSGQtViewer::SetView(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::SetView(), G4VtkViewer::SetView(), G4VViewer::SetViewParameters(), G4OpenGLWin32Viewer::SetZoom(), G4OpenGLXViewer::ShowView(), G4VtkViewer::ShowView(), G4OpenGLQtViewer::toggleAux(), G4OpenGLQtViewer::toggleHiddenMarkers(), G4OpenGLQtViewer::togglePicking(), G4OpenGLQtViewer::toggleProjection(), G4OpenGLQtViewer::toggleSurfaceAction(), G4VViewer::TouchableSetColour(), G4VViewer::TouchableSetVisibility(), up_down_pan_callback(), update_panels_callback(), UpdateControlPanel(), G4OpenGLQtViewer::updateToolbarAndMouseContextMenu(), G4OpenGLQtViewer::updateViewerPropertiesTableWidget(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::wheel_rotate(), G4Qt3DViewer::wheelEvent(), wobble_callback(), wobble_timer_callback(), and zoom_callback().

◆ fWinSize_x

unsigned int G4OpenGLViewer::fWinSize_x
protectedinherited

◆ fWinSize_y

unsigned int G4OpenGLViewer::fWinSize_y
protectedinherited

◆ glxarea

Widget G4OpenGLXmViewer::glxarea
protected

Definition at line 80 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ halo_str

XmString G4OpenGLXmViewer::halo_str
protected

Definition at line 102 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ haloing_enabled

G4bool G4OpenGLViewer::haloing_enabled
protectedinherited

◆ haloing_pullright

Widget G4OpenGLXmViewer::haloing_pullright
protected

Definition at line 77 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ hlhsr_str

XmString G4OpenGLXmViewer::hlhsr_str
protected

Definition at line 91 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ hlr_str

XmString G4OpenGLXmViewer::hlr_str
protected

Definition at line 89 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ hsr_str

XmString G4OpenGLXmViewer::hsr_str
protected

Definition at line 90 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ icon_pixmap

Pixmap G4OpenGLXViewer::icon_pixmap
protectedinherited

Definition at line 97 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::CreateMainWindow().

◆ iconName

XTextProperty G4OpenGLXViewer::iconName
protectedinherited

◆ main_win

Widget G4OpenGLXmViewer::main_win
protected

Definition at line 67 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ major

G4int G4OpenGLXViewer::major
protectedinherited

Definition at line 92 of file G4OpenGLXViewer.hh.

◆ menubar

Widget G4OpenGLXmViewer::menubar
protected

Definition at line 68 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ minor

G4int G4OpenGLXViewer::minor
protectedinherited

Definition at line 93 of file G4OpenGLXViewer.hh.

◆ misc_cascade

Widget G4OpenGLXmViewer::misc_cascade
protected

Definition at line 71 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ misc_str

XmString G4OpenGLXmViewer::misc_str
protected

Definition at line 84 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ norm_hints

XSizeHints* G4OpenGLXViewer::norm_hints
protectedinherited

Definition at line 94 of file G4OpenGLXViewer.hh.

◆ off_str

XmString G4OpenGLXmViewer::off_str
protected

Definition at line 105 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ on_str

XmString G4OpenGLXmViewer::on_str
protected

Definition at line 106 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ original_vp

G4Vector3D G4OpenGLXmViewer::original_vp
protected

Definition at line 133 of file G4OpenGLXmViewer.hh.

Referenced by wobble_callback(), and wobble_timer_callback().

◆ pan_high

G4double G4OpenGLXmViewer::pan_high
protected

Definition at line 111 of file G4OpenGLXmViewer.hh.

◆ pan_low

G4double G4OpenGLXmViewer::pan_low
protected

Definition at line 110 of file G4OpenGLXmViewer.hh.

◆ pan_right

G4bool G4OpenGLXmViewer::pan_right
protected

Definition at line 124 of file G4OpenGLXmViewer.hh.

Referenced by left_right_pan_callback(), and pan_left_right_callback().

◆ pan_sens_limit

G4double G4OpenGLXmViewer::pan_sens_limit
protected

◆ pan_str

XmString G4OpenGLXmViewer::pan_str
protected

Definition at line 94 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ pan_timer

XtIntervalId G4OpenGLXmViewer::pan_timer
protected

◆ pan_up

G4bool G4OpenGLXmViewer::pan_up
protected

Definition at line 126 of file G4OpenGLXmViewer.hh.

Referenced by pan_up_down_callback(), and up_down_pan_callback().

◆ polyhedron_str

XmString G4OpenGLXmViewer::polyhedron_str
protected

Definition at line 87 of file G4OpenGLXmViewer.hh.

◆ print_str

XmString G4OpenGLXmViewer::print_str
protected

Definition at line 97 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ quit_str

XmString G4OpenGLXmViewer::quit_str
protected

Definition at line 96 of file G4OpenGLXmViewer.hh.

◆ rot_sens_limit

G4double G4OpenGLXmViewer::rot_sens_limit
protected

◆ rot_str

XmString G4OpenGLXmViewer::rot_str
protected

Definition at line 93 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ rotate_right

G4bool G4OpenGLXmViewer::rotate_right
protected

Definition at line 125 of file G4OpenGLXmViewer.hh.

Referenced by rotate_in_theta(), and theta_rotation_callback().

◆ rotate_up

G4bool G4OpenGLXmViewer::rotate_up
protected

Definition at line 127 of file G4OpenGLXmViewer.hh.

Referenced by phi_rotation_callback(), and rotate_in_phi().

◆ rotation_timer

XtIntervalId G4OpenGLXmViewer::rotation_timer
protected

◆ set_str

XmString G4OpenGLXmViewer::set_str
protected

Definition at line 92 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ shell

Widget G4OpenGLXmViewer::shell
protected

Definition at line 66 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow(), GetXmConnection(), and ~G4OpenGLXmViewer().

◆ size_hints

XSizeHints* G4OpenGLXViewer::size_hints
protectedinherited

Definition at line 98 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::CreateMainWindow().

◆ snglBuf_RGBA

int G4OpenGLXViewer::snglBuf_RGBA
staticprotectedinherited
Initial value:
=
{ GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DEPTH_SIZE, 1,
GLX_STENCIL_SIZE, 1,
None }

Definition at line 69 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::G4OpenGLXViewer().

◆ spec_cascade

Widget G4OpenGLXmViewer::spec_cascade
protected

Definition at line 72 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ spec_str

XmString G4OpenGLXmViewer::spec_str
protected

Definition at line 85 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ style_cascade

Widget G4OpenGLXmViewer::style_cascade
protected

Definition at line 69 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ style_str

XmString G4OpenGLXmViewer::style_str
protected

Definition at line 82 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ swa

XSetWindowAttributes G4OpenGLXViewer::swa
protectedinherited

Definition at line 82 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::CreateMainWindow().

◆ tmp_cx

GLXContext G4OpenGLXViewer::tmp_cx
privateinherited

Definition at line 108 of file G4OpenGLXViewer.hh.

◆ toplevel

Widget G4OpenGLXmViewer::toplevel
protected

Definition at line 65 of file G4OpenGLXmViewer.hh.

Referenced by GetXmConnection(), and G4OpenGLXmVWidgetObject::ProcesspView().

◆ trans_str

XmString G4OpenGLXmViewer::trans_str
protected

Definition at line 101 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ transparency_enabled

G4bool G4OpenGLViewer::transparency_enabled
protectedinherited

◆ transparency_pullright

Widget G4OpenGLXmViewer::transparency_pullright
protected

Definition at line 75 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ vi

XVisualInfo * G4OpenGLXViewer::vi
protectedinherited

◆ vi_double_buffer

XVisualInfo * G4OpenGLXViewer::vi_double_buffer = 0
staticprotectedinherited

Definition at line 77 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::G4OpenGLXViewer().

◆ vi_immediate

XVisualInfo* G4OpenGLXViewer::vi_immediate
protectedinherited

◆ vi_single_buffer

XVisualInfo * G4OpenGLXViewer::vi_single_buffer = 0
staticprotectedinherited

Definition at line 76 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::G4OpenGLXViewer().

◆ vi_stored

XVisualInfo * G4OpenGLXViewer::vi_stored
protectedinherited

◆ white_str

XmString G4OpenGLXmViewer::white_str
protected

Definition at line 98 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ win

GLXDrawable G4OpenGLXViewer::win
protectedinherited

◆ windowName

XTextProperty G4OpenGLXViewer::windowName
protectedinherited

◆ wireframe_str

XmString G4OpenGLXmViewer::wireframe_str
protected

Definition at line 88 of file G4OpenGLXmViewer.hh.

Referenced by CreateMainWindow().

◆ wm_hints

XWMHints* G4OpenGLXViewer::wm_hints
protectedinherited

Definition at line 95 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::CreateMainWindow().

◆ wob_high

G4double G4OpenGLXmViewer::wob_high
protected

Definition at line 117 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback(), and ResetView().

◆ wob_low

G4double G4OpenGLXmViewer::wob_low
protected

Definition at line 118 of file G4OpenGLXmViewer.hh.

Referenced by misc_callback(), and ResetView().

◆ wob_sens

G4double G4OpenGLXmViewer::wob_sens
protected

◆ wobble_timer

XtIntervalId G4OpenGLXmViewer::wobble_timer
protected

Definition at line 131 of file G4OpenGLXmViewer.hh.

Referenced by wobble_callback(), and wobble_timer_callback().

◆ workId

XtWorkProcId G4OpenGLXmViewer::workId
protected

Definition at line 64 of file G4OpenGLXmViewer.hh.

◆ Xatom

Atom G4OpenGLXViewer::Xatom
protectedinherited

Definition at line 99 of file G4OpenGLXViewer.hh.

◆ xwa

XWindowAttributes G4OpenGLXViewer::xwa
protectedinherited

◆ zoom_high

G4double G4OpenGLXmViewer::zoom_high
protected

◆ zoom_low

G4double G4OpenGLXmViewer::zoom_low
protected

The documentation for this class was generated from the following files: