94 fMarkForClearingTransientStore (true),
98 fReadyForTransients (true),
99 fProcessingSolid (false),
100 fProcessing2D (false),
106 fpScene = pVMan -> GetCurrentScene ();
108 std::ostringstream ost;
151 (
"G4VSceneHandler::BeginPrimitives",
153 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
173 (
"G4VSceneHandler::BeginPrimitives2D",
175 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
263 (
"G4VSceneHandler::AddCompound(const G4VTrajectory&)",
276 const_cast<G4VHit&
>(hit).Draw();
281 const_cast<G4VDigi&
>(digi).Draw();
286 G4bool scoreMapHits =
false;
288 if (scoringManager) {
290 for (
size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
294 for(MeshScoreMap::const_iterator i = scoreMap.begin();
295 i != scoreMap.end(); ++i) {
298 if (foundHits == &hits) {
301 mesh->
DrawMesh(scoreMapName, &colorMap);
308 static G4bool first =
true;
312 "Scoring map drawn with default parameters."
313 "\n To get gMocren file for gMocren browser:"
314 "\n /vis/open gMocrenFile"
315 "\n /vis/viewer/flush"
316 "\n Many other options available with /score/draw... commands."
317 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
335 const G4double oneMinusMargin (1. - margin);
341 const G4double halfLength(length / 2.);
342 const G4double tickLength(length / 20.);
354 G4Polyline scaleLine, tick11, tick12, tick21, tick22;
366 scaleLine.push_back(r1);
367 scaleLine.push_back(r2);
370 tick11.push_back(r1 + ticky);
371 tick11.push_back(r1 - ticky);
372 tick12.push_back(r1 + tickz);
373 tick12.push_back(r1 - tickz);
374 tick21.push_back(r2 + ticky);
375 tick21.push_back(r2 - ticky);
376 tick22.push_back(r2 + tickz);
377 tick22.push_back(r2 - tickz);
378 G4Point3D textPosition(0., tickLength, 0.);
398 sxmid = xmin + oneMinusMargin * (xmax - xmin);
399 symid = ymin + margin * (ymax - ymin);
400 szmid = zmin + oneMinusMargin * (zmax - zmin);
413 transformation = translation * rotation;
437 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
448 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
457 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
476 (*i) -> SetNeedKernelVisit (
true);
484 switch (
fpViewer -> GetViewParameters () . GetRepStyle ()) {
488 static G4bool warned =
false;
492 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
493 "!!!!! NURBS are deprecated and will be removed in the next major release."
494 "\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
506 "ERROR: G4VSceneHandler::RequestPrimitives"
507 "\n NURBS not available for "
526 "ERROR: G4VSceneHandler::RequestPrimitives"
527 "\n Polyhedron not available for " << solid.
GetName () <<
528 ".\n This means it cannot be visualized on most systems."
529 "\n Contact the Visualization Coordinator." <<
G4endl;
560 const std::vector<G4Scene::Model>& runDurationModelList =
561 fpScene -> GetRunDurationModelList ();
563 if (runDurationModelList.size ()) {
573 for (
size_t i = 0; i < runDurationModelList.size (); i++) {
574 if (runDurationModelList[i].fActive) {
575 G4VModel* pModel = runDurationModelList[i].fpModel;
580 pModel -> SetModelingParameters (pMP);
582 pModel -> DescribeYourselfTo (*
this);
583 pModel -> SetModelingParameters (0);
609 const std::vector<const G4Event*>* events =
611 size_t nKeptEvents = 0;
612 if (events) nKeptEvents = events->size();
621 if (events && events->size())
event = events->back();
629 for (
size_t i = 0; i < nKeptEvents; ++i) {
630 const G4Event*
event = (*events)[i];
637 "WARNING: Cannot refresh events accumulated over more"
638 "\n than one runs. Refreshed just the last run."
660 const std::vector<G4Scene::Model>& EOEModelList =
661 fpScene -> GetEndOfEventModelList ();
662 size_t nModels = EOEModelList.size();
666 for (
size_t i = 0; i < nModels; i++) {
667 if (EOEModelList[i].fActive) {
668 G4VModel* pModel = EOEModelList[i].fpModel;
669 pModel -> SetModelingParameters(pMP);
671 pModel -> DescribeYourselfTo (*
this);
672 pModel -> SetModelingParameters(0);
682 const std::vector<G4Scene::Model>& EORModelList =
683 fpScene -> GetEndOfRunModelList ();
684 size_t nModels = EORModelList.size();
688 for (
size_t i = 0; i < nModels; i++) {
689 if (EORModelList[i].fActive) {
690 G4VModel* pModel = EORModelList[i].fpModel;
691 pModel -> SetModelingParameters(pMP);
693 pModel -> DescribeYourselfTo (*
this);
694 pModel -> SetModelingParameters(0);
727 G4bool reallyCullCovered =
756 return pModelingParams;
767 new G4Box(
"_sectioner", safe, safe, 1.e-5 * radius);
778 transform =
G4Rotate3D(angle, axis) * transform;
781 (
"_displaced_sectioning_box", sectionBox, transform);
796 const std::map<G4String,G4AttDef>* vaDefs =
807 const std::map<G4String,G4AttDef>* pvDefs = pPVModel->
GetAttDefs();
816 const std::map<G4String,G4AttDef>* trajModelDefs = trajModel->
GetAttDefs();
822 const std::map<G4String,G4AttDef>* trajDefs = traj->
GetAttDefs();
827 for (
G4int i = 0; i < nPoints; ++i) {
829 const std::map<G4String,G4AttDef>* pointDefs = trajPoint->
GetAttDefs();
840 const std::map<G4String,G4AttDef>* hitsDefs = hit->
GetAttDefs();
857 pVA =
fpViewer -> GetViewParameters (). GetDefaultTextVisAttributes ();
866 if (lineWidth < 1.) lineWidth = 1.;
867 lineWidth *=
fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
868 if (lineWidth < 1.) lineWidth = 1.;
879 if (pVisAttribs -> IsForceDrawingStyle ()) {
881 pVisAttribs -> GetForcedDrawingStyle ();
884 switch (forcedStyle) {
914 if (pVisAttribs -> IsForceAuxEdgeVisible()) isAuxEdgeVisible =
true;
915 return isAuxEdgeVisible;
924 fpViewer -> GetViewParameters().GetDefaultMarker();
929 markerSizeType =
world;
932 size = userSpecified ?
937 size *=
fpViewer -> GetViewParameters().GetGlobalMarkerScale();
938 if (markerSizeType ==
screen && size < 1.) size = 1.;
951 const G4int nSegmentsMin = 12;
952 if (lineSegmentsPerCircle < nSegmentsMin) {
953 lineSegmentsPerCircle = nSegmentsMin;
955 "G4VSceneHandler::GetNoOfSides: attempt to set the"
956 "\nnumber of line segements per circle < " << nSegmentsMin
957 <<
"; forced to " << lineSegmentsPerCircle <<
G4endl;
960 return lineSegmentsPerCircle;
965 os <<
"Scene handler " << sh.
fName <<
" has "
967 for (
size_t i = 0; i < sh.
fViewerList.size (); i++) {
975 os <<
"\n This scene handler currently has no scene.";
HepGeom::Normal3D< G4double > G4Normal3D
HepGeom::Point3D< G4double > G4Point3D
std::ostream & operator<<(std::ostream &os, const G4VSceneHandler &sh)
std::map< G4String, G4THitsMap< G4double > * > MeshScoreMap
std::vector< G4VViewer * >::iterator G4ViewerListIterator
G4DLLIMPORT std::ostream G4cout
void AddAtts(const std::vector< G4AttValue > *values, const std::map< G4String, G4AttDef > *defs)
const G4VHit * GetCurrentHit() const
void SetVisAttributesModifiers(const std::vector< VisAttributesModifier >)
void SetCutawaySolid(G4VSolid *pCutawaySolid)
void SetSectionSolid(G4VSolid *pSectionSolid)
void SetExplodeFactor(G4double explodeFactor)
void SetExplodeCentre(const G4Point3D &explodeCentre)
void SetEvent(const G4Event *pEvent)
std::vector< G4AttValue > * CreateCurrentAttValues() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4Polyline & transform(const G4Transform3D &)
MarkerType GetMarkerType() const
static G4RunManager * GetRunManager()
const G4Run * GetCurrentRun() const
const std::vector< const G4Event * > * GetEventVector() const
Direction GetDirection() const
const G4String & GetAnnotation() const
G4double GetLength() const
G4bool GetAutoPlacing() const
G4bool GetRefreshAtEndOfEvent() const
const G4VisExtent & GetExtent() const
G4bool GetRefreshAtEndOfRun() const
G4VScoringMesh * GetMesh(G4int i) const
size_t GetNumberOfMesh() const
static G4ScoringManager * GetScoringManagerIfExist()
G4ApplicationState GetCurrentState() const
static G4StateManager * GetStateManager()
const G4VTrajectory * GetCurrentTrajectory() const
G4bool IsDrawingModeSet() const
std::vector< G4AttValue > * CreateCurrentAttValues() const
G4int GetDrawingMode() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
const G4String & GetName() const
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4double GetScreenSize() const
void SetScreenSize(G4double)
void SetWorldSize(G4double)
void SetPosition(const G4Point3D &)
G4double GetWorldSize() const
const G4Transform3D & GetTransformation() const
virtual void BeginModeling()
G4int GetNoOfSides(const G4VisAttributes *)
virtual G4VSolid * CreateSectionSolid()
virtual void ClearTransientStore()
void LoadAtts(const G4Visible &, G4AttHolder *)
void DrawEvent(const G4Event *)
G4ModelingParameters * CreateModelingParameters()
const G4Colour & GetTextColour(const G4Text &)
G4Transform3D fObjectTransformation
virtual void EndPrimitives()
G4bool fTransientsDrawnThisEvent
virtual void EndModeling()
const G4int fSceneHandlerId
virtual void ProcessScene()
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
void SetModel(G4VModel *)
virtual void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &)
G4VSceneHandler(G4VGraphicsSystem &system, G4int id, const G4String &name="")
G4bool fTransientsDrawnThisRun
virtual void PostAddSolid()
void AddViewerToList(G4VViewer *pView)
virtual void BeginPrimitives(const G4Transform3D &objectTransformation)
virtual void EndPrimitives2D()
virtual void SetScene(G4Scene *)
void DrawEndOfRunModels()
G4bool fMarkForClearingTransientStore
const G4VisAttributes * fpVisAttribs
virtual void RequestPrimitives(const G4VSolid &solid)
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation)
G4bool fReadyForTransients
G4ViewParameters::DrawingStyle GetDrawingStyle(const G4VisAttributes *)
void RemoveViewerFromList(G4VViewer *pView)
virtual G4VSolid * CreateCutawaySolid()
G4double GetLineWidth(const G4VisAttributes *)
G4VGraphicsSystem & fSystem
virtual void AddSolid(const G4Box &)
virtual void ClearStore()
virtual void AddCompound(const G4VTrajectory &)
virtual ~G4VSceneHandler()
virtual void AddPrimitive(const G4Polyline &)=0
const G4Colour & GetColour(const G4Visible &)
G4bool GetAuxEdgeVisible(const G4VisAttributes *)
MeshScoreMap GetScoreMap()
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
virtual G4NURBS * CreateNURBS() const
virtual G4Polyhedron * GetPolyhedron() const
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual G4VTrajectoryPoint * GetPoint(G4int i) const =0
virtual int GetPointEntries() const =0
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual void DrawTrajectory(G4int i_mode=0) const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
const G4ViewParameters & GetViewParameters() const
static G4VVisManager * GetConcreteInstance()
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
G4int GetNoOfSides() const
G4double GetExplodeFactor() const
G4bool IsCullingInvisible() const
const G4VisAttributes * GetDefaultVisAttributes() const
G4bool IsDensityCulling() const
G4double GetVisibleDensity() const
const G4Point3D & GetExplodeCentre() const
G4bool IsCullingCovered() const
const G4Plane3D & GetSectionPlane() const
DrawingStyle GetDrawingStyle() const
G4bool IsAuxEdgeVisible() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4bool IsForceLineSegmentsPerCircle() const
G4double GetLineWidth() const
G4int GetForcedLineSegmentsPerCircle() const
const std::vector< G4AttValue > * CreateAttValues() const
G4double GetExtentRadius() const
const G4Point3D & GetExtentCentre() const
void SetEventRefreshing(G4bool)
G4bool GetTransientsDrawnThisEvent() const
G4bool GetTransientsDrawnThisRun() const
static Verbosity GetVerbosity()
const G4Event * GetRequestedEvent() const
void SetVisAttributes(const G4VisAttributes *)
const G4VisAttributes * GetVisAttributes() const
T dot(const BasicVector3D< T > &v) const
static void SetNumberOfRotationSteps(G4int n)
static void ResetNumberOfRotationSteps()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)