// $Id$
// Category: visualization
//
+// Author: I. Hrivnacova, A. Gheata
+//
+// Class TG4VisManager
+// -------------------
+// See the class description in the header file.
// According to visualization/management/include/MyVisManager.*
// John Allison 24th January 1998.
// I. Hrivnacova 12.5.98
#include <G4VRML2File.hh>
#endif
-TG4VisManager::TG4VisManager(G4int verboseLevel) {
+//_____________________________________________________________________________
+TG4VisManager::TG4VisManager(G4int verboseLevel)
+ : fVerboseLevel(0) {
//
- fVerbose = verboseLevel;
+ fVerboseLevel = verboseLevel;
fColourFlag = true;
}
+//_____________________________________________________________________________
TG4VisManager::TG4VisManager(const TG4VisManager& right) {
//
TG4Globals::Exception(
"Attempt to copy TG4VisManager singleton.");
}
+//_____________________________________________________________________________
TG4VisManager::~TG4VisManager() {
//
}
// operators
+//_____________________________________________________________________________
TG4VisManager& TG4VisManager::operator=(const TG4VisManager& right)
{
// check assignement to self
// private methods
+//_____________________________________________________________________________
void TG4VisManager::RegisterGraphicsSystems()
{
// Registers the graphics systems.
RegisterGraphicsSystem(new G4VRML2File);
#endif
- if (fVerbose > 0) {
+ if (fVerboseLevel > 0) {
G4cout <<
"\nYou have successfully chosen to use the following graphics systems."
<< G4endl;
// private methods
//---------------------------------------------------------------
+
+//_____________________________________________________________________________
+G4bool TG4VisManager::Contains(const LogicalVolumesVector& lvVector,
+ const G4LogicalVolume* lv) const
+{
+// Returns true if the vector contains specified logical volume.
+// ---
+
+ LogicalVolumesVector::const_iterator i;
-G4RWTPtrOrderedVector<G4LogicalVolume> TG4VisManager::GetLVList(G4String name)
+ for (i = lvVector.begin(); i != lvVector.end(); i++)
+ if (*i == lv) return true;
+
+ return false;
+}
+
+//_____________________________________________________________________________
+G4bool TG4VisManager::Contains(const PhysicalVolumesVector& pvVector,
+ const G4VPhysicalVolume* pv) const
+{
+// Returns true if the vector contains specified physical volume.
+// ---
+
+ PhysicalVolumesVector::const_iterator i;
+
+ for (i = pvVector.begin(); i != pvVector.end(); i++)
+ if (*i == pv) return true;
+
+ return false;
+}
+
+//_____________________________________________________________________________
+LogicalVolumesVector TG4VisManager::GetLVList(G4String name)
{
// Get function returning the list of logical volumes
// associated to NAME; G4 built clones of a G3 volume (identified
// NAME can be the name of a logical or physical volume
// ---
- G4RWTPtrOrderedVector <G4LogicalVolume> lvList;
+ LogicalVolumesVector lvList;
G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
G4LogicalVolume* pLV = 0;
if (pLVStore)
pLV = (*pLVStore)[i];
if (CaseInsensitiveEqual(name,pLV->GetName()))
{
- if (!lvList.contains(pLV)) lvList.append(pLV);
+ if (!Contains(lvList, pLV)) lvList.push_back(pLV);
}
}
}
- if (!lvList.isEmpty()) return lvList;
+ if (lvList.size()>0) return lvList;
+
G4PhysicalVolumeStore* pPVStore = G4PhysicalVolumeStore::GetInstance();
G4VPhysicalVolume* pPV = 0;
if (pPVStore)
if (CaseInsensitiveEqual(name,pPV->GetName()))
{
pLV = pPV->GetLogicalVolume();
- if (!lvList.contains(pLV)) lvList.append(pLV);
+ if (!Contains(lvList, pLV)) lvList.push_back(pLV);
}
}
}
}
-G4RWTPtrOrderedVector<G4VPhysicalVolume> TG4VisManager::GetPVList(G4String name)
+//_____________________________________________________________________________
+PhysicalVolumesVector TG4VisManager::GetPVList(G4String name)
{
// Get function returning the physical volume pointer for NAME
// ---
- G4RWTPtrOrderedVector <G4VPhysicalVolume> pvList;
+ PhysicalVolumesVector pvList;
G4PhysicalVolumeStore* pPVStore = G4PhysicalVolumeStore::GetInstance();
if (!pPVStore)
{
pPV = (*pPVStore)[i];
if (CaseInsensitiveEqual(name,pPV->GetName()))
{
- if (!pvList.contains(pPV)) pvList.append(pPV);
+ if (!Contains(pvList, pPV)) pvList.push_back(pPV);
}
}
return pvList;
}
+//_____________________________________________________________________________
G4bool TG4VisManager::CaseInsensitiveEqual(const G4String string1,
const G4String string2)
{
}
+//_____________________________________________________________________________
void TG4VisManager::SetAtt4Daughters(G4LogicalVolume* const lv,
const TG4G3Attribute att, const G4int val)
{
}
+//_____________________________________________________________________________
G4bool TG4VisManager::IsSharedVisAttributes(const G4LogicalVolume* pLV)
{
// Function seeking if the volume's visible attributes are shared with
}
+//_____________________________________________________________________________
void TG4VisManager::SetG4Attribute(G4LogicalVolume* const lv,
const TG4G3Attribute att, const G4int val)
{
case 3:
lineStyle = G4VisAttributes::dotted; break;
default:
- if (fVerbose > 0)
+ if (fVerboseLevel > 0)
G4cout << "TG4VisManager::Gsatt() Usage of LSTY :" << G4endl
<< "ATT = 1,2,3 means line unbroken, dashed or dotted" << G4endl
<< "any other value resets to the default : unbroken" << G4endl;
case kLWID:
lineWidth = kAbsVal;
if (lineWidth > 7) lineWidth = 7;
- if (fVerbose > 0)
+ if (fVerboseLevel > 0)
G4cout << "TG4VisManager::Gsatt() Usage for LWID :" << G4endl
<< " The VAL you supply means the width of lines in pixels "
<< "for the screen and in 0.1*mm for paper." << G4endl
drawingStyle = G4VisAttributes::solid;
break;
default:
- if (fVerbose > 0)
+ if (fVerboseLevel > 0)
G4cout << "TG4VisManager::Gsatt() FILL usage :" << G4endl
<< " The FILL values you can supply are only :" << G4endl
<< "+/- 1 : forces wireframe drawing (default)" << G4endl
// functions for drawing
//-----------------------------------------------------------------
+
+//_____________________________________________________________________________
void TG4VisManager::DrawOneSpec(const char* name)
{
// Function called when one double-clicks on a volume name
}
+//_____________________________________________________________________________
void TG4VisManager::SetColors()
{
// Function for setting default volume colours
}
+//_____________________________________________________________________________
void TG4VisManager::Gsatt(const char* name, const char* att, Int_t val)
{
// Geant3 description :
G4int ival = val;
G4LogicalVolume* lv = 0;
- G4RWTPtrOrderedVector<G4LogicalVolume> lvList;
+ LogicalVolumesVector lvList;
G4String sname(name),
satt(att);
// get the logical volume pointer corresponding to NAME
lvList = GetLVList(name);
- if (lvList.isEmpty())
+ if (lvList.size()==0)
{
G4String message = "TG4VisManager::Gsatt(): Ignored\n";
message += " Logical volume " + sname + " has not been found.\n";
// set attribute for all descendents
if (doForDaughters)
{
- for (G4int i=0; i<lvList.entries(); i++)
+ for (G4int i=0; i<lvList.size(); i++)
{
lv = lvList[i];
SetAtt4Daughters(lv,attribute,ival);
}
else
{
- for (G4int i=0; i<lvList.entries(); i++)
+ for (G4int i=0; i<lvList.size(); i++)
{
lv = lvList[i];
SetG4Attribute(lv,attribute,ival);
}
if (topVisible)
{
- for (G4int i=0; i<lvList.entries(); i++)
+ for (G4int i=0; i<lvList.size(); i++)
{
lv = lvList[i];
SetG4Attribute(lv,attribute,1);
}
+//_____________________________________________________________________________
void TG4VisManager::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,
Float_t u0,Float_t v0,Float_t ul,Float_t vl)
{
}
const G4double kRad = M_PI/180.;
- G4RWTPtrOrderedVector<G4VPhysicalVolume> pvList;
+ PhysicalVolumesVector pvList;
G4String sname(name);
G4bool successful = false;
pvList = GetPVList(name);
- if (pvList.isEmpty())
+ if (pvList.size()==0)
{
G4String message = "TG4VisManager::Gdraw() :\n";
message += "Volume " + sname + " not found. Bailing out";
// create and add object's model list to the runtime-duration model
// list and draw it
// (it is deleted in the VisManager destructor within
- // all the RWTPtrOrderedVectors of the scene)
- for (G4int i=0; i<pvList.entries(); i++)
+ // all the vectors of the scene)
+ for (G4int i=0; i<pvList.size(); i++)
{
pPV = pvList[i];
G4LogicalVolume* pLV = pPV->GetLogicalVolume();
// set and register view parameters to the viewer
- fVP.SetLightsMoveWithCamera(true);
- fVP.SetViewGeom();
- fVP.UnsetViewHits();
- fVP.UnsetViewDigis();
- fVP.SetNoOfSides(48);
- fVP.SetCurrentTargetPoint(kTargetPoint);
- fVP.SetViewpointDirection(viewpointDirection);
- fVP.SetUpVector(upVector);
- fVP.SetDensityCulling(true);
- fpViewer->SetViewParameters(fVP);
+ G4ViewParameters vp;;
+ vp.SetLightsMoveWithCamera(true);
+ vp.SetViewGeom();
+ vp.UnsetViewHits();
+ vp.UnsetViewDigis();
+ vp.SetNoOfSides(48);
+ vp.SetCurrentTargetPoint(kTargetPoint);
+ vp.SetViewpointDirection(viewpointDirection);
+ vp.SetUpVector(upVector);
+ vp.SetDensityCulling(true);
+ fpViewer->SetViewParameters(vp);
if (IsValidView())
{