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 (FWGeometryTableView *v)
bool isStringValid (std::string &exp)
virtual ~FWGeoMaterialValidator ()

Public Attributes

FWGeometryTableViewm_browser
std::vector< Materialm_list

Detailed Description

Definition at line 52 of file FWGeometryTableView.cc.


Constructor & Destructor Documentation

FWGeoMaterialValidator::FWGeoMaterialValidator ( FWGeometryTableView v) [inline]

Definition at line 66 of file FWGeometryTableView.cc.

References m_browser, and v.

{ m_browser = v;}
virtual FWGeoMaterialValidator::~FWGeoMaterialValidator ( ) [inline, virtual]

Definition at line 67 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 70 of file FWGeometryTableView.cc.

References g, FWGeometryTableView::getTableManager(), FWGeometryTableViewBase::getTopNodeIdx(), h, i, j, m_browser, m_list, FWGeometryTableManagerBase::refEntries(), 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);

      FWGeometryTableManagerBase::Entries_i it = m_browser->getTableManager()->refEntries().begin();
      std::advance(it, m_browser->getTopNodeIdx());
      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 114 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

Definition at line 63 of file FWGeometryTableView.cc.

Referenced by fillOptions(), and FWGeoMaterialValidator().

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