MCPcopy Create free account
hub / github.com/Geant4/geant4 / Draw

Method Draw

source/visualization/modeling/src/G4TrajectoryDrawByAttribute.cc:60–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60void
61G4TrajectoryDrawByAttribute::Draw(const G4VTrajectory& object,
62 const G4bool& /*visible*/) const
63{
64 // Return if attribute name has not been set. Just print one warning
65 if (fAttName.empty()) {
66
67 if (!fWarnedMissingAttribute) {
68 G4ExceptionDescription ed;
69 ed<<"Null attribute name";
70 G4Exception("G4TrajectoryDrawByAttribute::Draw",
71 "modeling0116",
72 JustWarning, ed);
73 fWarnedMissingAttribute = true;
74 }
75
76 return;
77 }
78
79 // Basically cache data loaded filter for efficiency
80 if (fFirst) {
81
82 fFirst = false;
83
84 // Get attribute definition
85 G4AttDef attDef;
86
87 // Expect definition to exist
88 if (!G4AttUtils::ExtractAttDef(object, fAttName, attDef)) {
89 static G4bool warnedUnableToExtract = false;
90 if (!warnedUnableToExtract) {
91 G4ExceptionDescription ed;
92 ed <<"Unable to extract attribute definition named "<<fAttName << '\n'
93 << "Available attributes:\n"
94 << *object.GetAttDefs();
95 G4Exception
96 ("G4TrajectoryDrawByAttribute::Draw",
97 "modeling0117", JustWarning, ed, ". Invalid attribute name");
98 warnedUnableToExtract = true;
99 }
100 return;
101 }
102
103 // Get new G4AttValue filter
104 filter = G4AttFilterUtils::GetNewFilter(attDef);
105 assert (0 != filter);
106
107 // Load both interval and single valued data. Single valued data should
108 // override interval data.
109 ContextMap::const_iterator iter = fContextMap.begin();
110
111 while (iter != fContextMap.end()) {
112 if (iter->first.second == G4TrajectoryDrawByAttribute::Interval) {
113 filter->LoadIntervalElement(iter->first.first);
114 }
115 else if (iter->first.second == G4TrajectoryDrawByAttribute::SingleValue) {
116 filter->LoadSingleValueElement(iter->first.first);
117 }

Callers

nothing calls this directly

Calls 14

G4ExceptionFunction · 0.85
ExtractAttDefFunction · 0.85
GetNewFilterFunction · 0.85
ExtractAttValueFunction · 0.85
DrawLineAndPointsFunction · 0.85
LoadIntervalElementMethod · 0.80
GetValidElementMethod · 0.80
emptyMethod · 0.45
GetAttDefsMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected