Changeset 2165 in Sophya


Ignore:
Timestamp:
Aug 7, 2002, 5:00:49 PM (23 years ago)
Author:
ansari
Message:

Ajout commande setaxelabels, adaptations aux modifs PIElDrwMgr et
PIDrawer3D - Reza 7/8/2002

Location:
trunk/SophyaPI/PIext
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/basexecut.cc

    r2158 r2165  
    128128
    129129
    130 else if (kw == "settitle") {
    131   if (tokens.size() < 1) { cout << "Usage: settitle TopTitle [BotTitle] [fontatt]" << endl;  return(0); }
     130else if ((kw == "settitle") || (kw == "addtitle")) {
     131  if (tokens.size() < 1) { cout << "Usage: settitle/addtitle TopTitle [BotTitle] [fontatt]" << endl;  return(0); }
    132132  if(tokens.size()<2) tokens.push_back("");
    133   mImgApp->SetTitle(tokens[0], tokens[1]);
     133  string gropt;
     134  if(tokens.size()>2) gropt = tokens[2];
     135  mImgApp->SetTitle(tokens[0], tokens[1], gropt);
     136}
     137
     138else if ((kw == "setaxelabels") || (kw == "addaxelabels")) {
     139  if (tokens.size() < 2) { cout << "Usage: setaxelabels/addaxelabels xLabel yLabel [fontatt]" << endl;  return(0); }
     140  string gropt;
     141  if(tokens.size()>2) gropt = tokens[2];
     142  mImgApp->SetAxeLabels(tokens[0], tokens[1], gropt);
    134143}
    135144 
     
    879888usage += "\n  Usage: settitle TopTitle [BottomTitle] [fontAtt]";
    880889usage += "\n  Related commands: addtext graphicatt"; 
     890mpiac->RegisterCommand(kw, usage, this, "Graphics");
     891
     892kw = "addtitle";
     893usage = "Set the title string (top title / bottom title) \n";
     894usage += "   alias for settitle ";
     895mpiac->RegisterCommand(kw, usage, this, "Graphics");
     896
     897kw = "setaxelabels";
     898usage = "Set the X and Y axis labels for the current 2D graphic object \n";
     899usage += "\n  Usage: setaxelabels xLabel yLabel [ColorFntAtt]";
     900usage += "\n  Related commands: settitle addtext graphicatt"; 
     901mpiac->RegisterCommand(kw, usage, this, "Graphics");
     902
     903kw = "addaxelabels";
     904usage = "Set the X and Y axis labels for the current 2D graphic object";
     905usage += "   alias for setaxelabels ";
    881906mpiac->RegisterCommand(kw, usage, this, "Graphics");
    882907
  • trunk/SophyaPI/PIext/pintup3d.cc

    r2092 r2165  
    148148            (xmin+xmax)/2.+D , (ymin+ymax)/2.-2.5*D , zmin+(zmax-zmin)*0.85, 0.25, 0.25); 
    149149
     150  /*
    150151  x3Min = xmin;  // - PERC_GARDE*(xmax-xmin);
    151152  x3Max = xmax;  // + PERC_GARDE*(xmax-xmin);
     
    154155  z3Min = zmin;  // - PERC_GARDE*(zmax-zmin);
    155156  z3Max = zmax;  // + PERC_GARDE*(zmax-zmin);
     157  */
     158
     159  Set3DBox(xmin, xmax, ymin, ymax, zmin, zmax);
    156160
    157161//  printf("PINTuple3D::UpdateLimits() : %g .. %g  %g .. %g  %g .. %g (%g) \n", xmin,xmax,ymin,ymax,zmin,zmax,D);
  • trunk/SophyaPI/PIext/pistdimgapp.cc

    r2158 r2165  
    777777void PIStdImgApp::AddText(string const & txt, double xp, double yp, string const& sop)
    778778{
    779 PIElDrawer *eld=CurrentElDrawer();
     779PIDrawer *eld=CurrentElDrawer();
    780780if (eld == NULL) return;
     781PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
     782PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
     783if ((eld2 == NULL) && (eld3 == NULL)) return;
     784PIElDrwMgr* elmgr;
     785if (eld2) elmgr = &(eld2->ElDrwMgr());
     786else if (eld3) elmgr = &(eld3->ElDrwMgr());
     787if (elmgr == NULL) return;
    781788
    782789vector<string> opts;
    783790ParseDisplayOption(sop, opts);
    784791PIGraphicAtt gratt(opts);
    785 eld->ElAddText(xp,yp,txt.c_str(), gratt.GetColor());
     792elmgr->ElAddText(xp,yp,txt.c_str(), gratt);
    786793eld->Refresh();
    787794}
     
    790797void PIStdImgApp::AddLine(double xp1, double yp1, double xp2, double yp2, string const& sop)
    791798{
    792 PIElDrawer *eld=CurrentElDrawer();
     799PIDrawer *eld=CurrentElDrawer();
    793800if (eld == NULL) return;
     801PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
     802PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
     803if ((eld2 == NULL) && (eld3 == NULL)) return;
     804PIElDrwMgr* elmgr = NULL;
     805if (eld2) elmgr = &(eld2->ElDrwMgr());
     806else if (eld3) elmgr = &(eld3->ElDrwMgr());
     807if (elmgr == NULL) return;
    794808
    795809vector<string> opts;
    796810ParseDisplayOption(sop, opts);
    797811PIGraphicAtt gratt(opts);
    798 eld->ElAddLine(xp1, yp1, xp2, yp2, gratt.GetColor());
     812elmgr->ElAddLine(xp1, yp1, xp2, yp2, gratt);
    799813eld->Refresh();
    800814}
     
    804818                               string const& sop, bool fgfill)
    805819{
    806 PIElDrawer *eld=CurrentElDrawer();
     820PIDrawer *eld=CurrentElDrawer();
    807821if (eld == NULL) return;
     822PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
     823PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
     824if ((eld2 == NULL) && (eld3 == NULL)) return;
     825PIElDrwMgr* elmgr = NULL;
     826if (eld2) elmgr = &(eld2->ElDrwMgr());
     827else if (eld3) elmgr = &(eld3->ElDrwMgr());
    808828
    809829double xp,yp;
     
    826846PIGraphicAtt gratt(opts);
    827847
    828 if (fgfill) eld->ElAddFRect(xp, yp, dx, dy, gratt.GetColor());
    829 else eld->ElAddRect(xp, yp, dx, dy, gratt.GetColor());
     848if (fgfill) elmgr->ElAddFRect(xp, yp, dx, dy, gratt);
     849else elmgr->ElAddRect(xp, yp, dx, dy, gratt);
    830850eld->Refresh();
    831851}
     
    834854void PIStdImgApp::AddCircle(double xc, double yc, double r, string const& sop, bool fgfill)
    835855{
    836 PIElDrawer *eld=CurrentElDrawer();
     856PIDrawer *eld=CurrentElDrawer();
    837857if (eld == NULL) return;
     858PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
     859PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
     860if ((eld2 == NULL) && (eld3 == NULL)) return;
     861PIElDrwMgr* elmgr = NULL;
     862if (eld2) elmgr = &(eld2->ElDrwMgr());
     863else if (eld3) elmgr = &(eld3->ElDrwMgr());
    838864
    839865vector<string> opts;
     
    841867PIGraphicAtt gratt(opts);
    842868
    843 if (fgfill) eld->ElAddFCirc(xc, yc, r, gratt.GetColor());
    844 else eld->ElAddCirc(xc, yc, r, gratt.GetColor());
     869if (fgfill) elmgr->ElAddFCirc(xc, yc, r, gratt);
     870else elmgr->ElAddCirc(xc, yc, r, gratt);
    845871eld->Refresh();
    846872}
    847873
    848874/* --Methode-- */
    849 void PIStdImgApp::SetTitle(string const & titletop, string const & titlebottom)
    850 {
    851 PIElDrawer *eld=CurrentElDrawer();
     875void PIStdImgApp::SetTitle(string const & titletop, string const & titlebottom, string const& sop)
     876{
     877PIDrawer *eld=CurrentElDrawer();
    852878if (eld == NULL) return;
    853 
    854 eld->SetTitles(titletop, titlebottom);
     879PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
     880PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
     881if ((eld2 == NULL) && (eld3 == NULL)) return;
     882
     883vector<string> opts;
     884ParseDisplayOption(sop, opts);
     885PIGraphicAtt gratt(opts);
     886
     887if (eld2) {
     888  eld2->SetTitles(titletop, titlebottom, gratt);
     889  eld2->ShowTitles(true);
     890}
     891else if (eld3) {
     892  eld3->SetTitles(titletop, titlebottom, gratt);
     893  eld3->ShowTitles(true);
     894}
    855895eld->Refresh();
    856896}
    857 
    858 /* --Methode-- */
    859 PIElDrawer* PIStdImgApp::CurrentElDrawer()
    860 {
    861 PIElDrawer *eld=NULL;
     897/* --Methode-- */
     898void PIStdImgApp::SetAxeLabels(string const & xLabel, string const & yLabel, string const& sop)
     899{
     900PIDrawer *eld=CurrentElDrawer();
     901if (eld == NULL) return;
     902PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
     903if (eld2 == NULL) return;
     904
     905vector<string> opts;
     906ParseDisplayOption(sop, opts);
     907PIGraphicAtt gratt(opts);
     908
     909eld2->SetAxesLabels(xLabel, yLabel, gratt);
     910eld2->ShowAxesLabels(true);
     911
     912eld->Refresh();
     913}
     914
     915/* --Methode-- */
     916PIDrawer* PIStdImgApp::CurrentElDrawer()
     917{
     918PIDrawer *eld=NULL;
    862919if (!mLastWdg)  return(eld);
    863920PIScDrawWdg* sdw=NULL;
  • trunk/SophyaPI/PIext/pistdimgapp.h

    r2141 r2165  
    6969
    7070  //  Fonction Ajout de titre de trace
    71      void SetTitle(string const & titleup, string const & titledown);
     71     void SetTitle(string const & titleup, string const & titledown, string const& opt);
     72  //  Fonction d'Ajout label d'axe X,Y
     73     void SetAxeLabels(string const & xLabel, string const & yLabel, string const& opt);
    7274
    7375  //  Acces au BaseDrawer (PIElDrawer) du PIBaseWdg courant
    74      PIElDrawer* CurrentElDrawer();
     76     PIDrawer* CurrentElDrawer();
    7577
    7678     void CreateGraphWin(int nx=1, int ny=1, int sx=0, int sy = 0);
Note: See TracChangeset for help on using the changeset viewer.