Import Geant4 11.3.0.beta source tree
This commit is contained in:
@@ -6,6 +6,19 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2024-05-30 John Allison (greps-V11-02-02)
|
||||
- G4VVisManager:
|
||||
- Add EventReadyForVis, used by G4SubEvtRunManager.
|
||||
|
||||
## 2024-04-06 John Allison (greps-V11-02-01)
|
||||
- G4Colour:
|
||||
- Clarify usage, add GetColor (US spelling), add G4Exception.
|
||||
|
||||
## 2024-01-22 John Allison (greps-V11-02-00)
|
||||
- Coworks with visman-V11-02-04, modeling-V11-02-01 and interfaces-V11-02-01.
|
||||
- G4SceneTreeItem.hh:
|
||||
- Add G4String field "FurtherInfo" and access functions.
|
||||
|
||||
## 2023-09-27 Stewart Boogert (greps-V11-01-06)
|
||||
- Added centre calculation to HepPolyhedron for use in vis systems
|
||||
|
||||
|
||||
@@ -69,6 +69,12 @@
|
||||
// G4double G4Colour::GetGreen () const ; // Get the green component.
|
||||
// G4double G4Colour::GetBlue () const ; // Get the blue component.
|
||||
//
|
||||
// You may add colours to a map. They can then be retrieved with a string.
|
||||
// Standard colours are added to map by default when static functions AddToMap,
|
||||
// GetMap or GetColour are called. The G4 Vis Manager adds a copious additional
|
||||
// set of colours on instantiation - see G4VisManager::InitialiseG4ColourMap.
|
||||
// (Issue "/vis/list" to see available colours.)
|
||||
//
|
||||
// Class Description - End:
|
||||
|
||||
#ifndef G4COLOUR_HH
|
||||
@@ -127,14 +133,26 @@ public: // With description
|
||||
static G4Colour Yellow();
|
||||
|
||||
static G4bool GetColour(const G4String& key, G4Colour& result);
|
||||
// Get colour for given key, placing it in result.
|
||||
static G4bool GetColor(const G4String& key, G4Colour& result);
|
||||
// Find colour in colour map, placing it in result.
|
||||
// The key is usually the name of the colour.
|
||||
// The key is not case sensitive.
|
||||
// The key is case insensitive.
|
||||
// Returns false if key doesn't exist, leaving result unchanged.
|
||||
// Usage:
|
||||
// G4Colour c; // A successful GetColour will place the colour here
|
||||
// if (G4Colour::GetColour("pink", c)) {
|
||||
// logical->SetVisAttributes(c);
|
||||
// } else {
|
||||
// logical->SetVisAttributes(G4Colour::Green());
|
||||
// }
|
||||
// or more simply:
|
||||
// G4Colour c(G4Colour::Green()); // Default if colour not found
|
||||
// G4Colour::GetColour("pink", c);
|
||||
// logical->SetVisAttributes(c);
|
||||
|
||||
static void AddToMap(const G4String& key, const G4Colour& colour);
|
||||
// Add user defined colour to colour map with given key. Standard
|
||||
// colours are added to map by default.
|
||||
// colours are added to map by default. The G4 Vis Manager adds more.
|
||||
|
||||
static void InitialiseColourMap();
|
||||
static const std::map<G4String, G4Colour>& GetMap();
|
||||
@@ -165,4 +183,7 @@ inline G4Colour G4Colour::Cyan() {return G4Colour(0.0, 1.0, 1.0);}
|
||||
inline G4Colour G4Colour::Magenta() {return G4Colour(1.0, 0.0, 1.0);}
|
||||
inline G4Colour G4Colour::Yellow() {return G4Colour(1.0, 1.0, 0.0);}
|
||||
|
||||
inline G4bool G4Colour::GetColor(const G4String& key, G4Colour& result)
|
||||
{return G4Colour::GetColour(key, result);}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -77,9 +77,11 @@ class G4SceneTreeItem
|
||||
|
||||
const G4String& GetModelDescription() const { return fModelDescription; }
|
||||
void SetModelDescription(const G4String& modelDescription)
|
||||
{
|
||||
fModelDescription = modelDescription;
|
||||
}
|
||||
{ fModelDescription = modelDescription; }
|
||||
|
||||
const G4String& GetFurtherInfo() const { return fFurtherInfo; }
|
||||
void SetFurtherInfo(const G4String& furtherInfo)
|
||||
{ fFurtherInfo = furtherInfo; }
|
||||
|
||||
const std::map<G4String, G4AttDef>* GetAttDefs() const { return fpAttDefs; }
|
||||
void SetAttDefs(const std::map<G4String, G4AttDef>* pAttDefs) { fpAttDefs = pAttDefs; };
|
||||
@@ -124,6 +126,7 @@ class G4SceneTreeItem
|
||||
G4String fDescription;
|
||||
G4String fModelType = "none";
|
||||
G4String fModelDescription;
|
||||
G4String fFurtherInfo; // Intended for a tooltip or equivalent?
|
||||
G4String fPVPath;
|
||||
G4VisAttributes fVisAttributes;
|
||||
const std::map<G4String, G4AttDef>* fpAttDefs = nullptr;
|
||||
|
||||
@@ -87,6 +87,7 @@ class G4VTrajectory;
|
||||
class G4LogicalVolume;
|
||||
class G4VPhysicalVolume;
|
||||
class G4VisAttributes;
|
||||
class G4Event;
|
||||
|
||||
class G4VVisManager {
|
||||
|
||||
@@ -228,6 +229,9 @@ public: // With description
|
||||
|
||||
#endif
|
||||
|
||||
virtual void EventReadyForVis(const G4Event*) {}
|
||||
// This is invoked by G4SubEvtRunManager
|
||||
|
||||
protected:
|
||||
|
||||
static void SetConcreteInstance (G4VVisManager*);
|
||||
|
||||
@@ -118,6 +118,9 @@ void G4Colour::AddToMap(const G4String& key, const G4Colour& colour)
|
||||
return;
|
||||
}
|
||||
|
||||
// Add standard colours to map
|
||||
InitialiseColourMap(); // Initialises if not already initialised
|
||||
|
||||
// Convert to lower case since colour map is case insensitive
|
||||
G4String myKey = G4StrUtil::to_lower_copy(key);
|
||||
|
||||
@@ -152,7 +155,11 @@ void G4Colour::InitialiseColourMap()
|
||||
AddToMap("yellow", G4Colour::Yellow());
|
||||
}
|
||||
|
||||
G4bool G4Colour::GetColour(const G4String& key, G4Colour& result)
|
||||
G4bool G4Colour::GetColour(const G4String& key, G4Colour& result)
|
||||
// Get colour for given key, placing it in result.
|
||||
// The key is usually the name of the colour.
|
||||
// The key is case insensitive.
|
||||
// Returns false if key doesn't exist, leaving result unchanged.
|
||||
{
|
||||
// Add standard colours to map
|
||||
InitialiseColourMap(); // Initialises if not already initialised
|
||||
@@ -163,8 +170,13 @@ G4bool G4Colour::GetColour(const G4String& key, G4Colour& result)
|
||||
std::map<G4String, G4Colour>::const_iterator iter = fColourMap.find(myKey);
|
||||
|
||||
// Don't modify "result" if colour was not found in map
|
||||
if (iter == fColourMap.cend()) return false;
|
||||
|
||||
if (iter == fColourMap.cend()) {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Colour \"" << key << "\" not found. No action taken.";
|
||||
G4Exception("G4Colour::GetColour", "greps0003", JustWarning, ed);
|
||||
return false;
|
||||
}
|
||||
|
||||
result = iter->second;
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user