Changeset 2546 in Sophya for trunk/SophyaPI/PI/pi3ddrw.cc


Ignore:
Timestamp:
Jun 2, 2004, 3:22:07 PM (21 years ago)
Author:
ansari
Message:

Suite (et presque fin) codage de traitement des options de limites d'axes et d'auto/rescaling ds les Drawers3D et le PIWdg3D - Reza 2 Juin 2004

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/pi3ddrw.cc

    r2544 r2546  
    262262}
    263263
     264/* --Methode-- */
     265int PIDrawer3D::DecodeOptionString(vector<string> & opt, bool rmdecopt)
     266{
     267  int optsz1 = opt.size();
     268  if(optsz1<1)  return(0); 
     269  // On appelle d'abord le decodage de la classe PIDrawer de laquelle
     270  // on herite. (Pas obligatoire) on decode donc ici les attributs de
     271  // couleur, fontes ...
     272  int ndec1 = PIDrawer::DecodeOptionString(opt, rmdecopt);
     273  if(optsz1-ndec1<1) return(ndec1);  // si tout a ete decode
     274
     275  vector<string> udopt;  // On gardera ici les options non decodees
     276  unsigned int k = 0;
     277  int ndec = opt.size();
     278  for( k=0; k<opt.size(); k++ ) {
     279    string opts = opt[k];
     280    if ( (opts == "rescale") || (opts == "autoscale") ) aScxy = aScz = true;
     281    else if ( (opts == "norescale") || (opts == "noautoscale") ) aScxy = aScz = false;
     282    else if ( (opts == "rescalexy") || (opts == "autoscalexy") )  aScxy = true;
     283    else if ( (opts == "norescalexy") || (opts == "noautoscalexy") )  aScxy = false;
     284    else if ( (opts == "rescalez") || (opts == "autoscalez") )  aScz = true;
     285    else if ( (opts == "norescalez") || (opts == "noautoscalez") )  aScz = false;
     286    else {
     287      // Si option non decode
     288      ndec--;
     289      // S'il faut supprimer les options decodees
     290      if (rmdecopt)  udopt.push_back(opts);
     291    }
     292  } 
     293  // S'il faut supprimer les options decodees, on remplace l'argument opt
     294  // par le vecteur des options non decodees.
     295  if (rmdecopt)  opt = udopt;
     296  return(ndec+ndec1); 
     297}
     298
     299/* --Methode-- */
     300int PIDrawer3D::OptionToString(vector<string> & opt) const
     301{
     302 PIDrawer::OptionToString(opt);
     303 if ( aScxy || aScz ) opt.push_back("autoscale");
     304 else if (!aScxy && !aScz ) opt.push_back("noautoscale");
     305 else {
     306   if(aScxy) opt.push_back("autoscalexy"); else opt.push_back("noautoscalexy");
     307   if(aScz) opt.push_back("autoscalez"); else opt.push_back("noautoscalez");
     308 }
     309 return 1;
     310}
     311
     312/* --Methode-- */
     313void PIDrawer3D::GetOptionsHelpInfo(string& info)
     314{
     315info += " ---- PIDrawer3D options help info : \n" ;
     316info += "  X/Y,Z axis rescaling option (-> cubic 3D box)  \n";
     317info += "  rescale=autoscale/ norescale=noautoscale : X/Y and Z axis \n";
     318info += "  rescalexy=autoscalexy / norescalexy=noautoscalexy : X/Y  axis \n";
     319info += "  rescalexy=autoscalexy / norescalexy=noautoscalexy : Z axis \n";
     320info += " --- + Usual color/line/marker/... attribute decoding  \n";
     321// On recupere ensuite la chaine info de la classe de base
     322PIDrawer::GetOptionsHelpInfo(info);
     323return;
     324}
     325
    264326/*  --------------------------------------------------------------  */
    265327/*  ------------------- Classe PIElDrawer3D ------------------------  */
     
    319381  int nopt0 = opt.size();
    320382  if (nopt0 < 1)  return(0); 
    321   int ndec1 = PIDrawer::DecodeOptionString(opt, rmdecopt);
     383  int ndec1 = PIDrawer3D::DecodeOptionString(opt, rmdecopt);
    322384  if ((nopt0 - ndec1) < 1) return(ndec1);  // si tout a ete decode
    323385  vector<string> udopt;
Note: See TracChangeset for help on using the changeset viewer.