44 ,fWarnedMissingAttribute(false)
50 ContextMap::iterator iter = fContextMap.begin();
52 while (iter != fContextMap.end()) {
65 if (fAttName.empty()) {
67 if (!fWarnedMissingAttribute) {
69 ed<<
"Null attribute name";
73 fWarnedMissingAttribute =
true;
89 static G4bool warnedUnableToExtract =
false;
90 if (!warnedUnableToExtract) {
92 ed <<
"Unable to extract attribute definition named "<<fAttName <<
'\n'
93 <<
"Available attributes:\n"
94 << *
object.GetAttDefs();
96 (
"G4TrajectoryDrawByAttribute::Draw",
97 "modeling0117",
JustWarning, ed,
". Invalid attribute name");
98 warnedUnableToExtract =
true;
105 assert (0 != filter);
109 ContextMap::const_iterator iter = fContextMap.begin();
111 while (iter != fContextMap.end()) {
112 if (iter->first.second == G4TrajectoryDrawByAttribute::Interval) {
115 else if (iter->first.second == G4TrajectoryDrawByAttribute::SingleValue) {
127 static G4bool warnedUnableToExtract =
false;
128 if (!warnedUnableToExtract) {
130 ed <<
"Unable to extract attribute definition named "<<fAttName <<
'\n'
131 <<
"Available attributes:\n"
132 << *
object.GetAttDefs();
134 (
"G4TrajectoryDrawByAttribute::Draw",
135 "modeling0118",
JustWarning, ed,
". Invalid attribute name");
136 warnedUnableToExtract =
true;
150 ContextMap::const_iterator iter = fContextMap.begin();
154 while (!gotContext && (iter != fContextMap.end())) {
155 if (iter->first.first == key) {
156 myContext = *(iter->second);
166 G4cout<<
"G4TrajectoryDrawByAttribute drawer named "<<
Name();
167 G4cout<<
", drawing style selected according to value of attribute "<<fAttName;
179 ostr<<
"G4TrajectoryDrawByAttribute, dumping configuration for model named "<<
Name() <<
":"<<std::endl;;
181 ostr<<
"Default configuration:"<<
G4endl;
184 ostr<<
"\nAttribute name "<<fAttName<<std::endl;
185 ostr<<
"\nKey<->Context map dump:"<<std::endl;
187 ContextMap::const_iterator iter = fContextMap.begin();
189 while (iter != fContextMap.end()) {
190 ostr<<
"Context for key "<<iter->first.first<<
":"<<std::endl;
191 iter->second->Print(ostr);
207 std::pair<G4String, Config> myPair(name, G4TrajectoryDrawByAttribute::Interval);
209 ContextMap::iterator iter = fContextMap.find(myPair);
211 if (iter != fContextMap.end()) {
213 ed <<
"Interval "<< name <<
" already exists";
215 (
"G4TrajectoryDrawByAttribute::AddIntervalContext",
219 fContextMap[myPair] = context;
226 std::pair<G4String, Config> myPair(name, G4TrajectoryDrawByAttribute::SingleValue);
228 ContextMap::iterator iter = fContextMap.find(myPair);
230 if (iter != fContextMap.end()) {
232 ed <<
"Single value "<< name <<
" already exists";
234 (
"G4TrajectoryDrawByAttribute::AddSingleValueContext",
238 fContextMap[myPair] = context;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cout
const G4String & GetValue() const
void AddValueContext(const G4String &name, G4VisTrajContext *context)
void AddIntervalContext(const G4String &name, G4VisTrajContext *context)
virtual void Draw(const G4VTrajectory &trajectory, const G4bool &visible=true) const
virtual ~G4TrajectoryDrawByAttribute()
void Set(const G4String &attribute)
virtual void Print(std::ostream &ostr) const
G4TrajectoryDrawByAttribute(const G4String &name="Unspecified", G4VisTrajContext *context=0)
virtual void LoadIntervalElement(const G4String &)=0
virtual G4bool GetValidElement(const G4AttValue &, G4String &) const =0
virtual void LoadSingleValueElement(const G4String &)=0
const G4VisTrajContext & GetContext() const
G4bool GetVerbose() const
void Print(std::ostream &ostr) const
G4VAttValueFilter * GetNewFilter(const G4AttDef &def)
G4bool ExtractAttDef(const T &object, const G4String &name, G4AttDef &def)
G4bool ExtractAttValue(const T &object, const G4String &name, G4AttValue &attVal)
void DrawLineAndPoints(const G4VTrajectory &traj, const G4VisTrajContext &)