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 (
size_t i = 0; i < nKeptEvents; ++i) {
608 const G4Event*
event = (*events)[i];
615 "WARNING: Cannot refresh events accumulated over more"
616 "\n than one runs. Refreshed just the last run."
638 const std::vector<G4Scene::Model>& EOEModelList =
639 fpScene -> GetEndOfEventModelList ();
640 size_t nModels = EOEModelList.size();
644 for (
size_t i = 0; i < nModels; i++) {
645 if (EOEModelList[i].fActive) {
646 G4VModel* pModel = EOEModelList[i].fpModel;
647 pModel -> SetModelingParameters(pMP);
649 pModel -> DescribeYourselfTo (*
this);
650 pModel -> SetModelingParameters(0);
660 const std::vector<G4Scene::Model>& EORModelList =
661 fpScene -> GetEndOfRunModelList ();
662 size_t nModels = EORModelList.size();
666 for (
size_t i = 0; i < nModels; i++) {
667 if (EORModelList[i].fActive) {
668 G4VModel* pModel = EORModelList[i].fpModel;
669 pModel -> SetModelingParameters(pMP);
671 pModel -> DescribeYourselfTo (*
this);
672 pModel -> SetModelingParameters(0);
707 G4bool reallyCullCovered =
736 return pModelingParams;
747 new G4Box(
"_sectioner", safe, safe, 1.e-5 * radius);
758 transform =
G4Rotate3D(angle, axis) * transform;
761 (
"_displaced_sectioning_box", sectionBox, transform);
776 const std::map<G4String,G4AttDef>* vaDefs =
787 const std::map<G4String,G4AttDef>* pvDefs = pPVModel->
GetAttDefs();
796 const std::map<G4String,G4AttDef>* trajModelDefs = trajModel->
GetAttDefs();
803 const std::map<G4String,G4AttDef>* trajDefs = traj->
GetAttDefs();
808 for (
G4int i = 0; i < nPoints; ++i) {
811 const std::map<G4String,G4AttDef>* pointDefs = trajPoint->
GetAttDefs();
824 const std::map<G4String,G4AttDef>* hitsDefs = hit->
GetAttDefs();
841 pVA =
fpViewer -> GetViewParameters (). GetDefaultTextVisAttributes ();
850 if (lineWidth < 1.) lineWidth = 1.;
851 lineWidth *=
fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
852 if (lineWidth < 1.) lineWidth = 1.;
862 fpViewer->GetViewParameters().GetDrawingStyle();
863 if (pVisAttribs -> IsForceDrawingStyle ()) {
865 pVisAttribs -> GetForcedDrawingStyle ();
868 switch (forcedStyle) {
898 if (pVisAttribs -> IsForceAuxEdgeVisible()) isAuxEdgeVisible =
true;
899 return isAuxEdgeVisible;
908 fpViewer -> GetViewParameters().GetDefaultMarker();
913 markerSizeType = world;
916 size = userSpecified ?
919 markerSizeType = screen;
921 size *= fpViewer -> GetViewParameters().GetGlobalMarkerScale();
922 if (markerSizeType == screen && size < 1.) size = 1.;
935 if (lineSegmentsPerCircle < pVisAttribs->GetMinLineSegmentsPerCircle()) {
938 "G4VSceneHandler::GetNoOfSides: attempt to set the"
939 "\nnumber of line segements per circle < " << lineSegmentsPerCircle
943 return lineSegmentsPerCircle;
948 os <<
"Scene handler " << sh.
fName <<
" has "
950 for (
size_t i = 0; i < sh.
fViewerList.size (); i++) {
958 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
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
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 &)