Changeset 1642 in Sophya for trunk/SophyaPI/PIext/pistdimgapp.cc


Ignore:
Timestamp:
Aug 16, 2001, 2:19:01 PM (24 years ago)
Author:
ansari
Message:

1/ Definition d'attributs graphiques texte pour les nouvelles couleurs violettes
2/ Ajout commandes addline addrect addfrect addfcircle ....

Reza 16/8/2001

File:
1 edited

Legend:

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

    r1593 r1642  
    661661void PIStdImgApp::AddText(string const & txt, double xp, double yp)
    662662{
    663 if (!mLastWdg)  return;
     663PIElDrawer *eld=CurrentElDrawer();
     664if (eld == NULL) return;
     665
     666if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) )
     667  eld->SetFontAtt(mFSz, mFAtt);
     668if ( mFName != PI_DefaultFont )
     669  eld->SetFont(mFName, eld->GetFontSz(), eld->GetFontAtt());
     670eld->ElAddText(xp,yp,txt.c_str(),mFCol);
     671eld->Refresh();
     672}
     673
     674/* --Methode-- */
     675void PIStdImgApp::AddLine(double xp1, double yp1, double xp2, double yp2)
     676{
     677PIElDrawer *eld=CurrentElDrawer();
     678if (eld == NULL) return;
     679
     680eld->ElAddLine(xp1, yp1, xp2, yp2, mFCol);
     681eld->Refresh();
     682}
     683
     684/* --Methode-- */
     685void PIStdImgApp::AddRectangle(double xp1, double yp1, double xp2, double yp2, bool fgfill)
     686{
     687PIElDrawer *eld=CurrentElDrawer();
     688if (eld == NULL) return;
     689
     690double xp,yp;
     691double dx, dy;
     692if (xp1 < xp2) {
     693  xp = xp1; dx = xp2-xp1;
     694}
     695else {
     696  xp = xp2; dx = xp1-xp2;
     697}
     698if (yp1 < yp2) {
     699  yp = yp1; dy = yp2-yp1;
     700}
     701else {
     702  yp = yp2; dy = yp1-yp2;
     703}
     704if (fgfill) eld->ElAddFRect(xp, yp, dx, dy, mFCol);
     705else eld->ElAddRect(xp, yp, dx, dy, mFCol);
     706eld->Refresh();
     707}
     708
     709/* --Methode-- */
     710void PIStdImgApp::AddCircle(double xc, double yc, double r, bool fgfill)
     711{
     712PIElDrawer *eld=CurrentElDrawer();
     713if (eld == NULL) return;
     714
     715if (fgfill) eld->ElAddFCirc(xc, yc, r, mFCol);
     716else eld->ElAddCirc(xc, yc, r, mFCol);
     717eld->Refresh();
     718}
     719
     720/* --Methode-- */
     721void PIStdImgApp::SetTitle(string const & titletop, string const & titlebottom)
     722{
     723PIElDrawer *eld=CurrentElDrawer();
     724if (eld == NULL) return;
     725
     726if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) )
     727  eld->SetFontAtt(mFSz, mFAtt);
     728if ( mFName != PI_DefaultFont )
     729  eld->SetFont(mFName, eld->GetFontSz(), eld->GetFontAtt());
     730eld->SetTitles(titletop, titlebottom);
     731eld->Refresh();
     732}
     733
     734/* --Methode-- */
     735PIElDrawer* PIStdImgApp::CurrentElDrawer()
     736{
    664737PIElDrawer *eld=NULL;
     738if (!mLastWdg)  return(eld);
    665739PIScDrawWdg* sdw=NULL;
    666740PIDraw3DWdg* w3d=NULL;
     
    677751  case PIImage::ClassId :
    678752    imgw = dynamic_cast<PIImage *>(mLastWdg);
    679     if (imgw) eld = imgw->MyElDrawer();
     753    if (imgw) eld = imgw->BaseDrawer();
    680754    break;
    681755  default :
    682756    break;
    683757  }
    684 if (eld) {
    685   if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) )     eld->SetFontAtt(mFSz, mFAtt);
    686   eld->ElAddText(xp,yp,txt.c_str(),mFCol);
    687   eld->Refresh();
    688   }
    689 }
    690 /* --Methode-- */
    691 void PIStdImgApp::SetTitle(string const & titletop, string const & titlebottom)
    692 {
    693 if (!mLastWdg)  return;
    694 PIElDrawer *eld=NULL;
    695 PIScDrawWdg* sdw=NULL;
    696 PIDraw3DWdg* w3d=NULL;
    697 PIImage* imgw;
    698 switch(mLastWdg->kind()) {
    699   case PIScDrawWdg::ClassId :
    700     sdw = dynamic_cast<PIScDrawWdg *>(mLastWdg);
    701     if (sdw) eld = sdw->BaseDrawer();
    702     break;
    703   case PIDraw3DWdg::ClassId :
    704     w3d = dynamic_cast<PIDraw3DWdg *>(mLastWdg);
    705     if (w3d) eld = w3d->BaseDrawer();
    706     break;
    707   case PIImage::ClassId :
    708     imgw = dynamic_cast<PIImage *>(mLastWdg);
    709     if (imgw) eld = imgw->MyElDrawer();
    710     break;
    711   default :
    712     break;
    713   }
    714 if (eld) {
    715   if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) )     eld->SetFontAtt(mFSz, mFAtt);
    716   eld->SetTitles(titletop, titlebottom);
    717   eld->Refresh();
    718   }
     758return(eld);
    719759}
    720760
Note: See TracChangeset for help on using the changeset viewer.