81 #ifdef G4MULTITHREADED
97 fMarkForClearingTransientStore (true),
101 fReadyForTransients (true),
102 fProcessingSolid (false),
103 fProcessing2D (false),
109 fpScene = pVMan -> GetCurrentScene ();
111 std::ostringstream ost;
161 if (fNestingDepth > 1)
163 (
"G4VSceneHandler::BeginPrimitives",
165 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
166 fObjectTransformation = objectTransformation;
183 if (fNestingDepth > 1)
185 (
"G4VSceneHandler::BeginPrimitives2D",
187 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
188 fObjectTransformation = objectTransformation;
189 fProcessing2D =
true;
274 if (trajectoriesModel)
278 (
"G4VSceneHandler::AddCompound(const G4VTrajectory&)",
285 const_cast<G4VHit&
>(hit).Draw();
290 const_cast<G4VDigi&
>(digi).Draw();
295 G4bool scoreMapHits =
false;
297 if (scoringManager) {
299 for (
size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
303 for(MeshScoreMap::const_iterator i = scoreMap.begin();
304 i != scoreMap.end(); ++i) {
307 if (foundHits == &hits) {
310 mesh->
DrawMesh(scoreMapName, &colorMap);
317 static G4bool first =
true;
321 "Scoring map drawn with default parameters."
322 "\n To get gMocren file for gMocren browser:"
323 "\n /vis/open gMocrenFile"
324 "\n /vis/viewer/flush"
325 "\n Many other options available with /score/draw... commands."
326 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
344 const G4double oneMinusMargin (1. - margin);
350 const G4double halfLength(length / 2.);
351 const G4double tickLength(length / 20.);
363 G4Polyline scaleLine, tick11, tick12, tick21, tick22;
375 scaleLine.push_back(r1);
376 scaleLine.push_back(r2);
379 tick11.push_back(r1 + ticky);
380 tick11.push_back(r1 - ticky);
381 tick12.push_back(r1 + tickz);
382 tick12.push_back(r1 - tickz);
383 tick21.push_back(r2 + ticky);
384 tick21.push_back(r2 - ticky);
385 tick22.push_back(r2 + tickz);
386 tick22.push_back(r2 - tickz);
387 G4Point3D textPosition(0., tickLength, 0.);
407 sxmid = xmin + oneMinusMargin * (xmax - xmin);
408 symid = ymin + margin * (ymax - ymin);
409 szmid = zmin + oneMinusMargin * (zmax - zmin);
422 transformation = translation * rotation;
446 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
457 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
466 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
485 (*i) -> SetNeedKernelVisit (
true);
493 G4Polyhedron::ResetNumberOfRotationSteps ();
502 "ERROR: G4VSceneHandler::RequestPrimitives"
503 "\n Polyhedron not available for " << solid.
GetName () <<
504 ".\n This means it cannot be visualized on most systems."
505 "\n Contact the Visualization Coordinator." <<
G4endl;
534 const std::vector<G4Scene::Model>& runDurationModelList =
535 fpScene -> GetRunDurationModelList ();
537 if (runDurationModelList.size ()) {
547 for (
size_t i = 0; i < runDurationModelList.size (); i++) {
548 if (runDurationModelList[i].fActive) {
549 G4VModel* pModel = runDurationModelList[i].fpModel;
554 pModel -> SetModelingParameters (pMP);
556 pModel -> DescribeYourselfTo (*
this);
557 pModel -> SetModelingParameters (0);
581 #ifdef G4MULTITHREADED
587 const std::vector<const G4Event*>* events =
589 size_t nKeptEvents = 0;
590 if (events) nKeptEvents = events->size();
599 if (events && events->size()) event = events->back();
607 for (
auto&& event: *events) {
614 "WARNING: Cannot refresh events accumulated over more"
615 "\n than one runs. Refreshed just the last run."
637 const std::vector<G4Scene::Model>& EOEModelList =
638 fpScene -> GetEndOfEventModelList ();
639 size_t nModels = EOEModelList.size();
643 for (
size_t i = 0; i < nModels; i++) {
644 if (EOEModelList[i].fActive) {
645 G4VModel* pModel = EOEModelList[i].fpModel;
646 pModel -> SetModelingParameters(pMP);
648 pModel -> DescribeYourselfTo (*
this);
649 pModel -> SetModelingParameters(0);
659 const std::vector<G4Scene::Model>& EORModelList =
660 fpScene -> GetEndOfRunModelList ();
661 size_t nModels = EORModelList.size();
665 for (
size_t i = 0; i < nModels; i++) {
666 if (EORModelList[i].fActive) {
667 G4VModel* pModel = EORModelList[i].fpModel;
668 pModel -> SetModelingParameters(pMP);
670 pModel -> DescribeYourselfTo (*
this);
671 pModel -> SetModelingParameters(0);
706 G4bool reallyCullCovered =
735 return pModelingParams;
746 new G4Box(
"_sectioner", safe, safe, 1.e-5 * radius);
757 transform =
G4Rotate3D(angle, axis) * transform;
760 (
"_displaced_sectioning_box", sectionBox, transform);
775 const std::map<G4String,G4AttDef>* vaDefs =
786 const std::map<G4String,G4AttDef>* pvDefs = pPVModel->
GetAttDefs();
795 const std::map<G4String,G4AttDef>* trajModelDefs = trajModel->
GetAttDefs();
802 const std::map<G4String,G4AttDef>* trajDefs = traj->
GetAttDefs();
807 for (
G4int i = 0; i < nPoints; ++i) {
810 const std::map<G4String,G4AttDef>* pointDefs = trajPoint->
GetAttDefs();
823 const std::map<G4String,G4AttDef>* hitsDefs = hit->
GetAttDefs();
840 pVA =
fpViewer -> GetViewParameters (). GetDefaultTextVisAttributes ();
849 if (lineWidth < 1.) lineWidth = 1.;
850 lineWidth *=
fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
851 if (lineWidth < 1.) lineWidth = 1.;
861 fpViewer->GetViewParameters().GetDrawingStyle();
862 if (pVisAttribs -> IsForceDrawingStyle ()) {
864 pVisAttribs -> GetForcedDrawingStyle ();
867 switch (forcedStyle) {
897 if (pVisAttribs -> IsForceAuxEdgeVisible()) isAuxEdgeVisible =
true;
898 return isAuxEdgeVisible;
907 fpViewer -> GetViewParameters().GetDefaultMarker();
912 markerSizeType = world;
915 size = userSpecified ?
918 markerSizeType = screen;
920 size *= fpViewer -> GetViewParameters().GetGlobalMarkerScale();
921 if (markerSizeType == screen && size < 1.) size = 1.;
934 if (lineSegmentsPerCircle < pVisAttribs->GetMinLineSegmentsPerCircle()) {
937 "G4VSceneHandler::GetNoOfSides: attempt to set the"
938 "\nnumber of line segements per circle < " << lineSegmentsPerCircle
942 return lineSegmentsPerCircle;
947 os <<
"Scene handler " << sh.
fName <<
" has "
949 for (
size_t i = 0; i < sh.
fViewerList.size (); i++) {
957 os <<
"\n This scene handler currently has no scene.";
virtual G4Polyhedron * GetPolyhedron() const
G4bool GetTransientsDrawnThisRun() const
Direction GetDirection() const
void SetWorldSize(G4double)
virtual void ClearStore()
virtual ~G4VSceneHandler()
void AddAtts(const std::vector< G4AttValue > *values, const std::map< G4String, G4AttDef > *defs)
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
virtual void AddSolid(const G4Box &)
static const G4VisExtent NullExtent
static const double halfpi
virtual G4VSolid * CreateSectionSolid()
MarkerType GetMarkerType() const
G4bool GetAutoPlacing() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4double GetVisibleDensity() const
virtual void BeginModeling()
G4ModelingParameters * CreateModelingParameters()
virtual void BeginPrimitives(const G4Transform3D &objectTransformation)
std::map< G4String, G4THitsMap< G4double > * > MeshScoreMap
static G4VVisManager * GetConcreteInstance()
G4double GetWorldSize() const
G4double GetLineWidth() const
const G4Point3D & GetExplodeCentre() const
std::vector< G4AttValue > * CreateCurrentAttValues() const
void SetEventRefreshing(G4bool)
void LoadAtts(const G4Visible &, G4AttHolder *)
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4bool IsCullingInvisible() const
G4double GetExplodeFactor() const
virtual G4VTrajectoryPoint * GetPoint(G4int i) const =0
void RemoveViewerFromList(G4VViewer *pView)
virtual void PostAddSolid()
const G4ViewParameters & GetViewParameters() const
const G4Transform3D & GetTransformation() const
G4bool IsDensityCulling() const
static G4double angle[DIM]
const std::vector< const G4Event * > * GetEventVector() const
G4Transform3D fObjectTransformation
const G4Point3D & GetExtentCentre() const
HepGeom::Point3D< G4double > G4Point3D
HepGeom::Vector3D< G4double > G4Vector3D
const G4VisAttributes * GetVisAttributes() const
G4int GetNoOfSides(const G4VisAttributes *)
virtual const G4VisExtent & GetExtent() const
G4bool GetRefreshAtEndOfEvent() const
virtual void AddPrimitive(const G4Polyline &)=0
const G4Run * GetCurrentRun() const
virtual G4VSolid * CreateCutawaySolid()
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4double GetScreenSize() const
G4VSceneHandler(G4VGraphicsSystem &system, G4int id, const G4String &name="")
virtual void DrawTrajectory() const
virtual std::vector< G4AttValue > * CreateAttValues() const
static double normal(HepRandomEngine *eptr)
void SetCutawaySolid(G4VSolid *pCutawaySolid)
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
static G4StateManager * GetStateManager()
G4double GetLineWidth(const G4VisAttributes *)
virtual int GetPointEntries() const =0
const G4int fSceneHandlerId
G4double GetExtentRadius() const
void AddViewerToList(G4VViewer *pView)
G4GLOB_DLL std::ostream G4cout
G4bool IsAuxEdgeVisible() const
static G4ScoringManager * GetScoringManagerIfExist()
const G4VisExtent & GetExtent() const
static G4int GetMinLineSegmentsPerCircle()
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
void SetEvent(const G4Event *pEvent)
static G4MTRunManager * GetMasterRunManager()
G4bool GetRefreshAtEndOfRun() const
static G4VisManager * GetInstance()
const G4VHit * GetCurrentHit() const
virtual void EndModeling()
virtual void EndPrimitives()
void DrawEndOfRunModels()
G4bool IsCullingCovered() const
G4ApplicationState GetCurrentState() const
G4bool IsMultithreadedApplication()
std::ostream & operator<<(std::ostream &os, const G4VSceneHandler &sh)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void SetVisAttributes(const G4VisAttributes *)
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation)
G4bool GetTransientsDrawnThisEvent() const
virtual void SetScene(G4Scene *)
G4int GetForcedLineSegmentsPerCircle() const
void SetSectionSolid(G4VSolid *pSectionSolid)
static G4RunManager * GetRunManager()
void SetVisAttributesModifiers(const std::vector< VisAttributesModifier > &)
const G4VisAttributes * fpVisAttribs
const G4String & GetName() const
G4bool fMarkForClearingTransientStore
virtual void AddCompound(const G4VTrajectory &)
const G4VTrajectory * GetCurrentTrajectory() const
virtual std::vector< G4AttValue > * CreateAttValues() const
void SetPosition(const G4Point3D &)
std::vector< G4AttValue > * CreateCurrentAttValues() const
const std::vector< G4AttValue > * CreateAttValues() const
void DrawEvent(const G4Event *)
G4double GetAnnotationSize() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4int GetNoOfSides() const
virtual void ProcessScene()
G4bool fTransientsDrawnThisEvent
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4double GetLength() const
G4ViewParameters::DrawingStyle GetDrawingStyle(const G4VisAttributes *)
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
static Verbosity GetVerbosity()
const G4Event * GetRequestedEvent() const
G4bool GetAuxEdgeVisible(const G4VisAttributes *)
MeshScoreMap GetScoreMap() const
DrawingStyle GetDrawingStyle() const
virtual void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &)
virtual std::vector< G4AttValue > * CreateAttValues() const
void SetExplodeFactor(G4double explodeFactor)
HepGeom::Plane3D< G4double > G4Plane3D
const G4Colour & GetColour(const G4Visible &)
const G4Plane3D & GetSectionPlane() const
virtual void RequestPrimitives(const G4VSolid &solid)
std::vector< G4VViewer * >::iterator G4ViewerListIterator
G4bool fReadyForTransients
void SetModel(G4VModel *)
size_t GetNumberOfMesh() const
const G4VisAttributes * GetDefaultVisAttributes() const
virtual void ClearTransientStore()
G4bool fTransientsDrawnThisRun
void SetExplodeCentre(const G4Point3D &explodeCentre)
G4VGraphicsSystem & fSystem
G4bool IsForceLineSegmentsPerCircle() const
const G4String & GetAnnotation() const
G4VScoringMesh * GetMesh(G4int i) const
G4Polyline & transform(const G4Transform3D &)
virtual void EndPrimitives2D()
G4GLOB_DLL std::ostream G4cerr
void SetScreenSize(G4double)
HepGeom::Normal3D< G4double > G4Normal3D
const G4Colour & GetTextColour(const G4Text &)