CMS 3D CMS Logo

Classes | Public Member Functions | Public Attributes

FWGeoMaterialValidator Class Reference

Inheritance diagram for FWGeoMaterialValidator:
FWValidatorBase

List of all members.

Classes

struct  Material

Public Member Functions

virtual void fillOptions (const char *iBegin, const char *iEnd, std::vector< std::pair< boost::shared_ptr< std::string >, std::string > > &oOptions) const
 FWGeoMaterialValidator (FWGeometryTableManager *t)
bool isStringValid (std::string &exp)
virtual ~FWGeoMaterialValidator ()

Public Attributes

std::vector< Materialm_list
FWGeometryTableManagerm_table

Detailed Description

Definition at line 58 of file FWGeometryTableView.cc.


Constructor & Destructor Documentation

FWGeoMaterialValidator::FWGeoMaterialValidator ( FWGeometryTableManager t) [inline]

Definition at line 71 of file FWGeometryTableView.cc.

References m_table, and matplotRender::t.

{ m_table = t;}
virtual FWGeoMaterialValidator::~FWGeoMaterialValidator ( ) [inline, virtual]

Definition at line 72 of file FWGeometryTableView.cc.

{}

Member Function Documentation

virtual void FWGeoMaterialValidator::fillOptions ( const char *  iBegin,
const char *  iEnd,
std::vector< std::pair< boost::shared_ptr< std::string >, std::string > > &  oOptions 
) const [inline, virtual]

Implements FWValidatorBase.

Definition at line 75 of file FWGeometryTableView.cc.

References g, h, i, j, m_list, m_table, FWGeometryTableManager::refSelected(), and python::multivaluedict::sort().

   {
      oOptions.clear();
      std::string part(iBegin,iEnd);
      unsigned int part_size = part.size();

      m_list.clear();
      m_list.push_back(0);

      FWGeometryTableManager::Entries_i it = m_table->refSelected();
      int nLevel = it->m_level;
      it++;
      while (it->m_level > nLevel)
      {
         TGeoMaterial* g = it->m_node->GetVolume()->GetMaterial();
         bool duplicate = false;
         for (std::vector<Material>::iterator j = m_list.begin(); j!=m_list.end(); ++j) {
            if (j->g == g) {
               duplicate = true;
               break;
            }
         }
         if (!duplicate)
            m_list.push_back(g);

         ++it;
      }
      std::vector<Material>::iterator startIt = m_list.begin();
      startIt++;
      std::sort(startIt, m_list.end());

      std::string h = "";
      oOptions.push_back(std::make_pair(boost::shared_ptr<std::string>(new std::string(m_list.begin()->n)), h));
      for (std::vector<Material>::iterator i = startIt; i!=m_list.end(); ++i) {
         if(part == (*i).n.substr(0,part_size) )
         {
            //  std::cout << i->n <<std::endl;
            oOptions.push_back(std::make_pair(boost::shared_ptr<std::string>(new std::string((*i).n)), (*i).n.substr(part_size, (*i).n.size()-part_size)));
         }
      }

   }
bool FWGeoMaterialValidator::isStringValid ( std::string &  exp) [inline]

Definition at line 118 of file FWGeometryTableView.cc.

References i, and m_list.

Referenced by FWGeometryTableView::filterTextEntryCallback().

   {
      if (exp.empty()) return true;

      for (std::vector<Material>::iterator i = m_list.begin(); i!=m_list.end(); ++i) {
         if (exp == (*i).n) 
            return true;
    
      }
      return false;
   }

Member Data Documentation

std::vector<Material> FWGeoMaterialValidator::m_list [mutable]

Definition at line 68 of file FWGeometryTableView.cc.

Referenced by fillOptions(), and FWGeoMaterialValidator().