void GLWidget::open_graphic(std::string file){ layer_groups.clear(); std::string line; std::ifstream infile(file.c_str()); while (std::getline(infile, line)){ std::istringstream iss(line); if (line.length()==0 || layer_groups.size()==0){ std::vector<Layer<double> > layers; layer_groups.push_back(layers); if (line.length()==0) continue; }; std::string layer_file; std::getline(iss,layer_file,';'); layer_file = file.substr(0,file.rfind("/"))+"/"+layer_file; std::string color_string; std::getline(iss,color_string,','); int rgb = (int)strtol(color_string.c_str(), NULL, 16); double r = double((rgb&0xFF0000)>>16)/255.0; double g = double((rgb&0x00FF00)>>8)/255.0; double b = double(rgb&0x0000FF)/255.0; //qDebug() << r << ".." << g << ".." << b << ".."; open_layer(layer_file,r,g,b); } }
void GLWidget::open_graphic(std::string file){ std::string line; std::ifstream infile(file.c_str()); while (std::getline(infile, line)){ std::istringstream iss(line); std::string layer_file; std::getline(iss,layer_file,';'); layer_file = file.substr(0,file.rfind("/"))+"/"+layer_file; std::string color_string; std::getline(iss,color_string,','); int rgb = (int)strtol(color_string.c_str(), NULL, 16); int r = double((rgb&0xFF0000)>>16)/255.0; int g = double((rgb&0x00FF00)>>8)/255.0; int b = double(rgb&0x0000FF)/255.0; open_layer(layer_file,r,g,b); } }