]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TGeant4/TG4VisManager.cxx
tags T/AliGeant4-3-03__ar-v3-05-Release__g4-3-2 commented
[u/mrichter/AliRoot.git] / TGeant4 / TG4VisManager.cxx
index c43f794be664697ef16c6eacec67bf242c0b3f15..e06460f25e2562598fdbf1b269d281d1e1086a2b 100644 (file)
 //   myVisManager -> RegisterGraphicsSystem (new MyGraphicsSystem);
 
 
+#ifdef G4VIS_USE
+
+#include "TG4VisManager.h"
 #include "TG4Globals.h"
 
 #include <G4LogicalVolumeStore.hh>
 #include <G4PhysicalVolumeStore.hh>
-#include <G4PhysicalVolumeModel.hh>
-#include <G4LogicalVolumeModel.hh>
 #include <G4TransportationManager.hh>
 #include <G4Material.hh>
-
-#ifdef G4VIS_USE
-#include "TG4VisManager.h"
-
+#include <G4PhysicalVolumeModel.hh>
 #include <G4VVisManager.hh>
 
 // Supported drivers...
@@ -210,9 +208,9 @@ G4RWTPtrOrderedVector<G4LogicalVolume> TG4VisManager::GetLVList(G4String name)
  G4LogicalVolume* pLV = 0; 
  if (pLVStore)
  {
-   for (G4int i=0; i<pLVStore->entries(); i++)
+   for (G4int i=0; i<pLVStore->size(); i++)
    {
-     pLV = pLVStore->at(i);  
+     pLV = (*pLVStore)[i];  
      if (CaseInsensitiveEqual(name,pLV->GetName())) 
      {
        if (!lvList.contains(pLV)) lvList.append(pLV);
@@ -224,9 +222,9 @@ G4RWTPtrOrderedVector<G4LogicalVolume> TG4VisManager::GetLVList(G4String name)
  G4VPhysicalVolume* pPV = 0;
  if (pPVStore) 
  {
-   for (G4int i=0; i<pPVStore->entries(); i++)
+   for (G4int i=0; i<pPVStore->size(); i++)
    {
-     pPV = pPVStore->at(i)
+     pPV = (*pPVStore)[i]
      if (CaseInsensitiveEqual(name,pPV->GetName())) 
      {
        pLV = pPV->GetLogicalVolume();
@@ -251,9 +249,9 @@ G4RWTPtrOrderedVector<G4VPhysicalVolume> TG4VisManager::GetPVList(G4String name)
     return pvList;
   }
   G4VPhysicalVolume* pPV = 0;
-  for (G4int i=0; i<pPVStore->entries(); i++)
+  for (G4int i=0; i<pPVStore->size(); i++)
   {
-    pPV = pPVStore->at(i);
+    pPV = (*pPVStore)[i];
     if (CaseInsensitiveEqual(name,pPV->GetName()))
     {
       if (!pvList.contains(pPV)) pvList.append(pPV);
@@ -287,7 +285,7 @@ G4bool TG4VisManager::CaseInsensitiveEqual(const G4String string1,
  
 
 void TG4VisManager::SetAtt4Daughters(G4LogicalVolume* const lv, 
-                                    const TG3Attribute att, const G4int val)
+                                    const TG4G3Attribute att, const G4int val)
 {
 // Iterator for setting a visual attribute for all daughters
 // ---
@@ -323,9 +321,9 @@ G4bool TG4VisManager::IsSharedVisAttributes(const G4LogicalVolume* pLV)
   G4LogicalVolume* pLVCurrent = 0;
   const G4VisAttributes* pVisAtt = pLV->GetVisAttributes();
   if (!pVisAtt) return false;
-  for (G4int i=0; i<pLVStore->entries(); i++)
+  for (G4int i=0; i<pLVStore->size(); i++)
   {
-    pLVCurrent = pLVStore->at(i);
+    pLVCurrent = (*pLVStore)[i];
     if (pLVCurrent != pLV)
     {
       if (pLVCurrent->GetVisAttributes() == pVisAtt) 
@@ -339,7 +337,7 @@ G4bool TG4VisManager::IsSharedVisAttributes(const G4LogicalVolume* pLV)
 
 
 void TG4VisManager::SetG4Attribute(G4LogicalVolume* const lv,
-                                  const TG3Attribute att, const G4int val)
+                                  const TG4G3Attribute att, const G4int val)
 {
 // Set the G4 attribute fo volume LV accordingly to the G3 description
 //  of (att- val)    
@@ -351,8 +349,11 @@ void TG4VisManager::SetG4Attribute(G4LogicalVolume* const lv,
  G4VisAttributes* newVisAttributes;
  if (!visAttributes)
    newVisAttributes    = new G4VisAttributes(false);
- else
-   newVisAttributes    = new G4VisAttributes(visAttributes);
+ else {
+   G4bool visibility = visAttributes->IsVisible();
+   G4Colour colour   = visAttributes->GetColour();
+   newVisAttributes = new G4VisAttributes(visibility, colour);
+ }
 
  const G4int kAbsVal = abs(val);       // the functionality is given by the abs value
 
@@ -565,9 +566,9 @@ void TG4VisManager::SetColors()
     return;
   }
   // parse the LV tree and set colours according to material density
-  for (G4int i=0; i<pLVStore->entries(); i++)
+  for (G4int i=0; i<pLVStore->size(); i++)
   {
-    pLV = pLVStore->at(i);
+    pLV = (*pLVStore)[i];
 //    G4cout << "VOLUME : " << pLV->GetName() << G4endl;
     const G4Material* pMaterial = pLV->GetMaterial();
     const G4State kState = pMaterial->GetState();
@@ -651,7 +652,7 @@ void TG4VisManager::Gsatt(const char* name, const char* att, Int_t val)
           satt(att);           
 
  // seek for known attributes
- TG3Attribute attribute = kUNKNOWN;
+ TG4G3Attribute attribute = kUNKNOWN;
  if (CaseInsensitiveEqual(att,"WORK"))
  {
    G4String message = "TG4VisManager::Gsatt: G3Attribute ";
@@ -703,9 +704,9 @@ void TG4VisManager::Gsatt(const char* name, const char* att, Int_t val)
  if (doForAll)
  {
      G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
-     for (G4int i=0; i<pLVStore->entries(); i++)
+     for (G4int i=0; i<pLVStore->size(); i++)
      {
-         lv = pLVStore->at(i);
+         lv = (*pLVStore)[i];
         SetG4Attribute(lv,attribute,ival);
      }
      return;
@@ -806,7 +807,6 @@ void TG4VisManager::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t p
     pPV = pvList[i];
     G4LogicalVolume* pLV = pPV->GetLogicalVolume();
     G4VSolid* pSolid = pLV->GetSolid();
-
     successful = fpScene->AddRunDurationModel(new G4PhysicalVolumeModel(pPV));
     if (!successful) 
     {