CMS 3D CMS Logo

Ig3DShapeManager Class Reference

#include <Iguana/GLBrowsers/interface/Ig3DShapeManager.h>

Inheritance diagram for Ig3DShapeManager:

IgStateElement

List of all members.

Public Member Functions

void add (const std::string &filename, const std::string &alias)
void add (SoNode *, const std::string &alias, bool save)
void addAlias (const std::string &oldAlias, const std::string &newAlias)
void addSearchPath (const std::string &path)
 Ig3DShapeManager (IgState *state)
SoNode * lookup (const std::string &alias)
 ~Ig3DShapeManager (void)

Private Types

typedef std::map< std::string,
SoNode * > 
NodeMap
typedef std::list< std::string > PathList

Private Member Functions

 IG_DECLARE_STATE_ELEMENT (Ig3DShapeManager)

Private Attributes

NodeMap m_nodeMap
PathList m_pathList
IgStatem_state


Detailed Description

Definition at line 23 of file Ig3DShapeManager.h.


Member Typedef Documentation

typedef std::map<std::string, SoNode *> Ig3DShapeManager::NodeMap [private]

Definition at line 40 of file Ig3DShapeManager.h.

typedef std::list<std::string> Ig3DShapeManager::PathList [private]

Definition at line 41 of file Ig3DShapeManager.h.


Constructor & Destructor Documentation

Ig3DShapeManager::Ig3DShapeManager ( IgState state  ) 

Definition at line 29 of file Ig3DShapeManager.cc.

References empty, DBSPlugin::get(), IgEnvsElement::getEnv(), i, m_state, and IgState::put().

00030     : m_state (state)
00031 {
00032     m_state->put (s_key, this);
00033 
00034     IgEnvsElement* envs = IgEnvsElement::get(m_state);
00035     std::vector<std::string> iguanaPath;
00036     if (envs->getEnv("IGUANA_PATH", iguanaPath))
00037     {
00038         for(size_t i=0; i<iguanaPath.size(); i++)
00039         {
00040             if (!iguanaPath[i].empty())
00041                 this->addSearchPath (iguanaPath[i]+"/share/ivs/");
00042         }
00043     }
00044 }

Ig3DShapeManager::~Ig3DShapeManager ( void   ) 

Definition at line 46 of file Ig3DShapeManager.cc.

References IgState::detach(), and m_state.

00047 {
00048     m_state->detach (s_key);
00049 }


Member Function Documentation

void Ig3DShapeManager::add ( const std::string &  filename,
const std::string &  alias 
)

Definition at line 75 of file Ig3DShapeManager.cc.

References lat::Filename::empty(), lat::endl(), lat::Filename::exists(), EgammaValidation_cff::filename, i, in, lat::Filename::isRelative(), LOG, m_pathList, lat::Filename::name(), prof2calltree::node, path(), and GsfMatrixTools::trace().

00076 {
00077     lat::Filename filename (name);
00078     lat::Filename completeFilename;
00079     
00080     if (filename.isRelative ())
00081     {
00082         for (PathList::iterator i = m_pathList.begin ();
00083              i != m_pathList.end () 
00084              && completeFilename.empty ();
00085              i++)
00086         {
00087             std::string path = *i;
00088             lat::Filename tmpCompleteFilename
00089                 = path + filename.name ();
00090             LOG (0, trace, LFshapeManager, "Looking up for name "       
00091                  << tmpCompleteFilename.name () << std::endl);
00092             
00093             if (tmpCompleteFilename.exists ())
00094                 completeFilename = tmpCompleteFilename.name ();
00095         }       
00096     }
00097     else
00098     {
00099         if (filename.exists ())
00100             completeFilename = filename;        
00101     }
00102     
00103     LOG (0, trace, LFshapeManager, 
00104          "Loading file: " << completeFilename << std::endl);
00105     
00106     SoInput in;
00107     if (in.openFile (completeFilename))
00108     {
00109         SoNode *node = SoDB::readAll (&in);
00110         if (node)
00111         {
00112             this->add (node, alias, false);                 
00113         }           
00114     }   
00115     return;    
00116 }

void Ig3DShapeManager::add ( SoNode *  node,
const std::string &  alias,
bool  save 
)

Definition at line 68 of file Ig3DShapeManager.cc.

References m_nodeMap.

00069 {
00070     node->ref ();    
00071     m_nodeMap.insert (NodeMap::value_type (alias, node));    
00072 }

void Ig3DShapeManager::addAlias ( const std::string &  oldAlias,
const std::string &  newAlias 
)

Definition at line 119 of file Ig3DShapeManager.cc.

References m_nodeMap.

00121 {
00122     if (m_nodeMap.find (oldAlias) != m_nodeMap.end ())
00123     {
00124         m_nodeMap.insert (NodeMap::value_type (newAlias, m_nodeMap[oldAlias])); 
00125     }    
00126 }

void Ig3DShapeManager::addSearchPath ( const std::string &  path  ) 

Definition at line 130 of file Ig3DShapeManager.cc.

References lat::endl(), lat::Filename::exists(), LOG, m_pathList, pathName(), and GsfMatrixTools::trace().

00131 {
00132     lat::Filename pathName (path);
00133     if (pathName.exists ())
00134         m_pathList.push_back (path);
00135     else
00136     {
00137         LOG (0, trace, LFshapeManager, 
00138              "Path not Added (no exists): " << path << std::endl);
00139     }
00140 }

Ig3DShapeManager::IG_DECLARE_STATE_ELEMENT ( Ig3DShapeManager   )  [private]

SoNode * Ig3DShapeManager::lookup ( const std::string &  alias  ) 

Definition at line 52 of file Ig3DShapeManager.cc.

References lat::endl(), LOG, m_nodeMap, and GsfMatrixTools::trace().

Referenced by VisDetIvTwig::VisDetIvTwig(), and VisHcalDetTwig::VisHcalDetTwig().

00053 {
00054     if (m_nodeMap.find (alias) == m_nodeMap.end ())
00055     {
00056         LOG (0, trace, LFshapeManager, 
00057              "Alias " << alias 
00058              << " not found. Adding it as if it was a filename" << std::endl);
00059         
00060         this->add (alias, alias);       
00061     }    
00062 
00063     SoNode *returnNode =  m_nodeMap[alias];    
00064     return returnNode;    
00065 }


Member Data Documentation

NodeMap Ig3DShapeManager::m_nodeMap [private]

Definition at line 43 of file Ig3DShapeManager.h.

Referenced by add(), addAlias(), and lookup().

PathList Ig3DShapeManager::m_pathList [private]

Definition at line 44 of file Ig3DShapeManager.h.

Referenced by add(), and addSearchPath().

IgState* Ig3DShapeManager::m_state [private]

Definition at line 42 of file Ig3DShapeManager.h.

Referenced by Ig3DShapeManager(), and ~Ig3DShapeManager().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:24:59 2009 for CMSSW by  doxygen 1.5.4