Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
G03ColorWriter Class Reference

GDML writer for the color attributes. More...

#include <Doxymodules_persistency.h>

Inheritance diagram for G03ColorWriter:
G4GDMLWriteStructure G4GDMLWriteParamvol G4GDMLWriteSetup G4GDMLWriteSolids G4GDMLWriteMaterials G4GDMLWriteDefine G4GDMLWrite

Public Member Functions

 G03ColorWriter ()
 
 ~G03ColorWriter ()
 
void AddExtension (xercesc::DOMElement *volumeElement, const G4LogicalVolume *const vol)
 
void ExtensionWrite (xercesc::DOMElement *element)
 
void ColorWrite (xercesc::DOMElement *volumeElement, const G4VisAttributes *const att)
 
G4bool BookAttribute (const G4VisAttributes *const att)
 

Private Attributes

std::vector< const G4VisAttributes * > fAttribs
 

Detailed Description

GDML writer for the color attributes.

Definition at line 49 of file Doxymodules_persistency.h.

Constructor & Destructor Documentation

◆ G03ColorWriter()

G03ColorWriter::G03ColorWriter ( )

Definition at line 39 of file G03ColorWriter.cc.

◆ ~G03ColorWriter()

G03ColorWriter::~G03ColorWriter ( )

Definition at line 46 of file G03ColorWriter.cc.

47{
48}

Member Function Documentation

◆ AddExtension()

void G03ColorWriter::AddExtension ( xercesc::DOMElement *  volumeElement,
const G4LogicalVolume *const  vol 
)

Definition at line 52 of file G03ColorWriter.cc.

54{
55 const G4VisAttributes* vis = vol->GetVisAttributes();
56 if (vis) { ColorWrite(volumeElement, vis); }
57}
void ColorWrite(xercesc::DOMElement *volumeElement, const G4VisAttributes *const att)

◆ ExtensionWrite()

void G03ColorWriter::ExtensionWrite ( xercesc::DOMElement *  element)

Definition at line 61 of file G03ColorWriter.cc.

62{
63 G4cout << "G4GDML: Writing GDML extension..." << G4endl;
64
65 // Mandatory calls the -first- time an extension is created
66 //
67 extElement = NewElement("extension");
68 element->appendChild(extElement);
69}

◆ ColorWrite()

void G03ColorWriter::ColorWrite ( xercesc::DOMElement *  volumeElement,
const G4VisAttributes *const  att 
)

Definition at line 73 of file G03ColorWriter.cc.

75{
76 G4bool book = BookAttribute(att);
77 G4Color color = att->GetColor();
78
79 const G4String& name = GenerateName("test_color", att);
80 G4double r=color.GetRed(), g=color.GetGreen(),
81 b=color.GetBlue(), a=color.GetAlpha();
82
83 if (book)
84 {
85 xercesc::DOMElement* colElement = NewElement("color");
86 colElement->setAttributeNode(NewAttribute("name",name));
87 colElement->setAttributeNode(NewAttribute("R",r));
88 colElement->setAttributeNode(NewAttribute("G",g));
89 colElement->setAttributeNode(NewAttribute("B",b));
90 colElement->setAttributeNode(NewAttribute("A",a));
91 extElement->appendChild(colElement);
92 }
93
94 xercesc::DOMElement* colorrefElement = NewElement("colorref");
95 colorrefElement->setAttributeNode(NewAttribute("ref",name));
96 volumeElement->appendChild(colorrefElement);
97
98 G4cout << "Written color attribute (R,G,B,A) is: "
99 << r << ", " << g << ", " << b << ", " << a << " !" << G4endl;
100}
std::vector< ExP01TrackerHit * > a
G4bool BookAttribute(const G4VisAttributes *const att)

◆ BookAttribute()

G4bool G03ColorWriter::BookAttribute ( const G4VisAttributes *const  att)

Definition at line 104 of file G03ColorWriter.cc.

105{
106 G4bool booking = true;
107 std::vector<const G4VisAttributes*>::const_iterator pos =
108 std::find(fAttribs.begin(), fAttribs.end(), ref);
109
110 if (pos != fAttribs.end()) { booking = false; }
111 else { fAttribs.push_back(ref); }
112
113 return booking;
114}
std::vector< const G4VisAttributes * > fAttribs

Member Data Documentation

◆ fAttribs

std::vector<const G4VisAttributes*> G03ColorWriter::fAttribs
private

Definition at line 66 of file G03ColorWriter.hh.


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

Applications | User Support | Publications | Collaboration