1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
   | 
bool GL_MAILLAGE::LoadConfig(const std::string& pathtoload)
{
     std::ifstream myfile(pathtoload.c_str());
     if (!myfile) {
         std::cerr << "Erreur de lecture." << std::endl;        
         return 0;
     }
 
     std::string line;
     int i = 0; // numéro de la ligne
 
     while (! myfile.eof()) {     
           ++i;
           getline(myfile, line);
           if (i == 1) 
               if (line != C_CONFIGFILE_TAG) // premiere ligne doit être = /*vmm config file*/
                   return 0;
               else
                   continue; 
 
           std::string value = line.substr(line.find(':') + 1);    // valeur du paramètre
 
           if (i == 2) {
              double taillenoeuds;
              Util::FromStrToAny(value,taillenoeuds);
              SetSizeNoeuds(taillenoeuds);  
           }
           else if (i == 10) {
                    double offset;
                    Util::FromStrToAny(value,offset);
                    SetPolygonOffset(offset);  
                }
                else {
                    std::vector<double> rgbparam = GetColorConfig(value);
                    double r = rgbparam.at(0);
                    double g = rgbparam.at(1);
                    double b = rgbparam.at(2);
                    switch (i) {
                         case 3:
                               SetRGBNoeuds(r,g,b);
                               break;
                         case 4:
                               SetRGBSegmentsW(r,g,b);
                               break;
                         case 5:
                               SetRGBSegmentsR(r,g,b);
                               break;
                         case 6:
                               SetRGBBordersW(r,g,b);
                               break;
                         case 7:
                               SetRGBBordersR(r,g,b);
                               break;
                         case 8:                    
                               SetRGBRender(r,g,b);
                               break;
                         case 9:
                               SetRGBBackground(r,g,b); 
                               break;
                    }
                }
     }
     return 1;
} | 
Partager