Geant4-11
Public Slots | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Private Types | Private Slots | Private Member Functions | Private Attributes
G4OpenGLQtViewer Class Referenceabstract

#include <G4OpenGLQtViewer.hh>

Inheritance diagram for G4OpenGLQtViewer:
G4OpenGLViewer G4VViewer G4OpenGLImmediateQtViewer G4OpenGLStoredQtViewer

Public Slots

void startPauseVideo ()
 

Public Member Functions

void addNonPVSceneTreeElement (const G4String &model, int currentPVPOIndex, const std::string &modelDescription, const G4Visible &visible)
 
void addPVSceneTreeElement (const G4String &model, G4PhysicalVolumeModel *pPVModel, int currentPVPOIndex)
 
void clearTreeWidget ()
 
void ClearView ()
 
void ClearViewWithoutFlush ()
 
std::vector< G4ThreeVectorComputeFlyThrough (G4Vector3D *)
 
void displayRecordingStatus ()
 
void DrawText (const G4Text &)
 
virtual void DrawView ()=0
 
void encodeVideo ()
 
bool exportImage (std::string name="", int width=-1, int height=-1)
 
void G4keyPressEvent (QKeyEvent *event)
 
void G4keyReleaseEvent (QKeyEvent *event)
 
void G4MouseDoubleClickEvent ()
 
void G4MouseMoveEvent (QMouseEvent *event)
 
void G4MousePressEvent (QMouseEvent *event)
 
void G4MouseReleaseEvent (QMouseEvent *evnt)
 
 G4OpenGLQtViewer (G4OpenGLSceneHandler &scene)
 
void G4wheelEvent (QWheelEvent *event)
 
bool generateMpegEncoderParameters ()
 
const G4VisAttributesGetApplicableVisAttributes (const G4VisAttributes *) const
 
const G4ViewParametersGetDefaultViewParameters () const
 
QString getEncoderPath ()
 
const G4StringGetName () const
 
QString getSaveFileName ()
 
G4VSceneHandlerGetSceneHandler () const
 
const G4StringGetShortName () const
 
QString getTempFolderPath ()
 
G4int GetViewId () const
 
const G4ViewParametersGetViewParameters () const
 
virtual void Initialise ()
 
bool isBadEncoder ()
 
bool isBadOutput ()
 
bool isBadTmp ()
 
bool isEncoding ()
 
bool isFailed ()
 
bool isPaused ()
 
bool isReadyToEncode ()
 
bool isRecording ()
 
bool isStopped ()
 
bool isSuccess ()
 
bool isTouchableVisible (int POindex)
 
bool isWaiting ()
 
void NeedKernelVisit ()
 
void ProcessView ()
 
void RefreshView ()
 
void resetRecording ()
 
void ResetView ()
 
void saveVideo ()
 
void setBadEncoder ()
 
void setBadOutput ()
 
void setBadTmp ()
 
void SetDefaultViewParameters (const G4ViewParameters &vp)
 
QString setEncoderPath (QString path)
 
bool setExportImageFormat (std::string format, bool quiet=false)
 
void SetName (const G4String &)
 
void SetNeedKernelVisit (G4bool need)
 
QString setSaveFileName (QString path)
 
QString setTempFolderPath (QString path)
 
void SetViewParameters (const G4ViewParameters &vp)
 
void setWaiting ()
 
virtual void ShowView ()
 
void stopVideo ()
 
void updatePickInfosWidget (int, int)
 
virtual void updateQWidget ()=0
 
void updateSceneTreeWidget ()
 
void updateViewerPropertiesTableWidget ()
 
virtual ~G4OpenGLQtViewer ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 

Protected Slots

void updateToolbarAndMouseContextMenu ()
 

Protected Member Functions

void addExportImageFormat (std::string format)
 
void ChangeLineWidth (G4double width)
 
void ChangePointSize (G4double size)
 
virtual void CreateFontLists ()
 
void CreateGLQtContext ()
 
virtual void CreateMainWindow (QGLWidget *, const QString &)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
void displaySceneTreeComponent ()
 
void FinishView ()
 
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])
 
void G4manageContextMenuEvent (QContextMenuEvent *e)
 
G4Colour getColorForPoIndex (int poIndex)
 
const std::vector< G4OpenGLViewerPickMap * > & GetPickDetails (GLdouble x, GLdouble y)
 
const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers () const
 
std::string getRealPrintFilename ()
 
GLdouble getSceneDepth ()
 
GLdouble getSceneFarWidth ()
 
GLdouble getSceneNearWidth ()
 
unsigned int getWinHeight () const
 
unsigned int getWinWidth () const
 
void HaloingFirstPass ()
 
void HaloingSecondPass ()
 
void HLRFirstPass ()
 
void HLRSecondPass ()
 
void HLRThirdPass ()
 
void InitializeGLView ()
 
bool isCurrentWidget ()
 
G4bool isFramebufferReady ()
 
G4bool isGl2psWriting ()
 
void moveScene (float, float, float, bool)
 
virtual G4String Pick (GLdouble x, GLdouble y)
 
void ResizeGLView ()
 
void ResizeWindow (unsigned int, unsigned int)
 
void rotateQtScene (float, float)
 
void rotateQtSceneToggle (float, float)
 
void rotateScene (G4double dx, G4double dy)
 
void rotateSceneToggle (G4double dx, G4double dy)
 
void savePPMToTemp ()
 
bool setExportFilename (G4String name, G4bool inc=true)
 
void setExportSize (G4int, G4int)
 
void SetTouchable (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath)
 
void SetView ()
 
G4bool sizeHasChanged ()
 
void TouchableSetColour (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, const G4Colour &)
 
void TouchableSetVisibility (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, G4bool visibility)
 
void updateKeyModifierState (const Qt::KeyboardModifiers &)
 

Protected Attributes

G4bool antialiasing_enabled
 
G4Colour background
 
std::string fDefaultExportImageFormat
 
G4ViewParameters fDefaultVP
 
int fExportFilenameIndex
 
std::string fExportImageFormat
 
std::vector< std::string > fExportImageFormatVector
 
G4OpenGL2PSActionfGL2PSAction
 
QWidget * fGLWidget
 
bool fHasToRepaint
 
bool fMouseOnSceneTree
 
G4String fName
 
G4bool fNeedKernelVisit
 
G4OpenGLSceneHandlerfOpenGLSceneHandler
 
bool fPaintEventLock
 
G4double fPan_sens
 
G4bool fPrintColour
 
G4int fPrintSizeX
 
G4int fPrintSizeY
 
bool fQGLWidgetInitialiseCompleted
 
int fRecordFrameNumber
 
G4double fRot_sens
 
G4VSceneHandlerfSceneHandler
 
G4String fShortName
 
bool fUpdateGLLock
 
G4bool fVectoredPs
 
G4int fViewId
 
G4ViewParameters fVP
 
unsigned int fWinSize_x
 
unsigned int fWinSize_y
 
G4bool haloing_enabled
 
G4bool transparency_enabled
 

Private Types

typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID
 
typedef std::vector< PVNodeIDPVPath
 
enum  RECORDING_STEP {
  WAIT , START , PAUSE , CONTINUE ,
  STOP , READY_TO_ENCODE , ENCODING , FAILED ,
  SUCCESS , BAD_ENCODER , BAD_OUTPUT , BAD_TMP ,
  SAVE
}
 

Private Slots

void actionChangeBackgroundColor ()
 
void actionChangeDefaultColor ()
 
void actionChangeTextColor ()
 
void actionMovieParameters ()
 
void actionSaveImage ()
 
void changeColorAndTransparency (QTreeWidgetItem *item, int val)
 
void changeDepthInSceneTree (int)
 
void changeSearchSelection ()
 
void currentTabActivated (int)
 
void processEncodeFinished ()
 
void processEncodeStdout ()
 
void processLookForFinished ()
 
void sceneTreeComponentItemChanged (QTreeWidgetItem *item, int id)
 
void sceneTreeComponentSelected ()
 
void showShortcuts ()
 
void tableWidgetViewerSetItemChanged (QTableWidgetItem *)
 
void toggleAntialiasing (bool)
 
void toggleAux (bool)
 
void toggleFullScreen (bool)
 
void toggleHaloing (bool)
 
void toggleHiddenMarkers (bool)
 
void toggleMouseAction (int)
 
void togglePicking ()
 
void toggleProjection (bool)
 
void toggleSceneTreeComponentPickingCout (int)
 
void toggleSurfaceAction (int)
 
void toggleTransparency (bool)
 

Private Member Functions

void changeColorAndTransparency (GLuint index, G4Color color)
 
void changeDepthOnSceneTreeItem (double lookForDepth, double currentDepth, QTreeWidgetItem *item)
 
void changeOpenCloseVisibleHiddenSelectedColorSceneTreeElement (QTreeWidgetItem *subItem)
 
void changeQColorForTreeWidgetItem (QTreeWidgetItem *item, const QColor &)
 
void clearSceneTreeSelection (QTreeWidgetItem *)
 
void clearTreeWidgetElements (QTreeWidgetItem *item)
 
void cloneSceneTree (QTreeWidgetItem *rootItem)
 
QTreeWidgetItem * cloneWidgetItem (QTreeWidgetItem *item)
 
void createPickInfosWidget ()
 
void createPopupMenu ()
 
void createRadioAction (QAction *, QAction *, const std::string &, unsigned int a=1)
 
void createSceneTreeComponent ()
 
void createSceneTreeWidget ()
 
QString createTempFolder ()
 
QTreeWidgetItem * createTreeWidgetItem (const PVPath &fullPath, const QString &name, int copyNb, int POIndex, const QString &logicalName, Qt::CheckState state, QTreeWidgetItem *treeNode, const G4Colour &color)
 
void createViewerPropertiesWidget ()
 
 G4OpenGLQtViewer (const G4OpenGLQtViewer &)
 
QString GetCommandParameterList (const G4UIcommand *aCommand)
 
QString getModelShortName (const G4String &modelShortName)
 
QTreeWidgetItem * getOldTreeWidgetItem (int POindex)
 
QWidget * getParentWidget ()
 
QString getProcessErrorMsg ()
 
G4int getRealExportHeight ()
 
G4int getRealExportWidth ()
 
QTreeWidgetItem * getTreeWidgetItem (int POindex)
 
GLubyte * grabPixels (int inColor, unsigned int width, unsigned int height)
 
void initMovieParameters ()
 
bool isPVVolume (QTreeWidgetItem *item)
 
bool isSameSceneTreeElement (QTreeWidgetItem *parentOldItem, QTreeWidgetItem *parentNewItem)
 
G4OpenGLQtVieweroperator= (const G4OpenGLQtViewer &)
 
bool parseAndCheckVisibility (QTreeWidgetItem *treeNode, int POindex)
 
bool parseAndInsertInSceneTree (QTreeWidgetItem *, G4PhysicalVolumeModel *pPVModel, unsigned int fullPathIndex, const QString &parentRoot, unsigned int currentIndex, int currentPVPOIndex)
 
std::string parseSceneTreeAndSaveState ()
 
std::string parseSceneTreeElementAndSaveState (QTreeWidgetItem *item, unsigned int level)
 
bool printGl2PS ()
 
bool printNonVectoredEPS ()
 
bool printPDF (const std::string, int, QImage)
 
bool printVectoredEPS ()
 
QString removeTempFolder ()
 
void rescaleImage (int, int)
 
void rotateSceneInViewDirection (G4double dx, G4double dy)
 
void rotateSceneThetaPhi (G4double dx, G4double dy)
 
void setCheckComponent (QTreeWidgetItem *item, bool check)
 
void setRecordingInfos (const QString &)
 
void setRecordingStatus (RECORDING_STEP)
 
void showMovieParametersDialog ()
 
void updatePositivePoIndexSceneTreeWidgetQuickMap (int POindex, QTreeWidgetItem *item)
 

Private Attributes

bool fAltKeyPress
 
bool fAutoMove
 
bool fBatchMode
 
bool fCheckSceneTreeComponentSignalLock
 
QMenu * fContextMenu
 
bool fControlKeyPress
 
G4String fDefaultExportFilename
 
G4double fDeltaDepth
 
G4double fDeltaZoom
 
QAction * fDrawingLineRemoval
 
QAction * fDrawingLineSurfaceRemoval
 
QAction * fDrawingSurfaceRemoval
 
QAction * fDrawingWireframe
 
QString fEncoderPath
 
G4String fExportFilename
 
QString fFileSavePath
 
QLineEdit * fFilterOutput
 
QAction * fFullScreenOff
 
QAction * fFullScreenOn
 
int fGl2psDefaultLineWith
 
int fGl2psDefaultPointSize
 
bool fGlViewInitialized
 
bool fHoldKeyEvent
 
bool fHoldMoveEvent
 
bool fHoldRotateEvent
 
bool fIsDeleting
 
bool fIsGettingPickInfos
 
QTime * fLastEventTime
 
int fLastExportSliderValue
 
G4Color fLastHighlightColor
 
GLuint fLastHighlightName
 
QPoint fLastPickPoint
 
QPoint fLastPos1
 
QPoint fLastPos2
 
QPoint fLastPos3
 
std::map< int, QTreeWidgetItem * >::const_iterator fLastSceneTreeWidgetAskForIterator
 
std::map< int, QTreeWidgetItem * >::const_iterator fLastSceneTreeWidgetAskForIteratorEnd
 
int fLaunchSpinDelay
 
int fMaxPOindexInserted
 
QTreeWidgetItem * fModelShortNameItem
 
QAction * fMouseMoveAction
 
QAction * fMousePickAction
 
QAction * fMouseRotateAction
 
QAction * fMouseZoomInAction
 
QAction * fMouseZoomOutAction
 
G4OpenGLQtMovieDialogfMovieParametersDialog
 
QString fMovieTempFolderPath
 
float fNbMaxAnglePerSec
 
int fNbMaxFramesPerSec
 
int fNbRotation
 
bool fNoKeyPress
 
int fNumber
 
std::map< int, QTreeWidgetItem * >::const_iterator fOldLastSceneTreeWidgetAskForIterator
 
std::map< int, QTreeWidgetItem * >::const_iterator fOldLastSceneTreeWidgetAskForIteratorEnd
 
std::vector< QTreeWidgetItem * > fOldNullPoIndexSceneTreeWidgetQuickVector
 
std::map< int, QTreeWidgetItem * > fOldPositivePoIndexSceneTreeWidgetQuickMap
 
std::map< int, PVPathfOldTreeItemModels
 
std::map< int, QColor > fOldVisAttrColorMap
 
QString fParameterFileName
 
QScrollArea * fPickInfosScrollArea
 
QWidget * fPickInfosWidget
 
G4float fPointSize
 
std::map< int, QTreeWidgetItem * > fPositivePoIndexSceneTreeWidgetQuickMap
 
QProcess * fProcess
 
QAction * fProjectionOrtho
 
QAction * fProjectionPerspective
 
bool fPVRootNodeCreate
 
RECORDING_STEP fRecordingStep
 
QString fSaveFileName
 
QPushButton * fSceneTreeButtonApply
 
QTreeWidget * fSceneTreeComponentTreeWidget
 
unsigned int fSceneTreeDepth
 
QSlider * fSceneTreeDepthSlider
 
QWidget * fSceneTreeWidget
 
QPixmap * fSearchIcon
 
bool fShiftKeyPress
 
QDialog * fShortcutsDialog
 
QTextEdit * fShortcutsDialogInfos
 
QSignalMapper * fSignalMapperMouse
 
QSignalMapper * fSignalMapperPicking
 
QSignalMapper * fSignalMapperSurface
 
G4bool fSizeHasChanged
 
int fSpinningDelay
 
QString fTempFolderPath
 
int fTimeRotation
 
QString fTouchableVolumes
 
QPixmap * fTreeIconClosed
 
QPixmap * fTreeIconOpen
 
std::map< int, PVPathfTreeItemModels
 
int fTreeWidgetInfosIgnoredCommands
 
QWidget * fUIPickInfosWidget
 
G4UIQtfUiQt
 
QWidget * fUISceneTreeWidget
 
QWidget * fUIViewerPropertiesWidget
 
QTableWidget * fViewerPropertiesTableWidget
 
bool fViewerPropertiesTableWidgetIsInit
 
G4AutoLocklWaitForVisSubThreadQtOpenGLContextInitialized
 
G4AutoLocklWaitForVisSubThreadQtOpenGLContextMoved
 

Detailed Description

Definition at line 84 of file G4OpenGLQtViewer.hh.

Member Typedef Documentation

◆ PVNodeID

Definition at line 88 of file G4OpenGLQtViewer.hh.

◆ PVPath

typedef std::vector<PVNodeID> G4OpenGLQtViewer::PVPath
private

Definition at line 89 of file G4OpenGLQtViewer.hh.

Member Enumeration Documentation

◆ RECORDING_STEP

Constructor & Destructor Documentation

◆ G4OpenGLQtViewer() [1/2]

G4OpenGLQtViewer::G4OpenGLQtViewer ( G4OpenGLSceneHandler scene)

Definition at line 216 of file G4OpenGLQtViewer.cc.

219 :G4VViewer (scene, -1)
220 ,G4OpenGLViewer (scene)
221 ,fGLWidget(NULL)
223 ,fMouseOnSceneTree(false)
224 ,fContextMenu(0)
225 ,fLastPickPoint(-1,-1)
226 ,fDeltaDepth(0.01)
227 ,fDeltaZoom(0.05)
228 ,fHoldKeyEvent(false)
229 ,fHoldMoveEvent(false)
230 ,fHoldRotateEvent(false)
231 ,fAutoMove(false)
232 ,fEncoderPath("")
233 ,fTempFolderPath("")
235 ,fSaveFileName("")
236 ,fParameterFileName("ppmtompeg_encode_parameter_file.par")
239 ,fProcess(NULL)
242 ,fLaunchSpinDelay(100)
243 ,fUISceneTreeWidget(NULL)
245 ,fUIPickInfosWidget(NULL)
246 ,fNoKeyPress(true)
247 ,fAltKeyPress(false)
248 ,fControlKeyPress(false)
249 ,fShiftKeyPress(false)
250 ,fBatchMode(false)
254 ,fSceneTreeWidget(NULL)
255 ,fPVRootNodeCreate(false)
256 ,fFilterOutput(NULL)
257 ,fNbRotation(0)
258 ,fTimeRotation(0)
259 ,fTouchableVolumes("Touchables")
260 ,fShortcutsDialog(NULL)
262 ,fPickInfosWidget(NULL)
269 ,fUiQt(NULL)
270#if QT_VERSION < 0x050600
271 ,fSignalMapperMouse(NULL)
274#endif
275 ,fTreeIconOpen(NULL)
276 ,fTreeIconClosed(NULL)
280 ,fIsDeleting(false)
281{
284 std::defer_lock);
287 std::defer_lock);
288
289 // launch Qt if not
290 if (QCoreApplication::instance () == NULL) {
291 fBatchMode = true;
292 }
294
295 fLastPos3 = QPoint(-1,-1);
296 fLastPos2 = QPoint(-1,-1);
297 fLastPos1 = QPoint(-1,-1);
298
300
301#if QT_VERSION < 0x050e00
302 fLastEventTime = new QTime();
303#else
304 fLastEventTime = new QElapsedTimer();
305#endif
306#if QT_VERSION < 0x050600
307 fSignalMapperMouse = new QSignalMapper(this);
308 fSignalMapperSurface = new QSignalMapper(this);
309#endif
310 // Set default path and format
311 fFileSavePath = QDir::currentPath();
312
313 // add available export format
314 QList<QByteArray> formats = QImageWriter::supportedImageFormats ();
315 for (int i = 0; i < formats.size(); ++i) {
316 addExportImageFormat(formats.at(i).data());
317 }
318
319 const char * const icon1[]={
320 /* columns rows colors chars-per-pixel */
321 "20 20 34 1",
322 " c None",
323 ". c #7C7C7C7C7C7C",
324 "X c #7D7D7D7D7D7D",
325 "o c #828282828282",
326 "O c #838383838383",
327 "+ c #848484848484",
328 "@ c #858585858585",
329 "# c #878787878787",
330 "$ c #888888888888",
331 "% c #8B8B8B8B8B8B",
332 "& c #8C8C8C8C8C8C",
333 "* c #8F8F8F8F8F8F",
334 "= c #909090909090",
335 "- c #919191919191",
336 "; c #999999999999",
337 ": c #9D9D9D9D9D9D",
338 "> c #A2A2A2A2A2A2",
339 ", c #A3A3A3A3A3A3",
340 "< c #A5A5A5A5A5A5",
341 "1 c #A6A6A6A6A6A6",
342 "2 c #B3B3B3B3B3B3",
343 "3 c #B6B6B6B6B6B6",
344 "4 c #C2C2C2C2C2C2",
345 "5 c #C6C6C6C6C6C6",
346 "6 c #CACACACACACA",
347 "7 c #CFCFCFCFCFCF",
348 "8 c #D0D0D0D0D0D0",
349 "9 c #D4D4D4D4D4D4",
350 "0 c #D7D7D7D7D7D7",
351 "q c #DEDEDEDEDEDE",
352 "w c #E0E0E0E0E0E0",
353 "e c #E7E7E7E7E7E7",
354 "r c #F4F4F4F4F4F4",
355 "t c #F7F7F7F7F7F7",
356 " ",
357 " ",
358 " ",
359 " ",
360 " ",
361 " ",
362 " =========> ",
363 " 7&X+++Oo<e ",
364 " 2o+@@+-8 ",
365 " w;.#@+3 ",
366 " 4$o@:q ",
367 " r1X%5 ",
368 " 9*,t ",
369 " 60 ",
370 " ",
371 " ",
372 " ",
373 " ",
374 " ",
375 " "
376 };
377 const char * const icon2[]={
378 "20 20 68 1",
379 " c None",
380 ". c #5F5F10102323",
381 "X c #40405F5F1010",
382 "o c #696963632E2E",
383 "O c #101019194C4C",
384 "+ c #101023237070",
385 "@ c #70702D2D6363",
386 "# c #73732D2D6464",
387 "$ c #79792E2E6767",
388 "% c #19194C4C5353",
389 "& c #2D2D63636161",
390 "* c #2E2E61617070",
391 "= c #6F6F6E6E4343",
392 "- c #707065655F5F",
393 "; c #727279795454",
394 ": c #535341417070",
395 "> c #797954547979",
396 ", c #434361617474",
397 "< c #414170707070",
398 "1 c #686869696363",
399 "2 c #6C6C69696363",
400 "3 c #656567676F6F",
401 "4 c #69696F6F6E6E",
402 "5 c #747465656767",
403 "6 c #757562626C6C",
404 "7 c #70706C6C6969",
405 "8 c #616174746565",
406 "9 c #656573736969",
407 "0 c #616174746969",
408 "q c #707075756262",
409 "w c #797970706565",
410 "e c #636361617474",
411 "r c #67676F6F7272",
412 "t c #727261617070",
413 "y c #616170707070",
414 "u c #6F6F72727979",
415 "i c #67676E6ED1D1",
416 "p c #808080808080",
417 "a c #828282828282",
418 "s c #838383838383",
419 "d c #848484848484",
420 "f c #858585858585",
421 "g c #868686868686",
422 "h c #888888888888",
423 "j c #8A8A8A8A8A8A",
424 "k c #8D8D8D8D8D8D",
425 "l c #8F8F8F8F8F8F",
426 "z c #909090909090",
427 "x c #949494949494",
428 "c c #9C9C9C9C9C9C",
429 "v c #9F9F9F9F9F9F",
430 "b c #A2A2A2A2A2A2",
431 "n c #AEAEAEAEAEAE",
432 "m c #B7B7B7B7B7B7",
433 "M c #C7C7C7C7C7C7",
434 "N c #C9C9C9C9C9C9",
435 "B c #D1D1D1D1D1D1",
436 "V c #D4D4D4D4D4D4",
437 "C c #D9D9D9D9D9D9",
438 "Z c #E0E0E0E0E0E0",
439 "A c #E2E2E2E2E2E2",
440 "S c #EEEEEEEEEEEE",
441 "D c #F0F0F0F0F0F0",
442 "F c #F5F5F5F5F5F5",
443 "G c #F6F6F6F6F6F6",
444 "H c #F9F9F9F9F9F9",
445 "J c #FCFCFCFCFCFC",
446 "K c #FDFDFDFDFDFD",
447 " ",
448 " ",
449 " ",
450 " ",
451 " ",
452 " bC ",
453 " zjnD ",
454 " ldjjMK ",
455 " zdhdjcA ",
456 " zddhdddVK ",
457 " zghdalBH ",
458 " zghamSK ",
459 " lubZH ",
460 " xMF ",
461 " G ",
462 " ",
463 " ",
464 " ",
465 " ",
466 " ",
467
468 };
469
470 const char * const search[] = {
471 /* columns rows colors chars-per-pixel */
472 "19 19 8 1",
473 " c #5C5C5C",
474 ". c #7D7D7D",
475 "X c #9B9B9B",
476 "o c #C3C3C3",
477 "O c None",
478 "+ c #000000",
479 "@ c #000000",
480 "# c None",
481 /* pixels */
482 "OOOOOOOOOOOOOOOOOOO",
483 "OOOOOOOOOOOOOOOOOOO",
484 "OOOOOOOo. .oOOOOOO",
485 "OOOOOOX XOOOOO",
486 "OOOOOo XOOX oOOOO",
487 "OOOOO. XOOOOX .OOOO",
488 "OOOOO OOOOOO OOOO",
489 "OOOOO OOOOOO OOOO",
490 "OOOOO. XOOOOo .OOOO",
491 "OOOOOo oOOo oOOOO",
492 "OOOOOOX XOOOO",
493 "OOOOOOOo. . XOOO",
494 "OOOOOOOOOOOOO. XOO",
495 "OOOOOOOOOOOOOO. XOO",
496 "OOOOOOOOOOOOOOOoOOO",
497 "OOOOOOOOOOOOOOOOOOO",
498 "OOOOOOOOOOOOOOOOOOO",
499 "OOOOOOOOOOOOOOOOOOO",
500 "OOOOOOOOOOOOOOOOOOO"
501 };
502
503 fSearchIcon = new QPixmap(search);
504 fTreeIconOpen = new QPixmap(icon1);
505 fTreeIconClosed = new QPixmap(icon2);
506
507}
G4TemplateAutoLock< G4Mutex > G4AutoLock
Definition: G4AutoLock.hh:582
G4Colour G4Color
Definition: G4Color.hh:41
QWidget * fUISceneTreeWidget
QTreeWidget * fSceneTreeComponentTreeWidget
QLineEdit * fFilterOutput
RECORDING_STEP fRecordingStep
QScrollArea * fPickInfosScrollArea
G4AutoLock * lWaitForVisSubThreadQtOpenGLContextMoved
QSignalMapper * fSignalMapperPicking
QWidget * fSceneTreeWidget
bool fCheckSceneTreeComponentSignalLock
QWidget * fUIPickInfosWidget
unsigned int fSceneTreeDepth
QSignalMapper * fSignalMapperMouse
QTreeWidgetItem * fModelShortNameItem
QTableWidget * fViewerPropertiesTableWidget
QWidget * fPickInfosWidget
QDialog * fShortcutsDialog
QWidget * fUIViewerPropertiesWidget
bool fViewerPropertiesTableWidgetIsInit
QSlider * fSceneTreeDepthSlider
QSignalMapper * fSignalMapperSurface
G4OpenGLQtMovieDialog * fMovieParametersDialog
G4AutoLock * lWaitForVisSubThreadQtOpenGLContextInitialized
G4OpenGLViewer(G4OpenGLSceneHandler &scene)
void addExportImageFormat(std::string format)
static G4Qt * getInstance()
Definition: G4Qt.cc:51
G4VViewer(G4VSceneHandler &, G4int id, const G4String &name="")
Definition: G4VViewer.cc:46

References G4OpenGLViewer::addExportImageFormat(), fBatchMode, fFileSavePath, fLastEventTime, fLastPos1, fLastPos2, fLastPos3, fSearchIcon, fSignalMapperMouse, fSignalMapperSurface, fTreeIconClosed, fTreeIconOpen, G4Qt::getInstance(), initMovieParameters(), lWaitForVisSubThreadQtOpenGLContextInitialized, lWaitForVisSubThreadQtOpenGLContextMoved, anonymous_namespace{G4OpenGLQtViewer.cc}::mWaitForVisSubThreadQtOpenGLContextInitialized, and anonymous_namespace{G4OpenGLQtViewer.cc}::mWaitForVisSubThreadQtOpenGLContextMoved.

◆ ~G4OpenGLQtViewer()

G4OpenGLQtViewer::~G4OpenGLQtViewer ( )
virtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 510 of file G4OpenGLQtViewer.cc.

514{
515 fIsDeleting = true;
516
517 // remove scene tree from layout
518 // Delete all the existing buttons in the layout
519 QLayoutItem *wItem;
520 if (fSceneTreeWidget != NULL) {
521 if (fSceneTreeWidget->layout() != NULL) {
522 while ((wItem = fSceneTreeWidget->layout()->takeAt(0)) != 0) {
523 delete wItem->widget();
524 delete wItem;
525 }
526 }
527 }
528
529 // Delete the open/close icons
530 delete fTreeIconOpen;
531 delete fTreeIconClosed;
532
533 G4cout <<removeTempFolder().toStdString().c_str() <<G4endl;
534
537
538}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

References fIsDeleting, fSceneTreeWidget, fTreeIconClosed, fTreeIconOpen, G4cout, G4endl, lWaitForVisSubThreadQtOpenGLContextInitialized, lWaitForVisSubThreadQtOpenGLContextMoved, and removeTempFolder().

◆ G4OpenGLQtViewer() [2/2]

G4OpenGLQtViewer::G4OpenGLQtViewer ( const G4OpenGLQtViewer )
private

Member Function Documentation

◆ actionChangeBackgroundColor

void G4OpenGLQtViewer::actionChangeBackgroundColor ( )
privateslot

Definition at line 1164 of file G4OpenGLQtViewer.cc.

1164 {
1165
1166 // //I need to revisit the kernel if the background colour changes and
1167 // //hidden line removal is enabled, because hlr drawing utilises the
1168 // //background colour in its drawing...
1169 // // (Note added by JA 13/9/2005) Background now handled in view
1170 // // parameters. A kernel visit is triggered on change of background.
1171
1172#if QT_VERSION < 0x040500
1173 bool a;
1174 const QColor color = QColor(QColorDialog::getRgba (QColor(Qt::black).rgba(),&a,fGLWidget));
1175#else
1176 const QColor color =
1177 QColorDialog::getColor(Qt::black,
1178 fGLWidget,
1179 " Get background color and transparency",
1180 QColorDialog::ShowAlphaChannel);
1181#endif
1182 if (color.isValid()) {
1183 G4Colour colour(((G4double)color.red())/255,
1184 ((G4double)color.green())/255,
1185 ((G4double)color.blue())/255,
1186 ((G4double)color.alpha())/255);
1187 fVP.SetBackgroundColour(colour);
1188
1190 updateQWidget();
1191 }
1192}
double G4double
Definition: G4Types.hh:83
void updateToolbarAndMouseContextMenu()
virtual void updateQWidget()=0
G4ViewParameters fVP
Definition: G4VViewer.hh:219
void SetBackgroundColour(const G4Colour &)

References fGLWidget, G4VViewer::fVP, G4ViewParameters::SetBackgroundColour(), updateQWidget(), and updateToolbarAndMouseContextMenu().

Referenced by createPopupMenu().

◆ actionChangeDefaultColor

void G4OpenGLQtViewer::actionChangeDefaultColor ( )
privateslot

Definition at line 1219 of file G4OpenGLQtViewer.cc.

1219 {
1220
1221#if QT_VERSION < 0x040500
1222 bool a;
1223 const QColor color = QColor(QColorDialog::getRgba (QColor(Qt::white).rgba(),&a,fGLWidget));
1224#else
1225 const QColor& color =
1226 QColorDialog::getColor(Qt::white,
1227 fGLWidget,
1228 " Get default color and transparency",
1229 QColorDialog::ShowAlphaChannel);
1230#endif
1231 if (color.isValid()) {
1232 G4Colour colour(((G4double)color.red())/255,
1233 ((G4double)color.green())/255,
1234 ((G4double)color.blue())/255,
1235 ((G4double)color.alpha())/255);
1236
1237 fVP.SetDefaultColour(colour);
1238
1240 updateQWidget();
1241 }
1242}
void SetDefaultColour(const G4Colour &)

References fGLWidget, G4VViewer::fVP, G4ViewParameters::SetDefaultColour(), updateQWidget(), and updateToolbarAndMouseContextMenu().

Referenced by createPopupMenu().

◆ actionChangeTextColor

void G4OpenGLQtViewer::actionChangeTextColor ( )
privateslot

Definition at line 1194 of file G4OpenGLQtViewer.cc.

1194 {
1195
1196#if QT_VERSION < 0x040500
1197 bool a;
1198 const QColor color = QColor(QColorDialog::getRgba (QColor(Qt::yellow).rgba(),&a,fGLWidget));
1199#else
1200 const QColor& color =
1201 QColorDialog::getColor(Qt::yellow,
1202 fGLWidget,
1203 " Get text color and transparency",
1204 QColorDialog::ShowAlphaChannel);
1205#endif
1206 if (color.isValid()) {
1207 G4Colour colour(((G4double)color.red())/255,
1208 ((G4double)color.green())/255,
1209 ((G4double)color.blue())/255,
1210 ((G4double)color.alpha())/255);
1211
1212 fVP.SetDefaultTextColour(colour);
1213
1215 updateQWidget();
1216 }
1217}
void SetDefaultTextColour(const G4Colour &)

References fGLWidget, G4VViewer::fVP, G4ViewParameters::SetDefaultTextColour(), updateQWidget(), and updateToolbarAndMouseContextMenu().

Referenced by createPopupMenu().

◆ actionMovieParameters

void G4OpenGLQtViewer::actionMovieParameters ( )
privateslot

Definition at line 1245 of file G4OpenGLQtViewer.cc.

1245 {
1247}

References showMovieParametersDialog().

Referenced by createPopupMenu().

◆ actionSaveImage

void G4OpenGLQtViewer::actionSaveImage ( )
privateslot

Definition at line 1094 of file G4OpenGLQtViewer.cc.

1094 {
1095 QString filters;
1096 for (unsigned int i = 0; i < fExportImageFormatVector.size(); ++i) {
1097 filters += QString("*.") + fExportImageFormatVector.at(i).c_str() + ";;";
1098 }
1099
1100 QString* selectedFormat = new QString(fDefaultExportImageFormat.c_str());
1101 QString qFilename;
1102 qFilename = QFileDialog::getSaveFileName ( fGLWidget,
1103 tr("Save as ..."),
1105 filters,
1106 selectedFormat );
1107
1108
1109 std::string name = qFilename.toStdString().c_str();
1110
1111 // bmp jpg jpeg png ppm xbm xpm
1112 if (name.empty()) {
1113 return;
1114 }
1115
1116 fFileSavePath = QFileInfo(qFilename).path();
1117
1118 std::string format = selectedFormat->toLower().toStdString().c_str();
1119
1120 // set the format to current
1121 fExportImageFormat = format.substr(format.find_last_of(".") + 1);
1122
1123 std::string filename = name;
1124 std::string extension = "";
1125 if (name.find_last_of(".") != std::string::npos) {
1126 filename = name.substr(0,name.find_last_of(".") + 1);
1127 extension = name.substr(name.find_last_of(".") + 1);
1128 } else {
1129 extension = fExportImageFormat;
1130 }
1131
1132 filename+= "."+ extension;
1133
1134 if (!setExportFilename(filename.c_str(),0)) {
1135 return;
1136 }
1137
1138 G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(fGLWidget,format.c_str(),fGLWidget->height(),fGLWidget->width());
1139 if( exportDialog->exec()) {
1140
1141 if ((exportDialog->getWidth() !=fGLWidget->width()) ||
1142 (exportDialog->getHeight() !=fGLWidget->height())) {
1143 setExportSize(exportDialog->getWidth(),exportDialog->getHeight());
1144
1145 }
1146 if (fExportImageFormat == "eps") {
1147 fVectoredPs = exportDialog->getVectorEPS();
1148 } else if (fExportImageFormat == "ps") {
1149 fVectoredPs = true;
1150 }
1151 fLastExportSliderValue = exportDialog->getSliderValue();
1152
1153 if (exportImage(filename)) {
1154 // set the default format to current
1156 }
1157 } else { // cancel selected
1158 return;
1159 }
1160
1161}
bool exportImage(std::string name="", int width=-1, int height=-1)
std::vector< std::string > fExportImageFormatVector
std::string fExportImageFormat
std::string fDefaultExportImageFormat
bool setExportFilename(G4String name, G4bool inc=true)
void setExportSize(G4int, G4int)
const char * name(G4int ptype)

References exportImage(), G4OpenGLViewer::fDefaultExportImageFormat, G4OpenGLViewer::fExportImageFormat, G4OpenGLViewer::fExportImageFormatVector, fFileSavePath, fGLWidget, fLastExportSliderValue, G4OpenGLViewer::fVectoredPs, G4OpenGLQtExportDialog::getHeight(), G4OpenGLQtExportDialog::getSliderValue(), G4OpenGLQtExportDialog::getVectorEPS(), G4OpenGLQtExportDialog::getWidth(), G4InuclParticleNames::name(), G4OpenGLViewer::setExportFilename(), and G4OpenGLViewer::setExportSize().

Referenced by createPopupMenu().

◆ addExportImageFormat()

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

Definition at line 1288 of file G4OpenGLViewer.cc.

1288 {
1289 fExportImageFormatVector.push_back(format);
1290}

References G4OpenGLViewer::fExportImageFormatVector.

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

◆ addNonPVSceneTreeElement()

void G4OpenGLQtViewer::addNonPVSceneTreeElement ( const G4String model,
int  currentPVPOIndex,
const std::string &  modelDescription,
const G4Visible visible 
)

Definition at line 3344 of file G4OpenGLQtViewer.cc.

3349 {
3350
3351 QString modelShortName = getModelShortName(model);
3352 G4Colour color;
3353
3354 // Special case for text
3355 try {
3356 const G4Text& g4Text = dynamic_cast<const G4Text&>(visible);
3357 color = fSceneHandler.GetTextColour(g4Text);
3358 }
3359 catch (const std::bad_cast&) {
3360 color = fSceneHandler.GetColour();
3361 }
3362
3363 // Special case for marker
3364 try {
3365 const G4VMarker& g4Marker = dynamic_cast<const G4VMarker&>(visible);
3366 if (g4Marker.GetInfo() != "") {
3367 modelShortName = g4Marker.GetInfo();
3368 }
3369 }
3370 catch (const std::bad_cast&) {}
3371
3372 if (modelShortName == "") {
3373 return ;
3374 }
3375 // try to init it
3376 if (fSceneTreeComponentTreeWidget == NULL) {
3378 }
3379
3380 // if no UI
3381 if (fSceneTreeComponentTreeWidget == NULL) {
3382 return;
3383 }
3384
3385 fSceneTreeComponentTreeWidget->blockSignals(true);
3386
3387 // Create the "Model" node if not
3388
3389 QList<QTreeWidgetItem *> resItem;
3390 resItem = fSceneTreeComponentTreeWidget->findItems (modelShortName, Qt::MatchExactly, 0 );
3391 QTreeWidgetItem * currentItem = NULL;
3392 const PVPath tmpFullPath;
3393
3394 if (resItem.empty()) {
3395 currentItem = createTreeWidgetItem(tmpFullPath,
3396 modelShortName,
3397 0, // currentPVCopyNb
3398 -1, // currentPVPOIndex
3399 "",
3400 Qt::Checked,
3401 NULL,
3402 color);
3403 } else {
3404 currentItem = resItem.first();
3405 }
3406
3407 // Is this volume already in the tree AND PO is not the same?
3408 const QList<QTreeWidgetItem *>&
3409 resItems = fSceneTreeComponentTreeWidget->findItems (QString(modelDescription.c_str()), Qt::MatchFixedString| Qt::MatchCaseSensitive|Qt::MatchRecursive, 0 );
3410
3411 bool alreadyPresent = false;
3412 for (int i = 0; i < resItems.size(); ++i) {
3413 if (currentPOIndex == resItems.at(i)->data(0,Qt::UserRole).toInt()) {
3414 alreadyPresent = true;
3415 }
3416 }
3417 if (!alreadyPresent) {
3418 createTreeWidgetItem(tmpFullPath,
3419 modelShortName,
3420 0, // currentPVCopyNb
3421 currentPOIndex,
3422 "",
3423 Qt::Checked,
3424 currentItem,
3425 color);
3426 }
3427 fSceneTreeComponentTreeWidget->blockSignals(false);
3428
3429}
QTreeWidgetItem * createTreeWidgetItem(const PVPath &fullPath, const QString &name, int copyNb, int POIndex, const QString &logicalName, Qt::CheckState state, QTreeWidgetItem *treeNode, const G4Colour &color)
QString getModelShortName(const G4String &modelShortName)
std::vector< PVNodeID > PVPath
Definition: G4Text.hh:72
virtual const G4String & GetInfo() const
const G4Colour & GetTextColour(const G4Text &)
const G4Colour & GetColour()
G4VSceneHandler & fSceneHandler
Definition: G4VViewer.hh:215

References createSceneTreeComponent(), createTreeWidgetItem(), G4VViewer::fSceneHandler, fSceneTreeComponentTreeWidget, G4VSceneHandler::GetColour(), G4VMarker::GetInfo(), getModelShortName(), and G4VSceneHandler::GetTextColour().

Referenced by G4OpenGLStoredQtSceneHandler::ExtraPOProcessing().

◆ addPVSceneTreeElement()

void G4OpenGLQtViewer::addPVSceneTreeElement ( const G4String model,
G4PhysicalVolumeModel pPVModel,
int  currentPVPOIndex 
)

Definition at line 2876 of file G4OpenGLQtViewer.cc.

2876 {
2877
2878 const QString& modelShortName = getModelShortName(model);
2879
2880 if (modelShortName == "") {
2881 return ;
2882 }
2883 // try to init it
2884 if (fSceneTreeComponentTreeWidget == NULL) {
2886 }
2887
2888 // if no UI
2889 if (fSceneTreeComponentTreeWidget == NULL) {
2890 return;
2891 }
2892
2893 fSceneTreeComponentTreeWidget->blockSignals(true);
2894
2895 // Create the "volume" node if not
2896 // if (fSceneTreeComponentTreeWidget->topLevelItemCount () == 0) {
2897 if (!fPVRootNodeCreate) {
2898 const G4Colour& color = fSceneHandler.GetColour();
2899
2901 modelShortName,
2902 0, // currentPVCopyNb
2903 -1, // currentPVPOIndex
2904 "",
2905 Qt::Checked,
2906 NULL,
2907 color);
2908 fPVRootNodeCreate = true;
2909 }
2910
2911 bool added = parseAndInsertInSceneTree(fModelShortNameItem,pPVModel,0,modelShortName,0,currentPOIndex);
2912 if (!added) {
2913 }
2914
2915 fSceneTreeComponentTreeWidget->blockSignals(false);
2916
2917}
bool parseAndInsertInSceneTree(QTreeWidgetItem *, G4PhysicalVolumeModel *pPVModel, unsigned int fullPathIndex, const QString &parentRoot, unsigned int currentIndex, int currentPVPOIndex)
const std::vector< G4PhysicalVolumeNodeID > & GetFullPVPath() const

References createSceneTreeComponent(), createTreeWidgetItem(), fModelShortNameItem, fPVRootNodeCreate, G4VViewer::fSceneHandler, fSceneTreeComponentTreeWidget, G4VSceneHandler::GetColour(), G4PhysicalVolumeModel::GetFullPVPath(), getModelShortName(), and parseAndInsertInSceneTree().

Referenced by G4OpenGLStoredQtSceneHandler::ExtraPOProcessing().

◆ changeColorAndTransparency() [1/2]

void G4OpenGLQtViewer::changeColorAndTransparency ( GLuint  index,
G4Color  color 
)
private

Definition at line 3643 of file G4OpenGLQtViewer.cc.

3643 {
3644
3645 // change vis attributes to set new colour
3646 G4int iPO = index;
3647 if (iPO >= 0 && fTreeItemModels.find(iPO) != fTreeItemModels.end()) {
3648 const PVPath& fullPath = fTreeItemModels[iPO];
3649 // If a physical volume
3650 if (fullPath.size()) {
3651 SetTouchable(fullPath);
3652 TouchableSetColour(fullPath, color);
3653 fMouseOnSceneTree = true;
3654 }
3655 }
3656}
int G4int
Definition: G4Types.hh:85
std::map< int, PVPath > fTreeItemModels
void SetTouchable(const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath)
Definition: G4VViewer.cc:125
void TouchableSetColour(const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, const G4Colour &)
Definition: G4VViewer.cc:181

References fMouseOnSceneTree, fTreeItemModels, G4VViewer::SetTouchable(), and G4VViewer::TouchableSetColour().

Referenced by changeColorAndTransparency(), createSceneTreeComponent(), and updatePickInfosWidget().

◆ changeColorAndTransparency [2/2]

void G4OpenGLQtViewer::changeColorAndTransparency ( QTreeWidgetItem *  item,
int  val 
)
privateslot

Definition at line 3612 of file G4OpenGLQtViewer.cc.

3612 {
3613
3614 if (item == NULL) {
3615 return;
3616 }
3617 const QColor& old = QColor(item->data(2,Qt::UserRole).value<QColor>());
3618
3619#if QT_VERSION < 0x040500
3620 bool a;
3621 const QColor& color = QColor(QColorDialog::getRgba (old.rgba(),&a,fSceneTreeComponentTreeWidget));
3622#else
3623 const QColor& color = QColorDialog::getColor(old,
3625 " Get color and transparency",
3626 QColorDialog::ShowAlphaChannel);
3627#endif
3628
3629 if (color.isValid()) {
3630
3631 changeColorAndTransparency(item->data(0,Qt::UserRole).toInt(),
3632 G4Colour (((G4double)color.red())/255,
3633 ((G4double)color.green())/255,
3634 ((G4double)color.blue())/255,
3635 ((G4double)color.alpha())/255));
3636
3637 // set scene tree parameters
3639 }
3640}
void changeColorAndTransparency(GLuint index, G4Color color)
void changeQColorForTreeWidgetItem(QTreeWidgetItem *item, const QColor &)

References changeColorAndTransparency(), changeQColorForTreeWidgetItem(), and fSceneTreeComponentTreeWidget.

◆ changeDepthInSceneTree

void G4OpenGLQtViewer::changeDepthInSceneTree ( int  val)
privateslot

Definition at line 3575 of file G4OpenGLQtViewer.cc.

3575 {
3576
3577 // If no scene tree (Immediate viewer)
3578 if (fSceneTreeComponentTreeWidget == NULL) {
3579 return;
3580 }
3581
3582 // max depth : fSceneTreeDepth
3583 // val is between 0 and 1
3584 // 0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1
3585 // 1 1.4 2
3586 // 1 2 3 4
3587
3588 // Get the depth :
3589 double depth = 1 + ((double)val)/1000 * ((double)fSceneTreeDepth+1);
3590
3591 // lock update on scene tree items
3593
3594 // Disable redraw each time !
3595 G4bool currentAutoRefresh = fVP.IsAutoRefresh();
3596 fVP.SetAutoRefresh(false);
3597
3598 for (int b=0;b<fSceneTreeComponentTreeWidget->topLevelItemCount();b++) {
3600 }
3601
3602 // Enable redraw !
3603 fVP.SetAutoRefresh(currentAutoRefresh);
3604 updateQWidget();
3605
3606 // unlock update on scene tree items
3608
3609}
bool G4bool
Definition: G4Types.hh:86
void changeDepthOnSceneTreeItem(double lookForDepth, double currentDepth, QTreeWidgetItem *item)
void SetAutoRefresh(G4bool)
G4bool IsAutoRefresh() const

References changeDepthOnSceneTreeItem(), fCheckSceneTreeComponentSignalLock, fSceneTreeComponentTreeWidget, fSceneTreeDepth, G4VViewer::fVP, G4ViewParameters::IsAutoRefresh(), G4ViewParameters::SetAutoRefresh(), and updateQWidget().

Referenced by createSceneTreeComponent().

◆ changeDepthOnSceneTreeItem()

void G4OpenGLQtViewer::changeDepthOnSceneTreeItem ( double  lookForDepth,
double  currentDepth,
QTreeWidgetItem *  item 
)
private

Definition at line 3794 of file G4OpenGLQtViewer.cc.

3798 {
3799 double transparencyLevel = 0.;
3800
3801 // look for a 2.2 depth and we are at level 3
3802 // -> Set all theses items to Opaque
3803 // ONLY if it is a PV volume !
3804 if (isPVVolume(item)) {
3805 if ((lookForDepth-currentDepth) < 0) {
3806 item->setCheckState(0,Qt::Checked);
3807 updatePositivePoIndexSceneTreeWidgetQuickMap(item->data(0,Qt::UserRole).toInt(),item);
3808 transparencyLevel = 1;
3809 } else if ((lookForDepth-currentDepth) > 1 ){
3810 item->setCheckState(0,Qt::Unchecked);
3811 updatePositivePoIndexSceneTreeWidgetQuickMap(item->data(0,Qt::UserRole).toInt(),item);
3812 transparencyLevel = 0;
3813 } else {
3814 item->setCheckState(0,Qt::Checked);
3815 updatePositivePoIndexSceneTreeWidgetQuickMap(item->data(0,Qt::UserRole).toInt(),item);
3816 transparencyLevel = 1-(lookForDepth-currentDepth);
3817 }
3818 }
3819
3820 if (item->data(0,Qt::UserRole).toInt() >= 0) {
3821 const G4Colour& color = getColorForPoIndex(item->data(0,Qt::UserRole).toInt());
3822
3823 // We are less depper (ex:tree depth:2) than lookForDepth (ex:3.1)
3824 // -> Have to hide this level ONLY if it was not hidden before
3825
3826 // Not on a top level item case
3827 // Do not set if it was already set
3828
3829 // Should add them all the time in case of an older command has change transparency
3830 // before. Should be checked in changeDepthInSceneTree for duplicated commands
3831 // Do not change transparency if not visible by humain (and avoid precision value
3832 // problems..)
3833 if (((color.GetAlpha()-transparencyLevel) > 0.000001) ||
3834 ((color.GetAlpha()-transparencyLevel) < -0.000001)) {
3835 if ((item->text(3) != "")) {
3836 // FIXME : Should not test this here because of transparent
3837 // volume that will came after and with a different alpha level
3838 // Good thing to do is to check and suppress doubles in changeDepthInSceneTree
3839 // and then check if last (transparents volumes) has to change alpha
3840
3841 changeQColorForTreeWidgetItem(item,QColor((int)(color.GetRed()*255),
3842 (int)(color.GetGreen()*255),
3843 (int)(color.GetBlue()*255),
3844 (int)(transparencyLevel*255)));
3845 }
3846 }
3847 }
3848
3849 for (int b=0;b< item->childCount();b++) {
3850 changeDepthOnSceneTreeItem(lookForDepth,currentDepth+1,item->child(b));
3851 }
3852}
G4double GetBlue() const
Definition: G4Colour.hh:154
G4double GetAlpha() const
Definition: G4Colour.hh:155
G4double GetRed() const
Definition: G4Colour.hh:152
G4double GetGreen() const
Definition: G4Colour.hh:153
bool isPVVolume(QTreeWidgetItem *item)
G4Colour getColorForPoIndex(int poIndex)
void updatePositivePoIndexSceneTreeWidgetQuickMap(int POindex, QTreeWidgetItem *item)

References changeDepthOnSceneTreeItem(), changeQColorForTreeWidgetItem(), G4Colour::GetAlpha(), G4Colour::GetBlue(), getColorForPoIndex(), G4Colour::GetGreen(), G4Colour::GetRed(), isPVVolume(), and updatePositivePoIndexSceneTreeWidgetQuickMap().

Referenced by changeDepthInSceneTree(), and changeDepthOnSceneTreeItem().

◆ 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().

◆ changeOpenCloseVisibleHiddenSelectedColorSceneTreeElement()

void G4OpenGLQtViewer::changeOpenCloseVisibleHiddenSelectedColorSceneTreeElement ( QTreeWidgetItem *  subItem)
private

Definition at line 3180 of file G4OpenGLQtViewer.cc.

3183{
3184 // Check if object with the same POIndex is the same in old tree
3185 QTreeWidgetItem* oldItem = NULL;
3186
3187 QTreeWidgetItem* foundItem = getOldTreeWidgetItem(subItem->data(0,Qt::UserRole).toInt());
3188
3189 if (foundItem != NULL) {
3190 if (isSameSceneTreeElement(foundItem,subItem)) {
3191 oldItem = foundItem;
3192 }
3193 }
3194 if (foundItem == NULL) { // PO should have change, parse all
3195
3196 // POindex > 0
3197 std::map <int, QTreeWidgetItem*>::const_iterator i;
3200 if (isSameSceneTreeElement(i->second,subItem)) {
3201 oldItem = i->second;
3203 } else {
3204 i++;
3205 }
3206 }
3207 // POindex == 0 ?
3208 if (oldItem == NULL) {
3209 unsigned int a = 0;
3214 } else {
3215 a++;
3216 }
3217 }
3218 }
3219 }
3220
3221 // if found : retore old state
3222 if (oldItem != NULL) {
3223 subItem->setFlags(oldItem->flags()); // flags
3224 subItem->setCheckState(0,oldItem->checkState(0)); // check state
3225 subItem->setSelected(oldItem->isSelected()); // selected
3226 subItem->setExpanded(oldItem->isExpanded ()); // expand
3227
3228 // change color
3229 // when we call this function, the color in the item is the one of vis Attr
3230
3231 std::map <int, QTreeWidgetItem* >::iterator it;
3232
3233 // getOldPO
3234 int oldPOIndex = oldItem->data(0,Qt::UserRole).toInt();
3235 it = fOldPositivePoIndexSceneTreeWidgetQuickMap.find(oldPOIndex);
3236 QColor color;
3237
3238 // get old Vis Attr Color
3239 std::map <int, QColor >::iterator itVis;
3240 itVis = fOldVisAttrColorMap.find(oldPOIndex);
3241
3242 QColor oldVisAttrColor;
3243 const QColor& newVisAttrColor = subItem->data(2,Qt::UserRole).value<QColor>();
3244
3245 bool visAttrChange = false;
3246 // if old vis attr color found
3247 if (itVis != fOldVisAttrColorMap.end()) {
3248 oldVisAttrColor = itVis->second;
3249 if (oldVisAttrColor != newVisAttrColor) {
3250 visAttrChange = true;
3251 }
3252 } else {
3253 visAttrChange = true;
3254 }
3255
3256 if (visAttrChange) {
3257 fOldVisAttrColorMap.insert(std::pair <int, QColor > (subItem->data(0,Qt::UserRole).toInt(),newVisAttrColor) );
3258
3259 } else { // if no changes, get old PO value
3260 // if old PO found
3262 color = (it->second)->data(2,Qt::UserRole).value<QColor>();
3263 } else {
3264 color = oldItem->data(2,Qt::UserRole).value<QColor>();
3265 }
3266 changeQColorForTreeWidgetItem(subItem,color);
3267 }
3268 }
3269
3270 return;
3271}
QTreeWidgetItem * getOldTreeWidgetItem(int POindex)
std::map< int, QColor > fOldVisAttrColorMap
std::vector< QTreeWidgetItem * > fOldNullPoIndexSceneTreeWidgetQuickVector
std::map< int, QTreeWidgetItem * > fOldPositivePoIndexSceneTreeWidgetQuickMap
bool isSameSceneTreeElement(QTreeWidgetItem *parentOldItem, QTreeWidgetItem *parentNewItem)

References changeQColorForTreeWidgetItem(), fOldNullPoIndexSceneTreeWidgetQuickVector, fOldPositivePoIndexSceneTreeWidgetQuickMap, fOldVisAttrColorMap, getOldTreeWidgetItem(), and isSameSceneTreeElement().

Referenced by createTreeWidgetItem().

◆ 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().

◆ changeQColorForTreeWidgetItem()

void G4OpenGLQtViewer::changeQColorForTreeWidgetItem ( QTreeWidgetItem *  item,
const QColor &  qc 
)
private

Definition at line 3985 of file G4OpenGLQtViewer.cc.

3985 {
3986
3987 int POIndex = item->data(0,Qt::UserRole).toInt();
3989
3990 QPixmap pixmap = QPixmap(QSize(16, 16));
3991 if (item->data(0,Qt::UserRole).toInt() != -1) {
3992 pixmap.fill (qc);
3993 } else {
3994 pixmap.fill (QColor(255,255,255,255));
3995 }
3996 QPainter painter(&pixmap);
3997 painter.setPen(Qt::black);
3998 painter.drawRect(0,0,15,15); // Draw contour
3999
4000 item->setIcon(0,pixmap);
4001 item->setData(2,Qt::UserRole,qc);
4002}

References updatePositivePoIndexSceneTreeWidgetQuickMap().

Referenced by changeColorAndTransparency(), changeDepthOnSceneTreeItem(), changeOpenCloseVisibleHiddenSelectedColorSceneTreeElement(), createTreeWidgetItem(), and parseAndInsertInSceneTree().

◆ changeSearchSelection

void G4OpenGLQtViewer::changeSearchSelection ( )
privateslot

Definition at line 3740 of file G4OpenGLQtViewer.cc.

3741{
3742 const QString& searchText = fFilterOutput->text();
3743 if (fSceneTreeComponentTreeWidget == NULL) {
3744 return;
3745 }
3746
3747 // unselect all
3748 for (int a=0; a<fSceneTreeComponentTreeWidget->topLevelItemCount(); a++) {
3749 fSceneTreeComponentTreeWidget->topLevelItem(a)->setExpanded(false);
3750 fSceneTreeComponentTreeWidget->topLevelItem(a)->setSelected(false);
3752 }
3753
3754 QList<QTreeWidgetItem *> itemList = fSceneTreeComponentTreeWidget->findItems (searchText,Qt::MatchContains | Qt::MatchRecursive,0);
3755
3756 for (int i = 0; i < itemList.size(); ++i) {
3757 QTreeWidgetItem* expandParentItem = itemList.at(i);
3758 while (expandParentItem->parent() != NULL) {
3759 expandParentItem->parent()->setExpanded(true);
3760 expandParentItem = expandParentItem->parent();
3761 }
3762 itemList.at(i)->setSelected(true);
3763 }
3764
3765}
void clearSceneTreeSelection(QTreeWidgetItem *)

References clearSceneTreeSelection(), fFilterOutput, and fSceneTreeComponentTreeWidget.

Referenced by createSceneTreeComponent().

◆ clearSceneTreeSelection()

void G4OpenGLQtViewer::clearSceneTreeSelection ( QTreeWidgetItem *  item)
private

Definition at line 3768 of file G4OpenGLQtViewer.cc.

3768 {
3769 for (int a=0; a<item->childCount(); a++) {
3770 item->child(a)->setSelected(false);
3771 item->child(a)->setExpanded(false);
3772 clearSceneTreeSelection(item->child(a));
3773 }
3774
3775}

References clearSceneTreeSelection().

Referenced by changeSearchSelection(), and clearSceneTreeSelection().

◆ clearTreeWidget()

void G4OpenGLQtViewer::clearTreeWidget ( )

Definition at line 3855 of file G4OpenGLQtViewer.cc.

3855 {
3856 // be careful about calling this twice
3857
3859
3860 if (fSceneTreeComponentTreeWidget->topLevelItemCount () > 0) {
3861
3862 fPVRootNodeCreate = false;
3863
3864 // reset all old
3867 fOldTreeItemModels.clear();
3868
3869 // Clone everything
3870 for (int b =0; b <fSceneTreeComponentTreeWidget->topLevelItemCount();b++) {
3871 // All tree widgets are in :
3872 // then we could get the old POindex and get
3873 // .visible/Hidden
3874 // .Check/Uncheck
3875 // .selected
3876 // .colour status from std::map
3877
3878 // clone top level items
3879 int poIndex = fSceneTreeComponentTreeWidget->topLevelItem(b)->data(0,Qt::UserRole).toInt();
3880 if (poIndex != -1) {
3881 fOldPositivePoIndexSceneTreeWidgetQuickMap.insert(std::pair <int, QTreeWidgetItem*> (poIndex,cloneWidgetItem(fSceneTreeComponentTreeWidget->topLevelItem(b))));
3882 } else {
3884 }
3885
3886 // clone leaves
3888 }
3889 // delete all elements
3890
3891 fOldTreeItemModels.insert(fTreeItemModels.begin(), fTreeItemModels.end());
3892
3893 // all is copy, then clear scene tree
3894 int tmp2 = fSceneTreeComponentTreeWidget->topLevelItemCount();
3895 while (tmp2 > 0) {
3896 delete fSceneTreeComponentTreeWidget->takeTopLevelItem (0);
3897 tmp2 = fSceneTreeComponentTreeWidget->topLevelItemCount();
3898 }
3900
3901 // put correct value in paramaters
3904 fSceneTreeDepth = 1;
3905 fModelShortNameItem = NULL;
3907
3908 }
3909 }
3910}
std::map< int, QTreeWidgetItem * >::const_iterator fOldLastSceneTreeWidgetAskForIteratorEnd
std::map< int, PVPath > fOldTreeItemModels
void cloneSceneTree(QTreeWidgetItem *rootItem)
QTreeWidgetItem * cloneWidgetItem(QTreeWidgetItem *item)
std::map< int, QTreeWidgetItem * > fPositivePoIndexSceneTreeWidgetQuickMap
std::map< int, QTreeWidgetItem * >::const_iterator fOldLastSceneTreeWidgetAskForIterator

References cloneSceneTree(), cloneWidgetItem(), fMaxPOindexInserted, fModelShortNameItem, fOldLastSceneTreeWidgetAskForIterator, fOldLastSceneTreeWidgetAskForIteratorEnd, fOldNullPoIndexSceneTreeWidgetQuickVector, fOldPositivePoIndexSceneTreeWidgetQuickMap, fOldTreeItemModels, fPositivePoIndexSceneTreeWidgetQuickMap, fPVRootNodeCreate, fSceneTreeComponentTreeWidget, fSceneTreeDepth, and fTreeItemModels.

Referenced by G4OpenGLStoredQtSceneHandler::ClearStore(), and G4OpenGLStoredQtSceneHandler::SetScene().

◆ clearTreeWidgetElements()

void G4OpenGLQtViewer::clearTreeWidgetElements ( QTreeWidgetItem *  item)
private

◆ 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}

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

Referenced by G4OpenGLViewer::ClearView().

◆ cloneSceneTree()

void G4OpenGLQtViewer::cloneSceneTree ( QTreeWidgetItem *  rootItem)
private

Clone the current tree in order to get a snapshot of old version

Definition at line 3945 of file G4OpenGLQtViewer.cc.

3947 {
3948
3949 for (int b=0;b< rootItem->childCount();b++) {
3950
3951 QTreeWidgetItem *child = rootItem->child(b);
3952
3953 // clone top level items
3954 int poIndex = child->data(0,Qt::UserRole).toInt();
3955 if (poIndex != -1) {
3956 fOldPositivePoIndexSceneTreeWidgetQuickMap.insert(std::pair <int, QTreeWidgetItem*> (poIndex,cloneWidgetItem(child)));
3957 } else {
3959 }
3960 cloneSceneTree(child);
3961 }
3962}

References cloneSceneTree(), cloneWidgetItem(), fOldNullPoIndexSceneTreeWidgetQuickVector, and fOldPositivePoIndexSceneTreeWidgetQuickMap.

Referenced by clearTreeWidget(), and cloneSceneTree().

◆ cloneWidgetItem()

QTreeWidgetItem * G4OpenGLQtViewer::cloneWidgetItem ( QTreeWidgetItem *  item)
private

Clone :

  • Open/close
  • Visible/hidden
  • Selected

Definition at line 3919 of file G4OpenGLQtViewer.cc.

3919 {
3920
3921 QTreeWidgetItem* cloneItem = new QTreeWidgetItem();
3922
3923 // Clone what is create createTreeWidgetItem step
3924
3925 cloneItem->setText(0,item->text(0));
3926 cloneItem->setData(1,Qt::UserRole,item->data(1,Qt::UserRole).toInt());
3927 cloneItem->setText(2,item->text(2));
3928 cloneItem->setData(0, Qt::UserRole,item->data(0,Qt::UserRole).toInt());
3929 cloneItem->setText(3,item->text(3));
3930 cloneItem->setFlags(item->flags());
3931 cloneItem->setToolTip(0,item->toolTip(0));
3932 cloneItem->setCheckState(0,item->checkState(0));
3933 cloneItem->setSelected(item->isSelected());
3934 cloneItem->setExpanded(item->isExpanded ());
3935
3936 cloneItem->setData(2,Qt::UserRole,item->data(2,Qt::UserRole).value<QColor>());
3937
3938 return cloneItem;
3939}

Referenced by clearTreeWidget(), and cloneSceneTree().

◆ 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

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

◆ CreateFontLists()

virtual void G4OpenGLViewer::CreateFontLists ( )
inlineprotectedvirtualinherited

◆ CreateGLQtContext()

void G4OpenGLQtViewer::CreateGLQtContext ( )
protected

◆ CreateMainWindow()

void G4OpenGLQtViewer::CreateMainWindow ( QGLWidget *  glWidget,
const QString &  name 
)
protectedvirtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 114 of file G4OpenGLQtViewer.cc.

120{
121
122 if(fGLWidget) return; //Done.
123
124 fGLWidget = glWidget ;
125 // fGLWidget->makeCurrent();
126
127 G4Qt* interactorManager = G4Qt::getInstance ();
128
130
131 // FIXME L.Garnier 9/11/09 Has to be check !!!
132 // Qt UI with Qt Vis
133 // Qt UI with X Vis
134 // X UI with Qt Vis
135 // X UI with X Vis
136 // Ne marche pas avec un UIBatch !! (ecran blanc)
137
138 // return false if G4UIQt was not launch
139
141 if (UI == NULL) return;
142
143 if (! static_cast<G4UIQt*> (UI->GetG4UIWindow())) {
144 // NO UI, should be batch mode
145 fBatchMode = true;
146 return;
147 }
148 fUiQt = static_cast<G4UIQt*> (UI->GetG4UIWindow());
149
150 bool isTabbedView = false;
151 if ( fUiQt) {
152 if (!fBatchMode) {
153 if (!interactorManager->IsExternalApp()) {
154 // INIT size
157
158 isTabbedView = fUiQt->AddTabWidget((QWidget*)fGLWidget,name);
160 SIGNAL(currentChanged(int)),
161 this,
162 SLOT(currentTabActivated(int)));
163
164
165 }
167 // activate them
168 }
169 }
170
171 if (!isTabbedView) { // we have to do a dialog
172
173 QWidget *glDialogWidget = getParentWidget();
174 if (glDialogWidget == NULL) {
175 return;
176 }
177 glWidget->setParent(glDialogWidget);
178 QHBoxLayout *mainLayout = new QHBoxLayout();
179
180 mainLayout->setMargin(0);
181 mainLayout->setSpacing(0);
182 mainLayout->addWidget(fGLWidget);
183 if (fGLWidget->inherits("QMainWindow")) {
184 fGLWidget->setWindowTitle( name);
185 }
186 glDialogWidget->setLayout(mainLayout);
187
188
189 //useful for MACOSX, we have to compt the menuBar height
190#if QT_VERSION >= 0x050a00
191 G4int offset = QApplication::desktop()->height()
192 - QGuiApplication::screenAt(QPoint(20,20))->availableGeometry().height();
193#else
194 G4int offset = QApplication::desktop()->height()
195 - QApplication::desktop()->availableGeometry().height();
196#endif
197
198 G4int YPos= fVP.GetWindowAbsoluteLocationHintY(QApplication::desktop()->height());
199 if (fVP.GetWindowAbsoluteLocationHintY(QApplication::desktop()->height())< offset) {
200 YPos = offset;
201 }
202 glDialogWidget->resize(getWinWidth(), getWinHeight());
203 glDialogWidget->move(fVP.GetWindowAbsoluteLocationHintX(QApplication::desktop()->width()),YPos);
204 glDialogWidget->show();
205 }
206
207 if(!fGLWidget) return;
208
209 if (!fContextMenu)
211
212}
void currentTabActivated(int)
QWidget * getParentWidget()
unsigned int fWinSize_y
unsigned int getWinHeight() const
void ResizeWindow(unsigned int, unsigned int)
unsigned int getWinWidth() const
unsigned int fWinSize_x
Definition: G4Qt.hh:49
bool IsExternalApp()
Definition: G4Qt.cc:196
QTabWidget * GetViewerTabWidget()
Definition: G4UIQt.hh:167
bool AddTabWidget(QWidget *, QString)
Definition: G4UIQt.cc:1860
G4UIsession * GetG4UIWindow() const
Definition: G4UImanager.hh:188
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
G4int GetWindowAbsoluteLocationHintY(G4int) const
unsigned int GetWindowSizeHintX() const
G4int GetWindowAbsoluteLocationHintX(G4int) const
unsigned int GetWindowSizeHintY() const
def connect(endpoint="tcp://127.0.0.1:5555")
Definition: g4zmq.py:15

References G4UIQt::AddTabWidget(), g4zmq::connect(), createPopupMenu(), createSceneTreeWidget(), currentTabActivated(), fBatchMode, fContextMenu, fGLWidget, fUiQt, G4VViewer::fVP, G4OpenGLViewer::fWinSize_x, G4OpenGLViewer::fWinSize_y, G4UImanager::GetG4UIWindow(), G4Qt::getInstance(), getParentWidget(), G4UImanager::GetUIpointer(), G4UIQt::GetViewerTabWidget(), G4ViewParameters::GetWindowAbsoluteLocationHintX(), G4ViewParameters::GetWindowAbsoluteLocationHintY(), G4ViewParameters::GetWindowSizeHintX(), G4ViewParameters::GetWindowSizeHintY(), G4OpenGLViewer::getWinHeight(), G4OpenGLViewer::getWinWidth(), G4Qt::IsExternalApp(), G4InuclParticleNames::name(), and G4OpenGLViewer::ResizeWindow().

Referenced by G4OpenGLImmediateQtViewer::Initialise(), and G4OpenGLStoredQtViewer::Initialise().

◆ createPickInfosWidget()

void G4OpenGLQtViewer::createPickInfosWidget ( )
private

Definition at line 2709 of file G4OpenGLQtViewer.cc.

2709 {
2710
2711 // Get the pointer to the Pick infos widget
2713
2714 if (!fUIPickInfosWidget) {
2715 return;
2716 }
2717
2718 // remove previous widgets
2719 QLayoutItem * wItem;
2720 if (fUIPickInfosWidget->layout()->count()) {
2721 while ((wItem = fUIPickInfosWidget->layout()->takeAt(0)) != 0) {
2722 delete wItem->widget();
2723 delete wItem;
2724 }
2725 }
2726
2727 QGroupBox *groupBox = new QGroupBox("");
2728 QVBoxLayout *vbox = new QVBoxLayout;
2729
2730 // add picking infos
2731 QWidget *pickingInfoWidget = new QWidget();
2732 QHBoxLayout *pickingInfoLayout = new QHBoxLayout();
2733
2734 pickingInfoWidget->setStyleSheet ("padding-left: 0px; border:0px;");
2735 pickingInfoWidget->setLayout(pickingInfoLayout);
2736
2737 vbox->addWidget(pickingInfoWidget);
2738 // add picking content
2739
2740 fPickInfosScrollArea = new QScrollArea();
2741 fPickInfosScrollArea->setWidgetResizable(true);
2742
2743
2744 fPickInfosWidget = new QWidget();
2745 fPickInfosWidget->setStyleSheet ("padding: 0px ");
2746
2747 QVBoxLayout* vLayout = new QVBoxLayout();
2748 fPickInfosWidget->setLayout (vLayout);
2750
2751 QSizePolicy vPolicy = fPickInfosWidget->sizePolicy();
2752 vPolicy.setVerticalStretch(4);
2753 vbox->addWidget(fPickInfosScrollArea);
2754 pickingInfoLayout->setContentsMargins(0,0,0,0);
2755 vLayout->setContentsMargins(0,0,0,0);
2756 vbox->setContentsMargins(1,1,1,1);
2757
2758 groupBox->setLayout(vbox);
2759 fUIPickInfosWidget->layout()->addWidget(groupBox);
2760
2762}
void updatePickInfosWidget(int, int)
QWidget * GetPickInfosWidget()
Definition: G4UIQt.cc:1799

References fLastPickPoint, fPickInfosScrollArea, fPickInfosWidget, fUIPickInfosWidget, fUiQt, G4UIQt::GetPickInfosWidget(), and updatePickInfosWidget().

Referenced by currentTabActivated(), and updatePickInfosWidget().

◆ createPopupMenu()

void G4OpenGLQtViewer::createPopupMenu ( )
private

Definition at line 544 of file G4OpenGLQtViewer.cc.

544 {
545
546 fContextMenu = new QMenu("All");
547
548 QMenu *mMouseAction = fContextMenu->addMenu("&Mouse actions");
549
550#if QT_VERSION < 0x050600
551 fMouseRotateAction = mMouseAction->addAction("Rotate", fSignalMapperMouse, SLOT(map()));
552 fMouseMoveAction = mMouseAction->addAction("Move", fSignalMapperMouse, SLOT(map()));
553 fMousePickAction = mMouseAction->addAction("Pick", fSignalMapperMouse, SLOT(map()));
554 fMouseZoomOutAction = mMouseAction->addAction("Zoom out", fSignalMapperMouse, SLOT(map()));
555 fMouseZoomInAction = mMouseAction->addAction("Zoom in", fSignalMapperMouse, SLOT(map()));
556#else
557 fMouseRotateAction = mMouseAction->addAction("Rotate", this, [this](){ this->toggleMouseAction(1); });
558 fMouseMoveAction = mMouseAction->addAction("Move", this, [this](){ this->toggleMouseAction(2); });
559 fMousePickAction = mMouseAction->addAction("Pick", this, [this](){ this->toggleMouseAction(3); });
560 fMouseZoomOutAction = mMouseAction->addAction("Zoom out", this, [this](){ this->toggleMouseAction(4); });
561 fMouseZoomInAction = mMouseAction->addAction("Zoom in", this, [this](){ this->toggleMouseAction(5); });
562#endif
563 QAction *shortcutsAction = mMouseAction->addAction("Show shortcuts");
564
565 fMouseRotateAction->setCheckable(true);
566 fMouseMoveAction->setCheckable(true);
567 fMousePickAction->setCheckable(true);
568 fMouseZoomOutAction->setCheckable(true);
569 fMouseZoomInAction->setCheckable(true);
570 shortcutsAction->setCheckable(false);
571
572#if QT_VERSION < 0x050600
573 connect(fSignalMapperMouse, SIGNAL(mapped(int)),this, SLOT(toggleMouseAction(int)));
579#endif
580
581 QObject::connect(shortcutsAction,
582 SIGNAL(triggered(bool)),
583 this,
584 SLOT(showShortcuts()));
585
586 // === Style Menu ===
587 QMenu *mStyle = fContextMenu->addMenu("&Style");
588
589 QMenu *mProjection = mStyle->addMenu("&Projection");
590
591#if QT_VERSION < 0x050600
592 fProjectionOrtho = mProjection->addAction("Orthographic", fSignalMapperSurface, SLOT(map()));
593 fProjectionPerspective = mProjection->addAction("Perspective", fSignalMapperSurface, SLOT(map()));
594
595 // INIT mProjection
596 if (fVP.GetFieldHalfAngle() == 0) {
598 } else {
600 }
601#else
602 // no more radioAction, not realy useful and could be confusing to use context menu and icon at the same time
603 fProjectionOrtho = mProjection->addAction("Orthographic", this, [this](){ this->toggleProjection(1); });
604 fProjectionPerspective = mProjection->addAction("Perspective", this, [this](){ this->toggleProjection(2); });
605#endif
606 // === Drawing Menu ===
607 QMenu *mDrawing = mStyle->addMenu("&Drawing");
608
609#if QT_VERSION < 0x050600
610 fDrawingWireframe = mDrawing->addAction("Wireframe", fSignalMapperSurface, SLOT(map()));
611
612 fDrawingLineRemoval = mDrawing->addAction("Hidden line removal", fSignalMapperSurface, SLOT(map()));
613
614 fDrawingSurfaceRemoval = mDrawing->addAction("Hidden Surface removal", fSignalMapperSurface, SLOT(map()));
615
616 fDrawingLineSurfaceRemoval = mDrawing->addAction("Hidden line and surface removal", fSignalMapperSurface, SLOT(map()));
617#endif
618
619#if QT_VERSION < 0x050600
620 connect(fSignalMapperSurface, SIGNAL(mapped(int)),this, SLOT(toggleSurfaceAction(int)));
625#else
626 fDrawingWireframe = mDrawing->addAction("Wireframe", this, [this](){ this->toggleSurfaceAction(1); });
627 fDrawingLineRemoval = mDrawing->addAction("Hidden line removal", this, [this](){ this->toggleSurfaceAction(2); });
628 fDrawingSurfaceRemoval = mDrawing->addAction("Hidden Surface removal", this, [this](){ this->toggleSurfaceAction(3); });
629 fDrawingLineSurfaceRemoval = mDrawing->addAction("Hidden line and surface removal", this, [this](){ this->toggleSurfaceAction(4); });
630#endif
631
632 fDrawingWireframe->setCheckable(true);
633 fDrawingLineRemoval->setCheckable(true);
634 fDrawingSurfaceRemoval->setCheckable(true);
635 fDrawingLineSurfaceRemoval->setCheckable(true);
636
637 // Background Color
638
639 QAction *backgroundColorChooser ;
640 // === Action Menu ===
641 backgroundColorChooser = mStyle->addAction("Background color");
642 QObject ::connect(backgroundColorChooser,
643 SIGNAL(triggered()),
644 this,
646
647 // Text Color
648
649 QAction *textColorChooser ;
650 // === Action Menu ===
651 textColorChooser = mStyle->addAction("Text color");
652 QObject ::connect(textColorChooser,
653 SIGNAL(triggered()),
654 this,
655 SLOT(actionChangeTextColor()));
656
657 // Default Color
658
659 QAction *defaultColorChooser ;
660 // === Action Menu ===
661 defaultColorChooser = mStyle->addAction("Default color");
662 QObject ::connect(defaultColorChooser,
663 SIGNAL(triggered()),
664 this,
666
667
668 // === Action Menu ===
669 QMenu *mActions = fContextMenu->addMenu("&Actions");
670 QAction *createEPS = mActions->addAction("Save as ...");
671 QObject ::connect(createEPS,
672 SIGNAL(triggered()),
673 this,
674 SLOT(actionSaveImage()));
675
676 // === Action Menu ===
677 QAction *movieParameters = mActions->addAction("Save as movie...");
678 QObject ::connect(movieParameters,
679 SIGNAL(triggered()),
680 this,
681 SLOT(actionMovieParameters()));
682
683
684
685
686 // === Special Menu ===
687 QMenu *mSpecial = fContextMenu->addMenu("S&pecial");
688 QMenu *mTransparency = mSpecial->addMenu("Transparency");
689 QAction *transparencyOn = mTransparency->addAction("On");
690 QAction *transparencyOff = mTransparency->addAction("Off");
691
692 if (transparency_enabled == false) {
693 createRadioAction(transparencyOn,transparencyOff,SLOT(toggleTransparency(bool)),2);
694 } else if (transparency_enabled == true) {
695 createRadioAction(transparencyOn,transparencyOff,SLOT(toggleTransparency(bool)),1);
696 } else {
697 mSpecial->clear();
698 }
699
700
701 QMenu *mAntialiasing = mSpecial->addMenu("Antialiasing");
702 QAction *antialiasingOn = mAntialiasing->addAction("On");
703 QAction *antialiasingOff = mAntialiasing->addAction("Off");
704
705 if (antialiasing_enabled == false) {
706 createRadioAction(antialiasingOn,antialiasingOff,SLOT(toggleAntialiasing(bool)),2);
707 } else if (antialiasing_enabled == true) {
708 createRadioAction(antialiasingOn,antialiasingOff,SLOT(toggleAntialiasing(bool)),1);
709 } else {
710 mAntialiasing->clear();
711 }
712
713 QMenu *mHaloing = mSpecial->addMenu("Haloing");
714 QAction *haloingOn = mHaloing->addAction("On");
715 QAction *haloingOff = mHaloing->addAction("Off");
716 if (haloing_enabled == false) {
717 createRadioAction(haloingOn,haloingOff,SLOT(toggleHaloing(bool)),2);
718 } else if (haloing_enabled == true) {
719 createRadioAction(haloingOn,haloingOff,SLOT(toggleHaloing(bool)),1);
720 } else {
721 mHaloing->clear();
722 }
723
724 QMenu *mAux = mSpecial->addMenu("Auxiliary edges");
725 QAction *auxOn = mAux->addAction("On");
726 QAction *auxOff = mAux->addAction("Off");
727 if (!fVP.IsAuxEdgeVisible()) {
728 createRadioAction(auxOn,auxOff,SLOT(toggleAux(bool)),2);
729 } else {
730 createRadioAction(auxOn,auxOff,SLOT(toggleAux(bool)),1);
731 }
732
733
734 QMenu *mHiddenMarkers = mSpecial->addMenu("Hidden markers");
735 QAction *hiddenMarkersOn = mHiddenMarkers->addAction("On");
736 QAction *hiddenMarkersOff = mHiddenMarkers->addAction("Off");
737 if (fVP.IsMarkerNotHidden()) {
738 createRadioAction(hiddenMarkersOn,hiddenMarkersOff,SLOT(toggleHiddenMarkers(bool)),2);
739 } else {
740 createRadioAction(hiddenMarkersOn,hiddenMarkersOff,SLOT(toggleHiddenMarkers(bool)),1);
741 }
742
743
744
745 QMenu *mFullScreen = mSpecial->addMenu("&Full screen");
746 fFullScreenOn = mFullScreen->addAction("On");
747 fFullScreenOff = mFullScreen->addAction("Off");
749
750 // INIT All
752}
void toggleFullScreen(bool)
void toggleSurfaceAction(int)
QAction * fMouseRotateAction
QAction * fDrawingLineSurfaceRemoval
void toggleHaloing(bool)
QAction * fMouseZoomOutAction
QAction * fProjectionPerspective
QAction * fDrawingLineRemoval
QAction * fDrawingSurfaceRemoval
QAction * fMousePickAction
void toggleMouseAction(int)
void actionChangeBackgroundColor()
void toggleProjection(bool)
void toggleHiddenMarkers(bool)
void createRadioAction(QAction *, QAction *, const std::string &, unsigned int a=1)
QAction * fMouseMoveAction
void toggleAntialiasing(bool)
void toggleTransparency(bool)
QAction * fProjectionOrtho
QAction * fDrawingWireframe
QAction * fMouseZoomInAction
G4bool antialiasing_enabled
G4bool transparency_enabled
G4bool IsMarkerNotHidden() const
G4double GetFieldHalfAngle() const
G4bool IsAuxEdgeVisible() const

References actionChangeBackgroundColor(), actionChangeDefaultColor(), actionChangeTextColor(), actionMovieParameters(), actionSaveImage(), G4OpenGLViewer::antialiasing_enabled, g4zmq::connect(), createRadioAction(), fContextMenu, fDrawingLineRemoval, fDrawingLineSurfaceRemoval, fDrawingSurfaceRemoval, fDrawingWireframe, fFullScreenOff, fFullScreenOn, fMouseMoveAction, fMousePickAction, fMouseRotateAction, fMouseZoomInAction, fMouseZoomOutAction, fProjectionOrtho, fProjectionPerspective, fSignalMapperMouse, fSignalMapperSurface, G4VViewer::fVP, G4ViewParameters::GetFieldHalfAngle(), G4OpenGLViewer::haloing_enabled, G4ViewParameters::IsAuxEdgeVisible(), G4ViewParameters::IsMarkerNotHidden(), anonymous_namespace{G4QuasiElRatios.cc}::map, showShortcuts(), toggleAntialiasing(), toggleAux(), toggleFullScreen(), toggleHaloing(), toggleHiddenMarkers(), toggleMouseAction(), toggleProjection(), toggleSurfaceAction(), toggleTransparency(), G4OpenGLViewer::transparency_enabled, and updateToolbarAndMouseContextMenu().

Referenced by CreateMainWindow(), and G4manageContextMenuEvent().

◆ createRadioAction()

void G4OpenGLQtViewer::createRadioAction ( QAction *  action1,
QAction *  action2,
const std::string &  method,
unsigned int  nCheck = 1 
)
private

Create a radio button menu. The two menu will be connected. When click on one, eatch state will be invert and callback method will be called.

Parameters
action1first action to connect
action2second action to connect
methodcallback method
nCheck1 : first action will be set true. 2 : second action will be set true

Definition at line 781 of file G4OpenGLQtViewer.cc.

781 {
782
783 action1->setCheckable(true);
784 action2->setCheckable(true);
785
786 if (nCheck ==1)
787 action1->setChecked (true);
788 else
789 action2->setChecked (true);
790
791 QObject ::connect(action1, SIGNAL(triggered(bool)),action2, SLOT(toggle()));
792 QObject ::connect(action2, SIGNAL(triggered(bool)),action1, SLOT(toggle()));
793
794 QObject ::connect(action1, SIGNAL(toggled(bool)),this, method.c_str());
795
796}

References g4zmq::connect().

Referenced by createPopupMenu().

◆ createSceneTreeComponent()

void G4OpenGLQtViewer::createSceneTreeComponent ( )
private

Definition at line 2566 of file G4OpenGLQtViewer.cc.

2566 {
2567
2568 QLayout* vLayout = fSceneTreeWidget->layout();
2569
2570 // Search line
2571 QWidget* coutButtonWidget = new QWidget();
2572 QHBoxLayout* layoutCoutTBButtons = new QHBoxLayout();
2573
2574 fFilterOutput = new QLineEdit();
2575 fFilterOutput->setToolTip("Filter output by...");
2576 fFilterOutput->setStyleSheet ("padding: 0px ");
2577
2578 QPixmap* searchIcon = fUiQt->getSearchIcon();
2579#if QT_VERSION > 0x050100
2580 fFilterOutput->addAction(*searchIcon,QLineEdit::TrailingPosition);
2581 fFilterOutput->setStyleSheet ("border-radius:7px;");
2582#else
2583 QPushButton *coutTBFilterButton = new QPushButton();
2584 coutTBFilterButton->setIcon(*searchIcon);
2585 coutTBFilterButton->setStyleSheet ("padding-left: 0px; border:0px;");
2586 fFilterOutput->setStyleSheet ("padding-right: 0px;");
2587#endif
2588 layoutCoutTBButtons->addWidget(fFilterOutput);
2589
2590#if QT_VERSION <= 0x050100
2591 layoutCoutTBButtons->addWidget(coutTBFilterButton);
2592#endif
2593
2594 coutButtonWidget->setLayout(layoutCoutTBButtons);
2595 vLayout->addWidget(coutButtonWidget);
2596
2597 // reduce margins
2598 vLayout->setContentsMargins(0,0,0,0);
2599
2600
2601 fSceneTreeComponentTreeWidget = new QTreeWidget();
2602 fSceneTreeComponentTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
2603 fSceneTreeComponentTreeWidget->setHeaderLabel ("Scene tree : "+QString(GetName().data()));
2604 fSceneTreeComponentTreeWidget->setColumnHidden (1,true); // copy number
2605 fSceneTreeComponentTreeWidget->setColumnHidden (2,true); // PO index
2606 fSceneTreeComponentTreeWidget->setColumnHidden (3,true); // Informations
2607 // data(0) : POindex
2608 // data(1) : copy number
2609 // data(2) : g4color
2610
2611 vLayout->addWidget(fSceneTreeComponentTreeWidget);
2612
2613 connect(fSceneTreeComponentTreeWidget,SIGNAL(itemChanged(QTreeWidgetItem*, int)),SLOT(sceneTreeComponentItemChanged(QTreeWidgetItem*, int)));
2614 connect(fSceneTreeComponentTreeWidget,SIGNAL(itemSelectionChanged ()),SLOT(sceneTreeComponentSelected()));
2615 connect(fSceneTreeComponentTreeWidget,SIGNAL(itemDoubleClicked ( QTreeWidgetItem*, int)),SLOT(changeColorAndTransparency( QTreeWidgetItem*, int)));
2616
2617
2618 // Depth slider
2619 QWidget *helpWidget = new QWidget();
2620 QHBoxLayout *helpLayout = new QHBoxLayout();
2621
2622 QWidget* depthWidget = new QWidget();
2623 QWidget *showBox = new QWidget(depthWidget);
2624 QHBoxLayout *showBoxLayout = new QHBoxLayout();
2625
2626 // reduce margins
2627 showBoxLayout->setContentsMargins(5,5,5,5);
2628
2629 QLabel *zero = new QLabel();
2630 zero->setText("Show all");
2631 QLabel *one = new QLabel();
2632 one->setText("Hide all");
2633 fSceneTreeDepthSlider = new QSlider ( Qt::Horizontal);
2634 fSceneTreeDepthSlider->setMaximum (1000);
2635 fSceneTreeDepthSlider->setMinimum (0);
2636 fSceneTreeDepthSlider->setTickPosition(QSlider::TicksAbove);
2637 // set a minimum size
2638 fSceneTreeDepthSlider->setMinimumWidth (40);
2639
2640 showBoxLayout->addWidget(zero);
2641 showBoxLayout->addWidget(fSceneTreeDepthSlider);
2642 showBoxLayout->addWidget(one);
2643
2644 showBox->setLayout(showBoxLayout);
2645
2646 helpLayout->addWidget(showBox);
2647 helpWidget->setLayout(helpLayout);
2648 helpLayout->setContentsMargins(0,0,0,0);
2649
2650 vLayout->addWidget(helpWidget);
2651
2652 connect( fSceneTreeDepthSlider, SIGNAL( valueChanged(int) ), this, SLOT( changeDepthInSceneTree(int) ) );
2653 connect( fFilterOutput, SIGNAL( textEdited ( const QString &) ), this, SLOT(changeSearchSelection()));
2654 fTreeItemModels.clear();
2655
2656 fPVRootNodeCreate = false;
2657
2659
2660
2661}
void changeDepthInSceneTree(int)
void sceneTreeComponentItemChanged(QTreeWidgetItem *item, int id)
QPixmap * getSearchIcon()
Definition: G4UIQt.hh:215
const G4String & GetName() const
static const G4LorentzVector zero(0., 0., 0., 0.)

References changeColorAndTransparency(), changeDepthInSceneTree(), changeSearchSelection(), g4zmq::connect(), fFilterOutput, fMaxPOindexInserted, fPVRootNodeCreate, fSceneTreeComponentTreeWidget, fSceneTreeDepthSlider, fSceneTreeWidget, fTreeItemModels, fUiQt, G4VViewer::GetName(), G4UIQt::getSearchIcon(), sceneTreeComponentItemChanged(), sceneTreeComponentSelected(), and anonymous_namespace{G4CascadeDeexciteBase.cc}::zero.

Referenced by addNonPVSceneTreeElement(), addPVSceneTreeElement(), and createSceneTreeWidget().

◆ createSceneTreeWidget()

void G4OpenGLQtViewer::createSceneTreeWidget ( )
private

Definition at line 2516 of file G4OpenGLQtViewer.cc.

2516 {
2518
2519 if (!fUISceneTreeWidget) {
2520 return;
2521 }
2522
2523 // do not remove previous widgets, hide them!
2524 QLayoutItem * wItem;
2525 bool found = false;
2526 if (fUISceneTreeWidget->layout()->count() ) {
2527 for(int idx = 0; idx < fUISceneTreeWidget->layout()->count(); idx++){
2528 wItem = fUISceneTreeWidget->layout()->itemAt(idx);
2529 if (fSceneTreeWidget) {
2530 if(dynamic_cast<QWidget *>(wItem->widget())) {
2531 if (wItem->widget()->windowTitle() == fSceneTreeWidget->windowTitle()) {
2532 wItem->widget()->show();
2533 found = true;
2534 } else {
2535 wItem->widget()->hide();
2536 }
2537 }
2538 } else {
2539 wItem->widget()->hide();
2540 }
2541 }
2542 }
2543
2544 if (!found) {
2545 // initialize scene tree / viewer properties / picking
2546 fSceneTreeWidget = new QWidget();
2547 QVBoxLayout* layoutSceneTree = new QVBoxLayout();
2548 fSceneTreeWidget->setStyleSheet ("padding: 0px ");
2549
2550 fSceneTreeWidget->setLayout(layoutSceneTree);
2551 fSceneTreeWidget->layout()->setContentsMargins(5,5,5,5);
2552 fSceneTreeWidget->setWindowTitle(QString(GetName().data()));
2553
2554 if (fUISceneTreeWidget != NULL) {
2555 fUISceneTreeWidget->layout()->addWidget(fSceneTreeWidget);
2556 }
2557
2558 // not available for Immediate mode
2559 if (dynamic_cast<G4OpenGLStoredQtViewer*> (this)) {
2561 }
2562 }
2563}
QWidget * GetSceneTreeWidget()
Definition: G4UIQt.cc:1780

References createSceneTreeComponent(), fSceneTreeWidget, fUiQt, fUISceneTreeWidget, G4VViewer::GetName(), and G4UIQt::GetSceneTreeWidget().

Referenced by CreateMainWindow(), currentTabActivated(), and updateSceneTreeWidget().

◆ createTempFolder()

QString G4OpenGLQtViewer::createTempFolder ( )
private

Create a Qt_temp folder in the temp folder given The temp folder will be like this /tmp/QtMovie_12-02-2008_12_12_58/

Returns
"" if success. Error message if not.

Definition at line 2122 of file G4OpenGLQtViewer.cc.

2122 {
2124 //check
2125 QString tmp = setTempFolderPath(fTempFolderPath);
2126 if (tmp != "") {
2127 return tmp;
2128 }
2129 QString sep = QString(QDir::separator());
2130 QString path = sep+"QtMovie_"+QDateTime::currentDateTime ().toString("dd-MM-yyyy_hh-mm-ss")+sep;
2131 QDir *d = new QDir(QDir::cleanPath(fTempFolderPath));
2132 // check if it is already present
2133 if (d->exists(path)) {
2134 return "Folder "+path+" already exists.Please remove it first";
2135 }
2136 if (d->mkdir(fTempFolderPath+path)) {
2138 return "";
2139 }
2140 return "Can't create "+fTempFolderPath+path;
2141}
QString setTempFolderPath(QString path)

References fMovieTempFolderPath, fTempFolderPath, and setTempFolderPath().

Referenced by startPauseVideo().

◆ createTreeWidgetItem()

QTreeWidgetItem * G4OpenGLQtViewer::createTreeWidgetItem ( const PVPath fullPath,
const QString &  name,
int  copyNb,
int  POIndex,
const QString &  logicalName,
Qt::CheckState  state,
QTreeWidgetItem *  parentTreeNode,
const G4Colour color 
)
private

if treeNode is NULL, then add this treeNode to the TreeWidget

Returns
the inserted item

Definition at line 2924 of file G4OpenGLQtViewer.cc.

2933 {
2934
2935 // Set depth
2936 if (fullPath.size() > fSceneTreeDepth) {
2937 fSceneTreeDepth = fullPath.size();
2938 // Change slider value
2940 fSceneTreeDepthSlider->setTickInterval(1000/(fSceneTreeDepth+1));
2941 }
2942 }
2943 QTreeWidgetItem * newItem = NULL;
2944 if (parentTreeNode == NULL) {
2945 newItem = new QTreeWidgetItem();
2946 fSceneTreeComponentTreeWidget->addTopLevelItem(newItem);
2947 } else {
2948 newItem = new QTreeWidgetItem(parentTreeNode);
2949 fSceneTreeComponentTreeWidget->addTopLevelItem(parentTreeNode);
2950 }
2951
2952
2953 newItem->setText(0,name);
2954 newItem->setData(1,Qt::UserRole,copyNb);
2955 newItem->setText(2,QString::number(POIndex));
2956 newItem->setData(0, Qt::UserRole, POIndex);
2957 newItem->setText(3,logicalName);
2958 newItem->setFlags(newItem->flags()|Qt::ItemIsUserCheckable);
2959 newItem->setCheckState(0,state);
2960 newItem->setExpanded(true);
2962
2963 changeQColorForTreeWidgetItem(newItem,QColor((int)(color.GetRed()*255),
2964 (int)(color.GetGreen()*255),
2965 (int)(color.GetBlue()*255),
2966 (int)(color.GetAlpha()*255)));
2967
2968 // If invisible
2969 if ((state == Qt::Unchecked) && (POIndex == -1)) {
2970 newItem->setForeground (0, QBrush( Qt::gray) );
2971
2972 // Set a tootip
2973 newItem->setToolTip (0,QString(
2974 "This node exists in the geometry but has not been\n")+
2975 "drawn, perhaps because it has been set invisible. It \n"+
2976 "cannot be made visible with a click on the button.\n"+
2977 "To see it, change the visibility, for example, with \n"+
2978 "/vis/geometry/set/visibility " + logicalName + " 0 true\n"+
2979 "and rebuild the view with /vis/viewer/rebuild.\n"+
2980 "Click here will only show/hide all child components");
2981 } else {
2982 // Set a tootip
2983 newItem->setToolTip (0,QString("double-click to change the color"));
2984 }
2985
2986 // special case: if alpha=0, it is a totally transparent objet,
2987 // then, do not redraw it
2988 if (color.GetAlpha() == 0) {
2989 state = Qt::Unchecked;
2990 newItem->setCheckState(0,state);
2992 }
2993
2994 fTreeItemModels.insert(std::pair <int, PVPath > (POIndex,fullPath) );
2995
2996 // Check last status of this item and change if necessary
2997 // open/close/hidden/visible/selected
2999 return newItem;
3000}
static constexpr double gray
Definition: G4SIunits.hh:302
void changeOpenCloseVisibleHiddenSelectedColorSceneTreeElement(QTreeWidgetItem *subItem)

References changeOpenCloseVisibleHiddenSelectedColorSceneTreeElement(), changeQColorForTreeWidgetItem(), fSceneTreeComponentTreeWidget, fSceneTreeDepth, fSceneTreeDepthSlider, fTreeItemModels, G4Colour::GetAlpha(), G4Colour::GetBlue(), G4Colour::GetGreen(), G4Colour::GetRed(), gray, G4InuclParticleNames::name(), and updatePositivePoIndexSceneTreeWidgetQuickMap().

Referenced by addNonPVSceneTreeElement(), addPVSceneTreeElement(), and parseAndInsertInSceneTree().

◆ createViewerPropertiesWidget()

void G4OpenGLQtViewer::createViewerPropertiesWidget ( )
private

Definition at line 2664 of file G4OpenGLQtViewer.cc.

2664 {
2665
2666 // Get the pointer to the Viewer Properties widget
2668
2670 return;
2671 }
2672
2673 // remove previous widgets
2674 QLayoutItem * wItem;
2675 if (fUIViewerPropertiesWidget->layout()->count()) {
2676 while ((wItem = fUIViewerPropertiesWidget->layout()->takeAt(0)) != 0) {
2677 delete wItem->widget();
2678 delete wItem;
2679 }
2680 }
2681
2682 // add properties
2683 QGroupBox *groupBox = new QGroupBox();
2684 groupBox->setTitle(GetName().data());
2685 QVBoxLayout *vbox = new QVBoxLayout;
2686
2687 // add properties content
2688 fViewerPropertiesTableWidget = new QTableWidget();
2689
2690 QSizePolicy vPolicy = fViewerPropertiesTableWidget->sizePolicy();
2691 vPolicy.setVerticalStretch(4);
2692
2693 vbox->addWidget(fViewerPropertiesTableWidget);
2694 groupBox->setLayout(vbox);
2695 fUIViewerPropertiesWidget->layout()->addWidget(groupBox);
2696
2697 connect(fViewerPropertiesTableWidget, SIGNAL(itemChanged(QTableWidgetItem*)),this, SLOT(tableWidgetViewerSetItemChanged(QTableWidgetItem *)));
2698
2700
2701 QDialog* dial = static_cast<QDialog*> (fUIViewerPropertiesWidget->parent());
2702 if (dial) {
2703 // change name
2704 dial->setWindowTitle(QString("Viewer properties - ")+GetName());
2705 }
2706}
void tableWidgetViewerSetItemChanged(QTableWidgetItem *)
void updateViewerPropertiesTableWidget()
QWidget * GetViewerPropertiesWidget()
Definition: G4UIQt.cc:1788

References g4zmq::connect(), fUiQt, fUIViewerPropertiesWidget, fViewerPropertiesTableWidget, G4VViewer::GetName(), G4UIQt::GetViewerPropertiesWidget(), tableWidgetViewerSetItemChanged(), and updateViewerPropertiesTableWidget().

Referenced by currentTabActivated(), and updateViewerPropertiesTableWidget().

◆ currentTabActivated

void G4OpenGLQtViewer::currentTabActivated ( int  currentTab)
privateslot

◆ displayRecordingStatus()

void G4OpenGLQtViewer::displayRecordingStatus ( )

Definition at line 1850 of file G4OpenGLQtViewer.cc.

1850 {
1851
1852 QString txtStatus = "";
1853 if (fRecordingStep == WAIT) {
1854 txtStatus = "Waiting to start...";
1855 fRecordFrameNumber = 0; // reset the frame number
1856 } else if (fRecordingStep == START) {
1857 txtStatus = "Start Recording...";
1858 } else if (fRecordingStep == PAUSE) {
1859 txtStatus = "Pause Recording...";
1860 } else if (fRecordingStep == CONTINUE) {
1861 txtStatus = "Continue Recording...";
1862 } else if (fRecordingStep == STOP) {
1863 txtStatus = "Stop Recording...";
1864 } else if (fRecordingStep == READY_TO_ENCODE) {
1865 txtStatus = "Ready to Encode...";
1866 } else if (fRecordingStep == ENCODING) {
1867 txtStatus = "Encoding...";
1868 } else if (fRecordingStep == FAILED) {
1869 txtStatus = "Failed to encode...";
1870 } else if ((fRecordingStep == BAD_ENCODER)
1872 || (fRecordingStep == BAD_TMP)) {
1873 txtStatus = "Correct above errors first";
1874 } else if (fRecordingStep == SUCCESS) {
1875 txtStatus = "File encoded successfully";
1876 } else {
1877 }
1878
1881 } else {
1882 G4cout << txtStatus.toStdString().c_str() << G4endl;
1883 }
1885}
void setRecordingInfos(const QString &)

References BAD_ENCODER, BAD_OUTPUT, BAD_TMP, CONTINUE, FAILED, fMovieParametersDialog, fRecordFrameNumber, fRecordingStep, G4cout, G4endl, PAUSE, READY_TO_ENCODE, setRecordingInfos(), G4OpenGLQtMovieDialog::setRecordingStatus(), START, STOP, SUCCESS, and WAIT.

Referenced by setBadEncoder(), setBadOutput(), setBadTmp(), setRecordingStatus(), setWaiting(), and showMovieParametersDialog().

◆ displaySceneTreeComponent()

void G4OpenGLQtViewer::displaySceneTreeComponent ( )
protected

Should replace actual tree by the one in this class and update tree

Definition at line 4085 of file G4OpenGLQtViewer.cc.

4085 {
4086 // no UI
4087 if (fUISceneTreeWidget == NULL) {
4088 return;
4089 }
4090 if (fSceneTreeComponentTreeWidget == NULL) {
4091 return;
4092 }
4093
4094 // sort tree items
4095 fSceneTreeComponentTreeWidget->sortItems (0, Qt::AscendingOrder );
4096
4097 return;
4098}

References fSceneTreeComponentTreeWidget, and fUISceneTreeWidget.

Referenced by G4OpenGLStoredQtViewer::ComputeView().

◆ DrawText()

void G4OpenGLQtViewer::DrawText ( const G4Text g4text)
virtual

Reimplemented from G4OpenGLViewer.

Definition at line 2795 of file G4OpenGLQtViewer.cc.

2796{
2797 QGLWidget* qGLW = dynamic_cast<QGLWidget*> (fGLWidget) ;
2798 if (! qGLW) {
2799 return;
2800 }
2801 if (isGl2psWriting()) {
2802
2804
2805 } else {
2806
2807 if (!fGLWidget) return;
2808
2809#ifdef G4MULTITHREADED
2811#endif
2812
2814 G4double size = fSceneHandler.GetMarkerSize(g4text,sizeType);
2815
2816 QFont font = QFont();
2817 font.setPointSizeF(size);
2818
2819 const G4Colour& c = fSceneHandler.GetTextColour(g4text);
2820 glColor4d(c.GetRed(),c.GetGreen(),c.GetBlue(),c.GetAlpha());
2821
2822 G4Point3D position = g4text.GetPosition();
2823
2824 const G4String& textString = g4text.GetText();
2825 const char* textCString = textString.c_str();
2826
2827 glRasterPos3d(position.x(),position.y(),position.z());
2828
2829 // Calculate move for centre and right adjustment
2830 QFontMetrics* f = new QFontMetrics (font);
2831#if QT_VERSION > 0x050110
2832 G4double span = f->boundingRect(textCString).width();
2833#else
2834 G4double span = f->width(textCString);
2835#endif
2836 G4double xmove = 0., ymove = 0.;
2837 switch (g4text.GetLayout()) {
2838 case G4Text::left: break;
2839 case G4Text::centre: xmove -= span / 2.; break;
2840 case G4Text::right: xmove -= span;
2841 }
2842
2843 //Add offsets
2844 xmove += g4text.GetXOffset();
2845 ymove += g4text.GetYOffset();
2846
2847 // xmove, ymove in pixels - or are they?
2848#ifdef __APPLE__
2849 const G4double fudgeFactor = 2.;
2850#else
2851 const G4double fudgeFactor = 1.;
2852#endif
2853 xmove *= fudgeFactor;
2854 ymove *= fudgeFactor;
2855
2856 qGLW->renderText
2857 ((position.x()+(2*xmove)/getWinWidth()),
2858 (position.y()+(2*ymove)/getWinHeight()),
2859 position.z(),
2860 textCString,
2861 font);
2862
2863 }
2864}
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
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
G4int G4GetThreadId()
Definition: G4Threading.cc:122

References G4Text::centre, G4OpenGLViewer::DrawText(), fGLWidget, G4VViewer::fSceneHandler, G4Threading::G4GetThreadId(), G4Colour::GetAlpha(), G4Colour::GetBlue(), G4Colour::GetGreen(), G4Text::GetLayout(), G4VSceneHandler::GetMarkerSize(), G4VMarker::GetPosition(), G4Colour::GetRed(), G4Text::GetText(), G4VSceneHandler::GetTextColour(), G4OpenGLViewer::getWinHeight(), G4OpenGLViewer::getWinWidth(), G4Text::GetXOffset(), G4Text::GetYOffset(), G4OpenGLViewer::isGl2psWriting(), G4Text::left, G4Threading::MASTER_ID, and G4Text::right.

◆ DrawView()

virtual void G4VViewer::DrawView ( )
pure virtualinherited

◆ encodeVideo()

void G4OpenGLQtViewer::encodeVideo ( )

Definition at line 2377 of file G4OpenGLQtViewer.cc.

2378{
2379 if ((getEncoderPath() != "") && (getSaveFileName() != "")) {
2381
2382 fProcess = new QProcess();
2383#if QT_VERSION > 0x040100
2384 QObject ::connect(fProcess,SIGNAL(finished ( int,QProcess::ExitStatus)),
2385 this,SLOT(processEncodeFinished()));
2386 QObject ::connect(fProcess,SIGNAL(readyReadStandardOutput ()),
2387 this,SLOT(processEncodeStdout()));
2388#else
2389 QObject ::connect(fProcess,SIGNAL(finished ( int)),
2390 this,SLOT(processEncodeFinished()));
2391 QObject ::connect(fProcess,SIGNAL(readyReadStandardOutput ()),
2392 this,SLOT(processEncodeStdout()));
2393#endif
2394#if QT_VERSION < 0x050a00
2395 fProcess->setReadChannelMode(QProcess::MergedChannels);
2396#else
2397 fProcess->setProcessChannelMode(QProcess::MergedChannels);
2398#endif
2400 }
2401}
void setRecordingStatus(RECORDING_STEP)

References g4zmq::connect(), fEncoderPath, fMovieTempFolderPath, fParameterFileName, fProcess, getEncoderPath(), getSaveFileName(), processEncodeFinished(), processEncodeStdout(), and setRecordingStatus().

Referenced by saveVideo().

◆ exportImage()

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

Export image. Try to get the format according to the file extention. If not present, the last one choosen by /vis/ogl/set/exportFormat If not, will take the default format : eps Best format actually available is pdf (vectored and allow transparency) If name is not set, it will take the default name value given by /vis/ogl/set/printFilename

Reimplemented from G4OpenGLViewer.

Definition at line 2187 of file G4OpenGLQtViewer.cc.

2187 {
2188
2189 QGLWidget* qGLW = dynamic_cast<QGLWidget*> (fGLWidget) ;
2190 if (! qGLW) {
2191 return false;
2192 }
2193 // If there is already an extention
2194 bool increaseFileNumber = true;
2195 // if
2196 if (name.size() != name.substr(name.find_last_of(".") + 1).size()) {
2197 increaseFileNumber = false;
2198 }
2199 if (! setExportFilename(name,increaseFileNumber)) {
2200 return false;
2201 }
2202 if ((width !=-1) && (height != -1)) {
2203 setExportSize(width, height);
2204 }
2205 // first, try to do it with generic function
2206 if (G4OpenGLViewer::exportImage(name, width, height)) {
2207 return true;
2208
2209 // Then try Qt saving functions
2210 } else {
2211 QImage image;
2212 image = qGLW->grabFrameBuffer();
2213
2214 bool res = image.save(QString(getRealPrintFilename().c_str()),0,fLastExportSliderValue);
2215
2216 if (!res) {
2217 G4cerr << "Error saving file... " << getRealPrintFilename().c_str() << G4endl;
2218 return false;
2219 } else {
2220 G4cout << "File " << getRealPrintFilename().c_str() << " size: " << fGLWidget->width() << "x" << fGLWidget->height() << " has been saved " << G4endl;
2222 }
2223 }
2224 return true;
2225}
G4GLOB_DLL std::ostream G4cerr
virtual bool exportImage(std::string name="", int width=-1, int height=-1)
std::string getRealPrintFilename()

References G4OpenGLViewer::exportImage(), G4OpenGLViewer::fExportFilenameIndex, fGLWidget, fLastExportSliderValue, G4cerr, G4cout, G4endl, G4OpenGLViewer::getRealPrintFilename(), G4InuclParticleNames::name(), G4OpenGLViewer::setExportFilename(), and G4OpenGLViewer::setExportSize().

Referenced by actionSaveImage().

◆ FinishView()

void G4OpenGLQtViewer::FinishView ( void  )
protectedvirtual

Reimplemented from G4VViewer.

Definition at line 1266 of file G4OpenGLQtViewer.cc.

1267{
1268 /* From Apple doc:
1269 CGLFlushDrawable : Copies the back buffer of a double-buffered context to the front buffer.
1270 If the backing store attribute is set to false, the buffers can be exchanged rather than copied
1271 */
1272 glFlush ();
1273
1274 // L. Garnier 10/2009 : Not necessary and cause problems on mac OS X 10.6
1275 // fGLWidget->swapBuffers ();
1276}

Referenced by G4OpenGLImmediateQtViewer::ComputeView(), and G4OpenGLStoredQtViewer::ComputeView().

◆ 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().

◆ G4keyPressEvent()

void G4OpenGLQtViewer::G4keyPressEvent ( QKeyEvent *  event)

Definition at line 1613 of file G4OpenGLQtViewer.cc.

1614{
1615 if (fHoldKeyEvent)
1616 return;
1617
1618 fHoldKeyEvent = true;
1619
1620
1621 // with no modifiers
1622 updateKeyModifierState(evnt->modifiers());
1623 if ((fNoKeyPress) || (evnt->modifiers() == Qt::KeypadModifier )) {
1624 if (evnt->key() == Qt::Key_Down) { // go down
1625 moveScene(0,1,0,false);
1626 }
1627 else if (evnt->key() == Qt::Key_Up) { // go up
1628 moveScene(0,-1,0,false);
1629 }
1630 if (evnt->key() == Qt::Key_Left) { // go left
1631 moveScene(-1,0,0,false);
1632 }
1633 else if (evnt->key() == Qt::Key_Right) { // go right
1634 moveScene(1,0,0,false);
1635 }
1636 if (evnt->key() == Qt::Key_Minus) { // go backward
1637 moveScene(0,0,1,false);
1638 }
1639 else if (evnt->key() == Qt::Key_Plus) { // go forward
1640 moveScene(0,0,-1,false);
1641 }
1642 // escaped from full screen
1643 if (evnt->key() == Qt::Key_Escape) {
1644 toggleFullScreen(false);
1645 }
1646 }
1647 // several case here : If return is pressed, in every case -> display the movie parameters dialog
1648 // If one parameter is wrong -> put it in red (only save filenam could be wrong..)
1649 // If encoder not found-> does nothing.Only display a message in status box
1650 // If all ok-> generate parameter file
1651 // If ok -> put encoder button enabled
1652
1653 if ((evnt->key() == Qt::Key_Return) || (evnt->key() == Qt::Key_Enter)){ // end of video
1654 stopVideo();
1655 }
1656 if (evnt->key() == Qt::Key_Space){ // start/pause of video
1658 }
1659
1660 // H : Return Home view
1661 if (evnt->key() == Qt::Key_H){ // go Home
1662 ResetView();
1663
1664 updateQWidget();
1665 }
1666
1667 // Shift Modifier
1668 if (fShiftKeyPress) {
1669 fGLWidget->setCursor(QCursor(Qt::SizeAllCursor));
1670
1671 if (evnt->key() == Qt::Key_Down) { // rotate phi
1673 }
1674 else if (evnt->key() == Qt::Key_Up) { // rotate phi
1676 }
1677 if (evnt->key() == Qt::Key_Left) { // rotate theta
1679 }
1680 else if (evnt->key() == Qt::Key_Right) { // rotate theta
1682 }
1683 if (evnt->key() == Qt::Key_Plus) { // go forward ("Plus" imply
1684 // "Shift" on Mac French keyboard
1685 moveScene(0,0,-1,false);
1686 }
1687
1688 // Alt Modifier
1689 }
1690 if ((fAltKeyPress)) {
1691 fGLWidget->setCursor(QCursor(Qt::ClosedHandCursor));
1692
1693 if (evnt->key() == Qt::Key_Down) { // rotate phi
1695 }
1696 else if (evnt->key() == Qt::Key_Up) { // rotate phi
1698 }
1699 if (evnt->key() == Qt::Key_Left) { // rotate theta
1701 }
1702 else if (evnt->key() == Qt::Key_Right) { // rotate theta
1704 }
1705
1706 // Rotatio +/-
1707 if (evnt->key() == Qt::Key_Plus) {
1708 fRot_sens = fRot_sens/0.7;
1709 G4cout << "Auto-rotation set to : " << fRot_sens << G4endl;
1710 }
1711 else if (evnt->key() == Qt::Key_Minus) {
1712 fRot_sens = fRot_sens*0.7;
1713 G4cout << "Auto-rotation set to : " << fRot_sens << G4endl;
1714 }
1715
1716 // Control Modifier OR Command on MAC
1717 }
1718 if ((fControlKeyPress)) {
1719 if (evnt->key() == Qt::Key_Plus) {
1721 updateQWidget();
1722 }
1723 else if (evnt->key() == Qt::Key_Minus) {
1725 updateQWidget();
1726 }
1727 }
1728
1729 fHoldKeyEvent = false;
1730}
void rotateQtSceneToggle(float, float)
void moveScene(float, float, float, bool)
void rotateQtScene(float, float)
void updateKeyModifierState(const Qt::KeyboardModifiers &)
G4double GetZoomFactor() const
void SetZoomFactor(G4double zoomFactor)

References fAltKeyPress, fControlKeyPress, fDeltaZoom, fGLWidget, fHoldKeyEvent, fNoKeyPress, G4OpenGLViewer::fRot_sens, fShiftKeyPress, G4VViewer::fVP, G4cout, G4endl, G4ViewParameters::GetZoomFactor(), moveScene(), ResetView(), rotateQtScene(), rotateQtSceneToggle(), G4ViewParameters::SetZoomFactor(), startPauseVideo(), stopVideo(), toggleFullScreen(), updateKeyModifierState(), and updateQWidget().

Referenced by G4OpenGLImmediateQtViewer::keyPressEvent(), and G4OpenGLStoredQtViewer::keyPressEvent().

◆ G4keyReleaseEvent()

void G4OpenGLQtViewer::G4keyReleaseEvent ( QKeyEvent *  event)

Definition at line 1733 of file G4OpenGLQtViewer.cc.

1734{
1735 fGLWidget->setCursor(QCursor(Qt::ArrowCursor));
1736}

References fGLWidget.

Referenced by G4OpenGLImmediateQtViewer::keyReleaseEvent(), and G4OpenGLStoredQtViewer::keyReleaseEvent().

◆ G4manageContextMenuEvent()

void G4OpenGLQtViewer::G4manageContextMenuEvent ( QContextMenuEvent *  e)
protected

Definition at line 754 of file G4OpenGLQtViewer.cc.

755{
756 if (!fGLWidget) {
757 G4cerr << "Visualization window not defined, please choose one before" << G4endl;
758 } else {
759
760 if (!fContextMenu)
762
763 // launch menu
764 if ( fContextMenu ) {
765 fContextMenu->exec( e->globalPos() );
766 // delete fContextMenu;
767 }
768 }
769 e->accept();
770}

References createPopupMenu(), fContextMenu, fGLWidget, G4cerr, and G4endl.

Referenced by G4OpenGLImmediateQtViewer::contextMenuEvent(), and G4OpenGLStoredQtViewer::contextMenuEvent().

◆ G4MouseDoubleClickEvent()

void G4OpenGLQtViewer::G4MouseDoubleClickEvent ( )

Definition at line 1435 of file G4OpenGLQtViewer.cc.

1436{
1437 fGLWidget->setMouseTracking(true);
1438}

References fGLWidget.

Referenced by G4OpenGLImmediateQtViewer::mouseDoubleClickEvent(), and G4OpenGLStoredQtViewer::mouseDoubleClickEvent().

◆ G4MouseMoveEvent()

void G4OpenGLQtViewer::G4MouseMoveEvent ( QMouseEvent *  evnt)
Parameters
pos_xmouse x position
pos_ymouse y position
mButtonsmouse button active
mAutoMovetrue: apply this move till another evnt came, false :one time move

Definition at line 1448 of file G4OpenGLQtViewer.cc.

1449{
1450
1451 Qt::MouseButtons mButtons = evnt->buttons();
1452
1453 updateKeyModifierState(evnt->modifiers());
1454
1455 if (fAutoMove) {
1456 return;
1457 }
1458
1461 fLastPos1 = QPoint(evnt->x(), evnt->y());
1462
1463 int deltaX = fLastPos2.x()-fLastPos1.x();
1464 int deltaY = fLastPos2.y()-fLastPos1.y();
1465
1466 bool move = false;
1467 if (fUiQt != NULL) {
1468 if (fUiQt->IsIconMoveSelected()) { // move
1469 move = true;
1470 }
1471 }
1472 if (!move) { // rotate, pick, zoom...
1473 if (mButtons & Qt::LeftButton) {
1474 if (fNoKeyPress) {
1475 rotateQtScene(((float)deltaX),((float)deltaY));
1476 } else if (fAltKeyPress) {
1477 rotateQtSceneToggle(((float)deltaX),((float)deltaY));
1478 } else if (fShiftKeyPress) {
1479 unsigned int sizeWin;
1480 sizeWin = getWinWidth();
1481 if (getWinHeight() < getWinWidth()) {
1482 sizeWin = getWinHeight();
1483 }
1484
1485 // L.Garnier : 08/2010 100 is the good value, but don't ask me why !
1486 float factor = ((float)100/(float)sizeWin) ;
1487 moveScene(-(float)deltaX*factor,-(float)deltaY*factor,0,false);
1488 } else if (fControlKeyPress) {
1489 fVP.SetZoomFactor(fVP.GetZoomFactor()*(1+((float)deltaY)));
1490 }
1491 }
1492 } else if (move) { // move
1493 if (mButtons & Qt::LeftButton) {
1494 moveScene(-(float)deltaX,-(float)deltaY,0,true);
1495 }
1496 }
1497
1498 fLastEventTime->start();
1499}
bool IsIconMoveSelected()
Definition: G4UIQt.hh:182

References fAltKeyPress, fAutoMove, fControlKeyPress, fLastEventTime, fLastPos1, fLastPos2, fLastPos3, fNoKeyPress, fShiftKeyPress, fUiQt, G4VViewer::fVP, G4OpenGLViewer::getWinHeight(), G4OpenGLViewer::getWinWidth(), G4ViewParameters::GetZoomFactor(), G4UIQt::IsIconMoveSelected(), moveScene(), rotateQtScene(), rotateQtSceneToggle(), G4ViewParameters::SetZoomFactor(), and updateKeyModifierState().

Referenced by G4OpenGLImmediateQtViewer::mouseMoveEvent(), and G4OpenGLStoredQtViewer::mouseMoveEvent().

◆ G4MousePressEvent()

void G4OpenGLQtViewer::G4MousePressEvent ( QMouseEvent *  evnt)

Save the current mouse press point

Parameters
pmouse click point

Definition at line 1282 of file G4OpenGLQtViewer.cc.

1283{
1284 if (evnt->button() == Qt::RightButton) {
1285 return;
1286 }
1287 if ((evnt->button() & Qt::LeftButton) && (! (evnt->modifiers() & Qt::ControlModifier ))){
1288 fGLWidget->setMouseTracking(true);
1289 fAutoMove = false; // stop automove
1290 fLastPos1 = evnt->pos();
1293 fLastEventTime->start();
1294 if (fUiQt != NULL) {
1295
1296 if (fUiQt->IsIconZoomInSelected()) { // zoomIn
1297 // Move click point to center of OGL
1298
1299 float deltaX = ((float)getWinWidth()/2-evnt->pos().x());
1300 float deltaY = ((float)getWinHeight()/2-evnt->pos().y());
1301
1302 G4double coefTrans = 0;
1303 coefTrans = ((G4double)getSceneNearWidth())/((G4double)getWinWidth());
1304 if (getWinHeight() <getWinWidth()) {
1305 coefTrans = ((G4double)getSceneNearWidth())/((G4double)getWinHeight());
1306 }
1307 fVP.IncrementPan(-deltaX*coefTrans,deltaY*coefTrans,0);
1309
1310 updateQWidget();
1311
1312 } else if (fUiQt->IsIconZoomOutSelected()) { // zoomOut
1313 // Move click point to center of OGL
1314 moveScene(((float)getWinWidth()/2-evnt->pos().x()),((float)getWinHeight()/2-evnt->pos().y()),0,true);
1315
1317 updateQWidget();
1318
1319 } else if (fUiQt->IsIconRotateSelected() ) {
1320
1321 if (fShiftKeyPress) { // move
1322 fGLWidget->setCursor(QCursor(Qt::SizeAllCursor));
1323
1324 } else { // rotate
1325 fGLWidget->setCursor(QCursor(Qt::ClosedHandCursor));
1326 }
1327 } else if (fUiQt->IsIconMoveSelected()) {
1328 fGLWidget->setCursor(QCursor(Qt::SizeAllCursor));
1329 } else if (fUiQt->IsIconPickSelected()) {
1330 fGLWidget->setCursor(QCursor(Qt::PointingHandCursor));
1331 }
1332 }
1333 }
1334}
GLdouble getSceneNearWidth()
bool IsIconRotateSelected()
Definition: G4UIQt.hh:185
bool IsIconZoomOutSelected()
Definition: G4UIQt.hh:194
bool IsIconZoomInSelected()
Definition: G4UIQt.hh:191
bool IsIconPickSelected()
Definition: G4UIQt.hh:188
void IncrementPan(G4double right, G4double up)

References fAutoMove, fGLWidget, fLastEventTime, fLastPos1, fLastPos2, fLastPos3, fShiftKeyPress, fUiQt, G4VViewer::fVP, G4OpenGLViewer::getSceneNearWidth(), G4OpenGLViewer::getWinHeight(), G4OpenGLViewer::getWinWidth(), G4ViewParameters::GetZoomFactor(), G4ViewParameters::IncrementPan(), G4UIQt::IsIconMoveSelected(), G4UIQt::IsIconPickSelected(), G4UIQt::IsIconRotateSelected(), G4UIQt::IsIconZoomInSelected(), G4UIQt::IsIconZoomOutSelected(), moveScene(), G4ViewParameters::SetZoomFactor(), and updateQWidget().

Referenced by G4OpenGLImmediateQtViewer::mousePressEvent(), and G4OpenGLStoredQtViewer::mousePressEvent().

◆ G4MouseReleaseEvent()

void G4OpenGLQtViewer::G4MouseReleaseEvent ( QMouseEvent *  evnt)

Definition at line 1338 of file G4OpenGLQtViewer.cc.

1339{
1340 GLint viewport[4];
1341 glGetIntegerv(GL_VIEWPORT, viewport);
1342
1343 // factorX == factorY
1344 double factorX = ((double)viewport[2]/fGLWidget->width());
1345 double factorY = ((double)viewport[3]/fGLWidget->height());
1346 fSpinningDelay = fLastEventTime->elapsed();
1347 QPoint delta = (fLastPos3-fLastPos1)*factorX;
1348
1349 // reset cursor state
1350 fGLWidget->setCursor(QCursor(Qt::ArrowCursor));
1351
1352 if (fVP.IsPicking()){ // pick
1353 if ((delta.x() != 0) || (delta.y() != 0)) {
1354 return;
1355 }
1356 updatePickInfosWidget(evnt->pos().x()*factorX,evnt->pos().y()*factorY);
1357
1358 } else if (fSpinningDelay < fLaunchSpinDelay ) {
1359 if ((delta.x() == 0) && (delta.y() == 0)) {
1360 return;
1361 }
1362
1363 fAutoMove = true;
1364#if QT_VERSION < 0x050e00
1365 QTime lastMoveTime;
1366#else
1367 QElapsedTimer lastMoveTime;
1368#endif
1369 lastMoveTime.start();
1370 // try to addapt speed move/rotate looking to drawing speed
1371 float correctionFactor = 5;
1372 while (fAutoMove) {
1373 if ( lastMoveTime.elapsed() >= (int)(1000/fNbMaxFramesPerSec)) {
1374 float lTime = 1000/lastMoveTime.elapsed();
1375 if (((((float)delta.x())/correctionFactor)*lTime > fNbMaxAnglePerSec) ||
1376 ((((float)delta.x())/correctionFactor)*lTime < -fNbMaxAnglePerSec) ) {
1377 correctionFactor = (float)delta.x()*(lTime/fNbMaxAnglePerSec);
1378 if (delta.x() <0 ) {
1379 correctionFactor = -correctionFactor;
1380 }
1381 }
1382 if (((((float)delta.y())/correctionFactor)*lTime > fNbMaxAnglePerSec) ||
1383 ((((float)delta.y())/correctionFactor)*lTime < -fNbMaxAnglePerSec) ) {
1384 correctionFactor = (float)delta.y()*(lTime/fNbMaxAnglePerSec);
1385 if (delta.y() <0 ) {
1386 correctionFactor = -correctionFactor;
1387 }
1388 }
1389
1390 // Check Qt Versions for META Keys
1391
1392 // Click and move mouse to rotate volume
1393 // ALT + Click and move mouse to rotate volume (View Direction)
1394 // SHIFT + Click and move camera point of view
1395 // CTRL + Click and zoom mouse to zoom in/out
1396
1397 lastMoveTime.start();
1398
1399 bool rotate = false;
1400 bool move = false;
1401
1402 if (fUiQt != NULL) {
1403 if (fUiQt->IsIconRotateSelected()) { // rotate
1404 rotate = true;
1405 } else if (fUiQt->IsIconMoveSelected()) { // move
1406 move = true;
1407 }
1408 } else {
1409 rotate = true;
1410 }
1411 // prevent from closing widget when rotating (cause a crash)
1412 if (fIsDeleting) {
1413 return;
1414 }
1415
1416 if (rotate) { // rotate
1417 if (fNoKeyPress) {
1418 rotateQtScene(((float)delta.x())/correctionFactor,((float)delta.y())/correctionFactor);
1419 } else if (fAltKeyPress) {
1420 rotateQtSceneToggle(((float)delta.x())/correctionFactor,((float)delta.y())/correctionFactor);
1421 }
1422
1423 } else if (move) { // move
1424 moveScene(-((float)delta.x())/correctionFactor,-((float)delta.y())/correctionFactor,0,true);
1425 }
1426 }
1427 ((QApplication*)G4Qt::getInstance ())->processEvents();
1428 }
1429 }
1430 fGLWidget->setMouseTracking(false);
1431
1432}
G4bool IsPicking() const

References fAltKeyPress, fAutoMove, fGLWidget, fIsDeleting, fLastEventTime, fLastPos1, fLastPos3, fLaunchSpinDelay, fNbMaxAnglePerSec, fNbMaxFramesPerSec, fNoKeyPress, fSpinningDelay, fUiQt, G4VViewer::fVP, G4Qt::getInstance(), G4UIQt::IsIconMoveSelected(), G4UIQt::IsIconRotateSelected(), G4ViewParameters::IsPicking(), moveScene(), rotateQtScene(), rotateQtSceneToggle(), and updatePickInfosWidget().

Referenced by G4OpenGLImmediateQtViewer::mouseReleaseEvent(), and G4OpenGLStoredQtViewer::mouseReleaseEvent().

◆ G4wheelEvent()

void G4OpenGLQtViewer::G4wheelEvent ( QWheelEvent *  event)

Definition at line 1600 of file G4OpenGLQtViewer.cc.

1601{
1602#if QT_VERSION < 0x050F00
1603 // Before Qt5.15
1604 fVP.SetZoomFactor(fVP.GetZoomFactor()+(fVP.GetZoomFactor()*(evnt->delta())/1200));
1605#else
1606 // Qt5.15 and beyond
1607 fVP.SetZoomFactor(fVP.GetZoomFactor()+(fVP.GetZoomFactor()*(evnt->angleDelta().y())/1200));
1608#endif
1609 updateQWidget();
1610}

References G4VViewer::fVP, G4ViewParameters::GetZoomFactor(), G4ViewParameters::SetZoomFactor(), and updateQWidget().

Referenced by G4OpenGLImmediateQtViewer::wheelEvent(), and G4OpenGLStoredQtViewer::wheelEvent().

◆ generateMpegEncoderParameters()

bool G4OpenGLQtViewer::generateMpegEncoderParameters ( )

Definition at line 2227 of file G4OpenGLQtViewer.cc.

2227 {
2228
2229 // save the parameter file
2230 FILE* fp;
2231 fp = fopen (QString(fMovieTempFolderPath+fParameterFileName).toStdString().c_str(), "w");
2232
2233 if (fp == NULL) {
2234 setRecordingInfos("Generation of parameter file failed");
2235 return false;
2236 }
2237
2238 fprintf (fp,"# Pattern affects speed, quality and compression. See the User's Guide\n");
2239 fprintf (fp,"# for more info.\n");
2240 fprintf (fp,"\n");
2241 fprintf (fp,"PATTERN I\n");
2242 fprintf (fp,"OUTPUT %s\n",getSaveFileName().toStdString().c_str());
2243 fprintf (fp,"\n");
2244 fprintf (fp,"# You must specify the type of the input files. The choices are:\n");
2245 fprintf (fp,"# YUV, PPM, JMOVIE, Y, JPEG, PNM\n");
2246 fprintf (fp,"# (must be upper case)\n");
2247 fprintf (fp,"#\n");
2248 fprintf (fp,"BASE_FILE_FORMAT PPM\n");
2249 fprintf (fp,"\n");
2250 fprintf (fp,"\n");
2251 fprintf (fp,"# If you are using YUV, there are different supported file formats.\n");
2252 fprintf (fp,"# EYUV or UCB are the same as previous versions of this encoder.\n");
2253 fprintf (fp,"# (All the Y's, then U's then V's, in 4:2:0 subsampling.)\n");
2254 fprintf (fp,"# Other formats, such as Abekas, Phillips, or a general format are\n");
2255 fprintf (fp,"# permissible, the general format is a string of Y's, U's, and V's\n");
2256 fprintf (fp,"# to specify the file order.\n");
2257 fprintf (fp,"\n");
2258 fprintf (fp,"INPUT_FORMAT UCB\n");
2259 fprintf (fp,"\n");
2260 fprintf (fp,"# the conversion statement\n");
2261 fprintf (fp,"#\n");
2262 fprintf (fp,"# Each occurrence of '*' will be replaced by the input file\n");
2263 fprintf (fp,"#\n");
2264 fprintf (fp,"# e.g., if you have a bunch of GIF files, then this might be:\n");
2265 fprintf (fp,"# INPUT_CONVERT giftoppm *\n");
2266 fprintf (fp,"#\n");
2267 fprintf (fp,"# e.g., if you have a bunch of files like a.Y a.U a.V, etc., then:\n");
2268 fprintf (fp,"# INPUT_CONVERT cat *.Y *.U *.V\n");
2269 fprintf (fp,"#\n");
2270 fprintf (fp,"# e.g., if you are grabbing from laser disc you might have something like\n");
2271 fprintf (fp,"# INPUT_CONVERT goto frame *; grabppm\n");
2272 fprintf (fp,"# 'INPUT_CONVERT *' means the files are already in the base file format\n");
2273 fprintf (fp,"#\n");
2274 fprintf (fp,"INPUT_CONVERT * \n");
2275 fprintf (fp,"\n");
2276 fprintf (fp,"# number of frames in a GOP.\n");
2277 fprintf (fp,"#\n");
2278 fprintf (fp,"# since each GOP must have at least one I-frame, the encoder will find the\n");
2279 fprintf (fp,"# the first I-frame after GOP_SIZE frames to start the next GOP\n");
2280 fprintf (fp,"#\n");
2281 fprintf (fp,"# later, will add more flexible GOP signalling\n");
2282 fprintf (fp,"#\n");
2283 fprintf (fp,"GOP_SIZE 1\n");
2284 fprintf (fp,"\n");
2285 fprintf (fp,"# number of slices in a frame\n");
2286 fprintf (fp,"#\n");
2287 fprintf (fp,"# 1 is a good number. another possibility is the number of macroblock rows\n");
2288 fprintf (fp,"# (which is the height divided by 16)\n");
2289 fprintf (fp,"#\n");
2290 fprintf (fp,"SLICES_PER_FRAME 1\n");
2291 fprintf (fp,"PIXEL HALF");
2292 fprintf (fp,"\n");
2293 fprintf (fp,"# directory to get all input files from (makes this file easier to read)\n");
2294 fprintf (fp,"INPUT_DIR %s\n",fMovieTempFolderPath.toStdString().c_str());
2295 fprintf (fp,"\n");
2296 fprintf (fp,"# There are a bunch of ways to specify the input files.\n");
2297 fprintf (fp,"# from a simple one-per-line listing, to the following \n");
2298 fprintf (fp,"# way of numbering them. See the manual for more information.\n");
2299 fprintf (fp,"INPUT\n");
2300 fprintf (fp,"# '*' is replaced by the numbers 01, 02, 03, 04\n");
2301 fprintf (fp,"# if I instead do [01-11], it would be 01, 02, ..., 09, 10, 11\n");
2302 fprintf (fp,"# if I instead do [1-11], it would be 1, 2, 3, ..., 9, 10, 11\n");
2303 fprintf (fp,"# if I instead do [1-11+3], it would be 1, 4, 7, 10\n");
2304 fprintf (fp,"# the program assumes none of your input files has a name ending in ']'\n");
2305 fprintf (fp,"# if you do, too bad!!!\n");
2306 fprintf (fp,"#\n");
2307 fprintf (fp,"#\n");
2308 fprintf (fp,"Test*.ppm [0-%d]\n",fRecordFrameNumber-1);
2309 fprintf (fp,"# can have more files here if you want...there is no limit on the number\n");
2310 fprintf (fp,"# of files\n");
2311 fprintf (fp,"END_INPUT\n");
2312 fprintf (fp,"\n");
2313 fprintf (fp,"\n");
2314 fprintf (fp,"\n");
2315 fprintf (fp,"# Many of the remaining options have to do with the motion search and qscale\n");
2316 fprintf (fp,"\n");
2317 fprintf (fp,"# FULL or HALF -- must be upper case\n");
2318 fprintf (fp,"# Should be FULL for computer generated images\n");
2319 fprintf (fp,"PIXEL FULL\n");
2320 fprintf (fp,"\n");
2321 fprintf (fp,"# means +/- this many pixels for both P and B frame searches\n");
2322 fprintf (fp,"# specify two numbers if you wish to serc different ranges in the two.\n");
2323 fprintf (fp,"RANGE 10\n");
2324 fprintf (fp,"\n");
2325 fprintf (fp,"# The two search algorithm parameters below mostly affect speed,\n");
2326 fprintf (fp,"# with some affect on compression and almost none on quality.\n");
2327 fprintf (fp,"\n");
2328 fprintf (fp,"# this must be one of {EXHAUSTIVE, SUBSAMPLE, LOGARITHMIC}\n");
2329 fprintf (fp,"PSEARCH_ALG LOGARITHMIC\n");
2330 fprintf (fp,"\n");
2331 fprintf (fp,"# this must be one of {SIMPLE, CROSS2, EXHAUSTIVE}\n");
2332 fprintf (fp,"#\n");
2333 fprintf (fp,"# note that EXHAUSTIVE is really, really, really slow\n");
2334 fprintf (fp,"#\n");
2335 fprintf (fp,"BSEARCH_ALG SIMPLE\n");
2336 fprintf (fp,"\n");
2337 fprintf (fp,"#\n");
2338 fprintf (fp,"# these specify the q-scale for I, P, and B frames\n");
2339 fprintf (fp,"# (values must be between 1 and 31)\n");
2340 fprintf (fp,"# These are the Qscale values for the entire frame in variable bit-rate\n");
2341 fprintf (fp,"# mode, and starting points (but not important) for constant bit rate\n");
2342 fprintf (fp,"#\n");
2343 fprintf (fp,"\n");
2344 fprintf (fp,"# Qscale (Quantization scale) affects quality and compression,\n");
2345 fprintf (fp,"# but has very little effect on speed.\n");
2346 fprintf (fp,"\n");
2347 fprintf (fp,"IQSCALE 4\n");
2348 fprintf (fp,"PQSCALE 5\n");
2349 fprintf (fp,"BQSCALE 12\n");
2350 fprintf (fp,"\n");
2351 fprintf (fp,"# this must be ORIGINAL or DECODED\n");
2352 fprintf (fp,"REFERENCE_FRAME ORIGINAL\n");
2353 fprintf (fp,"\n");
2354 fprintf (fp,"# for parallel parameters see parallel.param in the examples subdirectory\n");
2355 fprintf (fp,"\n");
2356 fprintf (fp,"# if you want constant bit-rate mode, specify it as follows (number is bits/sec):\n");
2357 fprintf (fp,"#BIT_RATE 1000000\n");
2358 fprintf (fp,"\n");
2359 fprintf (fp,"# To specify the buffer size (327680 is default, measused in bits, for 16bit words)\n");
2360 fprintf (fp,"BUFFER_SIZE 327680\n");
2361 fprintf (fp,"\n");
2362 fprintf (fp,"# The frame rate is the number of frames/second (legal values:\n");
2363 fprintf (fp,"# 23.976, 24, 25, 29.97, 30, 50 ,59.94, 60\n");
2364 fprintf (fp,"FRAME_RATE 30\n");
2365 fprintf (fp,"\n");
2366 fprintf (fp,"# There are many more options, see the users manual for examples....\n");
2367 fprintf (fp,"# ASPECT_RATIO, USER_DATA, GAMMA, IQTABLE, etc.\n");
2368 fprintf (fp,"\n");
2369 fprintf (fp,"\n");
2370 fclose (fp);
2371
2372 setRecordingInfos("Parameter file "+fParameterFileName+" generated in "+fMovieTempFolderPath);
2374 return true;
2375}

References fMovieTempFolderPath, fParameterFileName, fRecordFrameNumber, getSaveFileName(), READY_TO_ENCODE, setRecordingInfos(), and setRecordingStatus().

Referenced by saveVideo().

◆ GetApplicableVisAttributes()

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

◆ getColorForPoIndex()

G4Colour G4OpenGLQtViewer::getColorForPoIndex ( int  poIndex)
protected

Definition at line 3659 of file G4OpenGLQtViewer.cc.

3659 {
3660 // FIXME 09/2014 : Could be optimize by searching in a tab instead of item->data
3661 QTreeWidgetItem* item = getTreeWidgetItem(poIndex);
3662
3663 if (item != NULL) {
3664
3665 const QColor& color = item->data(2,Qt::UserRole).value<QColor>();
3666 G4Colour g4c(((G4double)color.red())/255,
3667 ((G4double)color.green())/255,
3668 ((G4double)color.blue())/255,
3669 ((G4double)color.alpha())/255);
3670
3671 return g4c;
3672 }
3673 return G4Colour();
3674}
QTreeWidgetItem * getTreeWidgetItem(int POindex)

References getTreeWidgetItem().

Referenced by changeDepthOnSceneTreeItem(), G4OpenGLStoredQtViewer::DisplayTimePOColourModification(), and updatePickInfosWidget().

◆ GetCommandParameterList()

QString G4OpenGLQtViewer::GetCommandParameterList ( const G4UIcommand aCommand)
private

Build the parameter list parameters in a QString
Reimplement partialy the G4UIparameter.cc

Parameters
aCommand: command to list parameters
See also
G4UIparameter::List()
G4UIcommand::List()
Returns
the command list parameters, or "" if nothing

Definition at line 4755 of file G4OpenGLQtViewer.cc.

4758{
4759 G4int n_parameterEntry = aCommand->GetParameterEntries();
4760 QString txt;
4761
4762 if( n_parameterEntry > 0 ) {
4763 G4UIparameter *param;
4764
4765 // Re-implementation of G4UIparameter.cc
4766
4767 for( G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ ) {
4768 param = aCommand->GetParameter(i_thParameter);
4769 txt += "\nParameter : " + QString((char*)(param->GetParameterName()).data()) + "\n";
4770 if( ! param->GetParameterGuidance().empty() )
4771 txt += QString((char*)(param->GetParameterGuidance()).data())+ "\n" ;
4772 txt += " Parameter type : " + QString(QChar(param->GetParameterType())) + "\n";
4773 if(param->IsOmittable()){
4774 txt += " Omittable : True\n";
4775 } else {
4776 txt += " Omittable : False\n";
4777 }
4778 if( param->GetCurrentAsDefault() ) {
4779 txt += " Default value : taken from the current value\n";
4780 } else if( ! param->GetDefaultValue().empty() ) {
4781 txt += " Default value : " + QString((char*)(param->GetDefaultValue()).data())+ "\n";
4782 }
4783 if( ! param->GetParameterRange().empty() ) {
4784 txt += " Parameter range : " + QString((char*)(param->GetParameterRange()).data())+ "\n";
4785 }
4786 if( ! param->GetParameterCandidates().empty() ) {
4787 txt += " Candidates : " + QString((char*)(param->GetParameterCandidates()).data())+ "\n";
4788 }
4789 }
4790 }
4791 return txt;
4792}
std::size_t GetParameterEntries() const
Definition: G4UIcommand.hh:138
G4UIparameter * GetParameter(G4int i) const
Definition: G4UIcommand.hh:139
const G4String & GetParameterCandidates() const
const G4String & GetParameterGuidance() const
G4bool IsOmittable() const
const G4String & GetParameterRange() const
G4bool GetCurrentAsDefault() const
char GetParameterType() const
const G4String & GetParameterName() const
const G4String & GetDefaultValue() const

References G4UIparameter::GetCurrentAsDefault(), G4UIparameter::GetDefaultValue(), G4UIcommand::GetParameter(), G4UIparameter::GetParameterCandidates(), G4UIcommand::GetParameterEntries(), G4UIparameter::GetParameterGuidance(), G4UIparameter::GetParameterName(), G4UIparameter::GetParameterRange(), G4UIparameter::GetParameterType(), and G4UIparameter::IsOmittable().

Referenced by updateViewerPropertiesTableWidget().

◆ GetDefaultViewParameters()

const G4ViewParameters & G4VViewer::GetDefaultViewParameters ( ) const
inherited

◆ getEncoderPath()

QString G4OpenGLQtViewer::getEncoderPath ( )
Returns
encoder path or "" if it does not exist

Definition at line 1918 of file G4OpenGLQtViewer.cc.

1918 {
1919 return fEncoderPath;
1920}

References fEncoderPath.

Referenced by G4OpenGLQtMovieDialog::checkEncoderSwParameters(), encodeVideo(), G4OpenGLQtMovieDialog::G4OpenGLQtMovieDialog(), and showMovieParametersDialog().

◆ getModelShortName()

QString G4OpenGLQtViewer::getModelShortName ( const G4String model)
private

Get the short name for a given label

Definition at line 3435 of file G4OpenGLQtViewer.cc.

3435 {
3436
3437 QString modelShortName = model.data();
3438 if (modelShortName.mid(0,modelShortName.indexOf(" ")) == "G4PhysicalVolumeModel") {
3439 modelShortName = fTouchableVolumes;
3440 } else {
3441 if (modelShortName.mid(0,2) == "G4") {
3442 modelShortName = modelShortName.mid(2);
3443 }
3444 if (modelShortName.indexOf("Model") != -1) {
3445 modelShortName = modelShortName.mid(0,modelShortName.indexOf("Model"));
3446 }
3447 }
3448 return modelShortName;
3449}

References fTouchableVolumes.

Referenced by addNonPVSceneTreeElement(), and addPVSceneTreeElement().

◆ GetName()

const G4String & G4VViewer::GetName ( ) const
inherited

◆ getOldTreeWidgetItem()

QTreeWidgetItem * G4OpenGLQtViewer::getOldTreeWidgetItem ( int  POindex)
private
Returns
the corresponding item if existing in the old tree Look into fOldPositivePoIndexSceneTreeWidgetQuickMap

Definition at line 4043 of file G4OpenGLQtViewer.cc.

4043 {
4044
4045
4046 // -1 is not a visible item
4047 if (POindex == -1) {
4048 return NULL;
4049 }
4050
4052 return NULL;
4053 }
4054
4055 // Should be call only once by item addition
4056 // Prevent to get out the std::map
4059 }
4060
4062 if (POindex == fOldLastSceneTreeWidgetAskForIterator->first) {
4063 if (fOldLastSceneTreeWidgetAskForIterator->second != NULL) {
4065 }
4066 }
4067 }
4068
4069 // if not, use the "find" algorithm
4072
4075 }
4076 return NULL;
4077}

References fOldLastSceneTreeWidgetAskForIterator, fOldLastSceneTreeWidgetAskForIteratorEnd, and fOldPositivePoIndexSceneTreeWidgetQuickMap.

Referenced by changeOpenCloseVisibleHiddenSelectedColorSceneTreeElement().

◆ getParentWidget()

QWidget * G4OpenGLQtViewer::getParentWidget ( )
private

Definition at line 2480 of file G4OpenGLQtViewer.cc.

2481{
2482 // launch Qt if not
2483 G4Qt* interactorManager = G4Qt::getInstance ();
2484 // G4UImanager* UI =
2485 // G4UImanager::GetUIpointer();
2486
2487 bool found = false;
2488 QDialog* dialog = NULL;
2489 // create window
2490 if (((QApplication*)interactorManager->GetMainInteractor())) {
2491 // look for the main window
2492 QWidgetList wl = QApplication::allWidgets();
2493 QWidget *widget = NULL;
2494 for (int i=0; i < wl.size(); i++) {
2495 widget = wl.at(i);
2496 if ((found== false) && (widget->inherits("QMainWindow"))) {
2497 dialog = new QDialog(widget,Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint);
2498 found = true;
2499 }
2500 }
2501
2502 if (found==false) {
2503 dialog = new QDialog();
2504 }
2505 } else {
2506 dialog= new QDialog();
2507 }
2508 if (found) {
2509 return dialog;
2510 } else {
2511 return NULL;
2512 }
2513}
G4Interactor GetMainInteractor()

References G4Qt::getInstance(), and G4VInteractorManager::GetMainInteractor().

Referenced by CreateMainWindow().

◆ 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
virtual void DrawView()=0
#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 updatePickInfosWidget().

◆ GetPrivateVisAttributesModifiers()

const std::vector< G4ModelingParameters::VisAttributesModifier > * G4OpenGLQtViewer::GetPrivateVisAttributesModifiers ( ) const
protectedvirtual

Reimplemented from G4VViewer.

Definition at line 3678 of file G4OpenGLQtViewer.cc.

3679{
3680 static std::vector<G4ModelingParameters::VisAttributesModifier>
3681 privateVisAttributesModifiers;
3682
3683 privateVisAttributesModifiers.clear();
3684
3685// I don't think we need this. (JA Sep 2016).
3686// // For each modified touchable...
3687// std::map<int,PVPath>::const_iterator i;
3688// for (i = fTreeItemModels.begin();
3689// i != fTreeItemModels.end();
3690// ++i) {
3691//
3692// // How do I know if it's been modified or not?
3693//
3694// int iPO = i->first;
3695// const PVPath& fullPath = i->second;
3696//
3697// // If a physical volume
3698// if (fullPath.size()) {
3699//
3700// // const G4bool& visibilityChanged = ???
3701// // const G4bool& visibility = ???
3702// // const G4bool& colourChanged = ???
3703// // const QColor& colour = ???
3704// // G4Colour g4colour(((G4double)colour.red())/255,
3705// // ((G4double)colour.green())/255,
3706// // ((G4double)colour.blue())/255,
3707// // ((G4double)colour.alpha())/255);
3708// // Next 4 lines are for testing, to be replaced by the above...
3709// G4bool visibilityChanged = true;
3710// G4bool visibility = true;
3711// G4bool colourChanged = true;
3712// G4Colour g4colour(G4Colour::Red());
3713//
3714// // Instantiate a working copy of a G4VisAttributes object...
3715// G4VisAttributes workingVisAtts;
3716// // ...and use it to create vis attribute modifiers...
3717// if (visibilityChanged) {
3718// workingVisAtts.SetVisibility(visibility);
3719// privateVisAttributesModifiers.push_back
3720// (G4ModelingParameters::VisAttributesModifier
3721// (workingVisAtts,
3722// G4ModelingParameters::VASVisibility,
3723// fullPath));
3724// }
3725// if (colourChanged) {
3726// workingVisAtts.SetColour(g4colour);
3727// privateVisAttributesModifiers.push_back
3728// (G4ModelingParameters::VisAttributesModifier
3729// (workingVisAtts,
3730// G4ModelingParameters::VASColour,
3731// fullPath));
3732// }
3733// }
3734// }
3735
3736 return &privateVisAttributesModifiers;
3737}

◆ getProcessErrorMsg()

QString G4OpenGLQtViewer::getProcessErrorMsg ( )
private

Definition at line 2449 of file G4OpenGLQtViewer.cc.

2450{
2451 QString txt = "";
2452 if (fProcess->exitCode() != 0) {
2453 switch (fProcess->error()) {
2454 case QProcess::FailedToStart:
2455 txt = "The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.\n";
2456 break;
2457 case QProcess::Crashed:
2458 txt = "The process crashed some time after starting successfully.\n";
2459 break;
2460 case QProcess::Timedout:
2461 txt = "The last waitFor...() function timed out. The state of QProcess is unchanged, and you can try calling waitFor...() again.\n";
2462 break;
2463 case QProcess::WriteError:
2464 txt = "An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel.\n";
2465 break;
2466 case QProcess::ReadError:
2467 txt = "An error occurred when attempting to read from the process. For example, the process may not be running.\n";
2468 break;
2469 case QProcess::UnknownError:
2470 txt = "An unknown error occurred. This is the default return value of error().\n";
2471 break;
2472 }
2473 }
2474 return txt;
2475}

References fProcess.

Referenced by processEncodeFinished(), and processLookForFinished().

◆ 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}

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}

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 exportImage(), G4OpenGLViewer::exportImage(), G4OpenGLXmViewer::misc_callback(), G4OpenGLViewer::printGl2PS(), G4OpenGLViewer::printNonVectoredEPS(), and G4OpenGLViewer::setExportFilename().

◆ getSaveFileName()

QString G4OpenGLQtViewer::getSaveFileName ( )
Returns
the save file path

Definition at line 2114 of file G4OpenGLQtViewer.cc.

2114 {
2115 return fSaveFileName ;
2116}

References fSaveFileName.

Referenced by G4OpenGLQtMovieDialog::checkSaveFileNameParameters(), encodeVideo(), and generateMpegEncoderParameters().

◆ 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 G4VisExtent & GetExtent() const
const G4Point3D & GetStandardTargetPoint() const
G4Scene * GetScene() 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
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:75

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

Referenced by 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

Definition at line 1079 of file G4OpenGLViewer.cc.

1080{
1081 if (!fSceneHandler.GetScene()) {
1082 return 0;
1083 }
1084 const G4Point3D targetPoint
1088 if(radius<=0.) radius = 1.;
1089 const G4double cameraDistance = fVP.GetCameraDistance (radius);
1090 const GLdouble pnear = fVP.GetNearDistance (cameraDistance, radius);
1091 return 2 * fVP.GetFrontHalfHeight (pnear, radius);
1092}

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

Referenced by G4MousePressEvent(), and moveScene().

◆ GetShortName()

const G4String & G4VViewer::GetShortName ( ) const
inherited

◆ getTempFolderPath()

QString G4OpenGLQtViewer::getTempFolderPath ( )
Returns
the temp folder path or "" if it does not exist

Definition at line 2080 of file G4OpenGLQtViewer.cc.

2080 {
2081 return fTempFolderPath;
2082}

References fTempFolderPath.

Referenced by G4OpenGLQtMovieDialog::checkTempFolderParameters(), G4OpenGLQtMovieDialog::G4OpenGLQtMovieDialog(), and startPauseVideo().

◆ getTreeWidgetItem()

QTreeWidgetItem * G4OpenGLQtViewer::getTreeWidgetItem ( int  POindex)
private
Returns
the corresponding item if existing. Look into fPositivePoIndexSceneTreeWidgetQuickMap

Definition at line 4010 of file G4OpenGLQtViewer.cc.

4010 {
4011
4012 // -1 is not a visible item
4013 if (POindex == -1) {
4014 return NULL;
4015 }
4016
4018 return NULL;
4019 }
4020
4022 if (POindex == fLastSceneTreeWidgetAskForIterator->first) {
4023 if (fLastSceneTreeWidgetAskForIterator->second != NULL) {
4025 }
4026 }
4027 }
4028
4029 // if not, use the "find" algorithm
4032
4035 }
4036 return NULL;
4037}
std::map< int, QTreeWidgetItem * >::const_iterator fLastSceneTreeWidgetAskForIteratorEnd
std::map< int, QTreeWidgetItem * >::const_iterator fLastSceneTreeWidgetAskForIterator

References fLastSceneTreeWidgetAskForIterator, fLastSceneTreeWidgetAskForIteratorEnd, and fPositivePoIndexSceneTreeWidgetQuickMap.

Referenced by getColorForPoIndex(), and isTouchableVisible().

◆ GetViewId()

G4int G4VViewer::GetViewId ( ) const
inherited

◆ GetViewParameters()

const G4ViewParameters & G4VViewer::GetViewParameters ( ) const
inherited

Referenced by G4OpenGLXmViewer::actions_callback(), G4OpenInventorSceneHandler::AddCircleSquare(), G4Qt3DSceneHandler::AddPrimitive(), G4ToolsSGSceneHandler::AddPrimitive(), G4OpenInventorSceneHandler::AddPrimitive(), G4OpenGLSceneHandler::AddPrimitive(), G4OpenGLImmediateSceneHandler::AddPrimitivePreambleInternal(), G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(), G4OpenInventorSceneHandler::AddTransform(), G4OpenGLXmViewer::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

◆ 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().

◆ 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().

◆ initMovieParameters()

void G4OpenGLQtViewer::initMovieParameters ( )
private

Init the movie parameters. Temp dir and encoder path

Definition at line 1898 of file G4OpenGLQtViewer.cc.

1898 {
1899 //init encoder
1900
1901 //look for encoderPath
1902 fProcess = new QProcess();
1903
1904 QObject ::connect(fProcess,SIGNAL(finished ( int)),
1905 this,SLOT(processLookForFinished()));
1906 fProcess->setProcessChannelMode(QProcess::MergedChannels);
1907#if QT_VERSION < 0x050F00
1908 // Before Qt5.15
1909 fProcess->start ("which ppmtompeg");
1910#else
1911 // Qt5.15 and beyond
1912 fProcess->start ("which ppmtompeg", QStringList());
1913#endif
1914}

References g4zmq::connect(), fProcess, and processLookForFinished().

Referenced by G4OpenGLQtViewer().

◆ isBadEncoder()

bool G4OpenGLQtViewer::isBadEncoder ( )

Definition at line 2001 of file G4OpenGLQtViewer.cc.

2001 {
2002 if (fRecordingStep == BAD_ENCODER) {
2003 return true;
2004 }
2005 return false;
2006}

References BAD_ENCODER, and fRecordingStep.

Referenced by G4OpenGLQtMovieDialog::setRecordingStatus().

◆ isBadOutput()

bool G4OpenGLQtViewer::isBadOutput ( )

Definition at line 2013 of file G4OpenGLQtViewer.cc.

2013 {
2014 if (fRecordingStep == BAD_OUTPUT) {
2015 return true;
2016 }
2017 return false;
2018}

References BAD_OUTPUT, and fRecordingStep.

Referenced by G4OpenGLQtMovieDialog::setRecordingStatus().

◆ isBadTmp()

bool G4OpenGLQtViewer::isBadTmp ( )

Definition at line 2007 of file G4OpenGLQtViewer.cc.

2007 {
2008 if (fRecordingStep == BAD_TMP) {
2009 return true;
2010 }
2011 return false;
2012}

References BAD_TMP, and fRecordingStep.

Referenced by G4OpenGLQtMovieDialog::setRecordingStatus().

◆ isCurrentWidget()

bool G4OpenGLQtViewer::isCurrentWidget ( )
protected

Definition at line 4736 of file G4OpenGLQtViewer.cc.

4736 {
4737 G4Qt* interactorManager = G4Qt::getInstance ();
4738 if (!interactorManager->IsExternalApp()) {
4739
4740 // Prevent from repainting a hidden tab (the current tab name has to be the one of th GL viewer)
4741 if ( GetName() != fUiQt->GetViewerTabWidget()->tabText(fUiQt->GetViewerTabWidget()->currentIndex()).toStdString().c_str()) {
4742 return false;
4743 }
4744 }
4745 return true;
4746}

References fUiQt, G4Qt::getInstance(), G4VViewer::GetName(), G4UIQt::GetViewerTabWidget(), and G4Qt::IsExternalApp().

Referenced by updatePickInfosWidget(), G4OpenGLImmediateQtViewer::updateQWidget(), G4OpenGLStoredQtViewer::updateQWidget(), and updateViewerPropertiesTableWidget().

◆ isEncoding()

bool G4OpenGLQtViewer::isEncoding ( )

Definition at line 1966 of file G4OpenGLQtViewer.cc.

1966 {
1967 if (fRecordingStep == ENCODING) {
1968 return true;
1969 }
1970 return false;
1971}

References fRecordingStep.

◆ isFailed()

bool G4OpenGLQtViewer::isFailed ( )

Definition at line 1987 of file G4OpenGLQtViewer.cc.

1987 {
1988 if (fRecordingStep == FAILED) {
1989 return true;
1990 }
1991 return false;
1992}

References FAILED, and fRecordingStep.

Referenced by G4OpenGLQtMovieDialog::setRecordingStatus().

◆ 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(), DrawText(), G4OpenGLViewer::DrawText(), and G4OpenGLXViewer::DrawText().

◆ isPaused()

bool G4OpenGLQtViewer::isPaused ( )

Definition at line 1959 of file G4OpenGLQtViewer.cc.

1959 {
1960 if (fRecordingStep == PAUSE) {
1961 return true;
1962 }
1963 return false;
1964}

References fRecordingStep, and PAUSE.

Referenced by G4OpenGLQtMovieDialog::save(), and G4OpenGLQtMovieDialog::setRecordingStatus().

◆ isPVVolume()

bool G4OpenGLQtViewer::isPVVolume ( QTreeWidgetItem *  item)
private

Definition at line 3778 of file G4OpenGLQtViewer.cc.

3778 {
3779 QTreeWidgetItem* sParent = item;
3780 while (sParent->parent() != NULL) {
3781 sParent = sParent->parent();
3782 }
3783 if (sParent->text(0) != fTouchableVolumes) {
3784 return false;
3785 }
3786 // item is the "Touchable" node
3787 if (item->text(0) == fTouchableVolumes) {
3788 return false;
3789 }
3790 return true;
3791}

References fTouchableVolumes.

Referenced by changeDepthOnSceneTreeItem().

◆ isReadyToEncode()

bool G4OpenGLQtViewer::isReadyToEncode ( )

Definition at line 2039 of file G4OpenGLQtViewer.cc.

2039 {
2041 return true;
2042 }
2043 return false;
2044}

References fRecordingStep, and READY_TO_ENCODE.

Referenced by G4OpenGLQtMovieDialog::checkEncoderSwParameters().

◆ isRecording()

bool G4OpenGLQtViewer::isRecording ( )

Definition at line 1952 of file G4OpenGLQtViewer.cc.

1952 {
1953 if ((fRecordingStep == START) || (fRecordingStep == CONTINUE)) {
1954 return true;
1955 }
1956 return false;
1957}

References CONTINUE, fRecordingStep, and START.

Referenced by G4OpenGLImmediateQtViewer::ComputeView(), G4OpenGLStoredQtViewer::ComputeView(), G4OpenGLQtMovieDialog::save(), and G4OpenGLQtMovieDialog::setRecordingStatus().

◆ isSameSceneTreeElement()

bool G4OpenGLQtViewer::isSameSceneTreeElement ( QTreeWidgetItem *  parentOldItem,
QTreeWidgetItem *  parentNewItem 
)
private

Definition at line 3278 of file G4OpenGLQtViewer.cc.

3281 {
3282
3283 int newPO = -1;
3284 int oldPO = -1;
3285
3286 int newCpNumber = -1;
3287 int oldCpNumber = -1;
3288
3289 bool firstWhile = true;
3290
3291 while ((parentOldItem != NULL) && (parentNewItem != NULL)) {
3292
3293 // check transform, optimize getting data(..,..) that consume lot of time
3294 if (!firstWhile) {
3295 oldPO = parentOldItem->data(0,Qt::UserRole).toInt();
3296 newPO = parentNewItem->data(0,Qt::UserRole).toInt();
3297 }
3298 firstWhile = false;
3299
3300 if ((oldPO >= 0) &&
3301 (newPO >= 0)) {
3302 const PVPath& oldFullPath = fOldTreeItemModels[oldPO];
3303 const PVPath& newFullPath = fTreeItemModels[newPO];
3304 if ((oldFullPath.size() > 0) &&
3305 (newFullPath.size() > 0)) {
3306 if (oldFullPath.size() != newFullPath.size()) {
3307 return false;
3308 }
3309 if (oldFullPath.at(oldFullPath.size()-1).GetTransform () == newFullPath.at(newFullPath.size()-1).GetTransform ()) {
3310 newCpNumber = newFullPath.at(newFullPath.size()-1).GetCopyNo();
3311 oldCpNumber = oldFullPath.at(oldFullPath.size()-1).GetCopyNo();
3312 // ok
3313 } else {
3314 return false;
3315 }
3316 }
3317 }
3318
3319 // Check copy Number
3320 if (oldCpNumber == -1) {
3321 oldCpNumber = parentOldItem->data(1,Qt::UserRole).toInt();
3322 }
3323 if (newCpNumber == -1) {
3324 newCpNumber = parentNewItem->data(1,Qt::UserRole).toInt();
3325 }
3326 if ((oldCpNumber != newCpNumber) ||
3327 // Check name
3328 (parentOldItem->text(0) != parentNewItem->text(0)) ) {
3329 // try to optimize
3330 return false;
3331 } else if ((parentOldItem->text(0) != parentNewItem->text(0)) || // Logical Name
3332 (parentOldItem->text(3) != parentNewItem->text(3))) { // Check logical name
3333 return false;
3334 } else {
3335 parentOldItem = parentOldItem->parent();
3336 parentNewItem = parentNewItem->parent();
3337 }
3338 } // end while
3339
3340 return true;
3341}

References fOldTreeItemModels, and fTreeItemModels.

Referenced by changeOpenCloseVisibleHiddenSelectedColorSceneTreeElement().

◆ isStopped()

bool G4OpenGLQtViewer::isStopped ( )

Definition at line 1980 of file G4OpenGLQtViewer.cc.

1980 {
1981 if (fRecordingStep == STOP) {
1982 return true;
1983 }
1984 return false;
1985}

References fRecordingStep, and STOP.

Referenced by G4OpenGLQtMovieDialog::save(), and G4OpenGLQtMovieDialog::setRecordingStatus().

◆ isSuccess()

bool G4OpenGLQtViewer::isSuccess ( )

Definition at line 1994 of file G4OpenGLQtViewer.cc.

1994 {
1995 if (fRecordingStep == SUCCESS) {
1996 return true;
1997 }
1998 return false;
1999}

References fRecordingStep, and SUCCESS.

Referenced by G4OpenGLQtMovieDialog::setRecordingStatus().

◆ isTouchableVisible()

bool G4OpenGLQtViewer::isTouchableVisible ( int  POindex)

Definition at line 3453 of file G4OpenGLQtViewer.cc.

3453 {
3454
3455 // If no scene tree (Immediate viewer)
3456 if (fSceneTreeComponentTreeWidget == NULL) {
3457 return false;
3458 }
3459
3460 // should be the next one
3461 // Prevent to get out the std::map
3464 }
3465 QTreeWidgetItem* item = getTreeWidgetItem(POindex);
3466
3467 if (item != NULL) {
3468 if ( item->checkState(0) == Qt::Checked) {
3469 return true;
3470 }
3471 }
3472 return false;
3473}

References fLastSceneTreeWidgetAskForIterator, fLastSceneTreeWidgetAskForIteratorEnd, fSceneTreeComponentTreeWidget, and getTreeWidgetItem().

Referenced by G4OpenGLStoredQtViewer::POSelected().

◆ isWaiting()

bool G4OpenGLQtViewer::isWaiting ( )

Definition at line 1973 of file G4OpenGLQtViewer.cc.

1973 {
1974 if (fRecordingStep == WAIT) {
1975 return true;
1976 }
1977 return false;
1978}

References fRecordingStep, and WAIT.

Referenced by G4OpenGLQtMovieDialog::setRecordingStatus().

◆ moveScene()

void G4OpenGLQtViewer::moveScene ( float  dx,
float  dy,
float  dz,
bool  mouseMove 
)
protected

Move the scene of dx, dy, dz values.

Parameters
dxdelta mouse x position
dydelta mouse y position
mouseMove: true if event comes from a mouse move, false if event comes from key action

Definition at line 1509 of file G4OpenGLQtViewer.cc.

1510{
1511 if (fHoldMoveEvent)
1512 return;
1513 fHoldMoveEvent = true;
1514
1515 G4double coefTrans = 0;
1516 GLdouble coefDepth = 0;
1517 if(mouseMove) {
1518 coefTrans = ((G4double)getSceneNearWidth())/((G4double)getWinWidth());
1519 if (getWinHeight() <getWinWidth()) {
1520 coefTrans = ((G4double)getSceneNearWidth())/((G4double)getWinHeight());
1521 }
1522 } else {
1523 coefTrans = getSceneNearWidth()*fPan_sens;
1524 coefDepth = getSceneDepth()*fDeltaDepth;
1525 }
1526 fVP.IncrementPan(-dx*coefTrans,dy*coefTrans,dz*coefDepth);
1527
1528 updateQWidget();
1529 if (fAutoMove)
1530 ((QApplication*)G4Qt::getInstance ())->processEvents();
1531
1532 fHoldMoveEvent = false;
1533}
GLdouble getSceneDepth()

References fAutoMove, fDeltaDepth, fHoldMoveEvent, G4OpenGLViewer::fPan_sens, G4VViewer::fVP, G4Qt::getInstance(), G4OpenGLViewer::getSceneDepth(), G4OpenGLViewer::getSceneNearWidth(), G4OpenGLViewer::getWinHeight(), G4OpenGLViewer::getWinWidth(), G4ViewParameters::IncrementPan(), and updateQWidget().

Referenced by G4keyPressEvent(), G4MouseMoveEvent(), G4MousePressEvent(), and G4MouseReleaseEvent().

◆ 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=()

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

◆ parseAndCheckVisibility()

bool G4OpenGLQtViewer::parseAndCheckVisibility ( QTreeWidgetItem *  treeNode,
int  POindex 
)
private

Definition at line 3476 of file G4OpenGLQtViewer.cc.

3476 {
3477 bool isFound = false;
3478 for (int i = 0; i < treeNode->childCount() ; ++i) {
3479
3480 if (treeNode->child(i)->data(0,Qt::UserRole).toInt() == POindex) {
3481 if (treeNode->child(i)->checkState(0) == Qt::Checked) {
3482 return true;
3483 }
3484 }
3485 isFound = parseAndCheckVisibility(treeNode->child(i),POindex);
3486 if (isFound) {
3487 return true;
3488 }
3489 } // end for
3490 return false;
3491}
bool parseAndCheckVisibility(QTreeWidgetItem *treeNode, int POindex)

References parseAndCheckVisibility().

Referenced by parseAndCheckVisibility().

◆ parseAndInsertInSceneTree()

bool G4OpenGLQtViewer::parseAndInsertInSceneTree ( QTreeWidgetItem *  parentItem,
G4PhysicalVolumeModel pPVModel,
unsigned int  fullPathIndex,
const QString &  parentRoot,
unsigned int  currentIndex,
int  currentPVPOIndex 
)
private

Definition at line 3015 of file G4OpenGLQtViewer.cc.

3022 {
3023
3024 if (parentItem == NULL) {
3025 return false;
3026 }
3027
3028 const PVPath& fullPath = pPVModel->GetFullPVPath();
3029
3030 std::ostringstream oss;
3031 oss << fullPath.at(fullPathIndex).GetCopyNo();
3032 std::string currentPVName = G4String(fullPath.at(fullPathIndex).GetPhysicalVolume()->GetName()+" ["+oss.str()+"]").data();
3033
3034 int currentPVCopyNb = fullPath.at(fullPathIndex).GetCopyNo();
3035
3036 const G4Colour& color = fSceneHandler.GetColour();
3037
3038 // look in all children in order to get if their is already a
3039 // child corresponding:
3040 // - if so, go into this child
3041 // - if not : create it as invisible
3042
3043 // Realy quick check if the POindex is already there
3044 QTreeWidgetItem* subItem = NULL;
3045 QList<QTreeWidgetItem *> parentItemList;
3046
3047
3048 // first of all, very quick check if it was not the same as last one
3049
3050 // Check only if it is a transparent object
3051 // If it is the last item and it is not transparent -> nothing to look for,
3052 // simply add it.
3053 if ((currentIndexInTreeSceneHandler == (fullPath.size()-1)) && ((color.GetAlpha() == 1.))) {
3054 } else {
3055 QString lookForString = QString(currentPVName.c_str());
3056 for (int i = 0;i < parentItem->childCount(); i++ ) {
3057 if (parentItem->child(i)->text(0) == lookForString) {
3058 parentItemList.push_back(parentItem->child(i));
3059 }
3060 }
3061 }
3062
3063 for (int i = 0; i < parentItemList.size(); ++i) {
3064 const std::string& parentItemName = parentItemList.at(i)->text(0).toStdString();
3065 int parentItemCopyNb = parentItemList.at(i)->data(1,Qt::UserRole).toInt();
3066 int parentItemPOIndex = parentItemList.at(i)->data(0,Qt::UserRole).toInt();
3067
3068 // if already inside
3069 // -> return true
3070 // special case, do not have to deal with hierarchy except for PhysicalVolume
3071
3072
3073 /* Physical Volume AND copy number equal AND name equal */
3074 if (((parentRoot == fTouchableVolumes) && (currentPVCopyNb == parentItemCopyNb)
3075 && (currentPVName == parentItemName)) ||
3076 /* NOT a Physical Volume AND copy number equal */
3077 ((parentRoot != fTouchableVolumes) && (currentPVCopyNb == parentItemCopyNb)
3078 /*AND name equal AND PO index equal*/
3079 && (currentPVName == parentItemName) && (currentPVPOIndex == parentItemPOIndex) )) {
3080
3081 // then check for the Transform3D
3082 bool sameTransform = true;
3083 if (parentItemPOIndex >= 0) {
3084 const PVPath& fullPathTmp = fTreeItemModels[parentItemPOIndex];
3085 if (fullPathTmp.size() > 0) {
3086 if (fullPathTmp.at(fullPathTmp.size()-1).GetTransform () == pPVModel->GetTransformation ()) {
3087 sameTransform = true;
3088 } else {
3089 sameTransform = false;
3090 }
3091 }
3092 }
3093
3094 // Same transformation, then try to change the PO index
3095 if (sameTransform == true) {
3096 // already exist in the tree, is it a transparent object ?
3097 // If so, then have to change the PO index ONLY if it is the last
3098 // and then change the state ONLY if POIndex has change
3099 // If not, then go deaper
3100
3101 // last element
3102 if (currentIndexInTreeSceneHandler == (fullPath.size()-1)) {
3103
3104 parentItemList.at(i)->setText(2,QString::number(currentPVPOIndex));
3105 parentItemList.at(i)->setData(0, Qt::UserRole,currentPVPOIndex);
3106
3107 fTreeItemModels.insert(std::pair <int, PVPath >(currentPVPOIndex,fullPath) );
3108
3109 // Then remove tooltip and special font
3110 QFont f = QFont();
3111 parentItemList.at(i)->setFont (0,f);
3112
3113 // set foreground
3114 parentItemList.at(i)->setForeground (0,QBrush());
3115
3116 // Set a tootip
3117 parentItemList.at(i)->setToolTip (0,"");
3118
3119 changeQColorForTreeWidgetItem(parentItemList.at(i),QColor((int)(color.GetRed()*255),
3120 (int)(color.GetGreen()*255),
3121 (int)(color.GetBlue()*255),
3122 (int)(color.GetAlpha()*255)));
3123
3124 // set check only if there is something to display
3125 if (color.GetAlpha() > 0) {
3126 parentItemList.at(i)->setCheckState(0,Qt::Checked);
3127 updatePositivePoIndexSceneTreeWidgetQuickMap(currentPVPOIndex,parentItemList.at(i));
3128 }
3129 return false;
3130 } else {
3131 subItem = parentItemList.at(i);
3132 }
3133
3134 // Exists but not the end of path, then forget get it
3135 } else if (currentIndexInTreeSceneHandler < (fullPath.size()-1)) {
3136 subItem = parentItemList.at(i);
3137 }
3138 }
3139
3140 } // end for
3141
3142 // if it the last, then add it and set it checked
3143 if (currentIndexInTreeSceneHandler == (fullPath.size()-1)) {
3144 /* subItem =*/ createTreeWidgetItem(fullPath,
3145 QString(currentPVName.c_str()),
3146 currentPVCopyNb,
3147 currentPVPOIndex,
3148 QString(fullPath.at(fullPathIndex).GetPhysicalVolume()->GetLogicalVolume()->GetName().data()),
3149 Qt::Checked,
3150 parentItem,
3151 color);
3152
3153 if (currentPVPOIndex > fMaxPOindexInserted) {
3154 fMaxPOindexInserted = currentPVPOIndex;
3155 }
3156
3157 } else {
3158
3159 // if no child found, then this child is create and marked as invisible, then go inside
3160 if (subItem == NULL) {
3161
3162 if (currentIndexInTreeSceneHandler < (fullPath.size()-1)) {
3163 subItem = createTreeWidgetItem(fullPath,
3164 QString(currentPVName.c_str()),
3165 currentPVCopyNb,
3166 -1,
3167 QString(fullPath.at(fullPathIndex).GetPhysicalVolume()->GetLogicalVolume()->GetName().data()),
3168 Qt::Unchecked,
3169 parentItem,
3170 color);
3171 }
3172 }
3173
3174 return parseAndInsertInSceneTree(subItem,pPVModel,fullPathIndex+1,parentRoot,currentIndexInTreeSceneHandler+1,currentPVPOIndex);
3175 }
3176 return true;
3177}
const G4Transform3D & GetTransformation() const

References changeQColorForTreeWidgetItem(), createTreeWidgetItem(), fMaxPOindexInserted, G4VViewer::fSceneHandler, fTouchableVolumes, fTreeItemModels, G4Colour::GetAlpha(), G4Colour::GetBlue(), G4VSceneHandler::GetColour(), G4PhysicalVolumeModel::GetFullPVPath(), G4Colour::GetGreen(), G4Colour::GetRed(), G4PhysicalVolumeModel::GetTransformation(), parseAndInsertInSceneTree(), and updatePositivePoIndexSceneTreeWidgetQuickMap().

Referenced by addPVSceneTreeElement(), and parseAndInsertInSceneTree().

◆ parseSceneTreeAndSaveState()

std::string G4OpenGLQtViewer::parseSceneTreeAndSaveState ( )
private

Definition at line 3494 of file G4OpenGLQtViewer.cc.

3494 {
3495 std::string commandLine = "";
3496 for (int b=0;b<fSceneTreeComponentTreeWidget->topLevelItemCount();b++) {
3497 commandLine += parseSceneTreeElementAndSaveState(fSceneTreeComponentTreeWidget->topLevelItem(b),1)+"\n";
3498 }
3499 if (commandLine != "") {
3500 commandLine = std::string("# Disable auto refresh and quieten vis messages whilst scene and\n") +
3501 "# trajectories are established:\n" +
3502 "/vis/viewer/set/autoRefresh false\n" +
3503 "/vis/verbose errors" +
3504 commandLine +
3505 "# Re-establish auto refreshing and verbosity:\n" +
3506 "/vis/viewer/set/autoRefresh true\n" +
3507 "/vis/verbose confirmations\n";
3508 }
3509 return commandLine;
3510}
std::string parseSceneTreeElementAndSaveState(QTreeWidgetItem *item, unsigned int level)

References fSceneTreeComponentTreeWidget, and parseSceneTreeElementAndSaveState().

◆ parseSceneTreeElementAndSaveState()

std::string G4OpenGLQtViewer::parseSceneTreeElementAndSaveState ( QTreeWidgetItem *  item,
unsigned int  level 
)
private

Definition at line 3513 of file G4OpenGLQtViewer.cc.

3513 {
3514 // parse current item
3515 std::string str( level, ' ' );
3516 std::string commandLine = "\n#"+ str + "PV Name: " + item->text(0).toStdString();
3517
3518 if (item->text(3) != "") {
3519 commandLine += " LV Name: "+item->text(3).toStdString()+"\n";
3520 // save check state
3521 commandLine += "/vis/geometry/set/visibility " + item->text(3).toStdString() + " ! "; // let default value for depth
3522 if (item->checkState(0) == Qt::Checked) {
3523 commandLine += "1";
3524 }
3525 if (item->checkState(0) == Qt::Unchecked) {
3526 commandLine += "0";
3527 }
3528 commandLine +="\n";
3529
3530 // save color
3531 const QColor& c = item->data(2,Qt::UserRole).value<QColor>();
3532 std::stringstream red;
3533 red << ((double)c.red())/255;
3534 std::stringstream green;
3535 green << (double)c.green()/255;
3536 std::stringstream blue;
3537 blue << ((double)c.blue())/255;
3538 std::stringstream alpha;
3539 alpha << ((double)c.alpha())/255;
3540
3541 commandLine += "/vis/geometry/set/colour " + item->text(3).toStdString() + " ! " + red.str() + " " + green.str() + " " + blue.str() + " " + alpha.str()+"\n";
3542
3543 } else {
3544 commandLine += "\n";
3545 }
3546
3547 // parse childs
3548 for (int b=0;b< item->childCount();b++) {
3549 commandLine += parseSceneTreeElementAndSaveState(item->child(b),level+1);
3550 }
3551
3552 return commandLine;
3553}
static const G4double alpha

References alpha, and parseSceneTreeElementAndSaveState().

Referenced by parseSceneTreeAndSaveState(), and parseSceneTreeElementAndSaveState().

◆ 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().

◆ 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()
G4int getRealExportHeight()
G4int getRealExportWidth()

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().

◆ printPDF()

bool G4OpenGLQtViewer::printPDF ( const std::string  ,
int  ,
QImage   
)
private

◆ 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().

◆ processEncodeFinished

void G4OpenGLQtViewer::processEncodeFinished ( )
privateslot

Definition at line 2414 of file G4OpenGLQtViewer.cc.

2415{
2416
2417 QString txt = "";
2418 txt = getProcessErrorMsg();
2419 if (txt == "") {
2421 } else {
2423 }
2424 // setRecordingInfos(txt+removeTempFolder());
2425}
QString getProcessErrorMsg()

References FAILED, getProcessErrorMsg(), setRecordingStatus(), and SUCCESS.

Referenced by encodeVideo().

◆ processEncodeStdout

void G4OpenGLQtViewer::processEncodeStdout ( )
privateslot

Definition at line 2405 of file G4OpenGLQtViewer.cc.

2406{
2407 QString tmp = fProcess->readAllStandardOutput ().data();
2408 int start = tmp.lastIndexOf("ESTIMATED TIME");
2409 tmp = tmp.mid(start,tmp.indexOf("\n",start)-start);
2410 setRecordingInfos(tmp);
2411}

References fProcess, and setRecordingInfos().

Referenced by encodeVideo().

◆ processLookForFinished

void G4OpenGLQtViewer::processLookForFinished ( )
privateslot

Definition at line 2428 of file G4OpenGLQtViewer.cc.

2429{
2430
2431 QString txt = getProcessErrorMsg();
2432 if (txt != "") {
2433 fEncoderPath = "";
2434 } else {
2435 fEncoderPath = QString(fProcess->readAllStandardOutput ().data()).trimmed();
2436 // if not found, return "not found"
2437 if (fEncoderPath.contains(" ")) {
2438 fEncoderPath = "";
2439 } else if (!fEncoderPath.contains("ppmtompeg")) {
2440 fEncoderPath = "";
2441 }
2443 }
2444 // init temp folder
2445 setTempFolderPath(QDir::temp ().absolutePath ());
2446}
QString setEncoderPath(QString path)

References fEncoderPath, fProcess, getProcessErrorMsg(), setEncoderPath(), and setTempFolderPath().

Referenced by initMovieParameters().

◆ 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().

◆ RefreshView()

void G4VViewer::RefreshView ( )
inherited

◆ removeTempFolder()

QString G4OpenGLQtViewer::removeTempFolder ( )
private

Remove the Qt_temp folder in the temp folder

Definition at line 2145 of file G4OpenGLQtViewer.cc.

2145 {
2146 // remove files in Qt_temp folder
2147 if (fMovieTempFolderPath == "") {
2148 return "";
2149 }
2150 QDir *d = new QDir(QDir::cleanPath(fMovieTempFolderPath));
2151 if (!d->exists()) {
2152 return ""; // already remove
2153 }
2154
2155 d->setFilter( QDir::Files );
2156 QStringList subDirList = d->entryList();
2157 int res = true;
2158 QString error = "";
2159 for (QStringList::ConstIterator it = subDirList.begin() ;(it != subDirList.end()) ; it++) {
2160 const QString currentFile = *it;
2161 if (!d->remove(currentFile)) {
2162 res = false;
2163 QString file = fMovieTempFolderPath+currentFile;
2164 error +="Removing file failed : "+file;
2165 } else {
2166 }
2167 }
2168 if (res) {
2169 if (d->rmdir(fMovieTempFolderPath)) {
2171 return "";
2172 } else {
2173 return "Dir "+fMovieTempFolderPath+" should be empty, but could not remove it";
2174 }
2175
2176 }
2177 return "Could not remove "+fMovieTempFolderPath+" because of the following errors :"+error;
2178}
static PROLOG_HANDLER error
Definition: xmlrole.cc:127

References error, geant4_check_module_cycles::file, and fMovieTempFolderPath.

Referenced by startPauseVideo(), and ~G4OpenGLQtViewer().

◆ rescaleImage()

void G4OpenGLQtViewer::rescaleImage ( int  ,
int   
)
private

This is the benning of a rescale function. It does nothing for the moment

Parameters
aWidth: new width
aHeight: new height

Definition at line 1580 of file G4OpenGLQtViewer.cc.

1583 {
1584 // GLfloat* feedback_buffer;
1585 // GLint returned;
1586 // FILE* file;
1587
1588 // feedback_buffer = new GLfloat[size];
1589 // glFeedbackBuffer (size, GL_3D_COLOR, feedback_buffer);
1590 // glRenderMode (GL_FEEDBACK);
1591
1592 // DrawView();
1593 // returned = glRenderMode (GL_RENDER);
1594
1595}

◆ resetRecording()

void G4OpenGLQtViewer::resetRecording ( )

Definition at line 2046 of file G4OpenGLQtViewer.cc.

2046 {
2048}

References setRecordingStatus(), and WAIT.

Referenced by G4OpenGLQtMovieDialog::resetRecording(), savePPMToTemp(), and stopVideo().

◆ ResetView()

void G4OpenGLQtViewer::ResetView ( )
virtual

Reimplemented from G4VViewer.

Definition at line 2867 of file G4OpenGLQtViewer.cc.

2867 {
2869 fDeltaDepth = 0.01;
2870 fDeltaZoom = 0.05;
2871}

References fDeltaDepth, fDeltaZoom, and G4OpenGLViewer::ResetView().

Referenced by G4keyPressEvent().

◆ 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

◆ rotateQtScene()

void G4OpenGLQtViewer::rotateQtScene ( float  dx,
float  dy 
)
protected
Parameters
dxdelta mouse x position
dydelta mouse y position

Definition at line 1541 of file G4OpenGLQtViewer.cc.

1542{
1543 if (fHoldRotateEvent)
1544 return;
1545 fHoldRotateEvent = true;
1546
1547 rotateScene(dx,dy);
1548
1549 updateQWidget();
1550
1551 fHoldRotateEvent = false;
1552}
void rotateScene(G4double dx, G4double dy)

References fHoldRotateEvent, G4OpenGLViewer::rotateScene(), and updateQWidget().

Referenced by G4keyPressEvent(), G4MouseMoveEvent(), and G4MouseReleaseEvent().

◆ rotateQtSceneToggle()

void G4OpenGLQtViewer::rotateQtSceneToggle ( float  dx,
float  dy 
)
protected
Parameters
dxdelta mouse x position
dydelta mouse y position

Definition at line 1559 of file G4OpenGLQtViewer.cc.

1560{
1561 if (fHoldRotateEvent)
1562 return;
1563 fHoldRotateEvent = true;
1564
1565 rotateSceneToggle(dx,dy);
1566
1567 updateQWidget();
1568
1569 fHoldRotateEvent = false;
1570}
void rotateSceneToggle(G4double dx, G4double dy)

References fHoldRotateEvent, G4OpenGLViewer::rotateSceneToggle(), and updateQWidget().

Referenced by G4keyPressEvent(), G4MouseMoveEvent(), and G4MouseReleaseEvent().

◆ 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 G4OpenGLXmViewer::rotate_in_phi(), G4OpenGLXmViewer::rotate_in_theta(), and 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)
const G4Vector3D & GetViewpointDirection() const
const G4Vector3D & GetUpVector() const
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}
G4bool GetLightsMoveWithCamera() const
BasicVector3D< T > cross(const BasicVector3D< T > &v) const
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

Definition at line 1143 of file G4OpenGLViewer.cc.

1144{
1147 } else {
1148 if( dx != 0) {
1149 rotateSceneThetaPhi(dx,0);
1150 }
1151 if( dy != 0) {
1152 rotateSceneThetaPhi(0,dy);
1153 }
1154 }
1155}

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

Referenced by rotateQtSceneToggle().

◆ savePPMToTemp()

void G4OpenGLQtViewer::savePPMToTemp ( )
protected

Definition at line 1066 of file G4OpenGLQtViewer.cc.

1066 {
1067 if (fMovieTempFolderPath == "") {
1068 return;
1069 }
1070 QGLWidget* qGLW = dynamic_cast<QGLWidget*> (fGLWidget) ;
1071 if (! qGLW) {
1072 return;
1073 }
1074 QString fileName ="Test"+QString::number(fRecordFrameNumber)+".ppm";
1075 QString filePath =fMovieTempFolderPath+fileName;
1076
1077 QImage image;
1078 image = qGLW->grabFrameBuffer();
1079 bool res = false;
1080
1081 res = image.save(filePath,0);
1082 if (res == false) {
1084 setRecordingInfos("Can't save tmp file "+filePath);
1085 return;
1086 }
1087
1088 setRecordingInfos("File "+fileName+" saved");
1090}

References fGLWidget, fMovieTempFolderPath, fRecordFrameNumber, resetRecording(), and setRecordingInfos().

Referenced by G4OpenGLImmediateQtViewer::ComputeView(), and G4OpenGLStoredQtViewer::ComputeView().

◆ saveVideo()

void G4OpenGLQtViewer::saveVideo ( )

Stop the video. Check all parameters and enable encoder button if all is ok.

Definition at line 1787 of file G4OpenGLQtViewer.cc.

1787 {
1788
1789 // if encoder parameter is wrong, display parameters dialog and return
1792 }
1793
1796
1797 if (fRecordingStep == STOP) {
1800 encodeVideo();
1801 }
1802}
bool generateMpegEncoderParameters()

References G4OpenGLQtMovieDialog::checkEncoderSwParameters(), G4OpenGLQtMovieDialog::checkSaveFileNameParameters(), encodeVideo(), fMovieParametersDialog, fRecordingStep, generateMpegEncoderParameters(), SAVE, setRecordingStatus(), showMovieParametersDialog(), and STOP.

Referenced by G4OpenGLQtMovieDialog::save().

◆ sceneTreeComponentItemChanged

void G4OpenGLQtViewer::sceneTreeComponentItemChanged ( QTreeWidgetItem *  item,
int  id 
)
privateslot

Definition at line 3556 of file G4OpenGLQtViewer.cc.

3556 {
3557
3560 G4bool checked = false;
3561 if (item->checkState(0) == Qt::Checked) {
3562 checked = true;
3563 }
3564 setCheckComponent(item,checked);
3565 updateQWidget();
3566
3568 }
3569}
void setCheckComponent(QTreeWidgetItem *item, bool check)

References fCheckSceneTreeComponentSignalLock, setCheckComponent(), and updateQWidget().

Referenced by createSceneTreeComponent().

◆ sceneTreeComponentSelected

void G4OpenGLQtViewer::sceneTreeComponentSelected ( )
privateslot

Definition at line 3572 of file G4OpenGLQtViewer.cc.

3572 {
3573}

Referenced by createSceneTreeComponent().

◆ setBadEncoder()

void G4OpenGLQtViewer::setBadEncoder ( )

Definition at line 2020 of file G4OpenGLQtViewer.cc.

2020 {
2023}

References BAD_ENCODER, displayRecordingStatus(), and fRecordingStep.

◆ setBadOutput()

void G4OpenGLQtViewer::setBadOutput ( )

Definition at line 2028 of file G4OpenGLQtViewer.cc.

2028 {
2031}

References BAD_OUTPUT, displayRecordingStatus(), and fRecordingStep.

◆ setBadTmp()

void G4OpenGLQtViewer::setBadTmp ( )

Definition at line 2024 of file G4OpenGLQtViewer.cc.

2024 {
2027}

References BAD_TMP, displayRecordingStatus(), and fRecordingStep.

◆ setCheckComponent()

void G4OpenGLQtViewer::setCheckComponent ( QTreeWidgetItem *  item,
bool  check 
)
private

Definition at line 2767 of file G4OpenGLQtViewer.cc.

2768{
2769 if (item) {
2770
2771 const PVPath& fullPath = fTreeItemModels[item->data(0,Qt::UserRole).toInt()];
2772 // If a physical volume
2773 if (fullPath.size() > 0) {
2774 SetTouchable(fullPath);
2775 TouchableSetVisibility(fullPath, check);
2776 fMouseOnSceneTree = true;
2777 }
2778 }
2779
2780 if (item != NULL) {
2781 if (check) {
2782 item->setCheckState(0,Qt::Checked);
2783 } else {
2784 item->setCheckState(0,Qt::Unchecked);
2785 }
2786 updatePositivePoIndexSceneTreeWidgetQuickMap(item->data(0,Qt::UserRole).toInt(),item);
2787 int nChildCount = item->childCount();
2788 for (int i = 0; i < nChildCount; i++) {
2789 setCheckComponent(item->child(i),check);
2790 }
2791 }
2792}
void TouchableSetVisibility(const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, G4bool visibility)
Definition: G4VViewer.cc:147

References fMouseOnSceneTree, fTreeItemModels, setCheckComponent(), G4VViewer::SetTouchable(), G4VViewer::TouchableSetVisibility(), and updatePositivePoIndexSceneTreeWidgetQuickMap().

Referenced by sceneTreeComponentItemChanged(), and setCheckComponent().

◆ SetDefaultViewParameters()

void G4VViewer::SetDefaultViewParameters ( const G4ViewParameters vp)
inherited

◆ setEncoderPath()

QString G4OpenGLQtViewer::setEncoderPath ( QString  path)

set the new encoder path

Returns
"" if correct. The error otherwise

Definition at line 1927 of file G4OpenGLQtViewer.cc.

1927 {
1928 if (path == "") {
1929 return "ppmtompeg is needed to encode in video format. It is available here: http://netpbm.sourceforge.net ";
1930 }
1931
1932 path = QDir::cleanPath(path);
1933 QFileInfo *f = new QFileInfo(path);
1934 if (!f->exists()) {
1935 return "File does not exist";
1936 } else if (f->isDir()) {
1937 return "This is a directory";
1938 } else if (!f->isExecutable()) {
1939 return "File exist but is not executable";
1940 } else if (!f->isFile()) {
1941 return "This is not a file";
1942 }
1943 fEncoderPath = path;
1944
1945 if (fRecordingStep == BAD_ENCODER) {
1947 }
1948 return "";
1949}

References BAD_ENCODER, fEncoderPath, fRecordingStep, setRecordingStatus(), and STOP.

Referenced by G4OpenGLQtMovieDialog::checkEncoderSwParameters(), and processLookForFinished().

◆ 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}
bool setExportImageFormat(std::string format, bool quiet=false)

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

Referenced by actionSaveImage(), 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
G4String fName
Definition: G4VViewer.hh:217
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

◆ setRecordingInfos()

void G4OpenGLQtViewer::setRecordingInfos ( const QString &  txt)
private

◆ setRecordingStatus()

void G4OpenGLQtViewer::setRecordingStatus ( RECORDING_STEP  step)
private

◆ setSaveFileName()

QString G4OpenGLQtViewer::setSaveFileName ( QString  path)

set the save file name path

Returns
"" if correct. The error otherwise

Definition at line 2088 of file G4OpenGLQtViewer.cc.

2088 {
2089
2090 if (path == "") {
2091 return "Path does not exist";
2092 }
2093
2094 QFileInfo *file = new QFileInfo(path);
2095 QDir dir = file->dir();
2096 path = QDir::cleanPath(path);
2097 if (file->exists()) {
2098 return "File already exist, please choose a new one";
2099 } else if (!dir.exists()) {
2100 return "Dir does not exist";
2101 } else if (!dir.isReadable()) {
2102 return path +" is read protected";
2103 }
2104
2105 if (fRecordingStep == BAD_OUTPUT) {
2107 }
2108 fSaveFileName = path;
2109 return "";
2110}

References BAD_OUTPUT, geant4_check_module_cycles::file, fRecordingStep, fSaveFileName, setRecordingStatus(), and STOP.

Referenced by G4OpenGLQtMovieDialog::checkSaveFileNameParameters().

◆ setTempFolderPath()

QString G4OpenGLQtViewer::setTempFolderPath ( QString  path)

set the temp folder path

Returns
"" if correct. The error otherwise

Definition at line 2054 of file G4OpenGLQtViewer.cc.

2054 {
2055
2056 if (path == "") {
2057 return "Path does not exist";
2058 }
2059 path = QDir::cleanPath(path);
2060 QFileInfo *d = new QFileInfo(path);
2061 if (!d->exists()) {
2062 return "Path does not exist";
2063 } else if (!d->isDir()) {
2064 return "This is not a directory";
2065 } else if (!d->isReadable()) {
2066 return path +" is read protected";
2067 } else if (!d->isWritable()) {
2068 return path +" is write protected";
2069 }
2070
2071 if (fRecordingStep == BAD_TMP) {
2073 }
2074 fTempFolderPath = path;
2075 return "";
2076}

References BAD_TMP, fRecordingStep, fTempFolderPath, setRecordingStatus(), and WAIT.

Referenced by G4OpenGLQtMovieDialog::checkTempFolderParameters(), createTempFolder(), and processLookForFinished().

◆ 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
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
static G4PhysicalVolumeStore * GetInstance()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:485

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

Referenced by changeColorAndTransparency(), and setCheckComponent().

◆ SetView()

void G4OpenGLViewer::SetView ( )
protectedvirtualinherited

Implements G4VViewer.

Reimplemented in G4OpenGLWin32Viewer, and G4OpenGLXViewer.

Definition at line 277 of file G4OpenGLViewer.cc.

277 {
278 // if getting pick infos, should not resize the view.
279 if (fIsGettingPickInfos) return;
280
281 if (!fSceneHandler.GetScene()) {
282 return;
283 }
284 // Calculates view representation based on extent of object being
285 // viewed and (initial) viewpoint. (Note: it can change later due
286 // to user interaction via visualization system's GUI.)
287
288 // Lighting.
289 GLfloat lightPosition [4];
290 lightPosition [0] = fVP.GetActualLightpointDirection().x();
291 lightPosition [1] = fVP.GetActualLightpointDirection().y();
292 lightPosition [2] = fVP.GetActualLightpointDirection().z();
293 lightPosition [3] = 0.;
294 // Light position is "true" light direction, so must come after gluLookAt.
295 GLfloat ambient [] = { 0.2f, 0.2f, 0.2f, 1.f};
296 GLfloat diffuse [] = { 0.8f, 0.8f, 0.8f, 1.f};
297 glEnable (GL_LIGHT0);
298 glLightfv (GL_LIGHT0, GL_AMBIENT, ambient);
299 glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuse);
300
301 G4double ratioX = 1;
302 G4double ratioY = 1;
303 if (fWinSize_y > fWinSize_x) {
304 ratioX = ((G4double)fWinSize_y) / ((G4double)fWinSize_x);
305 }
306 if (fWinSize_x > fWinSize_y) {
307 ratioY = ((G4double)fWinSize_x) / ((G4double)fWinSize_y);
308 }
309
310 // Get radius of scene, etc.
311 // Note that this procedure properly takes into account zoom, dolly and pan.
312 const G4Point3D targetPoint
316 if(radius<=0.) radius = 1.;
317 const G4double cameraDistance = fVP.GetCameraDistance (radius);
318 const G4Point3D cameraPosition =
319 targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
320 const GLdouble pnear = fVP.GetNearDistance (cameraDistance, radius);
321 const GLdouble pfar = fVP.GetFarDistance (cameraDistance, pnear, radius);
322 const GLdouble right = fVP.GetFrontHalfHeight (pnear, radius) * ratioY;
323 const GLdouble left = -right;
324 const GLdouble top = fVP.GetFrontHalfHeight (pnear, radius) * ratioX;
325 const GLdouble bottom = -top;
326
327 // FIXME
328 ResizeGLView();
329 //SHOULD SetWindowsSizeHint()...
330
331 glMatrixMode (GL_PROJECTION); // set up Frustum.
332 glLoadIdentity();
333
334 const G4Vector3D scaleFactor = fVP.GetScaleFactor();
335 glScaled(scaleFactor.x(),scaleFactor.y(),scaleFactor.z());
336
337 if (fVP.GetFieldHalfAngle() == 0.) {
338 g4GlOrtho (left, right, bottom, top, pnear, pfar);
339 }
340 else {
341 g4GlFrustum (left, right, bottom, top, pnear, pfar);
342 }
343
344 glMatrixMode (GL_MODELVIEW); // apply further transformations to scene.
345 glLoadIdentity();
346
347 const G4Normal3D& upVector = fVP.GetUpVector ();
348 G4Point3D gltarget;
349 if (cameraDistance > 1.e-6 * radius) {
350 gltarget = targetPoint;
351 }
352 else {
353 gltarget = targetPoint - radius * fVP.GetViewpointDirection().unit();
354 }
355
356 const G4Point3D& pCamera = cameraPosition; // An alias for brevity.
357
358 g4GluLookAt (pCamera.x(), pCamera.y(), pCamera.z(), // Viewpoint.
359 gltarget.x(), gltarget.y(), gltarget.z(), // Target point.
360 upVector.x(), upVector.y(), upVector.z()); // Up vector.
361 // Light position is "true" light direction, so must come after gluLookAt.
362 glLightfv (GL_LIGHT0, GL_POSITION, lightPosition);
363
364 // The idea is to use back-to-back clipping planes. This can cut an object
365 // down to just a few pixels, which can make it difficult to see. So, for
366 // now, comment this out and use the generic (Boolean) method, via
367 // G4VSolid* G4OpenGLSceneHandler::CreateSectionSolid ()
368 // { return G4VSceneHandler::CreateSectionSolid(); }
369// if (fVP.IsSection () ) { // pair of back to back clip planes.
370// const G4Plane3D& sp = fVP.GetSectionPlane ();
371// double sArray[4];
372// sArray[0] = sp.a();
373// sArray[1] = sp.b();
374// sArray[2] = sp.c();
375// sArray[3] = sp.d() + radius * 1.e-05;
376// glClipPlane (GL_CLIP_PLANE0, sArray);
377// glEnable (GL_CLIP_PLANE0);
378// sArray[0] = -sp.a();
379// sArray[1] = -sp.b();
380// sArray[2] = -sp.c();
381// sArray[3] = -sp.d() + radius * 1.e-05;
382// glClipPlane (GL_CLIP_PLANE1, sArray);
383// glEnable (GL_CLIP_PLANE1);
384// } else {
385// glDisable (GL_CLIP_PLANE0);
386// glDisable (GL_CLIP_PLANE1);
387// }
388
389 // What we call intersection of cutaways is easy in OpenGL. You
390 // just keep cutting. Unions are more tricky - you have to have
391 // multiple passes and this is handled in
392 // G4OpenGLImmediate/StoredViewer::ProcessView.
393 const G4Planes& cutaways = fVP.GetCutawayPlanes();
394 size_t nPlanes = cutaways.size();
395 if (fVP.IsCutaway() &&
397 nPlanes > 0) {
398 double a[4];
399 a[0] = cutaways[0].a();
400 a[1] = cutaways[0].b();
401 a[2] = cutaways[0].c();
402 a[3] = cutaways[0].d();
403 glClipPlane (GL_CLIP_PLANE2, a);
404 glEnable (GL_CLIP_PLANE2);
405 if (nPlanes > 1) {
406 a[0] = cutaways[1].a();
407 a[1] = cutaways[1].b();
408 a[2] = cutaways[1].c();
409 a[3] = cutaways[1].d();
410 glClipPlane (GL_CLIP_PLANE3, a);
411 glEnable (GL_CLIP_PLANE3);
412 }
413 if (nPlanes > 2) {
414 a[0] = cutaways[2].a();
415 a[1] = cutaways[2].b();
416 a[2] = cutaways[2].c();
417 a[3] = cutaways[2].d();
418 glClipPlane (GL_CLIP_PLANE4, a);
419 glEnable (GL_CLIP_PLANE4);
420 }
421 } else {
422 glDisable (GL_CLIP_PLANE2);
423 glDisable (GL_CLIP_PLANE3);
424 glDisable (GL_CLIP_PLANE4);
425 }
426
427 // Background.
429
430}
std::vector< G4Plane3D > G4Planes
void g4GlFrustum(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 g4GlOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
const G4Vector3D & GetScaleFactor() const
CutawayMode GetCutawayMode() const
G4bool IsCutaway() const
G4Vector3D & GetActualLightpointDirection()
const G4Colour & GetBackgroundColour() const
const G4Planes & GetCutawayPlanes() const

References G4OpenGLViewer::background, G4ViewParameters::cutawayIntersection, G4OpenGLViewer::fIsGettingPickInfos, G4VViewer::fSceneHandler, G4VViewer::fVP, G4OpenGLViewer::fWinSize_x, G4OpenGLViewer::fWinSize_y, G4OpenGLViewer::g4GlFrustum(), G4OpenGLViewer::g4GlOrtho(), G4OpenGLViewer::g4GluLookAt(), G4ViewParameters::GetActualLightpointDirection(), G4ViewParameters::GetBackgroundColour(), G4ViewParameters::GetCameraDistance(), G4ViewParameters::GetCurrentTargetPoint(), G4ViewParameters::GetCutawayMode(), G4ViewParameters::GetCutawayPlanes(), G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4ViewParameters::GetFarDistance(), G4ViewParameters::GetFieldHalfAngle(), G4ViewParameters::GetFrontHalfHeight(), G4ViewParameters::GetNearDistance(), G4ViewParameters::GetScaleFactor(), G4VSceneHandler::GetScene(), G4Scene::GetStandardTargetPoint(), G4ViewParameters::GetUpVector(), G4ViewParameters::GetViewpointDirection(), G4ViewParameters::IsCutaway(), G4OpenGLViewer::ResizeGLView(), HepGeom::BasicVector3D< T >::unit(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

Referenced by G4OpenGLImmediateQtViewer::paintGL(), G4OpenGLStoredQtViewer::paintGL(), G4OpenGLWin32Viewer::SetView(), and G4OpenGLXViewer::SetView().

◆ SetViewParameters()

void G4VViewer::SetViewParameters ( const G4ViewParameters vp)
inherited

◆ setWaiting()

void G4OpenGLQtViewer::setWaiting ( )

Definition at line 2033 of file G4OpenGLQtViewer.cc.

2033 {
2036}

References displayRecordingStatus(), fRecordingStep, and WAIT.

◆ showMovieParametersDialog()

void G4OpenGLQtViewer::showMovieParametersDialog ( )
private

◆ showShortcuts

void G4OpenGLQtViewer::showShortcuts ( )
privateslot

Show shortcuts for this mouse action

Definition at line 803 of file G4OpenGLQtViewer.cc.

803 {
804 G4String text;
805
806 text = "========= Mouse Shortcuts =========\n";
807 if (fUiQt != NULL) {
808 if (fUiQt->IsIconRotateSelected()) { // rotate
809 text += "Click and move mouse to rotate volume \n";
810 text += "ALT + Click and move mouse to rotate volume (Toggle View/Theta-Phi Direction) \n";
811 text += "CTRL + Click and move mouse to zoom in/out \n";
812 text += "SHIFT + Click and move mouse to change camera point of view \n";
813 } else if (fUiQt->IsIconMoveSelected()) { //move
814 text += "Move camera point of view with mouse \n";
815 } else if (fUiQt->IsIconPickSelected()) { //pick
816 text += "Click and pick \n";
817 }
818 } else {
819 text += "Click and move mouse to rotate volume \n";
820 text += "ALT + Click and move mouse to rotate volume (Toggle View/Theta-Phi Direction) \n";
821 text += "CTRL + Click and zoom mouse to zoom in/out \n";
822 text += "SHIFT + Click and zoommove camera point of view \n";
823 }
824 text += "========= Move Shortcuts ========= \n";
825 text += "Press left/right arrows to move volume left/right \n";
826 text += "Press up/down arrows to move volume up/down \n";
827 text += "Press '+'/'-' to move volume toward/forward \n";
828 text += "\n";
829 text += "========= Rotation (Theta/Phi) Shortcuts ========= \n";
830 text += "Press SHIFT + left/right arrows to rotate volume left/right \n";
831 text += "Press SHIFT + up/down arrows to rotate volume up/down \n";
832 text += "\n";
833 text += "========= Rotation (View Direction) Shortcuts ========= \n";
834 text += "Press ALT + left/right to rotate volume around vertical direction \n";
835 text += "Press ALT + up/down to rotate volume around horizontal direction \n";
836 text += "\n";
837 text += "========= Zoom View ========= \n";
838 text += "Press CTRL + '+'/'-' to zoom into volume \n";
839 text += "\n";
840 text += "========= Misc ========= \n";
841 text += "Press ALT +/- to slow/speed rotation/move \n";
842 text += "Press H to reset view \n";
843 text += "Press Esc to exit FullScreen \n";
844 text += "\n";
845 text += "========= Video ========= \n";
846 text += "In video mode : \n";
847 text += " Press SPACE to Start/Pause video recording \n";
848 text += " Press RETURN to Stop video recording \n";
849 text += "\n";
850
851 G4cout << text;
852
853 if ( fShortcutsDialog == NULL) {
854 fShortcutsDialog = new QDialog();
855 fShortcutsDialogInfos = new QTextEdit() ;
856 QVBoxLayout *mainLayout = new QVBoxLayout;
857 mainLayout->addWidget(fShortcutsDialogInfos);
858 fShortcutsDialog->setLayout(mainLayout);
859 fShortcutsDialog->setWindowTitle(tr("Shortcuts"));
860 }
861
862 fShortcutsDialogInfos->setPlainText(text.data());
863 fShortcutsDialog->show();
864}
QTextEdit * fShortcutsDialogInfos

References fShortcutsDialog, fShortcutsDialogInfos, fUiQt, G4cout, G4UIQt::IsIconMoveSelected(), G4UIQt::IsIconPickSelected(), and G4UIQt::IsIconRotateSelected().

Referenced by createPopupMenu().

◆ ShowView()

void G4VViewer::ShowView ( void  )
virtualinherited

◆ sizeHasChanged()

G4bool G4OpenGLViewer::sizeHasChanged ( )
protectedinherited

◆ startPauseVideo

void G4OpenGLQtViewer::startPauseVideo ( )
slot

Start/Pause the video..

Definition at line 1807 of file G4OpenGLQtViewer.cc.

1807 {
1808
1809 // first time, if temp parameter is wrong, display parameters dialog and return
1810
1811 if ( fRecordingStep == WAIT) {
1812 if ( fRecordFrameNumber == 0) {
1813 if (getTempFolderPath() == "") { // BAD_OUTPUT
1815 setRecordingInfos("You should specified the temp folder in order to make movie");
1816 return;
1817 } else {
1818 // remove temp folder if it was create
1819 QString tmp = removeTempFolder();
1820 if (tmp !="") {
1821 setRecordingInfos(tmp);
1822 return;
1823 }
1824 tmp = createTempFolder();
1825 if (tmp != "") {
1826 setRecordingInfos("Can't create temp folder."+tmp);
1827 return;
1828 }
1829 }
1830 }
1831 }
1832 if (fRecordingStep == WAIT) {
1834 } else if (fRecordingStep == START) {
1836 } else if (fRecordingStep == PAUSE) {
1838 } else if (fRecordingStep == CONTINUE) {
1840 }
1841}

References CONTINUE, createTempFolder(), fRecordFrameNumber, fRecordingStep, getTempFolderPath(), PAUSE, removeTempFolder(), setRecordingInfos(), setRecordingStatus(), showMovieParametersDialog(), START, and WAIT.

Referenced by G4keyPressEvent().

◆ stopVideo()

void G4OpenGLQtViewer::stopVideo ( )

Stop the video. Check all parameters and enable encoder button if all is ok.

Definition at line 1764 of file G4OpenGLQtViewer.cc.

1764 {
1765
1766 // if encoder parameter is wrong, display parameters dialog and return
1769 }
1771
1772 if (fRecordFrameNumber >0) {
1773 // check parameters if they were modified (Re APPLY them...)
1778 }
1779 } else {
1781 setRecordingInfos("No frame to encode.");
1782 }
1783}

References BAD_ENCODER, BAD_OUTPUT, G4OpenGLQtMovieDialog::checkEncoderSwParameters(), G4OpenGLQtMovieDialog::checkSaveFileNameParameters(), fMovieParametersDialog, fRecordFrameNumber, resetRecording(), setRecordingInfos(), setRecordingStatus(), showMovieParametersDialog(), and STOP.

Referenced by G4keyPressEvent(), and G4OpenGLQtMovieDialog::stopFinishClose().

◆ tableWidgetViewerSetItemChanged

void G4OpenGLQtViewer::tableWidgetViewerSetItemChanged ( QTableWidgetItem *  item)
privateslot

Definition at line 4721 of file G4OpenGLQtViewer.cc.

4721 {
4723 if(UI != NULL) {
4724 QTableWidgetItem* previous = fViewerPropertiesTableWidget->item(fViewerPropertiesTableWidget->row(item),0);
4725 if (previous) {
4726 fViewerPropertiesTableWidget->blockSignals(true);
4727 UI->ApplyCommand((std::string("/vis/viewer/set/")
4728 + previous->text().toStdString()
4729 + " "
4730 + item->text().toStdString()).c_str());
4731 fViewerPropertiesTableWidget->blockSignals(false);
4732 }
4733 }
4734}

References G4UImanager::ApplyCommand(), fViewerPropertiesTableWidget, and G4UImanager::GetUIpointer().

Referenced by createViewerPropertiesWidget().

◆ toggleAntialiasing

void G4OpenGLQtViewer::toggleAntialiasing ( bool  check)
privateslot

SLOT Activate by a click on the antialiasing menu

Parameters
check: 1 , 0

Definition at line 968 of file G4OpenGLQtViewer.cc.

968 {
969
970 if (!check) {
971 antialiasing_enabled = false;
972 glDisable (GL_LINE_SMOOTH);
973 glDisable (GL_POLYGON_SMOOTH);
974 } else {
976 glEnable (GL_LINE_SMOOTH);
977 glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
978 glEnable (GL_POLYGON_SMOOTH);
979 glHint (GL_POLYGON_SMOOTH_HINT, GL_NICEST);
980 }
981
984}

References G4OpenGLViewer::antialiasing_enabled, updateQWidget(), and updateToolbarAndMouseContextMenu().

Referenced by createPopupMenu().

◆ toggleAux

void G4OpenGLQtViewer::toggleAux ( bool  check)
privateslot

SLOT Activate by a click on the auxiliaire edges menu

Parameters
check: 1 , 0

Definition at line 1007 of file G4OpenGLQtViewer.cc.

1007 {
1008 if (check) {
1009 fVP.SetAuxEdgeVisible(true);
1010 } else {
1011 fVP.SetAuxEdgeVisible(false);
1012 }
1013 SetNeedKernelVisit (true);
1015 updateQWidget();
1016}
void SetNeedKernelVisit(G4bool need)
void SetAuxEdgeVisible(G4bool)

References G4VViewer::fVP, G4ViewParameters::SetAuxEdgeVisible(), G4VViewer::SetNeedKernelVisit(), updateQWidget(), and updateToolbarAndMouseContextMenu().

Referenced by createPopupMenu().

◆ toggleFullScreen

void G4OpenGLQtViewer::toggleFullScreen ( bool  check)
privateslot

SLOT Activate by a click on the full screen menu

Definition at line 1059 of file G4OpenGLQtViewer.cc.

1059 {
1060 if (check != fGLWidget->isFullScreen()) { //toggle
1061 fGLWidget->setWindowState(fGLWidget->windowState() ^ Qt::WindowFullScreen);
1062 }
1063}

References fGLWidget.

Referenced by createPopupMenu(), and G4keyPressEvent().

◆ toggleHaloing

void G4OpenGLQtViewer::toggleHaloing ( bool  check)
privateslot

SLOT Activate by a click on the haloing menu

Parameters
check: 1 , 0

Definition at line 991 of file G4OpenGLQtViewer.cc.

991 {
992 if (check) {
993 haloing_enabled = false;
994 } else {
995 haloing_enabled = true;
996 }
997
1000
1001}

References G4OpenGLViewer::haloing_enabled, updateQWidget(), and updateToolbarAndMouseContextMenu().

Referenced by createPopupMenu().

◆ toggleHiddenMarkers

void G4OpenGLQtViewer::toggleHiddenMarkers ( bool  check)
privateslot

SLOT Activate by a click on the hidden marker menu

Parameters
check: 1 , 0

Definition at line 1045 of file G4OpenGLQtViewer.cc.

1045 {
1046 if (check) {
1048 } else {
1050 }
1051 // SetNeedKernelVisit (true);
1053 updateQWidget();
1054}
void SetMarkerHidden()
void SetMarkerNotHidden()

References G4VViewer::fVP, G4ViewParameters::SetMarkerHidden(), G4ViewParameters::SetMarkerNotHidden(), updateQWidget(), and updateToolbarAndMouseContextMenu().

Referenced by createPopupMenu().

◆ toggleMouseAction

void G4OpenGLQtViewer::toggleMouseAction ( int  aAction)
privateslot

Slot activated when mouse action is toggle

Parameters
aAction: 1 rotate, 2 move, 3 pick, 4 zoom out, 5 zoom in
See also
G4OpenGLStoredQtViewer::DrawView
G4XXXStoredViewer::CompareForKernelVisit

Definition at line 874 of file G4OpenGLQtViewer.cc.

874 {
875
876 if (aAction == 1) {
878 } else if (aAction == 2) {
880 } else if (aAction == 3) {
882 } else if (aAction == 4) {
884 } else if (aAction == 5) {
886 }
887
890}
void SetIconZoomInSelected()
Definition: G4UIQt.cc:4899
void SetIconZoomOutSelected()
Definition: G4UIQt.cc:4930
void SetIconRotateSelected()
Definition: G4UIQt.cc:4842
void SetIconMoveSelected()
Definition: G4UIQt.cc:4816

References fUiQt, G4UIQt::SetIconMoveSelected(), G4UIQt::SetIconRotateSelected(), G4UIQt::SetIconZoomInSelected(), G4UIQt::SetIconZoomOutSelected(), togglePicking(), updateQWidget(), and updateToolbarAndMouseContextMenu().

Referenced by createPopupMenu().

◆ togglePicking

void G4OpenGLQtViewer::togglePicking ( )
privateslot

Definition at line 1019 of file G4OpenGLQtViewer.cc.

1019 {
1020 // FIXME : Not the good way to do, we should handle the multiple cases of Icon/ContextMenu and CheckBox in a better way
1021 if (fUiQt) {
1022 if (!fVP.IsPicking()) {
1024 } else {
1026 }
1027 }
1028
1030 if(UI != NULL) {
1031 if (!fVP.IsPicking()) {
1032 UI->ApplyCommand(std::string("/vis/viewer/set/picking true"));
1033 } else {
1034 UI->ApplyCommand(std::string("/vis/viewer/set/picking false"));
1035 }
1036 }
1037
1038}
void SetIconPickSelected()
Definition: G4UIQt.cc:4868

References G4UImanager::ApplyCommand(), fUiQt, G4VViewer::fVP, G4UImanager::GetUIpointer(), G4ViewParameters::IsPicking(), G4UIQt::SetIconPickSelected(), and G4UIQt::SetIconRotateSelected().

Referenced by toggleMouseAction().

◆ toggleProjection

void G4OpenGLQtViewer::toggleProjection ( bool  check)
privateslot

SLOT Activate by a click on the projection menu Warning : When G4OpenGLStoredQtViewer::DrawView() method call, KernelVisitDecision () will be call and will set the fNeedKernelVisit to 1. See G4XXXStoredViewer::CompareForKernelVisit for explanations. It will cause a redraw of the view

Parameters
check: 1 orthographic, 2 perspective
See also
G4OpenGLStoredQtViewer::DrawView
G4XXXStoredViewer::CompareForKernelVisit

Definition at line 936 of file G4OpenGLQtViewer.cc.

936 {
937
938 if (check == 1) {
940 } else {
942 }
945}
void SetPerspectiveProjection(G4double fieldHalfAngle=30. *CLHEP::deg)
void SetOrthogonalProjection()

References G4VViewer::fVP, G4ViewParameters::SetOrthogonalProjection(), G4ViewParameters::SetPerspectiveProjection(), updateQWidget(), and updateToolbarAndMouseContextMenu().

Referenced by createPopupMenu().

◆ toggleSceneTreeComponentPickingCout

void G4OpenGLQtViewer::toggleSceneTreeComponentPickingCout ( int  pickItem)
privateslot

Definition at line 4682 of file G4OpenGLQtViewer.cc.

4682 {
4683
4684 QWidget* w;
4685 // close other items, it could take too much space
4686
4687 for (int a=0; a<fPickInfosWidget->layout()->count(); a++) {
4688 w = fPickInfosWidget->layout()->itemAt(a)->widget();
4689 QTextEdit* ed = dynamic_cast<QTextEdit*>(w);
4690 QPushButton* button;
4691 if (ed) {
4692 if (a == pickItem) {
4693 w->setVisible(!w->isVisible());
4694 } else {
4695 w->setVisible(false);
4696 }
4697 if (a >= 1) {
4698 button = dynamic_cast<QPushButton*>(fPickInfosWidget->layout()->itemAt(a-1)->widget());
4699 if (button) {
4700 if (button->isVisible()) {
4701 button->setIcon(*fTreeIconOpen);
4702 } else {
4703 button->setIcon(*fTreeIconClosed);
4704 }
4705 }
4706 }
4707 }
4708 }
4709}

References fPickInfosWidget, fTreeIconClosed, and fTreeIconOpen.

Referenced by updatePickInfosWidget().

◆ toggleSurfaceAction

void G4OpenGLQtViewer::toggleSurfaceAction ( int  aAction)
privateslot

Slot activated when drawing menu is toggle Warning : When G4OpenGLStoredQtViewer::DrawView() method call, KernelVisitDecision () will be call and will set the fNeedKernelVisit to 1. See G4XXXStoredViewer::CompareForKernelVisit for explanations. It will cause a redraw of the view

Parameters
aAction: 1 wireframe, 2 line removal, 3 surface removal, 4 line & surface removal
See also
G4OpenGLStoredQtViewer::DrawView
G4XXXStoredViewer::CompareForKernelVisit

Definition at line 903 of file G4OpenGLQtViewer.cc.

903 {
904
906
907 if (aAction ==1) {
909
910 } else if (aAction ==2) {
911 d_style = G4ViewParameters::hlr;
912
913 } else if (aAction ==3) {
914 d_style = G4ViewParameters::hsr;
915
916 } else if (aAction ==4) {
917 d_style = G4ViewParameters::hlhsr;
918 }
919 fVP.SetDrawingStyle(d_style);
920
923}
void SetDrawingStyle(G4ViewParameters::DrawingStyle style)

References G4VViewer::fVP, G4ViewParameters::hlhsr, G4ViewParameters::hlr, G4ViewParameters::hsr, G4ViewParameters::SetDrawingStyle(), updateQWidget(), updateToolbarAndMouseContextMenu(), and G4ViewParameters::wireframe.

Referenced by createPopupMenu().

◆ toggleTransparency

void G4OpenGLQtViewer::toggleTransparency ( bool  check)
privateslot

SLOT Activate by a click on the transparency menu

Parameters
check: 1 , 0

Definition at line 952 of file G4OpenGLQtViewer.cc.

952 {
953
954 if (check) {
956 } else {
957 transparency_enabled = false;
958 }
959 SetNeedKernelVisit (true);
962}

References G4VViewer::SetNeedKernelVisit(), G4OpenGLViewer::transparency_enabled, updateQWidget(), and updateToolbarAndMouseContextMenu().

Referenced by createPopupMenu().

◆ 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 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 setCheckComponent().

◆ updateKeyModifierState()

void G4OpenGLQtViewer::updateKeyModifierState ( const Qt::KeyboardModifiers &  modifier)
protected

Definition at line 1739 of file G4OpenGLQtViewer.cc.

1739 {
1740 // Check Qt Versions for META Keys
1741
1742 fNoKeyPress = true;
1743 fAltKeyPress = false;
1744 fShiftKeyPress = false;
1745 fControlKeyPress = false;
1746
1747 if (modifier & Qt::AltModifier ) {
1748 fAltKeyPress = true;
1749 fNoKeyPress = false;
1750 }
1751 if (modifier & Qt::ShiftModifier ) {
1752 fShiftKeyPress = true;
1753 fNoKeyPress = false;
1754 }
1755 if (modifier & Qt::ControlModifier ) {
1756 fControlKeyPress = true;
1757 fNoKeyPress = false;
1758 }
1759}

References fAltKeyPress, fControlKeyPress, fNoKeyPress, and fShiftKeyPress.

Referenced by G4keyPressEvent(), and G4MouseMoveEvent().

◆ updatePickInfosWidget()

void G4OpenGLQtViewer::updatePickInfosWidget ( int  aX,
int  aY 
)

Update the pick infos component widget

Definition at line 4527 of file G4OpenGLQtViewer.cc.

4527 {
4528 fLastPickPoint = QPoint(aX,aY);
4529
4530 if (!isCurrentWidget()) {
4531 return;
4532 }
4533 // Ensure case where closing a UI tab close the widget
4534 if (!fPickInfosWidget) {
4536 }
4537
4538 const std::vector < G4OpenGLViewerPickMap* > & pickMapVector = GetPickDetails(aX,aY);
4539
4540 // remove all previous widgets
4541 if (fPickInfosWidget) {
4542 QLayoutItem * wItem;
4543 if (fPickInfosWidget->layout()->count()) {
4544 while ((wItem = fPickInfosWidget->layout()->takeAt(0)) != 0) {
4545 delete wItem->widget();
4546 delete wItem;
4547 }
4548 }
4549 } else {
4550 // Ensure case where closing a UI tab close the widget
4551 if (!fPickInfosWidget) {
4553 }
4554 }
4555
4556 // Create a new signalMapper
4557#if QT_VERSION < 0x050600
4558 delete fSignalMapperPicking;
4559 fSignalMapperPicking = new QSignalMapper(this);
4560#endif
4561
4562 // parse all pick results
4563 G4int nPickedObjectsWithAttributes = 0;
4564 for (unsigned int a=0; a< pickMapVector.size(); a++) {
4565 const auto& pickMap = pickMapVector[a];
4566 // Add a box inside the pick viewer box
4567 std::ostringstream label;
4568 std::ostringstream content;
4569 std::string txt = pickMap->getAttributes()[0].data();
4570 if (pickMapVector[a]->getAttributes().size()) {
4571 ++nPickedObjectsWithAttributes;
4572
4573 std::size_t pos1 = txt.find(':');
4574 std::string storeKey = txt.substr(0,pos1);
4575
4576 if (storeKey == "G4PhysicalVolumeModel") {
4577
4578 label << "Volume:";
4579 std::size_t pos2 = txt.find(':',pos1+1);
4580 std::size_t pos3 = txt.find('\n',pos2+1);
4581 label << txt.substr(pos2+1,pos3-pos2-1);
4582
4583 } else if (storeKey == "G4TrajectoriesModel") {
4584
4585 label << "Trajectory:";
4586 std::size_t pos2 = txt.find(':',pos1+1);
4587 std::size_t pos3 = txt.find('\n',pos2+1);
4588 label << " Run:" << txt.substr(pos2+1,pos3-pos2-1);
4589 std::size_t pos4 = txt.find(':',pos3+1);
4590 std::size_t pos5 = txt.find('\n',pos4+1);
4591 label << ", Event:" << txt.substr(pos4+1,pos5-pos4-1);
4592
4593 } else {
4594
4595 label << "Hit number:" << a << ", PickName: " << pickMap->getPickName();
4596
4597 }
4598
4599 // Accumulate all content with the same pickname
4600 content << pickMap->print().data();
4601 G4int thisPickName = pickMap->getPickName();
4602 while (++a < pickMapVector.size()) {
4603 const auto& a_pickMap = pickMapVector[a];
4604 if (a_pickMap->getPickName() == thisPickName) {
4605 content << a_pickMap->print().data();
4606 } else {
4607 a--;
4608 break;
4609 }
4610 }
4611
4612 QPushButton* pickCoutButton = new QPushButton(label.str().c_str());
4613 pickCoutButton->setStyleSheet ("text-align: left; padding: 1px; border: 0px;");
4614 pickCoutButton->setIcon(*fTreeIconClosed);
4615 fPickInfosWidget->layout()->addWidget(pickCoutButton);
4616
4617 QStringList newStr;
4618
4619 // Add to stringList
4620 newStr = QStringList(QString(content.str().c_str()).trimmed());
4621
4622 QTextEdit* ed = new QTextEdit();
4623 ed->setReadOnly(true);
4624 fPickInfosWidget->layout()->addWidget(ed);
4625 ed->setVisible((false));
4626 ed->append(newStr.join(""));
4627
4628#if QT_VERSION < 0x050600
4629 connect(pickCoutButton, SIGNAL(clicked()), fSignalMapperPicking, SLOT(map()));
4630 fSignalMapperPicking->setMapping(pickCoutButton,fPickInfosWidget->layout()->count()-1);
4631#else
4632 std::cout << pickCoutButton->text().toStdString() << " "<< fPickInfosWidget->layout()->count()-1<< std::endl;
4633 int tmp = fPickInfosWidget->layout()->count()-1;
4634 connect(pickCoutButton, &QPushButton::clicked , [this, tmp](){ this->toggleSceneTreeComponentPickingCout(tmp);});
4635#endif
4636 }
4637 }
4638#if QT_VERSION < 0x050600
4639 connect(fSignalMapperPicking, SIGNAL(mapped(int)),this, SLOT(toggleSceneTreeComponentPickingCout(int)));
4640#endif
4641
4642 // add a label to push everything up!
4643 QLabel * pushUp = new QLabel("");
4644 QSizePolicy vPolicy = QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
4645 vPolicy.setVerticalStretch(10);
4646 pushUp->setSizePolicy(vPolicy);
4647 fPickInfosWidget->layout()->addWidget(pushUp);
4648
4649 // highlight the first one :
4650
4651 // first un-highlight the last selected
4653
4654 if (pickMapVector.size() > 0 ) {
4655 // get the new one
4656 fLastHighlightName = pickMapVector[0]->getPickName();
4658 // set the new one
4660
4661 updateQWidget();
4662 }
4663 QDialog* dial = static_cast<QDialog*> (fUIPickInfosWidget->parent());
4664 if (dial) {
4665 // change name
4666 std::ostringstream oss;
4667 if (nPickedObjectsWithAttributes == 0) {
4668 oss << "No object";
4669 } else if (nPickedObjectsWithAttributes == 1) {
4670 oss << "1 object";
4671 } else {
4672 oss << nPickedObjectsWithAttributes << " objects";
4673 }
4674 oss << " selected - " << GetName();
4675 dial->setWindowTitle(oss.str().c_str());
4676 }
4677 // set picking cout visible
4678 fPickInfosScrollArea->setVisible(true);
4679}
void toggleSceneTreeComponentPickingCout(int)

References changeColorAndTransparency(), g4zmq::connect(), createPickInfosWidget(), fLastHighlightColor, fLastHighlightName, fLastPickPoint, fPickInfosScrollArea, fPickInfosWidget, fSignalMapperPicking, fTreeIconClosed, fUIPickInfosWidget, getColorForPoIndex(), G4VViewer::GetName(), G4OpenGLViewer::GetPickDetails(), isCurrentWidget(), anonymous_namespace{G4QuasiElRatios.cc}::map, toggleSceneTreeComponentPickingCout(), and updateQWidget().

Referenced by createPickInfosWidget(), and G4MouseReleaseEvent().

◆ updatePositivePoIndexSceneTreeWidgetQuickMap()

void G4OpenGLQtViewer::updatePositivePoIndexSceneTreeWidgetQuickMap ( int  POindex,
QTreeWidgetItem *  item 
)
private

Update the quick scene tree visibility map (used by parseAndCheckVisibility)

Definition at line 3968 of file G4OpenGLQtViewer.cc.

3968 {
3969
3970 // Check state
3971 std::map <int, QTreeWidgetItem*>::iterator i;
3973
3975 fPositivePoIndexSceneTreeWidgetQuickMap.insert(std::pair <int, QTreeWidgetItem*> (POindex,item) );
3978 } else {
3979 i->second = item;
3980 }
3981 }

References fLastSceneTreeWidgetAskForIterator, fLastSceneTreeWidgetAskForIteratorEnd, and fPositivePoIndexSceneTreeWidgetQuickMap.

Referenced by changeDepthOnSceneTreeItem(), changeQColorForTreeWidgetItem(), createTreeWidgetItem(), parseAndInsertInSceneTree(), and setCheckComponent().

◆ updateQWidget()

virtual void G4OpenGLQtViewer::updateQWidget ( )
pure virtual

◆ updateSceneTreeWidget()

void G4OpenGLQtViewer::updateSceneTreeWidget ( )

Update the scene tree widget

Definition at line 4208 of file G4OpenGLQtViewer.cc.

4208 {
4209 // Ensure case where closing a UI tab close the widget
4210 if (!fSceneTreeWidget) {
4212 }
4213}

References createSceneTreeWidget(), and fSceneTreeWidget.

Referenced by G4OpenGLImmediateQtViewer::updateQWidget(), and G4OpenGLStoredQtViewer::updateQWidget().

◆ updateToolbarAndMouseContextMenu

void G4OpenGLQtViewer::updateToolbarAndMouseContextMenu ( )
protectedslot

Update the toolbar Icons/Mouse context menu

  • Change ortho/perspective
  • Change surface style
  • Change cursor style

Definition at line 4107 of file G4OpenGLQtViewer.cc.

4107 {
4108 if (fBatchMode) {
4109 return;
4110 }
4111
4113 d_style = fVP.GetDrawingStyle();
4114
4115 // Surface style
4116 if (d_style == G4ViewParameters::wireframe) {
4118 if (fContextMenu) {
4119 fDrawingWireframe->setChecked(true);
4120 fDrawingLineRemoval->setChecked(false);
4121 fDrawingSurfaceRemoval->setChecked(false);
4122 fDrawingLineSurfaceRemoval->setChecked(false);
4123 }
4124 } else if (d_style == G4ViewParameters::hlr) {
4126 if (fContextMenu) {
4127 fDrawingLineRemoval->setChecked(true);
4128 fDrawingWireframe->setChecked(false);
4129 fDrawingSurfaceRemoval->setChecked(false);
4130 fDrawingLineSurfaceRemoval->setChecked(false);
4131 }
4132 } else if (d_style == G4ViewParameters::hsr) {
4134 if (fContextMenu) {
4135 fDrawingSurfaceRemoval->setChecked(true);
4136 fDrawingWireframe->setChecked(false);
4137 fDrawingLineRemoval->setChecked(false);
4138 fDrawingLineSurfaceRemoval->setChecked(false);
4139 }
4140 } else if (d_style == G4ViewParameters::hlhsr) {
4142 if (fContextMenu) {
4143 fDrawingLineSurfaceRemoval->setChecked(true);
4144 fDrawingWireframe->setChecked(false);
4145 fDrawingLineRemoval->setChecked(false);
4146 fDrawingSurfaceRemoval->setChecked(false);
4147 fDrawingLineSurfaceRemoval->setChecked(false);
4148 }
4149 }
4150
4151
4152 // projection style
4153 G4double d_proj = fVP.GetFieldHalfAngle () ;
4154 if (d_proj == 0.) { // ortho
4156 if (fContextMenu) {
4157 fProjectionOrtho->setChecked(true);
4158 fProjectionPerspective->setChecked(false);
4159 }
4160 } else {
4162 if (fContextMenu) {
4163 fProjectionPerspective->setChecked(true);
4164 fProjectionOrtho->setChecked(false);
4165 }
4166 }
4167
4168
4169 // mouse style : They are controlled by UI !
4170 if (fUiQt && fContextMenu) {
4171 if (fUiQt->IsIconPickSelected()) {
4172 fMousePickAction->setChecked(true);
4173 fMouseZoomOutAction->setChecked(false);
4174 fMouseZoomInAction->setChecked(false);
4175 fMouseRotateAction->setChecked(false);
4176 fMouseMoveAction->setChecked(false);
4177 } else if (fUiQt->IsIconZoomOutSelected()) {
4178 fMouseZoomOutAction->setChecked(true);
4179 fMousePickAction->setChecked(false);
4180 fMouseZoomInAction->setChecked(false);
4181 fMouseRotateAction->setChecked(false);
4182 fMouseMoveAction->setChecked(false);
4183 } else if (fUiQt->IsIconZoomInSelected()) {
4184 fMouseZoomInAction->setChecked(true);
4185 fMousePickAction->setChecked(false);
4186 fMouseZoomOutAction->setChecked(false);
4187 fMouseRotateAction->setChecked(false);
4188 fMouseMoveAction->setChecked(false);
4189 } else if (fUiQt->IsIconRotateSelected()) {
4190 fMouseRotateAction->setChecked(true);
4191 fMousePickAction->setChecked(false);
4192 fMouseZoomOutAction->setChecked(false);
4193 fMouseZoomInAction->setChecked(false);
4194 fMouseMoveAction->setChecked(false);
4195 } else if (fUiQt->IsIconMoveSelected()) {
4196 fMouseMoveAction->setChecked(true);
4197 fMousePickAction->setChecked(false);
4198 fMouseZoomOutAction->setChecked(false);
4199 fMouseZoomInAction->setChecked(false);
4200 fMouseRotateAction->setChecked(false);
4201 }
4202 }
4203}
void SetIconOrthoSelected()
Definition: G4UIQt.cc:5081
void SetIconHLRSelected()
Definition: G4UIQt.cc:5009
void SetIconPerspectiveSelected()
Definition: G4UIQt.cc:5059
void SetIconSolidSelected()
Definition: G4UIQt.cc:4961
void SetIconWireframeSelected()
Definition: G4UIQt.cc:4985
void SetIconHLHSRSelected()
Definition: G4UIQt.cc:5034
DrawingStyle GetDrawingStyle() const

References fBatchMode, fContextMenu, fDrawingLineRemoval, fDrawingLineSurfaceRemoval, fDrawingSurfaceRemoval, fDrawingWireframe, fMouseMoveAction, fMousePickAction, fMouseRotateAction, fMouseZoomInAction, fMouseZoomOutAction, fProjectionOrtho, fProjectionPerspective, fUiQt, G4VViewer::fVP, G4ViewParameters::GetDrawingStyle(), G4ViewParameters::GetFieldHalfAngle(), G4ViewParameters::hlhsr, G4ViewParameters::hlr, G4ViewParameters::hsr, G4UIQt::IsIconMoveSelected(), G4UIQt::IsIconPickSelected(), G4UIQt::IsIconRotateSelected(), G4UIQt::IsIconZoomInSelected(), G4UIQt::IsIconZoomOutSelected(), G4UIQt::SetIconHLHSRSelected(), G4UIQt::SetIconHLRSelected(), G4UIQt::SetIconOrthoSelected(), G4UIQt::SetIconPerspectiveSelected(), G4UIQt::SetIconSolidSelected(), G4UIQt::SetIconWireframeSelected(), and G4ViewParameters::wireframe.

Referenced by actionChangeBackgroundColor(), actionChangeDefaultColor(), actionChangeTextColor(), createPopupMenu(), G4OpenGLImmediateQtViewer::paintGL(), G4OpenGLStoredQtViewer::paintGL(), toggleAntialiasing(), toggleAux(), toggleHaloing(), toggleHiddenMarkers(), toggleMouseAction(), toggleProjection(), toggleSurfaceAction(), and toggleTransparency().

◆ updateViewerPropertiesTableWidget()

void G4OpenGLQtViewer::updateViewerPropertiesTableWidget ( )

Update the viewer properties component widget Clear it only if the number of command is less than the previous table widget row count

Definition at line 4220 of file G4OpenGLQtViewer.cc.

4220 {
4221
4222 if (!isCurrentWidget()) {
4223 return;
4224 }
4225
4226 // Ensure case where closing a UI tab close the widget
4229 }
4230 int treeWidgetInfosIgnoredCommands = 0;
4232 G4UIcommandTree * commandTreeTop = UI->GetTree();
4233 G4UIcommandTree* path = commandTreeTop->FindCommandTree("/vis/viewer/set/");
4234
4235 if (!path) {
4236 return;
4237 }
4238
4239 // clear old table
4242 }
4243
4244 fViewerPropertiesTableWidget->blockSignals(true);
4245 // TODO : Could be optimized by comparing current command to old commands. That should not change so much
4246
4247 fViewerPropertiesTableWidget->setColumnCount (2);
4249 fViewerPropertiesTableWidget->setHorizontalHeaderLabels(QStringList() << tr("Property")
4250 << tr("Value"));
4251 fViewerPropertiesTableWidget->verticalHeader()->setVisible(false);
4252 fViewerPropertiesTableWidget->setAlternatingRowColors (true);
4253
4254 // For the moment, we do only command that have a "set" command in UI
4255
4256 for (int a=0;a<path->GetCommandEntry();a++) {
4257 G4UIcommand* commandTmp = path->GetCommand(a+1);
4258
4259 // get current parameters
4260 QString params = "";
4261
4262 if(commandTmp->GetCommandName() == "autoRefresh") {
4263 if (fVP.IsAutoRefresh()) {
4264 params = "True";
4265 } else {
4266 params = "False";
4267 }
4268 } else if(commandTmp->GetCommandName() == "auxiliaryEdge") {
4269 if (fVP.IsAuxEdgeVisible()) {
4270 params = "True";
4271 } else {
4272 params = "False";
4273 }
4274 } else if(commandTmp->GetCommandName() == "background") {
4275 params = QString().number(fVP.GetBackgroundColour().GetRed()) + " "+
4276 QString().number(fVP.GetBackgroundColour().GetGreen()) + " "+
4277 QString().number(fVP.GetBackgroundColour().GetBlue()) + " "+
4278 QString().number(fVP.GetBackgroundColour().GetAlpha());
4279
4280 } else if(commandTmp->GetCommandName() == "culling") {
4281 params = QString().number(fVP. IsCulling ());
4282 } else if(commandTmp->GetCommandName() == "cutawayMode") {
4284 params = "union";
4285 } else {
4286 params = "intersection";
4287 }
4288
4289 } else if(commandTmp->GetCommandName() == "defaultColour") {
4290 params = QString().number(fVP.GetDefaultVisAttributes()->GetColor().GetRed()) + " "+
4291 QString().number(fVP.GetDefaultVisAttributes()->GetColor().GetGreen()) + " "+
4292 QString().number(fVP.GetDefaultVisAttributes()->GetColor().GetBlue()) + " "+
4293 QString().number(fVP.GetDefaultVisAttributes()->GetColor().GetAlpha());
4294
4295 } else if(commandTmp->GetCommandName() == "defaultTextColour") {
4296 params = QString().number(fVP.GetDefaultTextVisAttributes()->GetColor().GetRed()) + " "+
4297 QString().number(fVP.GetDefaultTextVisAttributes()->GetColor().GetGreen()) + " "+
4298 QString().number(fVP.GetDefaultTextVisAttributes()->GetColor().GetBlue()) + " "+
4299 QString().number(fVP.GetDefaultTextVisAttributes()->GetColor().GetAlpha());
4300
4301 } else if(commandTmp->GetCommandName() == "edge") {
4303 params = "False";
4304 if (existingStyle == G4ViewParameters::hsr) {
4305 params = "True";
4306 }
4307
4308 } else if(commandTmp->GetCommandName() == "explodeFactor") {
4309 params = QString().number(fVP.GetExplodeFactor()) + " " + QString(G4String(G4BestUnit(fVP.GetExplodeFactor(),"Length")).data());
4310
4311 } else if(commandTmp->GetCommandName() == "globalLineWidthScale") {
4312 params = QString().number(fVP.GetGlobalLineWidthScale());
4313
4314 } else if(commandTmp->GetCommandName() == "globalMarkerScale") {
4315 params = QString().number(fVP.GetGlobalMarkerScale());
4316
4317 } else if(commandTmp->GetCommandName() == "hiddenEdge") {
4319 if ((style == G4ViewParameters::hlr) ||
4320 (style == G4ViewParameters::hlhsr)) {
4321 params = "True";
4322 } else {
4323 params = "False";
4324 }
4325
4326 } else if(commandTmp->GetCommandName() == "hiddenMarker") {
4327 if (fVP.IsMarkerNotHidden()) {
4328 params = "False";
4329 } else {
4330 params = "True";
4331 }
4332
4333 } else if(commandTmp->GetCommandName() == "lightsMove") {
4335 params = "camera";
4336 } else {
4337 params = "object";
4338 }
4339 } else if(commandTmp->GetCommandName() == "lightsThetaPhi") {
4341 // degree
4342 params = QString().number(direction.theta()/CLHEP::degree)+ " "+ QString().number(direction.phi()/CLHEP::degree)+" deg";
4343 if (commandTmp->GetParameterEntries() == 3) {
4344 if (commandTmp->GetParameter(2)->GetDefaultValue() != "deg") {
4345 params = QString().number(direction.theta())+ " "+ QString().number(direction.phi())+" "+commandTmp->GetParameter(2)->GetDefaultValue().data();
4346 }
4347 }
4348 } else if(commandTmp->GetCommandName() == "lightsVector") {
4349 params = QString().number(fVP.GetLightpointDirection().x()) + " "+
4350 QString().number(fVP.GetLightpointDirection().y()) + " "+
4351 QString().number(fVP.GetLightpointDirection().z());
4352
4353 } else if(commandTmp->GetCommandName() == "lineSegmentsPerCircle") {
4354 params = QString().number(fVP.GetNoOfSides());
4355
4356 } else if(commandTmp->GetCommandName() == "picking") {
4357 if (fVP.IsPicking()) {
4358 params = "True";
4359 } else {
4360 params = "False";
4361 }
4362
4363 } else if(commandTmp->GetCommandName() == "projection") {
4364 if (fVP.GetFieldHalfAngle() == 0.) {
4365 params = "orthogonal";
4366 } else {
4367 params = QString("perspective ") + QString().number(fVP.GetFieldHalfAngle()/CLHEP::degree) + " deg";
4368 }
4369
4370 } else if(commandTmp->GetCommandName() == "rotationStyle") {
4372 params = "constrainUpDirection";
4373 } else {
4374 params = "freeRotation";
4375 }
4376
4377 } else if(commandTmp->GetCommandName() == "sectionPlane") {
4378 if (fVP.IsSection()) {
4379 params = QString("on ") +
4380 G4String(G4BestUnit(fVP.GetSectionPlane().point(),"Length")).data()+
4381 QString().number(fVP.GetSectionPlane().normal().x())
4382 + " " + QString().number(fVP.GetSectionPlane().normal().y())
4383 + " " + QString().number(fVP.GetSectionPlane().normal().z());
4384 } else {
4385 params = "off";
4386 }
4387
4388 } else if(commandTmp->GetCommandName() == "style") {
4390 params = "wireframe";
4391 } else {
4392 params = "surface";
4393 }
4394
4395
4396 } else if(commandTmp->GetCommandName() == "targetPoint") {
4398 if (fSceneHandler.GetScene()) {
4400 params = b.data();
4401 }
4402 } else if(commandTmp->GetCommandName() == "upThetaPhi") {
4403 G4Vector3D up = fVP.GetUpVector();
4404 // degree
4405 params = QString().number(up.theta()/CLHEP::degree)+ " "+ QString().number(up.phi()/CLHEP::degree)+" deg";
4406 if (commandTmp->GetParameterEntries() == 3) {
4407 if (commandTmp->GetParameter(2)->GetDefaultValue() != "deg") {
4408 params = QString().number(up.theta())+ " "+ QString().number(up.phi())+" "+commandTmp->GetParameter(2)->GetDefaultValue().data();
4409 }
4410 }
4411 } else if(commandTmp->GetCommandName() == "upVector") {
4412 G4Vector3D up = fVP.GetUpVector();
4413 params = QString().number(up.x())+ " "+ QString().number(up.y())+" "+QString().number(up.z())+ " ";
4414
4415 } else if(commandTmp->GetCommandName() == "viewpointThetaPhi") {
4416 G4Vector3D direction = fVP.GetViewpointDirection();
4417 // degree
4418 params = QString().number(direction.theta()/CLHEP::degree)+ " "+ QString().number(direction.phi()/CLHEP::degree)+" deg";
4419 if (commandTmp->GetParameterEntries() == 3) {
4420 if (commandTmp->GetParameter(2)->GetDefaultValue() != "deg") {
4421 params = QString().number(direction.theta())+ " "+ QString().number(direction.phi())+" "+commandTmp->GetParameter(2)->GetDefaultValue().data();
4422 }
4423 }
4424 } else if(commandTmp->GetCommandName() == "viewpointVector") {
4425 G4Vector3D direction = fVP.GetViewpointDirection();
4426 params = QString().number(direction.x())+ " "+ QString().number(direction.y())+" "+QString().number(direction.z());
4427 } else {
4428 // No help
4429 }
4430
4431 /* DO NOT DISPLAY COMMANDS WITHOUT ANY PARAMETERS SET
4432 if (params == "") {
4433 // TODO : display default parameters // should not be editable ?
4434
4435 for( G4int i_thParameter=0; i_thParameter<commandTmp->GetParameterEntries(); i_thParameter++ ) {
4436 commandParam = commandTmp->GetParameter(i_thParameter);
4437
4438 if (QString(QChar(commandParam->GetParameterType())) == "b") {
4439 if (commandParam->GetDefaultValue().data()) {
4440 params += "True";
4441 } else {
4442 params += "False";
4443 }
4444 } else {
4445 params += QString((char*)(commandParam->GetDefaultValue()).data());
4446 }
4447 if (i_thParameter<commandTmp->GetParameterEntries()-1) {
4448 params += " ";
4449 }
4450 }
4451 }
4452 */
4453
4454 if (params != "") {
4455
4456 QTableWidgetItem *nameItem;
4457 QTableWidgetItem *paramItem;
4458
4459 // already present ?
4460 QList<QTableWidgetItem *> list = fViewerPropertiesTableWidget->findItems (commandTmp->GetCommandName().data(),Qt::MatchExactly);
4461 if (list.size() == 1) {
4462 nameItem = list.first();
4463 paramItem = fViewerPropertiesTableWidget->item(nameItem->row(),1);
4464
4465 } else {
4466 nameItem = new QTableWidgetItem();
4467 paramItem = new QTableWidgetItem();
4468 fViewerPropertiesTableWidget->setItem(a-treeWidgetInfosIgnoredCommands, 0, nameItem);
4469 fViewerPropertiesTableWidget->setItem(a-treeWidgetInfosIgnoredCommands, 1, paramItem);
4470
4471 // Set Guidance
4472 QString guidance;
4473 G4int n_guidanceEntry = commandTmp->GetGuidanceEntries();
4474 for( G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
4475 guidance += QString((char*)(commandTmp->GetGuidanceLine(i_thGuidance)).data()) + "\n";
4476 }
4477
4478 nameItem->setToolTip(guidance);
4479 paramItem->setToolTip(GetCommandParameterList(commandTmp));
4480
4481 fViewerPropertiesTableWidget->setRowHeight(a-treeWidgetInfosIgnoredCommands,15);
4482 }
4483
4484 // set current name and parameters
4485 nameItem->setText(commandTmp->GetCommandName().data());
4486 paramItem->setText(params);
4487
4488 nameItem->setFlags(Qt::NoItemFlags);
4489 nameItem->setForeground(QBrush());
4490
4491 } else {
4492 treeWidgetInfosIgnoredCommands++;
4493 }
4494 }
4495 // remove empty content row
4496 for (int i=0; i<treeWidgetInfosIgnoredCommands; i++) {
4498 }
4499
4500 // The resize should done only at creation
4503
4504 fViewerPropertiesTableWidget->resizeColumnsToContents();
4505
4506 int x = fViewerPropertiesTableWidget->horizontalHeader()->length();
4507 int y = fViewerPropertiesTableWidget->verticalHeader()->length()+ fViewerPropertiesTableWidget->horizontalHeader()->sizeHint().height() + 2;
4508
4509 // fViewerPropertiesTableWidget->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
4510 // fViewerPropertiesTableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
4511
4512 // resize to fit content
4513 QDialog* dial = static_cast<QDialog*> (fUIViewerPropertiesWidget->parent());
4514 if (dial) {
4515 dial->resize(x+56,y+46); // more or less (margins) ...
4516 }
4517 }
4518 fViewerPropertiesTableWidget->blockSignals(false);
4519
4520 fTreeWidgetInfosIgnoredCommands = treeWidgetInfosIgnoredCommands;
4521}
#define G4BestUnit(a, b)
QString GetCommandParameterList(const G4UIcommand *aCommand)
G4int GetCommandEntry() const
G4UIcommand * GetCommand(G4int i)
G4UIcommandTree * FindCommandTree(const char *commandPath)
const G4String & GetGuidanceLine(G4int i) const
Definition: G4UIcommand.hh:132
std::size_t GetGuidanceEntries() const
Definition: G4UIcommand.hh:128
const G4String & GetCommandName() const
Definition: G4UIcommand.hh:137
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:186
G4int GetNoOfSides() const
G4double GetExplodeFactor() const
G4double GetGlobalLineWidthScale() const
const G4Vector3D & GetLightpointDirection() const
G4bool IsSection() const
const G4VisAttributes * GetDefaultTextVisAttributes() const
G4double GetGlobalMarkerScale() const
const G4VisAttributes * GetDefaultVisAttributes() const
const G4Plane3D & GetSectionPlane() const
const G4Color & GetColor() const
Point3D< T > point(const Point3D< T > &p) const
Definition: Plane3D.h:115
Normal3D< T > normal() const
Definition: Plane3D.h:97
static constexpr double degree

References G4ViewParameters::constrainUpDirection, createViewerPropertiesWidget(), G4ViewParameters::cutawayUnion, CLHEP::degree, G4UIcommandTree::FindCommandTree(), G4VViewer::fSceneHandler, fTreeWidgetInfosIgnoredCommands, fUIViewerPropertiesWidget, fViewerPropertiesTableWidget, fViewerPropertiesTableWidgetIsInit, G4VViewer::fVP, G4BestUnit, G4Colour::GetAlpha(), G4ViewParameters::GetBackgroundColour(), G4Colour::GetBlue(), G4VisAttributes::GetColor(), G4UIcommandTree::GetCommand(), G4UIcommandTree::GetCommandEntry(), G4UIcommand::GetCommandName(), GetCommandParameterList(), G4ViewParameters::GetCurrentTargetPoint(), G4ViewParameters::GetCutawayMode(), G4ViewParameters::GetDefaultTextVisAttributes(), G4UIparameter::GetDefaultValue(), G4ViewParameters::GetDefaultVisAttributes(), G4ViewParameters::GetDrawingStyle(), G4ViewParameters::GetExplodeFactor(), G4ViewParameters::GetFieldHalfAngle(), G4ViewParameters::GetGlobalLineWidthScale(), G4ViewParameters::GetGlobalMarkerScale(), G4Colour::GetGreen(), G4UIcommand::GetGuidanceEntries(), G4UIcommand::GetGuidanceLine(), G4ViewParameters::GetLightpointDirection(), G4ViewParameters::GetLightsMoveWithCamera(), G4ViewParameters::GetNoOfSides(), G4UIcommand::GetParameter(), G4UIcommand::GetParameterEntries(), G4Colour::GetRed(), G4ViewParameters::GetRotationStyle(), G4VSceneHandler::GetScene(), G4ViewParameters::GetSectionPlane(), G4Scene::GetStandardTargetPoint(), G4UImanager::GetTree(), G4UImanager::GetUIpointer(), G4ViewParameters::GetUpVector(), G4ViewParameters::GetViewpointDirection(), G4ViewParameters::hlhsr, G4ViewParameters::hlr, G4ViewParameters::hsr, G4ViewParameters::IsAutoRefresh(), G4ViewParameters::IsAuxEdgeVisible(), isCurrentWidget(), G4ViewParameters::IsMarkerNotHidden(), G4ViewParameters::IsPicking(), G4ViewParameters::IsSection(), HepGeom::Plane3D< T >::normal(), HepGeom::BasicVector3D< T >::phi(), HepGeom::Plane3D< T >::point(), HepGeom::BasicVector3D< T >::theta(), G4ViewParameters::wireframe, HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

Referenced by createViewerPropertiesWidget(), G4OpenGLImmediateQtViewer::updateQWidget(), and G4OpenGLStoredQtViewer::updateQWidget().

Field Documentation

◆ antialiasing_enabled

G4bool G4OpenGLViewer::antialiasing_enabled
protectedinherited

◆ background

G4Colour G4OpenGLViewer::background
protectedinherited

◆ fAltKeyPress

bool G4OpenGLQtViewer::fAltKeyPress
private

◆ fAutoMove

bool G4OpenGLQtViewer::fAutoMove
private

◆ fBatchMode

bool G4OpenGLQtViewer::fBatchMode
private

◆ fCheckSceneTreeComponentSignalLock

bool G4OpenGLQtViewer::fCheckSceneTreeComponentSignalLock
private

Definition at line 327 of file G4OpenGLQtViewer.hh.

Referenced by changeDepthInSceneTree(), and sceneTreeComponentItemChanged().

◆ fContextMenu

QMenu* G4OpenGLQtViewer::fContextMenu
private

◆ fControlKeyPress

bool G4OpenGLQtViewer::fControlKeyPress
private

Definition at line 324 of file G4OpenGLQtViewer.hh.

Referenced by G4keyPressEvent(), G4MouseMoveEvent(), and updateKeyModifierState().

◆ 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 actionSaveImage().

◆ fDefaultVP

G4ViewParameters G4VViewer::fDefaultVP
protectedinherited

◆ fDeltaDepth

G4double G4OpenGLQtViewer::fDeltaDepth
private

Definition at line 279 of file G4OpenGLQtViewer.hh.

Referenced by moveScene(), and ResetView().

◆ fDeltaZoom

G4double G4OpenGLQtViewer::fDeltaZoom
private

Definition at line 281 of file G4OpenGLQtViewer.hh.

Referenced by G4keyPressEvent(), and ResetView().

◆ fDrawingLineRemoval

QAction* G4OpenGLQtViewer::fDrawingLineRemoval
private

Definition at line 302 of file G4OpenGLQtViewer.hh.

Referenced by createPopupMenu(), and updateToolbarAndMouseContextMenu().

◆ fDrawingLineSurfaceRemoval

QAction* G4OpenGLQtViewer::fDrawingLineSurfaceRemoval
private

Definition at line 304 of file G4OpenGLQtViewer.hh.

Referenced by createPopupMenu(), and updateToolbarAndMouseContextMenu().

◆ fDrawingSurfaceRemoval

QAction* G4OpenGLQtViewer::fDrawingSurfaceRemoval
private

Definition at line 303 of file G4OpenGLQtViewer.hh.

Referenced by createPopupMenu(), and updateToolbarAndMouseContextMenu().

◆ fDrawingWireframe

QAction* G4OpenGLQtViewer::fDrawingWireframe
private

Definition at line 301 of file G4OpenGLQtViewer.hh.

Referenced by createPopupMenu(), and updateToolbarAndMouseContextMenu().

◆ fEncoderPath

QString G4OpenGLQtViewer::fEncoderPath
private

◆ fExportFilename

G4String G4OpenGLViewer::fExportFilename
privateinherited

◆ fExportFilenameIndex

int G4OpenGLViewer::fExportFilenameIndex
protectedinherited

◆ fExportImageFormat

std::string G4OpenGLViewer::fExportImageFormat
protectedinherited

◆ fExportImageFormatVector

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

◆ fFileSavePath

QString G4OpenGLQtViewer::fFileSavePath
private

Definition at line 334 of file G4OpenGLQtViewer.hh.

Referenced by actionSaveImage(), and G4OpenGLQtViewer().

◆ fFilterOutput

QLineEdit* G4OpenGLQtViewer::fFilterOutput
private

Definition at line 333 of file G4OpenGLQtViewer.hh.

Referenced by changeSearchSelection(), and createSceneTreeComponent().

◆ fFullScreenOff

QAction* G4OpenGLQtViewer::fFullScreenOff
private

Definition at line 300 of file G4OpenGLQtViewer.hh.

Referenced by createPopupMenu().

◆ fFullScreenOn

QAction* G4OpenGLQtViewer::fFullScreenOn
private

Definition at line 299 of file G4OpenGLQtViewer.hh.

Referenced by createPopupMenu().

◆ 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().

◆ fGLWidget

QWidget* G4OpenGLQtViewer::fGLWidget
protected

◆ fHasToRepaint

bool G4OpenGLQtViewer::fHasToRepaint
protected

◆ fHoldKeyEvent

bool G4OpenGLQtViewer::fHoldKeyEvent
private

Definition at line 283 of file G4OpenGLQtViewer.hh.

Referenced by G4keyPressEvent().

◆ fHoldMoveEvent

bool G4OpenGLQtViewer::fHoldMoveEvent
private

Definition at line 285 of file G4OpenGLQtViewer.hh.

Referenced by moveScene().

◆ fHoldRotateEvent

bool G4OpenGLQtViewer::fHoldRotateEvent
private

Definition at line 287 of file G4OpenGLQtViewer.hh.

Referenced by rotateQtScene(), and rotateQtSceneToggle().

◆ fIsDeleting

bool G4OpenGLQtViewer::fIsDeleting
private

Definition at line 383 of file G4OpenGLQtViewer.hh.

Referenced by G4MouseReleaseEvent(), and ~G4OpenGLQtViewer().

◆ fIsGettingPickInfos

bool G4OpenGLViewer::fIsGettingPickInfos
privateinherited

Definition at line 241 of file G4OpenGLViewer.hh.

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

◆ fLastEventTime

QTime* G4OpenGLQtViewer::fLastEventTime
private

◆ fLastExportSliderValue

int G4OpenGLQtViewer::fLastExportSliderValue
private

Definition at line 380 of file G4OpenGLQtViewer.hh.

Referenced by actionSaveImage(), and exportImage().

◆ fLastHighlightColor

G4Color G4OpenGLQtViewer::fLastHighlightColor
private

Definition at line 381 of file G4OpenGLQtViewer.hh.

Referenced by updatePickInfosWidget().

◆ fLastHighlightName

GLuint G4OpenGLQtViewer::fLastHighlightName
private

Definition at line 382 of file G4OpenGLQtViewer.hh.

Referenced by updatePickInfosWidget().

◆ fLastPickPoint

QPoint G4OpenGLQtViewer::fLastPickPoint
private

Definition at line 276 of file G4OpenGLQtViewer.hh.

Referenced by createPickInfosWidget(), and updatePickInfosWidget().

◆ fLastPos1

QPoint G4OpenGLQtViewer::fLastPos1
private

◆ fLastPos2

QPoint G4OpenGLQtViewer::fLastPos2
private

Definition at line 274 of file G4OpenGLQtViewer.hh.

Referenced by G4MouseMoveEvent(), G4MousePressEvent(), and G4OpenGLQtViewer().

◆ fLastPos3

QPoint G4OpenGLQtViewer::fLastPos3
private

◆ fLastSceneTreeWidgetAskForIterator

std::map<int,QTreeWidgetItem*>::const_iterator G4OpenGLQtViewer::fLastSceneTreeWidgetAskForIterator
private

◆ fLastSceneTreeWidgetAskForIteratorEnd

std::map<int,QTreeWidgetItem*>::const_iterator G4OpenGLQtViewer::fLastSceneTreeWidgetAskForIteratorEnd
private

◆ fLaunchSpinDelay

int G4OpenGLQtViewer::fLaunchSpinDelay
private

Definition at line 318 of file G4OpenGLQtViewer.hh.

Referenced by G4MouseReleaseEvent().

◆ fMaxPOindexInserted

int G4OpenGLQtViewer::fMaxPOindexInserted
private

◆ fModelShortNameItem

QTreeWidgetItem* G4OpenGLQtViewer::fModelShortNameItem
private

Definition at line 358 of file G4OpenGLQtViewer.hh.

Referenced by addPVSceneTreeElement(), and clearTreeWidget().

◆ fMouseMoveAction

QAction* G4OpenGLQtViewer::fMouseMoveAction
private

Definition at line 295 of file G4OpenGLQtViewer.hh.

Referenced by createPopupMenu(), and updateToolbarAndMouseContextMenu().

◆ fMouseOnSceneTree

bool G4OpenGLQtViewer::fMouseOnSceneTree
protected

◆ fMousePickAction

QAction* G4OpenGLQtViewer::fMousePickAction
private

Definition at line 296 of file G4OpenGLQtViewer.hh.

Referenced by createPopupMenu(), and updateToolbarAndMouseContextMenu().

◆ fMouseRotateAction

QAction* G4OpenGLQtViewer::fMouseRotateAction
private

Definition at line 294 of file G4OpenGLQtViewer.hh.

Referenced by createPopupMenu(), and updateToolbarAndMouseContextMenu().

◆ fMouseZoomInAction

QAction* G4OpenGLQtViewer::fMouseZoomInAction
private

Definition at line 297 of file G4OpenGLQtViewer.hh.

Referenced by createPopupMenu(), and updateToolbarAndMouseContextMenu().

◆ fMouseZoomOutAction

QAction* G4OpenGLQtViewer::fMouseZoomOutAction
private

Definition at line 298 of file G4OpenGLQtViewer.hh.

Referenced by createPopupMenu(), and updateToolbarAndMouseContextMenu().

◆ fMovieParametersDialog

G4OpenGLQtMovieDialog* G4OpenGLQtViewer::fMovieParametersDialog
private

◆ fMovieTempFolderPath

QString G4OpenGLQtViewer::fMovieTempFolderPath
private

◆ fName

G4String G4VViewer::fName
protectedinherited

◆ fNbMaxAnglePerSec

float G4OpenGLQtViewer::fNbMaxAnglePerSec
private

Definition at line 317 of file G4OpenGLQtViewer.hh.

Referenced by G4MouseReleaseEvent().

◆ fNbMaxFramesPerSec

int G4OpenGLQtViewer::fNbMaxFramesPerSec
private

Definition at line 316 of file G4OpenGLQtViewer.hh.

Referenced by G4MouseReleaseEvent().

◆ fNbRotation

int G4OpenGLQtViewer::fNbRotation
private

Definition at line 335 of file G4OpenGLQtViewer.hh.

◆ fNeedKernelVisit

G4bool G4VViewer::fNeedKernelVisit
protectedinherited

◆ fNoKeyPress

bool G4OpenGLQtViewer::fNoKeyPress
private

◆ fNumber

int G4OpenGLQtViewer::fNumber
private

Definition at line 359 of file G4OpenGLQtViewer.hh.

◆ fOldLastSceneTreeWidgetAskForIterator

std::map<int,QTreeWidgetItem*>::const_iterator G4OpenGLQtViewer::fOldLastSceneTreeWidgetAskForIterator
private

Definition at line 372 of file G4OpenGLQtViewer.hh.

Referenced by clearTreeWidget(), and getOldTreeWidgetItem().

◆ fOldLastSceneTreeWidgetAskForIteratorEnd

std::map<int,QTreeWidgetItem*>::const_iterator G4OpenGLQtViewer::fOldLastSceneTreeWidgetAskForIteratorEnd
private

Definition at line 373 of file G4OpenGLQtViewer.hh.

Referenced by clearTreeWidget(), and getOldTreeWidgetItem().

◆ fOldNullPoIndexSceneTreeWidgetQuickVector

std::vector<QTreeWidgetItem*> G4OpenGLQtViewer::fOldNullPoIndexSceneTreeWidgetQuickVector
private

◆ fOldPositivePoIndexSceneTreeWidgetQuickMap

std::map<int, QTreeWidgetItem*> G4OpenGLQtViewer::fOldPositivePoIndexSceneTreeWidgetQuickMap
private

◆ fOldTreeItemModels

std::map<int, PVPath > G4OpenGLQtViewer::fOldTreeItemModels
private

Definition at line 347 of file G4OpenGLQtViewer.hh.

Referenced by clearTreeWidget(), and isSameSceneTreeElement().

◆ fOldVisAttrColorMap

std::map<int, QColor> G4OpenGLQtViewer::fOldVisAttrColorMap
private

◆ fOpenGLSceneHandler

G4OpenGLSceneHandler& G4OpenGLViewer::fOpenGLSceneHandler
protectedinherited

Definition at line 197 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::GetPickDetails().

◆ fPaintEventLock

bool G4OpenGLQtViewer::fPaintEventLock
protected

◆ fPan_sens

G4double G4OpenGLViewer::fPan_sens
protectedinherited

◆ fParameterFileName

QString G4OpenGLQtViewer::fParameterFileName
private

Definition at line 293 of file G4OpenGLQtViewer.hh.

Referenced by encodeVideo(), and generateMpegEncoderParameters().

◆ fPickInfosScrollArea

QScrollArea* G4OpenGLQtViewer::fPickInfosScrollArea
private

Definition at line 341 of file G4OpenGLQtViewer.hh.

Referenced by createPickInfosWidget(), and updatePickInfosWidget().

◆ fPickInfosWidget

QWidget* G4OpenGLQtViewer::fPickInfosWidget
private

◆ fPointSize

G4float G4OpenGLViewer::fPointSize
privateinherited

Definition at line 218 of file G4OpenGLViewer.hh.

◆ fPositivePoIndexSceneTreeWidgetQuickMap

std::map<int, QTreeWidgetItem*> G4OpenGLQtViewer::fPositivePoIndexSceneTreeWidgetQuickMap
private

◆ fPrintColour

G4bool G4OpenGLViewer::fPrintColour
protectedinherited

◆ fPrintSizeX

G4int G4OpenGLViewer::fPrintSizeX
protectedinherited

◆ fPrintSizeY

G4int G4OpenGLViewer::fPrintSizeY
protectedinherited

◆ fProcess

QProcess* G4OpenGLQtViewer::fProcess
private

◆ fProjectionOrtho

QAction* G4OpenGLQtViewer::fProjectionOrtho
private

Definition at line 305 of file G4OpenGLQtViewer.hh.

Referenced by createPopupMenu(), and updateToolbarAndMouseContextMenu().

◆ fProjectionPerspective

QAction* G4OpenGLQtViewer::fProjectionPerspective
private

Definition at line 306 of file G4OpenGLQtViewer.hh.

Referenced by createPopupMenu(), and updateToolbarAndMouseContextMenu().

◆ fPVRootNodeCreate

bool G4OpenGLQtViewer::fPVRootNodeCreate
private

◆ fQGLWidgetInitialiseCompleted

bool G4OpenGLQtViewer::fQGLWidgetInitialiseCompleted
protected

◆ fRecordFrameNumber

int G4OpenGLQtViewer::fRecordFrameNumber
protected

◆ fRecordingStep

RECORDING_STEP G4OpenGLQtViewer::fRecordingStep
private

◆ fRot_sens

G4double G4OpenGLViewer::fRot_sens
protectedinherited

◆ fSaveFileName

QString G4OpenGLQtViewer::fSaveFileName
private

Definition at line 292 of file G4OpenGLQtViewer.hh.

Referenced by getSaveFileName(), and setSaveFileName().

◆ fSceneHandler

G4VSceneHandler& G4VViewer::fSceneHandler
protectedinherited

◆ fSceneTreeButtonApply

QPushButton* G4OpenGLQtViewer::fSceneTreeButtonApply
private

Definition at line 343 of file G4OpenGLQtViewer.hh.

◆ fSceneTreeComponentTreeWidget

QTreeWidget* G4OpenGLQtViewer::fSceneTreeComponentTreeWidget
private

◆ fSceneTreeDepth

unsigned int G4OpenGLQtViewer::fSceneTreeDepth
private

◆ fSceneTreeDepthSlider

QSlider* G4OpenGLQtViewer::fSceneTreeDepthSlider
private

Definition at line 345 of file G4OpenGLQtViewer.hh.

Referenced by createSceneTreeComponent(), and createTreeWidgetItem().

◆ fSceneTreeWidget

QWidget* G4OpenGLQtViewer::fSceneTreeWidget
private

◆ fSearchIcon

QPixmap* G4OpenGLQtViewer::fSearchIcon
private

Definition at line 378 of file G4OpenGLQtViewer.hh.

Referenced by G4OpenGLQtViewer().

◆ fShiftKeyPress

bool G4OpenGLQtViewer::fShiftKeyPress
private

◆ fShortcutsDialog

QDialog* G4OpenGLQtViewer::fShortcutsDialog
private

Definition at line 338 of file G4OpenGLQtViewer.hh.

Referenced by showShortcuts().

◆ fShortcutsDialogInfos

QTextEdit* G4OpenGLQtViewer::fShortcutsDialogInfos
private

Definition at line 344 of file G4OpenGLQtViewer.hh.

Referenced by showShortcuts().

◆ fShortName

G4String G4VViewer::fShortName
protectedinherited

◆ fSignalMapperMouse

QSignalMapper* G4OpenGLQtViewer::fSignalMapperMouse
private

Definition at line 363 of file G4OpenGLQtViewer.hh.

Referenced by createPopupMenu(), and G4OpenGLQtViewer().

◆ fSignalMapperPicking

QSignalMapper* G4OpenGLQtViewer::fSignalMapperPicking
private

Definition at line 365 of file G4OpenGLQtViewer.hh.

Referenced by updatePickInfosWidget().

◆ fSignalMapperSurface

QSignalMapper* G4OpenGLQtViewer::fSignalMapperSurface
private

Definition at line 364 of file G4OpenGLQtViewer.hh.

Referenced by createPopupMenu(), and G4OpenGLQtViewer().

◆ fSizeHasChanged

G4bool G4OpenGLViewer::fSizeHasChanged
privateinherited

◆ fSpinningDelay

int G4OpenGLQtViewer::fSpinningDelay
private

Definition at line 315 of file G4OpenGLQtViewer.hh.

Referenced by G4MouseReleaseEvent().

◆ fTempFolderPath

QString G4OpenGLQtViewer::fTempFolderPath
private

Definition at line 290 of file G4OpenGLQtViewer.hh.

Referenced by createTempFolder(), getTempFolderPath(), and setTempFolderPath().

◆ fTimeRotation

int G4OpenGLQtViewer::fTimeRotation
private

Definition at line 336 of file G4OpenGLQtViewer.hh.

◆ fTouchableVolumes

QString G4OpenGLQtViewer::fTouchableVolumes
private

Definition at line 337 of file G4OpenGLQtViewer.hh.

Referenced by getModelShortName(), isPVVolume(), and parseAndInsertInSceneTree().

◆ fTreeIconClosed

QPixmap* G4OpenGLQtViewer::fTreeIconClosed
private

◆ fTreeIconOpen

QPixmap* G4OpenGLQtViewer::fTreeIconOpen
private

◆ fTreeItemModels

std::map<int, PVPath > G4OpenGLQtViewer::fTreeItemModels
private

◆ fTreeWidgetInfosIgnoredCommands

int G4OpenGLQtViewer::fTreeWidgetInfosIgnoredCommands
private

Definition at line 342 of file G4OpenGLQtViewer.hh.

Referenced by updateViewerPropertiesTableWidget().

◆ fUIPickInfosWidget

QWidget* G4OpenGLQtViewer::fUIPickInfosWidget
private

Definition at line 321 of file G4OpenGLQtViewer.hh.

Referenced by createPickInfosWidget(), and updatePickInfosWidget().

◆ fUiQt

G4UIQt* G4OpenGLQtViewer::fUiQt
private

◆ fUISceneTreeWidget

QWidget* G4OpenGLQtViewer::fUISceneTreeWidget
private

Definition at line 319 of file G4OpenGLQtViewer.hh.

Referenced by createSceneTreeWidget(), and displaySceneTreeComponent().

◆ fUIViewerPropertiesWidget

QWidget* G4OpenGLQtViewer::fUIViewerPropertiesWidget
private

◆ fUpdateGLLock

bool G4OpenGLQtViewer::fUpdateGLLock
protected

◆ fVectoredPs

G4bool G4OpenGLViewer::fVectoredPs
protectedinherited

◆ fViewerPropertiesTableWidget

QTableWidget* G4OpenGLQtViewer::fViewerPropertiesTableWidget
private

◆ fViewerPropertiesTableWidgetIsInit

bool G4OpenGLQtViewer::fViewerPropertiesTableWidgetIsInit
private

Definition at line 328 of file G4OpenGLQtViewer.hh.

Referenced by updateViewerPropertiesTableWidget().

◆ fViewId

G4int G4VViewer::fViewId
protectedinherited

◆ fVP

G4ViewParameters G4VViewer::fVP
protectedinherited

Definition at line 219 of file G4VViewer.hh.

Referenced by actionChangeBackgroundColor(), actionChangeDefaultColor(), actionChangeTextColor(), G4OpenGLXmViewer::actions_callback(), G4OpenGLSceneHandler::AddPrimitive(), G4OpenGLImmediateSceneHandler::AddPrimitivePreambleInternal(), G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(), G4OpenGLXmViewer::aux_edge_callback(), changeDepthInSceneTree(), G4OpenGLStoredQtViewer::CompareForKernelVisit(), G4OpenGLStoredViewer::CompareForKernelVisit(), G4OpenInventorViewer::CompareForKernelVisit(), G4Qt3DViewer::CompareForKernelVisit(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::CompareForKernelVisit(), G4OpenGLStoredQtViewer::ComputeView(), G4OpenGLWin32Viewer::CreateMainWindow(), G4OpenGLXmViewer::CreateMainWindow(), G4OpenGLXViewer::CreateMainWindow(), CreateMainWindow(), createPopupMenu(), G4OpenGLXmViewer::dolly_callback(), G4OpenGLStoredViewer::DrawDisplayLists(), G4OpenGLXmViewer::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(), G4keyPressEvent(), G4MouseMoveEvent(), G4MousePressEvent(), G4MouseReleaseEvent(), G4OpenGLViewer::G4OpenGLViewer(), G4OpenInventorViewer::G4OpenInventorViewer(), G4VtkViewer::G4VtkViewer(), G4VViewer::G4VViewer(), G4wheelEvent(), G4OpenGLViewer::getSceneDepth(), G4OpenGLViewer::getSceneFarWidth(), G4OpenGLViewer::getSceneNearWidth(), G4OpenGLXmViewer::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(), G4OpenGLXmViewer::left_right_pan_callback(), G4OpenGLXmViewer::misc_callback(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::mouse_move(), G4Qt3DViewer::mouseMoveEvent(), moveScene(), G4OpenGLImmediateViewer::ProcessView(), G4OpenGLXmViewer::projection_callback(), G4OpenGLXmViewer::reset_callback(), G4OpenGLXmViewer::ResetView(), G4OpenGLViewer::rotateScene(), G4OpenGLViewer::rotateSceneInViewDirection(), G4OpenGLViewer::rotateSceneThetaPhi(), G4OpenGLViewer::rotateSceneToggle(), G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI(), G4DAWNFILEViewer::SendViewParameters(), G4VRML2FileViewer::SendViewParameters(), G4OpenGLXmViewer::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(), toggleAux(), toggleHiddenMarkers(), togglePicking(), toggleProjection(), toggleSurfaceAction(), G4VViewer::TouchableSetColour(), G4VViewer::TouchableSetVisibility(), G4OpenGLXmViewer::up_down_pan_callback(), G4OpenGLXmViewer::update_panels_callback(), G4OpenGLXmViewer::UpdateControlPanel(), updateToolbarAndMouseContextMenu(), updateViewerPropertiesTableWidget(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::wheel_rotate(), G4Qt3DViewer::wheelEvent(), G4OpenGLXmViewer::wobble_callback(), G4OpenGLXmViewer::wobble_timer_callback(), and G4OpenGLXmViewer::zoom_callback().

◆ fWinSize_x

unsigned int G4OpenGLViewer::fWinSize_x
protectedinherited

◆ fWinSize_y

unsigned int G4OpenGLViewer::fWinSize_y
protectedinherited

◆ haloing_enabled

G4bool G4OpenGLViewer::haloing_enabled
protectedinherited

◆ lWaitForVisSubThreadQtOpenGLContextInitialized

G4AutoLock* G4OpenGLQtViewer::lWaitForVisSubThreadQtOpenGLContextInitialized
private

Definition at line 391 of file G4OpenGLQtViewer.hh.

Referenced by G4OpenGLQtViewer(), and ~G4OpenGLQtViewer().

◆ lWaitForVisSubThreadQtOpenGLContextMoved

G4AutoLock* G4OpenGLQtViewer::lWaitForVisSubThreadQtOpenGLContextMoved
private

Definition at line 392 of file G4OpenGLQtViewer.hh.

Referenced by G4OpenGLQtViewer(), and ~G4OpenGLQtViewer().

◆ transparency_enabled

G4bool G4OpenGLViewer::transparency_enabled
protectedinherited

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