3 #include "cheprep/config.h"
8 #include "cheprep/DefaultHepRepAttribute.h"
9 #include "cheprep/DefaultHepRepAttValue.h"
21 DefaultHepRepAttribute::DefaultHepRepAttribute() {
24 DefaultHepRepAttribute::~DefaultHepRepAttribute() {
25 for (map<string, HepRepAttValue*>::iterator i = attValues.begin(); i != attValues.end(); i++) {
30 set<HepRepAttValue*> DefaultHepRepAttribute::getAttValuesFromNode() {
31 set<HepRepAttValue*> attSet;
32 for (map<string, HepRepAttValue*>::iterator i = attValues.begin(); i != attValues.end(); i++) {
33 if ((*i).first !=
"layer") attSet.insert((*i).second);
38 void DefaultHepRepAttribute::addAttValue(HepRepAttValue* hepRepAttValue) {
39 string lowerCaseName = hepRepAttValue->getLowerCaseName();
40 if (attValues[lowerCaseName] != NULL)
delete attValues[lowerCaseName];
41 attValues[lowerCaseName] = hepRepAttValue;
44 void DefaultHepRepAttribute::addAttValue(
string key,
char *value,
int showLabel) {
45 addAttValue(key, (std::string)value, showLabel);
48 void DefaultHepRepAttribute::addAttValue(
string key,
string value,
int showLabel) {
49 addAttValue(
new DefaultHepRepAttValue(key, value, showLabel));
52 void DefaultHepRepAttribute::addAttValue(
string key, int64 value,
int showLabel) {
53 addAttValue(
new DefaultHepRepAttValue(key, value, showLabel));
56 void DefaultHepRepAttribute::addAttValue(
string key,
int value,
int showLabel) {
57 addAttValue(
new DefaultHepRepAttValue(key, value, showLabel));
60 void DefaultHepRepAttribute::addAttValue(
string key,
double value,
int showLabel) {
61 addAttValue(
new DefaultHepRepAttValue(key, value, showLabel));
64 void DefaultHepRepAttribute::addAttValue(
string key,
bool value,
int showLabel) {
65 addAttValue(
new DefaultHepRepAttValue(key, value, showLabel));
68 void DefaultHepRepAttribute::addAttValue(
string key, vector<double> value,
int showLabel) {
69 addAttValue(
new DefaultHepRepAttValue(key, value, showLabel));
72 void DefaultHepRepAttribute::addAttValue(
string key,
double red,
double green,
double blue,
double alpha,
int showLabel) {
75 color.push_back(green);
76 color.push_back(blue);
77 color.push_back(alpha);
78 addAttValue(
new DefaultHepRepAttValue(key, color, showLabel));
81 HepRepAttValue* DefaultHepRepAttribute::getAttValueFromNode(
string name) {
83 transform(s.begin(), s.end(), s.begin(), (int(*)(int)) tolower);
84 return (attValues.count(s) > 0) ? attValues[s] : NULL;
87 HepRepAttValue* DefaultHepRepAttribute::removeAttValue(
string name) {
89 transform(s.begin(), s.end(), s.begin(), (int(*)(int)) tolower);
90 HepRepAttValue* attValue = attValues[
s];
static const G4double alpha