Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G03ColorReader Class Reference

GDML reader for the color attributes. More...

#include <G03ColorReader.hh>

Inheritance diagram for G03ColorReader:
Collaboration diagram for G03ColorReader:

Public Member Functions

 G03ColorReader ()
 
 ~G03ColorReader ()
 
void ExtensionRead (const xercesc::DOMElement *const element)
 
void ColorRead (const xercesc::DOMElement *const element)
 
G4VisAttributesGetVisAttribute (const G4String &ref)
 
- Public Member Functions inherited from G4GDMLReadStructure
 G4GDMLReadStructure ()
 
virtual ~G4GDMLReadStructure ()
 
G4VPhysicalVolumeGetPhysvol (const G4String &) const
 
G4LogicalVolumeGetVolume (const G4String &) const
 
G4AssemblyVolumeGetAssembly (const G4String &) const
 
G4GDMLAuxListType GetVolumeAuxiliaryInformation (G4LogicalVolume *) const
 
G4VPhysicalVolumeGetWorldVolume (const G4String &)
 
const G4GDMLAuxMapTypeGetAuxMap () const
 
void Clear ()
 
virtual void Volume_contentRead (const xercesc::DOMElement *const)
 
virtual void StructureRead (const xercesc::DOMElement *const)
 
- Public Member Functions inherited from G4GDMLReadParamvol
virtual void ParamvolRead (const xercesc::DOMElement *const, G4LogicalVolume *)
 
virtual void Paramvol_contentRead (const xercesc::DOMElement *const)
 
- Public Member Functions inherited from G4GDMLReadSetup
G4String GetSetup (const G4String &)
 
virtual void SetupRead (const xercesc::DOMElement *const element)
 
- Public Member Functions inherited from G4GDMLReadSolids
G4VSolidGetSolid (const G4String &) const
 
G4SurfacePropertyGetSurfaceProperty (const G4String &) const
 
virtual void SolidsRead (const xercesc::DOMElement *const)
 
- Public Member Functions inherited from G4GDMLReadMaterials
G4ElementGetElement (const G4String &, G4bool verbose=true) const
 
G4IsotopeGetIsotope (const G4String &, G4bool verbose=true) const
 
G4MaterialGetMaterial (const G4String &, G4bool verbose=true) const
 
virtual void MaterialsRead (const xercesc::DOMElement *const)
 
- Public Member Functions inherited from G4GDMLReadDefine
G4bool IsValidID (const G4String &) const
 
G4double GetConstant (const G4String &)
 
G4double GetVariable (const G4String &)
 
G4double GetQuantity (const G4String &)
 
G4ThreeVector GetPosition (const G4String &)
 
G4ThreeVector GetRotation (const G4String &)
 
G4ThreeVector GetScale (const G4String &)
 
G4GDMLMatrix GetMatrix (const G4String &)
 
virtual void DefineRead (const xercesc::DOMElement *const)
 
- Public Member Functions inherited from G4GDMLRead
virtual void UserinfoRead (const xercesc::DOMElement *const)
 
void Read (const G4String &, G4bool validation, G4bool isModule, G4bool strip=true)
 
void StripNames () const
 
void StripName (G4String &) const
 
void OverlapCheck (G4bool)
 
const G4GDMLAuxListTypeGetAuxList () const
 

Protected Member Functions

virtual void VolumeRead (const xercesc::DOMElement *const)
 
- Protected Member Functions inherited from G4GDMLReadStructure
void AssemblyRead (const xercesc::DOMElement *const)
 
void DivisionvolRead (const xercesc::DOMElement *const)
 
G4LogicalVolumeFileRead (const xercesc::DOMElement *const)
 
void PhysvolRead (const xercesc::DOMElement *const, G4AssemblyVolume *assembly=0)
 
void ReplicavolRead (const xercesc::DOMElement *const, G4int number)
 
void ReplicaRead (const xercesc::DOMElement *const replicaElement, G4LogicalVolume *logvol, G4int number)
 
EAxis AxisRead (const xercesc::DOMElement *const axisElement)
 
G4double QuantityRead (const xercesc::DOMElement *const readElement)
 
void BorderSurfaceRead (const xercesc::DOMElement *const)
 
void SkinSurfaceRead (const xercesc::DOMElement *const)
 
- Protected Member Functions inherited from G4GDMLReadParamvol
 G4GDMLReadParamvol ()
 
virtual ~G4GDMLReadParamvol ()
 
void Box_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void Trd_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void Trap_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void Tube_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void Cone_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void Sphere_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void Orb_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void Torus_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void Ellipsoid_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void Para_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void Hype_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void Polycone_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void Polyhedra_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void ParameterisedRead (const xercesc::DOMElement *const)
 
void ParametersRead (const xercesc::DOMElement *const)
 
- Protected Member Functions inherited from G4GDMLReadSetup
 G4GDMLReadSetup ()
 
virtual ~G4GDMLReadSetup ()
 
- Protected Member Functions inherited from G4GDMLReadSolids
 G4GDMLReadSolids ()
 
virtual ~G4GDMLReadSolids ()
 
void BooleanRead (const xercesc::DOMElement *const, const BooleanOp)
 
void BoxRead (const xercesc::DOMElement *const)
 
void ConeRead (const xercesc::DOMElement *const)
 
void ElconeRead (const xercesc::DOMElement *const)
 
void EllipsoidRead (const xercesc::DOMElement *const)
 
void EltubeRead (const xercesc::DOMElement *const)
 
void XtruRead (const xercesc::DOMElement *const)
 
void HypeRead (const xercesc::DOMElement *const)
 
void MultiUnionNodeRead (const xercesc::DOMElement *const, G4MultiUnion *const)
 
void MultiUnionRead (const xercesc::DOMElement *const)
 
void OrbRead (const xercesc::DOMElement *const)
 
void ParaRead (const xercesc::DOMElement *const)
 
void ParaboloidRead (const xercesc::DOMElement *const)
 
void PolyconeRead (const xercesc::DOMElement *const)
 
void GenericPolyconeRead (const xercesc::DOMElement *const)
 
void PolyhedraRead (const xercesc::DOMElement *const)
 
void GenericPolyhedraRead (const xercesc::DOMElement *const)
 
G4QuadrangularFacetQuadrangularRead (const xercesc::DOMElement *const)
 
void ReflectedSolidRead (const xercesc::DOMElement *const)
 
void ScaledSolidRead (const xercesc::DOMElement *const)
 
G4ExtrudedSolid::ZSection SectionRead (const xercesc::DOMElement *const, G4double)
 
void SphereRead (const xercesc::DOMElement *const)
 
void TessellatedRead (const xercesc::DOMElement *const)
 
void TetRead (const xercesc::DOMElement *const)
 
void TorusRead (const xercesc::DOMElement *const)
 
void GenTrapRead (const xercesc::DOMElement *const)
 
void TrapRead (const xercesc::DOMElement *const)
 
void TrdRead (const xercesc::DOMElement *const)
 
void TubeRead (const xercesc::DOMElement *const)
 
void CutTubeRead (const xercesc::DOMElement *const)
 
void TwistedboxRead (const xercesc::DOMElement *const)
 
void TwistedtrapRead (const xercesc::DOMElement *const)
 
void TwistedtrdRead (const xercesc::DOMElement *const)
 
void TwistedtubsRead (const xercesc::DOMElement *const)
 
G4TriangularFacetTriangularRead (const xercesc::DOMElement *const)
 
G4TwoVector TwoDimVertexRead (const xercesc::DOMElement *const, G4double)
 
zplaneType ZplaneRead (const xercesc::DOMElement *const)
 
rzPointType RZPointRead (const xercesc::DOMElement *const)
 
void OpticalSurfaceRead (const xercesc::DOMElement *const)
 
- Protected Member Functions inherited from G4GDMLReadMaterials
 G4GDMLReadMaterials ()
 
virtual ~G4GDMLReadMaterials ()
 
G4double AtomRead (const xercesc::DOMElement *const)
 
G4int CompositeRead (const xercesc::DOMElement *const, G4String &)
 
G4double DRead (const xercesc::DOMElement *const)
 
G4double PRead (const xercesc::DOMElement *const)
 
G4double TRead (const xercesc::DOMElement *const)
 
G4double MEERead (const xercesc::DOMElement *const)
 
void ElementRead (const xercesc::DOMElement *const)
 
G4double FractionRead (const xercesc::DOMElement *const, G4String &)
 
void IsotopeRead (const xercesc::DOMElement *const)
 
void MaterialRead (const xercesc::DOMElement *const)
 
void MixtureRead (const xercesc::DOMElement *const, G4Element *)
 
void MixtureRead (const xercesc::DOMElement *const, G4Material *)
 
void PropertyRead (const xercesc::DOMElement *const, G4Material *)
 
- Protected Member Functions inherited from G4GDMLReadDefine
 G4GDMLReadDefine ()
 
virtual ~G4GDMLReadDefine ()
 
G4RotationMatrix GetRotationMatrix (const G4ThreeVector &)
 
void VectorRead (const xercesc::DOMElement *const, G4ThreeVector &)
 
G4String RefRead (const xercesc::DOMElement *const)
 
void ConstantRead (const xercesc::DOMElement *const)
 
void MatrixRead (const xercesc::DOMElement *const)
 
void PositionRead (const xercesc::DOMElement *const)
 
void RotationRead (const xercesc::DOMElement *const)
 
void ScaleRead (const xercesc::DOMElement *const)
 
void VariableRead (const xercesc::DOMElement *const)
 
void QuantityRead (const xercesc::DOMElement *const)
 
void ExpressionRead (const xercesc::DOMElement *const)
 
- Protected Member Functions inherited from G4GDMLRead
 G4GDMLRead ()
 
virtual ~G4GDMLRead ()
 
G4String Transcode (const XMLCh *const)
 
G4String GenerateName (const G4String &name, G4bool strip=false)
 
G4String Strip (const G4String &) const
 
void GeneratePhysvolName (const G4String &, G4VPhysicalVolume *)
 
void LoopRead (const xercesc::DOMElement *const, void(G4GDMLRead::*)(const xercesc::DOMElement *const))
 
G4GDMLAuxStructType AuxiliaryRead (const xercesc::DOMElement *const auxElem)
 

Additional Inherited Members

- Protected Attributes inherited from G4GDMLReadStructure
G4GDMLAuxMapType auxMap
 
G4GDMLAssemblyMapType assemblyMap
 
G4LogicalVolumepMotherLogical
 
std::map< std::string,
G4VPhysicalVolume * > 
setuptoPV
 
G4bool strip
 
- Protected Attributes inherited from G4GDMLReadParamvol
G4GDMLParameterisationparameterisation
 
- Protected Attributes inherited from G4GDMLReadSetup
std::map< G4String, G4StringsetupMap
 
- Protected Attributes inherited from G4GDMLReadDefine
std::map< G4String, G4doublequantityMap
 
std::map< G4String, G4ThreeVectorpositionMap
 
std::map< G4String, G4ThreeVectorrotationMap
 
std::map< G4String, G4ThreeVectorscaleMap
 
std::map< G4String, G4GDMLMatrixmatrixMap
 
- Protected Attributes inherited from G4GDMLRead
G4GDMLEvaluator eval
 
G4bool validate
 
G4bool check
 
G4bool dostrip
 

Detailed Description

GDML reader for the color attributes.

Definition at line 48 of file G03ColorReader.hh.

Constructor & Destructor Documentation

G03ColorReader::G03ColorReader ( )

Definition at line 40 of file G03ColorReader.cc.

42 {
43 }
G03ColorReader::~G03ColorReader ( )

Definition at line 47 of file G03ColorReader.cc.

48 {
49  std::map<G4String, G4VisAttributes*>::iterator pos;
50  for (pos=fAttribs.begin(); pos!=fAttribs.end(); pos++)
51  { delete pos->second; }
52 }
static const G4double pos

Member Function Documentation

void G03ColorReader::ColorRead ( const xercesc::DOMElement *const  element)

Definition at line 122 of file G03ColorReader.cc.

123 {
124  G4String name;
125  G4VisAttributes* color = 0;
126  G4double r=0., g=0., b=0., a=0.;
127 
128  const xercesc::DOMNamedNodeMap* const attributes
129  = colorElement->getAttributes();
130  XMLSize_t attributeCount = attributes->getLength();
131 
132  for (XMLSize_t attribute_index=0;
133  attribute_index<attributeCount; attribute_index++)
134  {
135  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
136 
137  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
138  { continue; }
139 
140  const xercesc::DOMAttr* const attribute
141  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
142  const G4String attName = Transcode(attribute->getName());
143  const G4String attValue = Transcode(attribute->getValue());
144 
145  if (attName=="name")
146  { name = GenerateName(attValue); } else
147  if (attName=="R")
148  { r = eval.Evaluate(attValue); } else
149  if (attName=="G")
150  { g = eval.Evaluate(attValue); } else
151  if (attName=="B")
152  { b = eval.Evaluate(attValue); } else
153  if (attName=="A")
154  { a = eval.Evaluate(attValue); }
155  }
156 
157  G4cout << "Color attribute (R,G,B,A) is: "
158  << r << ", " << g << ", " << b << ", " << a << " !" << G4endl;
159  color = new G4VisAttributes(G4Color(r,g,b,a));
160  fAttribs.insert(std::make_pair(name,color));
161 }
const XML_Char * name
Definition: expat.h:151
G4GDMLEvaluator eval
Definition: G4GDMLRead.hh:155
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
G4String Transcode(const XMLCh *const)
Definition: G4GDMLRead.cc:55
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
tuple b
Definition: test.py:12
G4GLOB_DLL std::ostream G4cout
G4Colour G4Color
Definition: G4Color.hh:42
G4String GenerateName(const G4String &name, G4bool strip=false)
Definition: G4GDMLRead.cc:68
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4double Evaluate(const G4String &)

Here is the call graph for this function:

Here is the caller graph for this function:

void G03ColorReader::ExtensionRead ( const xercesc::DOMElement *const  element)
virtual

Reimplemented from G4GDMLRead.

Definition at line 56 of file G03ColorReader.cc.

57 {
58  G4cout << "G4GDML: Reading GDML extension..." << G4endl;
59 
60  for (xercesc::DOMNode* iter = extElement->getFirstChild();
61  iter != 0; iter = iter->getNextSibling())
62  {
63  if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
64 
65  const xercesc::DOMElement* const child
66  = dynamic_cast<xercesc::DOMElement*>(iter);
67  const G4String tag = Transcode(child->getTagName());
68 
69  if (tag=="color") { ColorRead(child); }
70  else
71  {
72  G4String error_msg = "Unknown tag in structure: " + tag;
73  G4Exception("G03ColorReader::ExtensionRead()",
74  "ReadError", FatalException, error_msg);
75  }
76  }
77 }
Definition: xmlparse.cc:187
void ColorRead(const xercesc::DOMElement *const element)
G4String Transcode(const XMLCh *const)
Definition: G4GDMLRead.cc:55
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

G4VisAttributes * G03ColorReader::GetVisAttribute ( const G4String ref)

Definition at line 165 of file G03ColorReader.cc.

166 {
167  G4VisAttributes* col = 0;
168  std::map<G4String, G4VisAttributes*>::iterator pos = fAttribs.find(ref);
169 
170  if (pos != fAttribs.end())
171  {
172  col = pos->second;
173  }
174  else
175  {
176  G4String err_mess = "Attribute: " + ref + " NOT found !";
177  G4Exception("G03ColorReader::GetVisAttribute()",
178  "ReadError", FatalException, err_mess);
179  }
180  return col;
181 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static const G4double pos

Here is the call graph for this function:

Here is the caller graph for this function:

void G03ColorReader::VolumeRead ( const xercesc::DOMElement * const  volumeElement)
protectedvirtual

Reimplemented from G4GDMLReadStructure.

Definition at line 81 of file G03ColorReader.cc.

82 {
83  G4VSolid* solidPtr = 0;
84  G4Material* materialPtr = 0;
85  G4VisAttributes* attrPtr = 0;
86  G4GDMLAuxListType auxList;
87 
88  XMLCh *name_attr = xercesc::XMLString::transcode("name");
89  const G4String name = Transcode(volumeElement->getAttribute(name_attr));
90  xercesc::XMLString::release(&name_attr);
91 
92  for (xercesc::DOMNode* iter = volumeElement->getFirstChild();
93  iter != 0; iter = iter->getNextSibling())
94  {
95  if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
96 
97  const xercesc::DOMElement* const child
98  = dynamic_cast<xercesc::DOMElement*>(iter);
99  const G4String tag = Transcode(child->getTagName());
100 
101  if (tag=="auxiliary")
102  { auxList.push_back(AuxiliaryRead(child)); } else
103  if (tag=="materialref")
104  { materialPtr = GetMaterial(GenerateName(RefRead(child),true)); } else
105  if (tag=="solidref")
106  { solidPtr = GetSolid(GenerateName(RefRead(child))); } else
107  if (tag == "colorref")
108  { attrPtr = GetVisAttribute(GenerateName(RefRead(child))); }
109  }
110 
111  pMotherLogical = new G4LogicalVolume(solidPtr,materialPtr,
112  GenerateName(name),0,0,0);
114 
115  if (!auxList.empty()) { auxMap[pMotherLogical] = auxList; }
116 
117  Volume_contentRead(volumeElement);
118 }
const XML_Char * name
Definition: expat.h:151
G4Material * GetMaterial(const G4String &, G4bool verbose=true) const
Definition: xmlparse.cc:187
G4String Transcode(const XMLCh *const)
Definition: G4GDMLRead.cc:55
G4VSolid * GetSolid(const G4String &) const
G4String RefRead(const xercesc::DOMElement *const)
G4LogicalVolume * pMotherLogical
G4String GenerateName(const G4String &name, G4bool strip=false)
Definition: G4GDMLRead.cc:68
std::vector< G4GDMLAuxStructType > G4GDMLAuxListType
G4GDMLAuxMapType auxMap
G4GDMLAuxStructType AuxiliaryRead(const xercesc::DOMElement *const auxElem)
Definition: G4GDMLRead.cc:262
virtual void Volume_contentRead(const xercesc::DOMElement *const)
G4VisAttributes * GetVisAttribute(const G4String &ref)
void SetVisAttributes(const G4VisAttributes *pVA)

Here is the call graph for this function:


The documentation for this class was generated from the following files: