93 fMarkForClearingTransientStore (true),
97 fReadyForTransients (true),
98 fProcessingSolid (false),
99 fProcessing2D (false),
105 fpScene = pVMan -> GetCurrentScene ();
107 std::ostringstream ost;
157 if (fNestingDepth > 1)
159 (
"G4VSceneHandler::BeginPrimitives",
161 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
162 fObjectTransformation = objectTransformation;
179 if (fNestingDepth > 1)
181 (
"G4VSceneHandler::BeginPrimitives2D",
183 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
184 fObjectTransformation = objectTransformation;
185 fProcessing2D =
true;
270 if (trajectoriesModel)
274 (
"G4VSceneHandler::AddCompound(const G4VTrajectory&)",
281 const_cast<G4VHit&
>(hit).Draw();
286 const_cast<G4VDigi&
>(digi).Draw();
291 G4bool scoreMapHits =
false;
293 if (scoringManager) {
295 for (
size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
299 for(MeshScoreMap::const_iterator i = scoreMap.begin();
300 i != scoreMap.end(); ++i) {
303 if (foundHits == &hits) {
306 mesh->
DrawMesh(scoreMapName, &colorMap);
313 static G4bool first =
true;
317 "Scoring map drawn with default parameters."
318 "\n To get gMocren file for gMocren browser:"
319 "\n /vis/open gMocrenFile"
320 "\n /vis/viewer/flush"
321 "\n Many other options available with /score/draw... commands."
322 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
340 const G4double oneMinusMargin (1. - margin);
346 const G4double halfLength(length / 2.);
347 const G4double tickLength(length / 20.);
359 G4Polyline scaleLine, tick11, tick12, tick21, tick22;
371 scaleLine.push_back(r1);
372 scaleLine.push_back(r2);
375 tick11.push_back(r1 + ticky);
376 tick11.push_back(r1 - ticky);
377 tick12.push_back(r1 + tickz);
378 tick12.push_back(r1 - tickz);
379 tick21.push_back(r2 + ticky);
380 tick21.push_back(r2 - ticky);
381 tick22.push_back(r2 + tickz);
382 tick22.push_back(r2 - tickz);
383 G4Point3D textPosition(0., tickLength, 0.);
403 sxmid = xmin + oneMinusMargin * (xmax - xmin);
404 symid = ymin + margin * (ymax - ymin);
405 szmid = zmin + oneMinusMargin * (zmax - zmin);
418 transformation = translation * rotation;
442 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
453 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
462 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
481 (*i) -> SetNeedKernelVisit (
true);
489 G4Polyhedron::ResetNumberOfRotationSteps ();
498 "ERROR: G4VSceneHandler::RequestPrimitives"
499 "\n Polyhedron not available for " << solid.
GetName () <<
500 ".\n This means it cannot be visualized on most systems."
501 "\n Contact the Visualization Coordinator." <<
G4endl;
530 const std::vector<G4Scene::Model>& runDurationModelList =
531 fpScene -> GetRunDurationModelList ();
533 if (runDurationModelList.size ()) {
543 for (
size_t i = 0; i < runDurationModelList.size (); i++) {
544 if (runDurationModelList[i].fActive) {
545 G4VModel* pModel = runDurationModelList[i].fpModel;
550 pModel -> SetModelingParameters (pMP);
552 pModel -> DescribeYourselfTo (*
this);
553 pModel -> SetModelingParameters (0);
579 const std::vector<const G4Event*>* events =
581 size_t nKeptEvents = 0;
582 if (events) nKeptEvents = events->size();
591 if (events && events->size()) event = events->back();
599 for (
size_t i = 0; i < nKeptEvents; ++i) {
600 const G4Event*
event = (*events)[i];
607 "WARNING: Cannot refresh events accumulated over more"
608 "\n than one runs. Refreshed just the last run."
630 const std::vector<G4Scene::Model>& EOEModelList =
631 fpScene -> GetEndOfEventModelList ();
632 size_t nModels = EOEModelList.size();
636 for (
size_t i = 0; i < nModels; i++) {
637 if (EOEModelList[i].fActive) {
638 G4VModel* pModel = EOEModelList[i].fpModel;
639 pModel -> SetModelingParameters(pMP);
641 pModel -> DescribeYourselfTo (*
this);
642 pModel -> SetModelingParameters(0);
652 const std::vector<G4Scene::Model>& EORModelList =
653 fpScene -> GetEndOfRunModelList ();
654 size_t nModels = EORModelList.size();
658 for (
size_t i = 0; i < nModels; i++) {
659 if (EORModelList[i].fActive) {
660 G4VModel* pModel = EORModelList[i].fpModel;
661 pModel -> SetModelingParameters(pMP);
663 pModel -> DescribeYourselfTo (*
this);
664 pModel -> SetModelingParameters(0);
697 G4bool reallyCullCovered =
726 return pModelingParams;
737 new G4Box(
"_sectioner", safe, safe, 1.e-5 * radius);
748 transform =
G4Rotate3D(angle, axis) * transform;
751 (
"_displaced_sectioning_box", sectionBox, transform);
766 const std::map<G4String,G4AttDef>* vaDefs =
777 const std::map<G4String,G4AttDef>* pvDefs = pPVModel->
GetAttDefs();
786 const std::map<G4String,G4AttDef>* trajModelDefs = trajModel->
GetAttDefs();
792 const std::map<G4String,G4AttDef>* trajDefs = traj->
GetAttDefs();
797 for (
G4int i = 0; i < nPoints; ++i) {
799 const std::map<G4String,G4AttDef>* pointDefs = trajPoint->
GetAttDefs();
810 const std::map<G4String,G4AttDef>* hitsDefs = hit->
GetAttDefs();
827 pVA =
fpViewer -> GetViewParameters (). GetDefaultTextVisAttributes ();
836 if (lineWidth < 1.) lineWidth = 1.;
837 lineWidth *=
fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
838 if (lineWidth < 1.) lineWidth = 1.;
848 fpViewer->GetViewParameters().GetDrawingStyle();
849 if (pVisAttribs -> IsForceDrawingStyle ()) {
851 pVisAttribs -> GetForcedDrawingStyle ();
854 switch (forcedStyle) {
884 if (pVisAttribs -> IsForceAuxEdgeVisible()) isAuxEdgeVisible =
true;
885 return isAuxEdgeVisible;
894 fpViewer -> GetViewParameters().GetDefaultMarker();
899 markerSizeType = world;
902 size = userSpecified ?
905 markerSizeType = screen;
907 size *= fpViewer -> GetViewParameters().GetGlobalMarkerScale();
908 if (markerSizeType == screen && size < 1.) size = 1.;
921 const G4int nSegmentsMin = 12;
922 if (lineSegmentsPerCircle < nSegmentsMin) {
923 lineSegmentsPerCircle = nSegmentsMin;
925 "G4VSceneHandler::GetNoOfSides: attempt to set the"
926 "\nnumber of line segements per circle < " << nSegmentsMin
927 <<
"; forced to " << lineSegmentsPerCircle <<
G4endl;
930 return lineSegmentsPerCircle;
935 os <<
"Scene handler " << sh.
fName <<
" has "
937 for (
size_t i = 0; i < sh.
fViewerList.size (); i++) {
945 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
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
void SetEvent(const G4Event *pEvent)
G4bool GetRefreshAtEndOfRun() const
static G4VisManager * GetInstance()
const G4VHit * GetCurrentHit() const
virtual void EndModeling()
virtual void EndPrimitives()
void DrawEndOfRunModels()
G4bool IsCullingCovered() const
G4ApplicationState GetCurrentState() const
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 *)
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()
void SetScreenSize(G4double)
HepGeom::Normal3D< G4double > G4Normal3D
const G4Colour & GetTextColour(const G4Text &)