Changeset 2855 in Sophya


Ignore:
Timestamp:
Nov 28, 2005, 7:23:09 PM (20 years ago)
Author:
ansari
Message:

codage GrAtt2String dans PIGraphicAtt - Reza 29/11/2005

File:
1 edited

Legend:

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

    r2780 r2855  
    660660int PIGraphicAtt::AttToStrings(vector<string> & att) const
    661661{
    662   // A FAIRE - Reza->CMV  Mars 2004
    663662  // On ne vide pas (ne met pas a zero) att, mais on ajoute derriere.
    664   att.push_back("??GraphicAtt??");
    665   return 1;
     663  //  att.push_back("??GraphicAtt??");
     664  char sbuff[32];
     665  string astr;
     666  int naj = 0;
     667  // ------ Attribut de couleur
     668  for (GrAttColors::const_iterator it = GrAcolors->begin();
     669       it != GrAcolors->end(); it++)
     670    if ( (*it).second == mFCol ) {
     671      att.push_back((*it).first);
     672      naj++;
     673      break;
     674    }
     675  // ------ Attribut de ligne
     676  astr = "line=";
     677  if (mLAtt.GetLineDash() == PI_LineSolid) astr += "solid,";
     678  else if (mLAtt.GetLineDash() == PI_LineDashed) astr += "dashed,";
     679  else if (mLAtt.GetLineDash() == PI_LineDotted) astr += "dotted";
     680  else if (mLAtt.GetLineDash() == PI_LineDashDotted) astr += "dashdotted";
     681  else astr += "solid,";
     682  sprintf(sbuff,"%d",mLAtt.GetLineWidth());
     683  astr += sbuff;
     684  att.push_back(astr);
     685  naj++;
     686  // ------ Attribut de fonte
     687  astr = "font=";
     688  if (mFnt.GetFontName() == PI_CourierFont) astr += "courier,";
     689  else if (mFnt.GetFontName() == PI_HelveticaFont) astr += "helvetica,";
     690  else if (mFnt.GetFontName() == PI_TimesFont) astr += "times,";
     691  else if (mFnt.GetFontName() == PI_SymbolFont) astr += "symbol,";
     692  else astr += "courier,";
     693  if (mFnt.GetFontAtt() == PI_RomanFont) astr += "roman,";
     694  else if (mFnt.GetFontAtt() == PI_BoldFont) astr += "bold,";
     695  else if (mFnt.GetFontAtt() == PI_ItalicFont) astr += "italic,";
     696  else if (mFnt.GetFontAtt() == PI_BoldItalicFont) astr += "bolditalic,";
     697  else astr += "roman,";
     698  sprintf(sbuff,"%d",mFnt.GetFontSize());
     699  astr += sbuff;
     700  att.push_back(astr);
     701  naj++;
     702  // ------ Attribut de table de couleur
     703  for (GrAttColMaps::const_iterator it = GrAcmaps->begin();
     704       it != GrAcmaps->end(); it++)
     705    if ( (*it).second == mCmapid ) {
     706      att.push_back((*it).first);
     707      naj++;
     708      break;
     709    }
     710  // Inversion d'indexage de ColorMap
     711  //  else if (gratt == "revcmap")  {
     712  if (mRevCmap) {
     713    att.push_back("revcmap");
     714    naj++;
     715  }
     716
     717  // ------ Attribut de marqueur
     718  const char* mrkn[11] = {"dot", "plus", "cross",
     719                          "circle", "fcircle",
     720                          "boxmarker", "fbox",
     721                          "triangle", "ftriangle",
     722                          "star", "fstar"};
     723  PIMarker mrk[11] = {PI_DotMarker, PI_PlusMarker, PI_CrossMarker,
     724                      PI_CircleMarker, PI_FCircleMarker,
     725                      PI_BoxMarker, PI_FBoxMarker,
     726                      PI_TriangleMarker, PI_FTriangleMarker,
     727                      PI_StarMarker, PI_FStarMarker};
     728  if (mMrk != PI_NotDefMarker) {
     729    astr = "marker=";
     730    for(int kk=0; kk<11; kk++)
     731      if (mrk[kk] == mMrk)  {
     732        astr += mrkn[kk];
     733        break;
     734      }
     735    sprintf(sbuff,",%d",mMSz);
     736    astr += sbuff;
     737    att.push_back(astr);
     738    naj++;
     739  }
     740  if (mArrowMrk != PI_NotDefArrowMarker) {
     741    astr = "arrow=";
     742    if (mArrowMrk == PI_BasicArrowMarker)  astr += "basic";
     743    else if (mArrowMrk == PI_TriangleArrowMarker)  astr += "triangle";
     744    else if (mArrowMrk == PI_FTriangleArrowMarker)  astr += "ftriangle";
     745    else if (mArrowMrk == PI_ArrowShapedArrowMarker)  astr += "arrowshaped";
     746    else if (mArrowMrk == PI_FArrowShapedArrowMarker)  astr += "farrowshaped";
     747    else astr += "basic";
     748    sprintf(sbuff,",%d",mArrowMrkSz);
     749    astr += sbuff;
     750    att.push_back(astr);
     751    naj++;
     752  }
     753  return naj;
    666754}
    667755
Note: See TracChangeset for help on using the changeset viewer.