#include <Iguana/GLBrowsers/interface/Ig3DShapeManager.h>
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 |
IgState * | m_state |
Definition at line 23 of file Ig3DShapeManager.h.
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.
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 | ) |
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 }
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 }
NodeMap Ig3DShapeManager::m_nodeMap [private] |
PathList Ig3DShapeManager::m_pathList [private] |
IgState* Ig3DShapeManager::m_state [private] |
Definition at line 42 of file Ig3DShapeManager.h.
Referenced by Ig3DShapeManager(), and ~Ig3DShapeManager().