Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 25 26 // Frederick Jones TRIUMF 07 November 2017 26 // Frederick Jones TRIUMF 07 November 2017 27 27 28 // this : 28 // this : 29 #include "G4OpenInventorQtViewer.hh" 29 #include "G4OpenInventorQtViewer.hh" 30 30 31 #include "G4OpenInventorQtExaminerViewer.hh" 31 #include "G4OpenInventorQtExaminerViewer.hh" 32 32 33 #include <Inventor/nodes/SoSelection.h> 33 #include <Inventor/nodes/SoSelection.h> 34 34 35 #include <Inventor/Qt/SoQt.h> 35 #include <Inventor/Qt/SoQt.h> 36 // FWJ these are needed (why?) to use flags in 36 // FWJ these are needed (why?) to use flags in SoQtExaminerViewer constr. 37 #include <Inventor/Qt/viewers/SoQtViewer.h> 37 #include <Inventor/Qt/viewers/SoQtViewer.h> 38 #include <Inventor/Qt/viewers/SoQtFullViewer.h 38 #include <Inventor/Qt/viewers/SoQtFullViewer.h> 39 #include <Inventor/Qt/viewers/SoQtExaminerView 39 #include <Inventor/Qt/viewers/SoQtExaminerViewer.h> 40 40 41 //#include <QMenuBar> 41 //#include <QMenuBar> 42 #include <QMenu> 42 #include <QMenu> 43 #include <QAction> 43 #include <QAction> 44 #include <QFont> 44 #include <QFont> 45 45 46 #include "HEPVis/actions/SoGL2PSAction.h" 46 #include "HEPVis/actions/SoGL2PSAction.h" 47 47 48 #include "G4OpenInventor.hh" 48 #include "G4OpenInventor.hh" 49 #include "G4OpenInventorSceneHandler.hh" 49 #include "G4OpenInventorSceneHandler.hh" 50 #include "G4VInteractorManager.hh" 50 #include "G4VInteractorManager.hh" 51 #include "G4VisManager.hh" 51 #include "G4VisManager.hh" 52 #include "G4UImanager.hh" 52 #include "G4UImanager.hh" 53 #include "G4UIQt.hh" 53 #include "G4UIQt.hh" 54 54 55 #include "G4SoQt.hh" 55 #include "G4SoQt.hh" 56 56 57 #ifndef G4GMAKE 57 #ifndef G4GMAKE 58 #include "moc_G4OpenInventorQtViewer.cpp" 58 #include "moc_G4OpenInventorQtViewer.cpp" 59 #endif 59 #endif 60 60 61 G4OpenInventorQtViewer::G4OpenInventorQtViewer 61 G4OpenInventorQtViewer::G4OpenInventorQtViewer( 62 G4OpenInventorSceneHandler& sceneHandler, c 62 G4OpenInventorSceneHandler& sceneHandler, const G4String& name) 63 : G4OpenInventorViewer(sceneHandler, name), 63 : G4OpenInventorViewer(sceneHandler, name), fViewer(0) 64 #if 0x060000 <= QT_VERSION << 65 ,fDestroyCallback(0) << 66 #endif << 67 { 64 { 68 #if 0x060000 <= QT_VERSION << 69 fDestroyCallback = new G4OpenInventorQtDestr << 70 #endif << 71 // FWJ fName is in G4VViewer parent of G4Op 65 // FWJ fName is in G4VViewer parent of G4OpenInventorViewer 72 if (G4VisManager::GetVerbosity() >= G4VisMa 66 if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations) 73 G4cout << "Window name: " << fName << G4e 67 G4cout << "Window name: " << fName << G4endl; 74 } 68 } 75 69 76 70 77 void G4OpenInventorQtViewer::Initialise() 71 void G4OpenInventorQtViewer::Initialise() 78 { 72 { 79 73 80 #if QT_VERSION < 0x060000 << 81 QWidget* parent = SoQt::getTopLevelWidget() 74 QWidget* parent = SoQt::getTopLevelWidget(); 82 #else << 83 QWidget* parent = new QWidget; << 84 QObject::connect(parent,SIGNAL(destroyed()) << 85 #endif << 86 75 87 // FWJ DEBUG 76 // FWJ DEBUG 88 // G4cout << "G4OIQtViewer: Creating G4OIQ 77 // G4cout << "G4OIQtViewer: Creating G4OIQtExaminerViewer with parent " << 89 // parent << G4endl; 78 // parent << G4endl; 90 79 91 fViewer = new G4OpenInventorQtExaminerViewe 80 fViewer = new G4OpenInventorQtExaminerViewer(parent, fName, TRUE); 92 << 81 93 #if 0x060000 <= QT_VERSION << 94 fViewer->addInTab(); << 95 #endif << 96 << 97 // FWJ tried this to replace sensors, but i 82 // FWJ tried this to replace sensors, but it misses some camera changes. 98 // fGroupCameraSensor->detach(); 83 // fGroupCameraSensor->detach(); 99 // fCameraSensor->detach(); 84 // fCameraSensor->detach(); 100 // fViewer->addFinishCallback(FinishCB); 85 // fViewer->addFinishCallback(FinishCB); 101 86 102 auto UI = G4UImanager::GetUIpointer(); 87 auto UI = G4UImanager::GetUIpointer(); 103 auto uiQt = dynamic_cast<G4UIQt*>(UI->GetG4 88 auto uiQt = dynamic_cast<G4UIQt*>(UI->GetG4UIWindow()); 104 89 105 // Moved this to G4OpenInventorQtExaminerVi 90 // Moved this to G4OpenInventorQtExaminerViewer::afterRealizeHook() 106 /////////////////////////////////////////// 91 /////////////////////////////////////////////////////////// 107 // 92 // 108 // This explicitly sets the TabWidget as pa 93 // This explicitly sets the TabWidget as parent before addTab(): 109 // if (uiQt) uiQt->AddTabWidget(parent, Q 94 // if (uiQt) uiQt->AddTabWidget(parent, QString(fName)); 110 /////////////////////////////////////////// 95 /////////////////////////////////////////////////////////// 111 96 112 // Simpler: calls addTab(), but causes view 97 // Simpler: calls addTab(), but causes viewer parts to show (temporarily) 113 // in the "Useful tips" page !! 98 // in the "Useful tips" page !! 114 // if (uiQt) uiQt->AddViewerTab(parent, f 99 // if (uiQt) uiQt->AddViewerTab(parent, fName); 115 // Leaves an empty viewer window frame hang 100 // Leaves an empty viewer window frame hanging around: 116 // if (uiQt) uiQt->AddTabWidget(fViewer-> 101 // if (uiQt) uiQt->AddTabWidget(fViewer->getWidget(), QString(fName)); 117 102 118 // G4String wName = fName; 103 // G4String wName = fName; 119 // 104 // 120 // QWidget parent = (QWidget)fInteractorMa 105 // QWidget parent = (QWidget)fInteractorManager->GetParentInteractor(); 121 106 122 #if QT_VERSION < 0x060000 << 123 int width = fVP.GetWindowSizeHintX(); 107 int width = fVP.GetWindowSizeHintX(); 124 int height = fVP.GetWindowSizeHintY(); 108 int height = fVP.GetWindowSizeHintY(); 125 109 126 // FWJ not sure what this is for 110 // FWJ not sure what this is for 127 // fInteractorManager->AddShell(fShell) 111 // fInteractorManager->AddShell(fShell); 128 112 129 // FWJ or this: 113 // FWJ or this: 130 // } else { 114 // } else { 131 // char* str = fInteractorManager->GetCr 115 // char* str = fInteractorManager->GetCreationString(); 132 // if(str!=0) wName = str; 116 // if(str!=0) wName = str; 133 // fViewer = new SoQtExaminerViewer(pare 117 // fViewer = new SoQtExaminerViewer(parent,wName.c_str(),TRUE); 134 // } 118 // } 135 119 136 fViewer->setSize(SbVec2s(width, height)); 120 fViewer->setSize(SbVec2s(width, height)); 137 fViewer->setOrigWindowSize(width, height); 121 fViewer->setOrigWindowSize(width, height); 138 #else << 139 //G.Barrand: if in a QTabViewer, it is bett << 140 // SoQt set the size and position << 141 #endif << 142 122 143 // Add common menu items... 123 // Add common menu items... 144 124 145 // QMenuBar* menubar = fViewer->getMenuba 125 // QMenuBar* menubar = fViewer->getMenubar(); 146 QMenu* filemenu = fViewer->getFileMenu(); 126 QMenu* filemenu = fViewer->getFileMenu(); 147 QMenu* etcmenu = fViewer->getEtcMenu(); 127 QMenu* etcmenu = fViewer->getEtcMenu(); 148 QFont* font = fViewer->getFont(); 128 QFont* font = fViewer->getFont(); 149 129 150 // File menu 130 // File menu 151 131 152 FileWritePS = new QAction("Write PostScript 132 FileWritePS = new QAction("Write PostScript (gl2ps)", this); 153 FileWritePS->setFont(*font); 133 FileWritePS->setFont(*font); 154 connect(FileWritePS, SIGNAL(triggered()), t 134 connect(FileWritePS, SIGNAL(triggered()), this, 155 SLOT(FileWritePSCB())); 135 SLOT(FileWritePSCB())); 156 filemenu->addAction(FileWritePS); 136 filemenu->addAction(FileWritePS); 157 137 158 FileWritePDF = new QAction("Write PDF (gl2p 138 FileWritePDF = new QAction("Write PDF (gl2ps)", this); 159 FileWritePDF->setFont(*font); 139 FileWritePDF->setFont(*font); 160 connect(FileWritePDF, SIGNAL(triggered()), 140 connect(FileWritePDF, SIGNAL(triggered()), this, 161 SLOT(FileWritePDFCB())); 141 SLOT(FileWritePDFCB())); 162 filemenu->addAction(FileWritePDF); 142 filemenu->addAction(FileWritePDF); 163 143 164 FileWriteIV = new QAction("Write IV", this) 144 FileWriteIV = new QAction("Write IV", this); 165 FileWriteIV->setFont(*font); 145 FileWriteIV->setFont(*font); 166 connect(FileWriteIV, SIGNAL(triggered()), t 146 connect(FileWriteIV, SIGNAL(triggered()), this, 167 SLOT(FileWriteIVCB())); 147 SLOT(FileWriteIVCB())); 168 filemenu->addAction(FileWriteIV); 148 filemenu->addAction(FileWriteIV); 169 149 170 FileEscape = new QAction("Escape", this); 150 FileEscape = new QAction("Escape", this); 171 FileEscape->setFont(*font); 151 FileEscape->setFont(*font); 172 connect(FileEscape, SIGNAL(triggered()), th 152 connect(FileEscape, SIGNAL(triggered()), this, 173 SLOT(FileEscapeCB())); 153 SLOT(FileEscapeCB())); 174 filemenu->addAction(FileEscape); 154 filemenu->addAction(FileEscape); 175 155 176 // G4cout << "G4OIQtViewer: externalApp = 156 // G4cout << "G4OIQtViewer: externalApp = " << 177 // static_cast<G4SoQt*>(fInteractorManage 157 // static_cast<G4SoQt*>(fInteractorManager)->IsExternalApp() << G4endl; 178 if (static_cast<G4SoQt*>(fInteractorManager 158 if (static_cast<G4SoQt*>(fInteractorManager)->IsExternalApp()) 179 fViewer->setExternalQtApp(); 159 fViewer->setExternalQtApp(); 180 160 181 // Register escape CB with viewer, allowing 161 // Register escape CB with viewer, allowing E key escape 182 // fViewer->addEscapeCallback(FileEscapeC 162 // fViewer->addEscapeCallback(FileEscapeCB); 183 // fViewer->addEscapeCallback(FileEscapeC 163 // fViewer->addEscapeCallback(FileEscapeCB, (void*)this); 184 164 185 // Etc menu 165 // Etc menu 186 166 187 EtcEraseDetector = new QAction("Erase detec 167 EtcEraseDetector = new QAction("Erase detector", this); 188 EtcEraseDetector->setFont(*font); 168 EtcEraseDetector->setFont(*font); 189 connect(EtcEraseDetector, SIGNAL(triggered( 169 connect(EtcEraseDetector, SIGNAL(triggered()), this, 190 SLOT(EtcEraseDetectorCB())); 170 SLOT(EtcEraseDetectorCB())); 191 etcmenu->addAction(EtcEraseDetector); 171 etcmenu->addAction(EtcEraseDetector); 192 172 193 EtcEraseEvent = new QAction("Erase event", 173 EtcEraseEvent = new QAction("Erase event", this); 194 EtcEraseEvent->setFont(*font); 174 EtcEraseEvent->setFont(*font); 195 connect(EtcEraseEvent, SIGNAL(triggered()), 175 connect(EtcEraseEvent, SIGNAL(triggered()), this, 196 SLOT(EtcEraseEventCB())); 176 SLOT(EtcEraseEventCB())); 197 etcmenu->addAction(EtcEraseEvent); 177 etcmenu->addAction(EtcEraseEvent); 198 178 199 EtcSetSolid = new QAction("Set solid", this 179 EtcSetSolid = new QAction("Set solid", this); 200 EtcSetSolid->setFont(*font); 180 EtcSetSolid->setFont(*font); 201 connect(EtcSetSolid, SIGNAL(triggered()), t 181 connect(EtcSetSolid, SIGNAL(triggered()), this, SLOT(EtcSetSolidCB())); 202 etcmenu->addAction(EtcSetSolid); 182 etcmenu->addAction(EtcSetSolid); 203 183 204 EtcSetReducedWireframe = new QAction("Set ( 184 EtcSetReducedWireframe = new QAction("Set (G4) reduced wireframe", this); 205 EtcSetReducedWireframe->setFont(*font); 185 EtcSetReducedWireframe->setFont(*font); 206 connect(EtcSetReducedWireframe, SIGNAL(trig 186 connect(EtcSetReducedWireframe, SIGNAL(triggered()), this, 207 SLOT(EtcSetReducedWireframeCB())); 187 SLOT(EtcSetReducedWireframeCB())); 208 etcmenu->addAction(EtcSetReducedWireframe); 188 etcmenu->addAction(EtcSetReducedWireframe); 209 189 210 EtcSetFullWireframe = new QAction("Set full 190 EtcSetFullWireframe = new QAction("Set full wireframe", this); 211 EtcSetFullWireframe->setFont(*font); 191 EtcSetFullWireframe->setFont(*font); 212 connect(EtcSetFullWireframe, SIGNAL(trigger 192 connect(EtcSetFullWireframe, SIGNAL(triggered()), this, 213 SLOT(EtcSetFullWireframeCB())); 193 SLOT(EtcSetFullWireframeCB())); 214 etcmenu->addAction(EtcSetFullWireframe); 194 etcmenu->addAction(EtcSetFullWireframe); 215 195 216 EtcVisibMInvisibD = new QAction("Visible mo 196 EtcVisibMInvisibD = new QAction("Visible mothers + invisible daughters", 217 this); 197 this); 218 EtcVisibMInvisibD->setFont(*font); 198 EtcVisibMInvisibD->setFont(*font); 219 connect(EtcVisibMInvisibD, SIGNAL(triggered 199 connect(EtcVisibMInvisibD, SIGNAL(triggered()), this, 220 SLOT(EtcVisibMInvisibDCB())); 200 SLOT(EtcVisibMInvisibDCB())); 221 etcmenu->addAction(EtcVisibMInvisibD); 201 etcmenu->addAction(EtcVisibMInvisibD); 222 202 223 EtcVisibMVisibD = new QAction("Visible moth 203 EtcVisibMVisibD = new QAction("Visible mothers + visible daughters", this); 224 EtcVisibMVisibD->setFont(*font); 204 EtcVisibMVisibD->setFont(*font); 225 connect(EtcVisibMVisibD, SIGNAL(triggered() 205 connect(EtcVisibMVisibD, SIGNAL(triggered()), this, 226 SLOT(EtcVisibMVisibDCB())); 206 SLOT(EtcVisibMVisibDCB())); 227 etcmenu->addAction(EtcVisibMVisibD); 207 etcmenu->addAction(EtcVisibMVisibD); 228 208 229 EtcUpdateScene = new QAction("Update scene" 209 EtcUpdateScene = new QAction("Update scene", this); 230 EtcUpdateScene->setFont(*font); 210 EtcUpdateScene->setFont(*font); 231 connect(EtcUpdateScene, SIGNAL(triggered()) 211 connect(EtcUpdateScene, SIGNAL(triggered()), this, 232 SLOT(EtcUpdateSceneCB())); 212 SLOT(EtcUpdateSceneCB())); 233 etcmenu->addAction(EtcUpdateScene); 213 etcmenu->addAction(EtcUpdateScene); 234 214 235 EtcSceneGraphStats = new QAction("Scene gra 215 EtcSceneGraphStats = new QAction("Scene graph stats", this); 236 EtcSceneGraphStats->setFont(*font); 216 EtcSceneGraphStats->setFont(*font); 237 connect(EtcSceneGraphStats, SIGNAL(triggere 217 connect(EtcSceneGraphStats, SIGNAL(triggered()), this, 238 SLOT(EtcSceneGraphStatsCB())); 218 SLOT(EtcSceneGraphStatsCB())); 239 etcmenu->addAction(EtcSceneGraphStats); 219 etcmenu->addAction(EtcSceneGraphStats); 240 220 241 221 242 // Have a GL2PS render action : 222 // Have a GL2PS render action : 243 const SbViewportRegion& vpRegion = fViewer-> 223 const SbViewportRegion& vpRegion = fViewer->getViewportRegion(); 244 fGL2PSAction = new SoGL2PSAction(vpRegion); 224 fGL2PSAction = new SoGL2PSAction(vpRegion); 245 fViewer->setGLRenderAction(fGL2PSAction); 225 fViewer->setGLRenderAction(fGL2PSAction); 246 226 247 // Else : 227 // Else : 248 228 249 // FWJ DEBUG 229 // FWJ DEBUG 250 // G4cout << "G4OpenInventorQtViewer: setti 230 // G4cout << "G4OpenInventorQtViewer: setting scene graph " << 251 // fSoSelection << G4endl; 231 // fSoSelection << G4endl; 252 // G4cout << "G4OpenInventorQtViewer: getNu 232 // G4cout << "G4OpenInventorQtViewer: getNumChildren " << 253 // fSoSelection->getNumChildren() << G4e 233 // fSoSelection->getNumChildren() << G4endl; 254 234 255 fViewer->setSceneGraph(fSoSelection); 235 fViewer->setSceneGraph(fSoSelection); 256 fViewer->setTransparencyType(SoGLRenderActio 236 fViewer->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_ADD); 257 fViewer->viewAll(); 237 fViewer->viewAll(); 258 fViewer->saveHomePosition(); 238 fViewer->saveHomePosition(); 259 // SOMEHOW this also the OIQt main window ti 239 // SOMEHOW this also the OIQt main window title 260 if (!uiQt) fViewer->setTitle(fName); 240 if (!uiQt) fViewer->setTitle(fName); 261 #if QT_VERSION < 0x060000 << 262 fViewer->show(); 241 fViewer->show(); 263 242 264 // This SHOULD invoke the event loop: 243 // This SHOULD invoke the event loop: 265 // if(fShell) { 244 // if(fShell) { 266 245 267 QWidget* mainWin = SoQt::getTopLevelWidget() 246 QWidget* mainWin = SoQt::getTopLevelWidget(); 268 247 269 // FWJ DEBUG 248 // FWJ DEBUG 270 // G4cout << "G4OIQtViewer: calling SoQt::s 249 // G4cout << "G4OIQtViewer: calling SoQt::show on mainWin = " << mainWin 271 // << G4endl; 250 // << G4endl; 272 251 273 SoQt::show(mainWin); 252 SoQt::show(mainWin); 274 fInteractorManager->FlushAndWaitExecution(); 253 fInteractorManager->FlushAndWaitExecution(); 275 254 276 // } 255 // } 277 fInteractorManager->SetCreatedInteractor(fVi 256 fInteractorManager->SetCreatedInteractor(fViewer->getWidget()); 278 #else << 279 fViewer->setupSceneGraph(); << 280 #endif << 281 } 257 } 282 258 283 259 284 G4OpenInventorQtViewer::~G4OpenInventorQtViewe 260 G4OpenInventorQtViewer::~G4OpenInventorQtViewer() 285 { 261 { 286 // if(fShell) fInteractorManager->RemoveShe 262 // if(fShell) fInteractorManager->RemoveShell(fShell); 287 if(fViewer) { 263 if(fViewer) { 288 fViewer->setSceneGraph(0); 264 fViewer->setSceneGraph(0); 289 //FIXME : SGI : the below "delete" block t 265 //FIXME : SGI : the below "delete" block things. 290 #if 0x060000 <= QT_VERSION << 266 //FIXME : CoinXt : the below "delete" crashe in ~SoXtRenderArea. 291 delete fViewer; << 267 //FIXME : delete fViewer; 292 #endif << 293 } 268 } 294 #if 0x060000 <= QT_VERSION << 269 // if(fShell) XtDestroyWidget(fShell); 295 delete fDestroyCallback; << 296 #endif << 297 } 270 } 298 271 299 void G4OpenInventorQtViewer::FinishView() 272 void G4OpenInventorQtViewer::FinishView() 300 { 273 { 301 if(!fViewer) return; 274 if(!fViewer) return; 302 fViewer->viewAll(); 275 fViewer->viewAll(); 303 fViewer->saveHomePosition(); 276 fViewer->saveHomePosition(); 304 } 277 } 305 278 306 void G4OpenInventorQtViewer::SetView() 279 void G4OpenInventorQtViewer::SetView() 307 { 280 { 308 G4OpenInventorViewer::SetView(); 281 G4OpenInventorViewer::SetView(); 309 if(!fViewer) return; 282 if(!fViewer) return; 310 // Background. 283 // Background. 311 G4Colour b = fVP.GetBackgroundColour(); 284 G4Colour b = fVP.GetBackgroundColour(); 312 fViewer->setBackgroundColor 285 fViewer->setBackgroundColor 313 (SbColor((float)b.GetRed(),(float)b.GetGre 286 (SbColor((float)b.GetRed(),(float)b.GetGreen(),(float)b.GetBlue())); 314 } 287 } 315 288 316 void G4OpenInventorQtViewer::ViewerRender() 289 void G4OpenInventorQtViewer::ViewerRender() 317 { 290 { 318 if(!fViewer) return; 291 if(!fViewer) return; 319 fViewer->render(); 292 fViewer->render(); 320 } 293 } 321 294 322 SoCamera* G4OpenInventorQtViewer::GetCamera () 295 SoCamera* G4OpenInventorQtViewer::GetCamera () { 323 if(!fViewer) return 0; 296 if(!fViewer) return 0; 324 return fViewer->getCamera(); 297 return fViewer->getCamera(); 325 } 298 } 326 299 327 300 328 // User interaction finished: update VPs 301 // User interaction finished: update VPs 329 //void G4OpenInventorQtViewer::FinishCB(void* 302 //void G4OpenInventorQtViewer::FinishCB(void* data, SoQtViewer* viewer) 330 //{ 303 //{ 331 // G4cout << "FINISHCB CALLED !!!!!" << G4en 304 // G4cout << "FINISHCB CALLED !!!!!" << G4endl; 332 //} 305 //} 333 306 334 307 335 // File menu... 308 // File menu... 336 309 337 void G4OpenInventorQtViewer::FileWritePSCB() 310 void G4OpenInventorQtViewer::FileWritePSCB() 338 { 311 { 339 // G4cout << "G4OIQtViewer: File: Write P 312 // G4cout << "G4OIQtViewer: File: Write PS CALLBACK" << G4endl; 340 // FWJ Workaround: avoids empty 2nd page in 313 // FWJ Workaround: avoids empty 2nd page in file 341 SbBool superimpState = 314 SbBool superimpState = 342 fViewer->getSuperimpositionEnabled(fView 315 fViewer->getSuperimpositionEnabled(fViewer->superimposition); 343 fViewer->setSuperimpositionEnabled(fViewer- 316 fViewer->setSuperimpositionEnabled(fViewer->superimposition, FALSE); 344 WritePostScript(); 317 WritePostScript(); 345 if (superimpState) 318 if (superimpState) 346 fViewer->setSuperimpositionEnabled(fView 319 fViewer->setSuperimpositionEnabled(fViewer->superimposition, TRUE); 347 } 320 } 348 321 349 void G4OpenInventorQtViewer::FileWritePDFCB() 322 void G4OpenInventorQtViewer::FileWritePDFCB() 350 { 323 { 351 // G4cout << "G4OIQtViewer: File: Write P 324 // G4cout << "G4OIQtViewer: File: Write PDF CALLBACK" << G4endl; 352 // FWJ Workaround: avoids empty 2nd page in 325 // FWJ Workaround: avoids empty 2nd page in file 353 SbBool superimpState = 326 SbBool superimpState = 354 fViewer->getSuperimpositionEnabled(fView 327 fViewer->getSuperimpositionEnabled(fViewer->superimposition); 355 fViewer->setSuperimpositionEnabled(fViewer- 328 fViewer->setSuperimpositionEnabled(fViewer->superimposition, FALSE); 356 WritePDF(); 329 WritePDF(); 357 if (superimpState) 330 if (superimpState) 358 fViewer->setSuperimpositionEnabled(fView 331 fViewer->setSuperimpositionEnabled(fViewer->superimposition, TRUE); 359 } 332 } 360 333 361 void G4OpenInventorQtViewer::FileWriteIVCB() 334 void G4OpenInventorQtViewer::FileWriteIVCB() 362 { 335 { 363 // G4cout << "G4OIQtViewer: File: Write I 336 // G4cout << "G4OIQtViewer: File: Write IV CALLBACK" << G4endl; 364 WriteInventor(); 337 WriteInventor(); 365 } 338 } 366 339 367 void G4OpenInventorQtViewer::FileEscapeCB() 340 void G4OpenInventorQtViewer::FileEscapeCB() 368 { 341 { 369 // G4cout << "G4OIQtViewer: File: Escape 342 // G4cout << "G4OIQtViewer: File: Escape CALLBACK" << G4endl; 370 static_cast<G4SoQt*>(fInteractorManager)->E 343 static_cast<G4SoQt*>(fInteractorManager)->ExitSecondaryLoop(); 371 // Escape(); 344 // Escape(); 372 } 345 } 373 346 374 // Etc menu... 347 // Etc menu... 375 348 376 void 349 void 377 G4OpenInventorQtViewer::EtcEraseDetectorCB() 350 G4OpenInventorQtViewer::EtcEraseDetectorCB() 378 { 351 { 379 // G4cout << "G4OIQtViewer: Etc: Erase De 352 // G4cout << "G4OIQtViewer: Etc: Erase Detector CALLBACK" << G4endl; 380 EraseDetector(); 353 EraseDetector(); 381 } 354 } 382 355 383 void 356 void 384 G4OpenInventorQtViewer::EtcEraseEventCB() 357 G4OpenInventorQtViewer::EtcEraseEventCB() 385 { 358 { 386 // G4cout << "G4OIQtViewer: Etc: Erase Ev 359 // G4cout << "G4OIQtViewer: Etc: Erase Event CALLBACK" << G4endl; 387 EraseEvent(); 360 EraseEvent(); 388 } 361 } 389 362 390 void G4OpenInventorQtViewer::EtcSetSolidCB() 363 void G4OpenInventorQtViewer::EtcSetSolidCB() 391 { 364 { 392 // G4cout << "G4OIQtViewer: Etc: Set Soli 365 // G4cout << "G4OIQtViewer: Etc: Set Solid CALLBACK" << G4endl; 393 SetSolid(); 366 SetSolid(); 394 } 367 } 395 368 396 void G4OpenInventorQtViewer::EtcSetReducedWire 369 void G4OpenInventorQtViewer::EtcSetReducedWireframeCB() 397 { 370 { 398 // G4cout << "G4OIQtViewer: Etc: Set Reduce 371 // G4cout << "G4OIQtViewer: Etc: Set Reduced Wireframe CALLBACK" << G4endl; 399 SetReducedWireFrame(true); 372 SetReducedWireFrame(true); 400 } 373 } 401 374 402 void G4OpenInventorQtViewer::EtcSetFullWirefra 375 void G4OpenInventorQtViewer::EtcSetFullWireframeCB() 403 { 376 { 404 // G4cout << "G4OIQtViewer: Etc: Set Full W 377 // G4cout << "G4OIQtViewer: Etc: Set Full Wireframe CALLBACK" << G4endl; 405 SetReducedWireFrame(false); 378 SetReducedWireFrame(false); 406 } 379 } 407 380 408 void G4OpenInventorQtViewer::EtcVisibMInvisibD 381 void G4OpenInventorQtViewer::EtcVisibMInvisibDCB() 409 { 382 { 410 // G4cout << "G4OIQtViewer: Etc: Visible Mo 383 // G4cout << "G4OIQtViewer: Etc: Visible Mothers + Invisible Daughters" 411 // " CALLBACK" << G4endl; 384 // " CALLBACK" << G4endl; 412 SetPreview(); 385 SetPreview(); 413 } 386 } 414 387 415 void G4OpenInventorQtViewer::EtcVisibMVisibDCB 388 void G4OpenInventorQtViewer::EtcVisibMVisibDCB() 416 { 389 { 417 // G4cout << "G4OIQtViewer: Etc: Visible Mo 390 // G4cout << "G4OIQtViewer: Etc: Visible Mothers + Visible Daughters" 418 // "CALLBACK" << G4endl; 391 // "CALLBACK" << G4endl; 419 SetPreviewAndFull(); 392 SetPreviewAndFull(); 420 } 393 } 421 394 422 void G4OpenInventorQtViewer::EtcUpdateSceneCB( 395 void G4OpenInventorQtViewer::EtcUpdateSceneCB() 423 { 396 { 424 // G4cout << "G4OIQtViewer: Etc: Update S 397 // G4cout << "G4OIQtViewer: Etc: Update Scene CALLBACK" << G4endl; 425 UpdateScene(); 398 UpdateScene(); 426 } 399 } 427 400 428 void G4OpenInventorQtViewer::EtcSceneGraphStat 401 void G4OpenInventorQtViewer::EtcSceneGraphStatsCB() 429 { 402 { 430 // G4cout << "G4OIQtViewer: Etc: Scene Gr 403 // G4cout << "G4OIQtViewer: Etc: Scene Graph Stats CALLBACK" << G4endl; 431 SceneGraphStatistics(); 404 SceneGraphStatistics(); 432 } 405 } 433 406