Changeset 1642 in Sophya for trunk/SophyaPI/PIext
- Timestamp:
- Aug 16, 2001, 2:19:01 PM (24 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/basexecut.cc
r1569 r1642 98 98 } 99 99 else if (kw == "addtext") { 100 if (tokens.size() < 4) { cout << "Usage: addtext x y colfontatt txt" << endl; return(0); }100 if (tokens.size() < 3) { cout << "Usage: addtext x y txt [colfontatt]" << endl; return(0); } 101 101 double xp = atof(tokens[0].c_str()); 102 102 double yp = atof(tokens[1].c_str()); 103 bool fgsr = true;104 string txt = tokens[3];105 for(int k=4; k<(int)tokens.size(); k++) txt += (' ' + tokens[k]);106 //int opt = mObjMgr->GetServiceObj()->DecodeDispOption(tokens[2], fgsr);103 string txt = tokens[2]; 104 bool fgsr = false; 105 if (tokens.size() > 3) 106 mObjMgr->GetServiceObj()->DecodeDispOption(tokens[3], fgsr); 107 107 mImgApp->AddText(txt, xp, yp); 108 108 if (fgsr) mImgApp->RestoreGraphicAtt(); 109 109 } 110 else if ((kw == "addline") || (kw == "addrect") || (kw == "addfrect")) { 111 if (tokens.size() < 4) { cout << "Usage: addline/addrect/addfrect x1 y1 x2 y2 [colatt]" << endl; return(0); } 112 double xp1 = atof(tokens[0].c_str()); 113 double yp1 = atof(tokens[1].c_str()); 114 double xp2 = atof(tokens[2].c_str()); 115 double yp2 = atof(tokens[3].c_str()); 116 bool fgsr = false; 117 if (tokens.size() > 4) 118 mObjMgr->GetServiceObj()->DecodeDispOption(tokens[4], fgsr); 119 if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2); 120 else { 121 bool fgfill = (kw == "addrect") ? false : true; 122 mImgApp->AddRectangle(xp1, yp1, xp2, yp2, fgfill); 123 } 124 if (fgsr) mImgApp->RestoreGraphicAtt(); 125 } 126 else if ((kw == "addcirc") || (kw == "addfcirc")) { 127 if (tokens.size() < 3) { cout << "Usage: addcirc/addfcirc xc yc r [colatt]" << endl; return(0); } 128 double xc = atof(tokens[0].c_str()); 129 double yc = atof(tokens[1].c_str()); 130 double rad = atof(tokens[2].c_str()); 131 bool fgsr = false; 132 if (tokens.size() > 3) 133 mObjMgr->GetServiceObj()->DecodeDispOption(tokens[3], fgsr); 134 bool fgfill = (kw == "addcirc") ? false : true; 135 mImgApp->AddCircle(xc, yc, rad, fgfill); 136 if (fgsr) mImgApp->RestoreGraphicAtt(); 137 } 138 139 110 140 else if (kw == "settitle") { 111 if (tokens.size() < 2) { cout << "Usage: addtitle fontatt titleup" << endl; return(0); }141 if (tokens.size() < 1) { cout << "Usage: settitle TopTitle [BotTitle] [fontatt]" << endl; return(0); } 112 142 bool fgsr = true; 113 //int opt = mObjMgr->GetServiceObj()->DecodeDispOption(tokens[0], fgsr);114 string txt = tokens[1];115 for(int k=2; k<(int)tokens.size(); k++) txt += (' ' + tokens[k]);116 string td = "";117 mImgApp->SetTitle(t xt, td);143 if (tokens.size() > 2) 144 mObjMgr->GetServiceObj()->DecodeDispOption(tokens[2], fgsr); 145 if (tokens.size() < 2) 146 tokens.push_back(""); 147 mImgApp->SetTitle(tokens[0], tokens[1]); 118 148 if (fgsr) mImgApp->RestoreGraphicAtt(); 119 149 } … … 744 774 usage += "att_list=def back to default values, Example: gratt red,circlemarker5"; 745 775 usage += "\n ------------------ Graphic attribute list ------------------ \n"; 746 usage += ">> Colors: defcol black white grey red blue green yellow magenta cyan \n"; 747 usage += " turquoise navyblue orange siennared purple limegreen gold \n"; 776 usage += ">> Colors: defcol black white grey red blue green yellow \n"; 777 usage += " magenta cyan turquoise navyblue orange siennared purple \n"; 778 usage += " limegreen gold violet violetred blueviolet darkviolet \n"; 748 779 usage += ">> Lines: defline normalline thinline thickline dashedline thindashedline \n"; 749 780 usage += " thickdashedline dottedline thindottedline thickdottedline \n"; … … 796 827 kw = "addtext"; 797 828 usage = "Adds a text string to the current graphic object"; 798 usage += "\n at the specified position (Gr-Object Coordinate) with graphic attribute specification"; 799 usage += "\n Usage: addtext x y ColFontAtt TextString"; 800 usage += "\n Related commands: settitle graphicatt"; 829 usage += "\n at the specified position (+ color and font attributes) "; 830 usage += "\n The Base/AxesDrawer is used to handle added text strings" ; 831 usage += "\n Alt<Z> to remove added elements"; 832 usage += "\n Font attribute is common with axes"; 833 usage += "\n Usage: addtext x y TextString [ColFontAtt]"; 834 usage += "\n (use quotes '' for multi word text strings) "; 835 usage += "\n Related commands: addline addrect addfrect addcirc addfcirc settitle graphicatt"; 801 836 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 802 837 838 kw = "addline"; 839 usage = "Adds a line to the current graphic object"; 840 usage += "\n at the specified position (+ color attribute)"; 841 usage += "\n The Base/AxesDrawer is used to handle added lines"; 842 usage += "\n Alt<Z> to remove added elements"; 843 usage += "\n Usage: addline x1 y1 x2 y2 [ColAtt]"; 844 usage += "\n Related commands: addtext addrect addfrect addcirc addfcirc graphicatt"; 845 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 846 847 kw = "addrect"; 848 usage = "Adds a rectangle to the current graphic object"; 849 usage += "\n between the specified positions (+ color attribute)"; 850 usage += "\n The Base/AxesDrawer is used to handle added rectangle"; 851 usage += "\n Alt<Z> to remove added elements"; 852 usage += "\n Usage: addrect x1 y1 x2 y2 [ColAtt]"; 853 usage += "\n Related commands: addtext addline addfrect addcirc addfcirc graphicatt"; 854 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 855 856 kw = "addfrect"; 857 usage = "Adds a filled rectangle to the current graphic object"; 858 usage += "\n between the specified positions (+ color attribute)"; 859 usage += "\n The Base/AxesDrawer is used to handle added rectangle"; 860 usage += "\n Alt<Z> to remove added elements"; 861 usage += "\n Usage: addfrect x1 y1 x2 y2 [ColAtt]"; 862 usage += "\n Related commands: addtext addline addrect addcirc addfcirc graphicatt"; 863 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 864 865 kw = "addcirc"; 866 usage = "Adds a circle to the current graphic object"; 867 usage += "\n with the specified center and radius (+ color attribute)"; 868 usage += "\n The Base/AxesDrawer is used to handle added circles"; 869 usage += "\n Alt<Z> to remove added elements"; 870 usage += "\n Usage: addcirc xcenter ycenter radius [ColAtt]"; 871 usage += "\n Related commands: addtext addline addfrect addfrect addfcirc graphicatt"; 872 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 873 874 kw = "addfcirc"; 875 usage = "Adds a filled circle to the current graphic object"; 876 usage += "\n with the specified center and radius (+ color attribute)"; 877 usage += "\n The Base/AxesDrawer is used to handle added circles"; 878 usage += "\n Alt<Z> to remove added elements"; 879 usage += "\n Usage: addcirc xcenter ycenter radius [ColAtt]"; 880 usage += "\n Related commands: addtext addline addfrect addfrect addcirc graphicatt"; 881 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 882 803 883 kw = "settitle"; 804 usage = "Set the title string (top title ) for the current graphic object";805 usage += "\n Usage: settitle FontAtt TopTitle";884 usage = "Set the title string (top title / bottom title) for the current graphic object"; 885 usage += "\n Usage: settitle TopTitle [BottomTitle] [fontAtt]"; 806 886 usage += "\n Related commands: addtext graphicatt"; 807 887 mpiac->RegisterCommand(kw, usage, this, "Graphics"); -
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 -
trunk/SophyaPI/PIext/pistdimgapp.h
r1569 r1642 51 51 int Disp3DDrawer(PIDrawer3D* scd, string const & name, int opt, string title="", int oid=0); 52 52 53 // Fonction d'ajout de texte (provisoire - Aout 99) 53 // Fonction d'ajout de texte (provisoire - Aout 99) 54 54 void AddText(string const & txt, double xp, double yp); 55 // Ajout de lignes, rectangles, cercles (provisoires - Aout 2001) 56 void AddLine(double xp1, double yp1, double xp2, double yp2); 57 void AddRectangle(double xp1, double yp1, double xp2, double yp2, bool fgfill=false); 58 void AddCircle(double xc, double yc, double r, bool fgfill=false); 59 55 60 // Fonction Ajout de titre de trace 56 61 void SetTitle(string const & titleup, string const & titledown); 57 62 63 // Acces au BaseDrawer (PIElDrawer) du PIBaseWdg courant 64 PIElDrawer* CurrentElDrawer(); 58 65 59 66 void CreateGraphWin(int nx=1, int ny=1, int sx=0, int sy = 0); -
trunk/SophyaPI/PIext/servnobjm.cc
r1569 r1642 1515 1515 gi.a1 = PI_Gold; 1516 1516 GrAcolors["gold"] = gi; 1517 gi.a1 = PI_Violet; 1518 GrAcolors["violet"] = gi; 1519 gi.a1 = PI_VioletRed; 1520 GrAcolors["violetred"] = gi; 1521 gi.a1 = PI_BlueViolet; 1522 GrAcolors["blueviolet"] = gi; 1523 gi.a1 = PI_DarkViolet; 1524 GrAcolors["darkviolet"] = gi; 1517 1525 1518 1526 // Les attributs de lignes
Note:
See TracChangeset
for help on using the changeset viewer.