34#ifndef G4OPENGLQTVIEWER_HH
35#define G4OPENGLQTVIEWER_HH
55class QContextMenuEvent;
75#if QT_VERSION < 0x050600
80class QTableWidgetItem;
89 typedef std::vector<PVNodeID> PVPath;
97 virtual void DoneWithMasterThread ();
99 virtual void MovingToVisSubThread ();
101 virtual void SwitchToVisSubThread ();
103 virtual void DoneWithVisSubThread ();
107 virtual void SwitchToMasterThread ();
149 int currentPVPOIndex);
151 int currentPVPOIndex,
152 const std::string& modelDescription,
156 bool exportImage(std::string name=
"",
int width=-1,
int height=-1);
173 void moveScene(
float,
float,
float,
bool);
182 const std::vector<G4ModelingParameters::VisAttributesModifier>*
203 enum RECORDING_STEP {WAIT,START,PAUSE,CONTINUE,STOP,READY_TO_ENCODE,
ENCODING,FAILED,SUCCESS,BAD_ENCODER,BAD_OUTPUT,BAD_TMP,SAVE};
205 void createPopupMenu();
206 void createRadioAction(QAction *,QAction *,
const std::string&,
unsigned int a=1);
207 void rescaleImage(
int,
int);
208 bool printPDF(
const std::string,
int,QImage);
209 void showMovieParametersDialog();
210 void initMovieParameters();
211 QString createTempFolder();
212 QString removeTempFolder();
213 void setRecordingStatus(RECORDING_STEP);
214 void setRecordingInfos(
const QString&);
215 QString getProcessErrorMsg();
216 QWidget* getParentWidget();
217 bool parseAndInsertInSceneTree(QTreeWidgetItem *,
219 unsigned int fullPathIndex,
220 const QString& parentRoot,
221 unsigned int currentIndex,
222 int currentPVPOIndex);
223 void setCheckComponent(QTreeWidgetItem* item,
bool check);
224 void createSceneTreeComponent();
225 void createSceneTreeWidget();
226 void createViewerPropertiesWidget();
227 void createPickInfosWidget();
228 bool parseAndCheckVisibility(QTreeWidgetItem * treeNode,
int POindex);
229 QTreeWidgetItem* createTreeWidgetItem(
const PVPath& fullPath,
233 const QString& logicalName,
234 Qt::CheckState state,
235 QTreeWidgetItem * treeNode,
237 QString getModelShortName(
const G4String& modelShortName);
238 void cloneSceneTree(QTreeWidgetItem* rootItem);
239 void changeDepthOnSceneTreeItem(
double lookForDepth,
double currentDepth,QTreeWidgetItem* item);
240 void updatePositivePoIndexSceneTreeWidgetQuickMap(
int POindex,QTreeWidgetItem* item);
241 void changeQColorForTreeWidgetItem(QTreeWidgetItem* item,
const QColor&);
243 bool isSameSceneTreeElement(QTreeWidgetItem* parentOldItem,QTreeWidgetItem* parentNewItem);
244 void changeOpenCloseVisibleHiddenSelectedColorSceneTreeElement(QTreeWidgetItem* subItem);
245 bool isPVVolume(QTreeWidgetItem* item);
246 QTreeWidgetItem* cloneWidgetItem(QTreeWidgetItem* item);
247 void clearSceneTreeSelection(QTreeWidgetItem*);
248 void clearTreeWidgetElements(QTreeWidgetItem* item);
251 QTreeWidgetItem* getTreeWidgetItem(
int POindex);
254 QTreeWidgetItem* getOldTreeWidgetItem(
int POindex);
257 std::string parseSceneTreeAndSaveState();
259 std::string parseSceneTreeElementAndSaveState(QTreeWidgetItem* item,
unsigned int level);
260 QString GetCommandParameterList (
const G4UIcommand *aCommand);
261 void changeColorAndTransparency(GLuint index,
G4Color color);
263#ifdef G4MULTITHREADED
264 inline void SetQGLContextVisSubThread(QThread *th) {
265 fQGLContextVisSubThread = th;
267 inline void SetQGLContextMainThread(QThread *th) {
268 fQGLContextMainThread = th;
276 QPoint fLastPickPoint;
287 bool fHoldRotateEvent;
289 QString fEncoderPath;
290 QString fTempFolderPath;
291 QString fMovieTempFolderPath;
292 QString fSaveFileName;
293 QString fParameterFileName;
294 QAction *fMouseRotateAction;
295 QAction *fMouseMoveAction;
296 QAction *fMousePickAction;
297 QAction *fMouseZoomInAction;
298 QAction *fMouseZoomOutAction;
299 QAction *fFullScreenOn;
300 QAction *fFullScreenOff;
301 QAction *fDrawingWireframe;
302 QAction *fDrawingLineRemoval;
303 QAction *fDrawingSurfaceRemoval;
304 QAction *fDrawingLineSurfaceRemoval;
305 QAction *fProjectionOrtho;
306 QAction *fProjectionPerspective;
308 RECORDING_STEP fRecordingStep;
310#if QT_VERSION < 0x050e00
311 QTime *fLastEventTime;
313 QElapsedTimer *fLastEventTime;
316 int fNbMaxFramesPerSec;
317 float fNbMaxAnglePerSec;
318 int fLaunchSpinDelay;
319 QWidget* fUISceneTreeWidget;
320 QWidget* fUIViewerPropertiesWidget;
321 QWidget* fUIPickInfosWidget;
324 bool fControlKeyPress;
327 bool fCheckSceneTreeComponentSignalLock;
328 bool fViewerPropertiesTableWidgetIsInit;
329 QTreeWidget* fSceneTreeComponentTreeWidget;
331 QWidget* fSceneTreeWidget;
332 bool fPVRootNodeCreate;
333 QLineEdit* fFilterOutput;
334 QString fFileSavePath;
337 QString fTouchableVolumes;
338 QDialog* fShortcutsDialog;
339 QTableWidget *fViewerPropertiesTableWidget;
340 QWidget* fPickInfosWidget;
341 QScrollArea* fPickInfosScrollArea;
342 int fTreeWidgetInfosIgnoredCommands;
343 QPushButton * fSceneTreeButtonApply;
344 QTextEdit *fShortcutsDialogInfos;
345 QSlider* fSceneTreeDepthSlider;
346 std::map <int, PVPath > fTreeItemModels;
347 std::map <int, PVPath > fOldTreeItemModels;
350 std::map <int, QTreeWidgetItem*> fPositivePoIndexSceneTreeWidgetQuickMap;
352 std::map <int, QTreeWidgetItem*> fOldPositivePoIndexSceneTreeWidgetQuickMap;
353 std::vector <QTreeWidgetItem*> fOldNullPoIndexSceneTreeWidgetQuickVector;
355 std::map <int, QColor> fOldVisAttrColorMap;
357 unsigned int fSceneTreeDepth;
358 QTreeWidgetItem* fModelShortNameItem;
360 int fMaxPOindexInserted;
362#if QT_VERSION < 0x050600
363 QSignalMapper *fSignalMapperMouse;
364 QSignalMapper *fSignalMapperSurface;
365 QSignalMapper *fSignalMapperPicking;
368 std::map <int, QTreeWidgetItem*>::const_iterator fLastSceneTreeWidgetAskForIterator;
369 std::map <int, QTreeWidgetItem*>::const_iterator fLastSceneTreeWidgetAskForIteratorEnd;
372 std::map <int, QTreeWidgetItem*>::const_iterator fOldLastSceneTreeWidgetAskForIterator;
373 std::map <int, QTreeWidgetItem*>::const_iterator fOldLastSceneTreeWidgetAskForIteratorEnd;
376 QPixmap* fTreeIconOpen;
377 QPixmap* fTreeIconClosed;
378 QPixmap* fSearchIcon;
380 int fLastExportSliderValue;
382 GLuint fLastHighlightName;
385#ifdef G4MULTITHREADED
386 QThread* fQGLContextVisSubThread;
387 QThread* fQGLContextMainThread;
391 G4AutoLock* lWaitForVisSubThreadQtOpenGLContextInitialized;
392 G4AutoLock* lWaitForVisSubThreadQtOpenGLContextMoved;
401 void actionSaveImage();
402 void actionChangeBackgroundColor();
403 void actionChangeTextColor();
404 void actionChangeDefaultColor();
405 void actionMovieParameters();
407 void showShortcuts();
408 void toggleMouseAction(
int);
409 void toggleSurfaceAction(
int);
410 void toggleProjection(
bool);
411 void toggleTransparency(
bool);
412 void toggleAntialiasing(
bool);
413 void toggleHaloing(
bool);
414 void toggleAux(
bool);
415 void toggleHiddenMarkers(
bool);
416 void toggleFullScreen(
bool);
417 void processEncodeFinished();
418 void processLookForFinished();
419 void processEncodeStdout();
420 void sceneTreeComponentItemChanged(QTreeWidgetItem* item,
int id);
421 void toggleSceneTreeComponentPickingCout(
int);
422 void togglePicking();
423 void currentTabActivated(
int);
426 void sceneTreeComponentSelected();
427 void changeDepthInSceneTree(
int);
428 void changeSearchSelection();
429 void changeColorAndTransparency(QTreeWidgetItem* item,
int val);
430 void tableWidgetViewerSetItemChanged(QTableWidgetItem *);
void G4MouseReleaseEvent(QMouseEvent *evnt)
void rotateQtSceneToggle(float, float)
void G4MouseMoveEvent(QMouseEvent *event)
void G4keyPressEvent(QKeyEvent *event)
void updateViewerPropertiesTableWidget()
void addNonPVSceneTreeElement(const G4String &model, int currentPVPOIndex, const std::string &modelDescription, const G4Visible &visible)
void displayRecordingStatus()
QString getSaveFileName()
void G4MousePressEvent(QMouseEvent *event)
void G4wheelEvent(QWheelEvent *event)
void G4MouseDoubleClickEvent()
void updateSceneTreeWidget()
bool isTouchableVisible(int POindex)
void moveScene(float, float, float, bool)
void G4manageContextMenuEvent(QContextMenuEvent *e)
QString getTempFolderPath()
bool fQGLWidgetInitialiseCompleted
void rotateQtScene(float, float)
bool exportImage(std::string name="", int width=-1, int height=-1)
void updateToolbarAndMouseContextMenu()
void updateKeyModifierState(const Qt::KeyboardModifiers &)
void G4keyReleaseEvent(QKeyEvent *event)
G4Colour getColorForPoIndex(int poIndex)
void updatePickInfosWidget(int, int)
virtual ~G4OpenGLQtViewer()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void DrawText(const G4Text &)
QString setEncoderPath(QString path)
virtual void CreateMainWindow(QGLWidget *, const QString &)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
bool generateMpegEncoderParameters()
virtual void updateQWidget()=0
QString setSaveFileName(QString path)
void addPVSceneTreeElement(const G4String &model, G4PhysicalVolumeModel *pPVModel, int currentPVPOIndex)
const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers() const
QString setTempFolderPath(QString path)
void displaySceneTreeComponent()