57 G4cout <<
"G4GDML: Reading GDML extension..." << G4endl;
59 for (xercesc::DOMNode* iter = extElement->getFirstChild();
60 iter != 0; iter = iter->getNextSibling())
62 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
64 const xercesc::DOMElement*
const child
65 =
dynamic_cast<xercesc::DOMElement*
>(iter);
66 const G4String tag = Transcode(child->getTagName());
71 G4String error_msg =
"Unknown tag in structure: " + tag;
72 G4Exception(
"G03ColorReader::ExtensionRead()",
73 "ReadError", FatalException, error_msg);
85 G4GDMLAuxListType auxList;
87 XMLCh *name_attr = xercesc::XMLString::transcode(
"name");
88 const G4String name = Transcode(volumeElement->getAttribute(name_attr));
89 xercesc::XMLString::release(&name_attr);
91 for (xercesc::DOMNode* iter = volumeElement->getFirstChild();
92 iter != 0; iter = iter->getNextSibling())
94 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
96 const xercesc::DOMElement*
const child
97 =
dynamic_cast<xercesc::DOMElement*
>(iter);
98 const G4String tag = Transcode(child->getTagName());
100 if (tag==
"auxiliary")
101 { auxList.push_back(AuxiliaryRead(child)); }
else
102 if (tag==
"materialref")
103 { materialPtr = GetMaterial(GenerateName(RefRead(child),
true)); }
else
105 { solidPtr = GetSolid(GenerateName(RefRead(child))); }
else
106 if (tag ==
"colorref")
111 GenerateName(name),0,0,0);
112 pMotherLogical->SetVisAttributes(attrPtr);
114 if (!auxList.empty()) { auxMap[pMotherLogical] = auxList; }
116 Volume_contentRead(volumeElement);
125 G4double r=0., g=0., b=0.,
a=0.;
127 const xercesc::DOMNamedNodeMap*
const attributes
128 = colorElement->getAttributes();
129 XMLSize_t attributeCount = attributes->getLength();
131 for (XMLSize_t attribute_index=0;
132 attribute_index<attributeCount; attribute_index++)
134 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
136 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
139 const xercesc::DOMAttr*
const attribute
140 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
141 const G4String attName = Transcode(attribute->getName());
142 const G4String attValue = Transcode(attribute->getValue());
145 { name = GenerateName(attValue); }
else
147 { r = eval.Evaluate(attValue); }
else
149 { g = eval.Evaluate(attValue); }
else
151 { b = eval.Evaluate(attValue); }
else
153 {
a = eval.Evaluate(attValue); }
156 G4cout <<
"Color attribute (R,G,B,A) is: "
157 << r <<
", " << g <<
", " << b <<
", " <<
a <<
" !" << G4endl;
159 fAttribs.insert(std::make_pair(name,color));