Changeset 1642 in Sophya for trunk/SophyaPI/PIext/pistdimgapp.cc
- Timestamp:
- Aug 16, 2001, 2:19:01 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/pistdimgapp.cc
r1593 r1642 661 661 void PIStdImgApp::AddText(string const & txt, double xp, double yp) 662 662 { 663 if (!mLastWdg) return; 663 PIElDrawer *eld=CurrentElDrawer(); 664 if (eld == NULL) return; 665 666 if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) ) 667 eld->SetFontAtt(mFSz, mFAtt); 668 if ( mFName != PI_DefaultFont ) 669 eld->SetFont(mFName, eld->GetFontSz(), eld->GetFontAtt()); 670 eld->ElAddText(xp,yp,txt.c_str(),mFCol); 671 eld->Refresh(); 672 } 673 674 /* --Methode-- */ 675 void PIStdImgApp::AddLine(double xp1, double yp1, double xp2, double yp2) 676 { 677 PIElDrawer *eld=CurrentElDrawer(); 678 if (eld == NULL) return; 679 680 eld->ElAddLine(xp1, yp1, xp2, yp2, mFCol); 681 eld->Refresh(); 682 } 683 684 /* --Methode-- */ 685 void PIStdImgApp::AddRectangle(double xp1, double yp1, double xp2, double yp2, bool fgfill) 686 { 687 PIElDrawer *eld=CurrentElDrawer(); 688 if (eld == NULL) return; 689 690 double xp,yp; 691 double dx, dy; 692 if (xp1 < xp2) { 693 xp = xp1; dx = xp2-xp1; 694 } 695 else { 696 xp = xp2; dx = xp1-xp2; 697 } 698 if (yp1 < yp2) { 699 yp = yp1; dy = yp2-yp1; 700 } 701 else { 702 yp = yp2; dy = yp1-yp2; 703 } 704 if (fgfill) eld->ElAddFRect(xp, yp, dx, dy, mFCol); 705 else eld->ElAddRect(xp, yp, dx, dy, mFCol); 706 eld->Refresh(); 707 } 708 709 /* --Methode-- */ 710 void PIStdImgApp::AddCircle(double xc, double yc, double r, bool fgfill) 711 { 712 PIElDrawer *eld=CurrentElDrawer(); 713 if (eld == NULL) return; 714 715 if (fgfill) eld->ElAddFCirc(xc, yc, r, mFCol); 716 else eld->ElAddCirc(xc, yc, r, mFCol); 717 eld->Refresh(); 718 } 719 720 /* --Methode-- */ 721 void PIStdImgApp::SetTitle(string const & titletop, string const & titlebottom) 722 { 723 PIElDrawer *eld=CurrentElDrawer(); 724 if (eld == NULL) return; 725 726 if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) ) 727 eld->SetFontAtt(mFSz, mFAtt); 728 if ( mFName != PI_DefaultFont ) 729 eld->SetFont(mFName, eld->GetFontSz(), eld->GetFontAtt()); 730 eld->SetTitles(titletop, titlebottom); 731 eld->Refresh(); 732 } 733 734 /* --Methode-- */ 735 PIElDrawer* PIStdImgApp::CurrentElDrawer() 736 { 664 737 PIElDrawer *eld=NULL; 738 if (!mLastWdg) return(eld); 665 739 PIScDrawWdg* sdw=NULL; 666 740 PIDraw3DWdg* w3d=NULL; … … 677 751 case PIImage::ClassId : 678 752 imgw = dynamic_cast<PIImage *>(mLastWdg); 679 if (imgw) eld = imgw-> MyElDrawer();753 if (imgw) eld = imgw->BaseDrawer(); 680 754 break; 681 755 default : 682 756 break; 683 757 } 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 } 758 return(eld); 719 759 } 720 760
Note:
See TracChangeset
for help on using the changeset viewer.