45 ,fWarnedMissingAttribute(false)
51 ContextMap::iterator iter = fContextMap.begin();
53 while (iter != fContextMap.end()) {
64 const G4bool& visible)
const
66 Draw(
object, visible);
71 const G4bool& visible)
const
76 if (!fWarnedMissingAttribute) {
78 ed<<
"Null attribute name";
82 fWarnedMissingAttribute =
true;
98 static G4bool warnedUnableToExtract =
false;
99 if (!warnedUnableToExtract) {
101 ed <<
"Unable to extract attribute definition named "<<fAttName;
103 (
"G4TrajectoryDrawByAttribute::Draw",
104 "modeling0117",
JustWarning, ed,
"Invalid attribute name");
105 G4cout <<
"Available attributes:\n"
106 <<
object.GetAttDefs();
107 warnedUnableToExtract =
true;
114 assert (0 != filter);
118 ContextMap::const_iterator iter = fContextMap.begin();
120 while (iter != fContextMap.end()) {
121 if (iter->first.second == G4TrajectoryDrawByAttribute::Interval) {
124 else if (iter->first.second == G4TrajectoryDrawByAttribute::SingleValue) {
136 static G4bool warnedUnableToExtract =
false;
137 if (!warnedUnableToExtract) {
139 ed <<
"Unable to extract attribute value named "<<fAttName;
141 (
"G4TrajectoryDrawByAttribute::Draw",
142 "modeling0118",
JustWarning, ed,
"Invalid attribute name");
143 G4cout <<
"Available attributes:\n"
144 <<
object.GetAttDefs();
145 warnedUnableToExtract =
true;
159 ContextMap::const_iterator iter = fContextMap.begin();
163 while (!gotContext && (iter != fContextMap.end())) {
164 if (iter->first.first == key) {
165 myContext = *(iter->second);
177 G4cout<<
"G4TrajectoryDrawByAttribute drawer named "<<
Name();
178 G4cout<<
", drawing style selected according to value of attribute "<<fAttName;
190 ostr<<
"G4TrajectoryDrawByAttribute, dumping configuration for model named "<<
Name() <<
":"<<std::endl;;
192 ostr<<
"Default configuration:"<<
G4endl;
195 ostr<<
"\nAttribute name "<<fAttName<<std::endl;
196 ostr<<
"\nKey<->Context map dump:"<<std::endl;
198 ContextMap::const_iterator iter = fContextMap.begin();
200 while (iter != fContextMap.end()) {
201 ostr<<
"Context for key "<<iter->first.first<<
":"<<std::endl;
202 iter->second->Print(ostr);
218 std::pair<G4String, Config> myPair(name, G4TrajectoryDrawByAttribute::Interval);
220 ContextMap::iterator iter = fContextMap.find(myPair);
222 if (iter != fContextMap.end()) {
224 ed <<
"Interval "<< name <<
" already exists";
226 (
"G4TrajectoryDrawByAttribute::AddIntervalContext",
230 fContextMap[myPair] = context;
237 std::pair<G4String, Config> myPair(name, G4TrajectoryDrawByAttribute::SingleValue);
239 ContextMap::iterator iter = fContextMap.find(myPair);
241 if (iter != fContextMap.end()) {
243 ed <<
"Single value "<< name <<
" already exists";
245 (
"G4TrajectoryDrawByAttribute::AddSingleValueContext",
249 fContextMap[myPair] = context;
G4DLLIMPORT std::ostream G4cout
const G4String & GetValue() const
void AddValueContext(const G4String &name, G4VisTrajContext *context)
void AddIntervalContext(const G4String &name, G4VisTrajContext *context)
virtual ~G4TrajectoryDrawByAttribute()
void Set(const G4String &attribute)
virtual void Print(std::ostream &ostr) const
virtual void Draw(const G4VTrajectory &trajectory, const G4int &i_mode=0, const G4bool &visible=true) 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 SetVisible(const G4bool &visible)
void Print(std::ostream &ostr) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
std::ostringstream G4ExceptionDescription
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 &, const G4int &i_mode)