42:
G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name)
52 setObjectName(
fName.c_str());
54 fVP.SetAutoRefresh(
true);
58 auto uiQt =
dynamic_cast<G4UIQt*
>(UI->GetG4UIWindow());
61 G4warn <<
"G4Qt3DViewer::G4Qt3DViewer requires G4UIQt"
65 fUIWidget = QWidget::createWindowContainer(
this);
73 setRootEntity(
nullptr);
89 +
fVP.GetCurrentTargetPoint ();
91 if(radius<=0.) radius = 1.;
92 const G4double cameraDistance =
fVP.GetCameraDistance (radius);
94 targetPoint + cameraDistance *
fVP.GetViewpointDirection().unit();
95 const GLdouble pnear =
fVP.GetNearDistance (cameraDistance, radius);
96 const GLdouble pfar =
fVP.GetFarDistance (cameraDistance, pnear, radius);
97 const GLdouble right =
fVP.GetFrontHalfHeight (pnear, radius);
98 const GLdouble left = -right;
99 const GLdouble top =
fVP.GetFrontHalfHeight (pnear, radius);
100 const GLdouble bottom = -top;
102 camera()->setObjectName((
fName +
" camera").c_str());
122 if (
fVP.GetFieldHalfAngle() == 0.) {
123 camera()->lens()->setOrthographicProjection
124 (left*aspectRatio,right*aspectRatio,bottom,top,pnear,pfar);
126 camera()->lens()->setPerspectiveProjection
127 (2.*
fVP.GetFieldHalfAngle()/deg,aspectRatio,pnear,pfar);
151 if (kernelVisitWasNeeded) {
162#if QT_VERSION < 0x060000
174#if QT_VERSION < 0x060000
197 QThread* masterQThread =
nullptr;
198 QThread* visSubThreadQThread =
nullptr;
202 G4bool visSubThreadEstablished =
false;
203 G4bool qObjectsSwitched =
false;
210 masterQThread = QThread::currentThread();
221 auto p2 = p1->parent();
223 p2->moveToThread(visSubThreadQThread);
225 p1->moveToThread(visSubThreadQThread);
231 qObjectsSwitched =
true;
240 visSubThreadQThread = QThread::currentThread();
245 visSubThreadEstablished =
true;
262 auto p2 = p1->parent();
264 p2->moveToThread(masterQThread);
266 p1->moveToThread(masterQThread);
271 visSubThreadQThread =
nullptr;
272 qObjectsSwitched =
false;
278 visSubThreadEstablished =
false;
303 fVP.GetCBDAlgorithmNumber()) ||
317 fVP.GetDefaultVisAttributes()->GetColour()) ||
319 fVP.GetDefaultTextVisAttributes()->GetColour()) ||
327 fVP.GetVisAttributesModifiers()) ||
329 fVP.IsSpecialMeshRendering()) ||
331 fVP.GetSpecialMeshRenderingOption())
351 fVP.GetCutawayPlanes ().size ())
return true;
390#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
408 const G4double dxScene = dx*sceneRadius/scale;
409 const G4double dyScene = dy*sceneRadius/scale;
410 fVP.IncrementPan(-dxScene,dyScene);
415 const G4Vector3D& x_prime =
fVP.GetViewpointDirection().cross(
fVP.GetUpVector());
418 G4Vector3D newViewpointDirection =
fVP.GetViewpointDirection();
419 newViewpointDirection += dx*x_prime/scale;
420 newViewpointDirection += dy*y_prime/scale;
421 fVP.SetViewpointDirection(newViewpointDirection.
unit());
425 newUpVector += dx*x_prime/scale;
426 newUpVector += dy*y_prime/scale;
427 fVP.SetUpVector(newUpVector.
unit());
439#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
456 const G4double angleY = ev->angleDelta().y();
458 if (
fVP.GetFieldHalfAngle() == 0.) {
460 fVP.MultiplyZoomFactor(1.+angleY/scale);
463 fVP.SetDolly(
fVP.GetDolly()+angleY*delta);
G4TemplateAutoLock< G4Mutex > G4AutoLock
HepGeom::Point3D< G4double > G4Point3D
#define G4CONDITION_INITIALIZER
#define G4MUTEX_INITIALIZER
#define G4CONDITIONWAITLAMBDA(cond, mutex, lambda)
#define G4CONDITIONBROADCAST(cond)
HepGeom::Vector3D< G4double > G4Vector3D
G4GLOB_DLL std::ostream G4cout
void mousePressEvent(QMouseEvent *)
void KernelVisitDecision()
G4Qt3DSceneHandler & fQt3DSceneHandler
void SwitchToMasterThread()
void SwitchToVisSubThread()
void MovingToMasterThread()
void mouseReleaseEvent(QMouseEvent *)
virtual void resizeEvent(QResizeEvent *)
void wheelEvent(QWheelEvent *)
void keyPressEvent(QKeyEvent *)
G4Qt3DViewer(G4Qt3DSceneHandler &, const G4String &name)
void mouseDoubleClickEvent(QMouseEvent *)
void MovingToVisSubThread()
void mouseMoveEvent(QMouseEvent *)
G4bool CompareForKernelVisit(G4ViewParameters &)
void keyReleaseEvent(QKeyEvent *)
static G4UImanager * GetUIpointer()
G4VSceneHandler & fSceneHandler
G4ViewParameters fDefaultVP
G4VViewer(G4VSceneHandler &, G4int id, const G4String &name="")
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
const G4Vector3D & GetScaleFactor() const
G4int GetNoOfSides() const
G4bool IsSpecialMeshRendering() const
CutawayMode GetCutawayMode() const
G4double GetExplodeFactor() const
G4int GetNumberOfCloudPoints() const
G4bool IsMarkerNotHidden() const
G4double GetGlobalLineWidthScale() const
const G4Colour & GetBackgroundColour() const
const G4VisAttributes * GetDefaultTextVisAttributes() const
const std::vector< G4double > & GetCBDParameters() const
G4int GetCBDAlgorithmNumber() const
const std::vector< G4ModelingParameters::PVNameCopyNo > & GetSpecialMeshVolumes() const
G4double GetGlobalMarkerScale() const
G4bool IsCullingInvisible() const
const G4VisAttributes * GetDefaultVisAttributes() const
const G4Planes & GetCutawayPlanes() const
G4bool IsDensityCulling() const
G4double GetVisibleDensity() const
SMROption GetSpecialMeshRenderingOption() const
G4bool IsCullingCovered() const
const G4Plane3D & GetSectionPlane() const
DrawingStyle GetDrawingStyle() const
G4bool IsAuxEdgeVisible() const
const G4Colour & GetColour() const
BasicVector3D< T > cross(const BasicVector3D< T > &v) const
BasicVector3D< T > unit() const
QColor ConvertToQColor(const G4Colour &c)
QVector3D ConvertToQVector3D(const G4ThreeVector &v)