Changeset 2243 in Sophya for trunk/SophyaPI/PIext
- Timestamp:
- Nov 3, 2002, 10:52:49 PM (23 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/basexecut.cc
r2217 r2243 13 13 #include "nobjmgr.h" 14 14 #include "servnobjm.h" 15 #include "piyfxdrw.h" 15 16 16 17 #include "histos.h" … … 70 71 else if (kw == "newwin") { 71 72 int nx=1, ny=1; 73 int sx=0, sy=0; 72 74 //if(tokens.size() < 2) { cout << "Usage: newwin nx ny" << endl; return(0); } 73 75 if(tokens.size() > 0) nx = atoi(tokens[0].c_str()); 74 76 if(tokens.size() > 1) ny = atoi(tokens[1].c_str()); 75 if (mImgApp) mImgApp->CreateGraphWin(nx, ny); 76 } 77 if(tokens.size() > 3) { 78 sx = atoi(tokens[2].c_str()); 79 sy = atoi(tokens[3].c_str()); 80 } 81 if (mImgApp) mImgApp->CreateGraphWin(nx, ny, sx, sy); 82 } 77 83 else if (kw == "stacknext") mImgApp->StackWinNext(); 78 84 else if (kw == "graphicatt") { … … 98 104 mImgApp->SetInsetLimits(xmin, xmax, ymin, ymax); 99 105 } 106 else if (kw == "drpanel") { 107 if (tokens.size() < 4) { 108 cout << "Usage: drpanel xmin xmax ymin ymax [gratt] [name]" << endl; 109 return(0); 110 } 111 double xmin = atof(tokens[0].c_str()); 112 double xmax = atof(tokens[1].c_str()); 113 double ymin = atof(tokens[2].c_str()); 114 double ymax = atof(tokens[3].c_str()); 115 char buff[128]; 116 sprintf(buff, "axesnone xylimits=%g,%g,%g,%g", xmin, xmax, ymin, ymax); 117 string sop = buff; 118 if (tokens.size() > 4) sop += tokens[4]; 119 string name; 120 if (tokens.size() > 5) sop += tokens[5]; 121 PIFuncDrawer* gdr = new PIFuncDrawer(NULL); 122 mImgApp->DispScDrawer(gdr, name, sop); 123 } 100 124 else if (kw == "addtext") { 101 125 if (tokens.size() < 3) { cout << "Usage: addtext x y txt [colfontatt]" << endl; return(0); } … … 107 131 mImgApp->AddText(txt, xp, yp, sop); 108 132 } 109 else if ((kw == "addline") || (kw == "addrect") || (kw == "addfrect")) { 133 else if ((kw == "addline") || (kw == "addrect") || (kw == "addfrect") || 134 (kw == "addarrow") ) { 110 135 if (tokens.size() < 4) { cout << "Usage: addline/addrect/addfrect x1 y1 x2 y2 [colatt]" << endl; return(0); } 111 136 double xp1 = atof(tokens[0].c_str()); … … 115 140 string sop; 116 141 if (tokens.size() > 4) sop = tokens[4]; 117 if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop); 142 if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, false); 143 else if (kw == "addarrow") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, true); 118 144 else { 119 145 bool fgfill = (kw == "addrect") ? false : true; 120 146 mImgApp->AddRectangle(xp1, yp1, xp2, yp2, sop, fgfill); 121 147 } 122 148 } 123 149 else if ((kw == "addcirc") || (kw == "addfcirc")) { 124 150 if (tokens.size() < 3) { cout << "Usage: addcirc/addfcirc xc yc r [colatt]" << endl; return(0); } … … 131 157 mImgApp->AddCircle(xc, yc, rad, sop, fgfill); 132 158 } 159 else if (kw == "addmarker") { 160 if (tokens.size() < 2) { 161 cout << "Usage: addmarker x y [gratt]" << endl; 162 return(0); 163 } 164 double xm = atof(tokens[0].c_str()); 165 double ym = atof(tokens[1].c_str()); 166 string sop; 167 if (tokens.size() > 2) sop = tokens[2]; 168 mImgApp->AddCircle(xm, ym, -1, sop, false); 169 } 170 else if ((kw == "addarc") || (kw == "addfarc") ) { 171 if (tokens.size() < 6) { 172 cout << "Usage: addarc/addfarc x1 y1 x2 y2 x3 y3 [gratt]" << endl; 173 return(0); 174 } 175 double x1 = atof(tokens[0].c_str()); 176 double y1 = atof(tokens[1].c_str()); 177 double x2 = atof(tokens[2].c_str()); 178 double y2 = atof(tokens[3].c_str()); 179 double x3 = atof(tokens[4].c_str()); 180 double y3 = atof(tokens[5].c_str()); 181 string sop; 182 if (tokens.size() > 6) sop = tokens[6]; 183 bool fgfill = (kw == "addarc") ? false : true; 184 mImgApp->AddArc(x1, y1, x2, y2, x3, y3, sop, fgfill); 185 } 133 186 134 187 … … 775 828 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 776 829 kw = "newwin"; 777 usage = "To Create a New Graphic window, with zones \n Usage: newwin nx ny"; 830 usage = "To Create a New Graphic window, with zones \n"; 831 usage += " Window size can be specified \n"; 832 usage += " Usage: newwin [nx ny [sizeX sizeY]] "; 778 833 usage += "\n Related commands: zone"; 779 834 mpiac->RegisterCommand(kw, usage, this, "Graphics"); … … 819 874 usage += ">> LogScale : linx liny logx logy -> Lin/Log Scales for 2D plots \n"; 820 875 usage += ">> xylimits=xmin,xmax,ymin,ymax -> Forces X-Y limits in 2-D plots \n"; 876 usage += ">> defdrrect=xmin,xmax,ymin,ymax -> Defines drawing rectangle 2-D plots \n"; 877 usage += " The rectangle is defined as a fraction of the widget size\n"; 821 878 usage += ">> stat/nostat or stats/nostats -> Toggle statistic display flag \n"; 822 879 usage += ">> title/notitle or tit/notit -> Toggle Auto AddTitle flag \n"; … … 846 903 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 847 904 905 kw = "drpanel"; 906 usage = "Creates a new 2D drawing zone for addtext, addline \n"; 907 usage += " Usage: drpanel xmin xmax ymin ymax [GrAtt] [Name]"; 908 usage += "\n Related commands: addtext addline addrect addcirc ..."; 909 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 910 848 911 kw = "addtext"; 849 912 usage = "Adds a text string to the current graphic object"; 850 usage += "\n at the specified position (+ color and fontattributes) ";913 usage += "\n at the specified position (+ color/font/pos/dir attributes) "; 851 914 usage += "\n The Base/AxesDrawer is used to handle added text strings" ; 852 915 usage += "\n Alt<Z> to remove added elements"; 853 usage += "\n Font attribute is common with axes"; 854 usage += "\n Usage: addtext x y TextString [ColFontAtt]"; 916 usage += "\n Usage: addtext x y TextString [ColFontPosAtt]"; 855 917 usage += "\n (use quotes '' for multi word text strings) "; 856 usage += "\n Related commands: addline addrect addfrect addcirc addfcirc settitle graphicatt"; 918 usage += "\n Text position/direction attribute: "; 919 usage += "\n horizleft horizcenter horizright"; 920 usage += "\n vertbottom vertcenter verttop "; 921 usage += "\n textdirhoriz textdirvertup textdirvertdown "; 922 usage += "\n Related commands: addline addarrow addrect addfrect"; 923 usage += "\n addcirc addfcirc addarc addfrac settitle graphicatt"; 857 924 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 858 925 859 926 kw = "addline"; 860 927 usage = "Adds a line to the current graphic object"; 861 usage += "\n at the specified position (+ colorattribute)";928 usage += "\n at the specified position (+ graphic attribute)"; 862 929 usage += "\n The Base/AxesDrawer is used to handle added lines"; 863 930 usage += "\n Alt<Z> to remove added elements"; 864 usage += "\n Usage: addline x1 y1 x2 y2 [ColAtt]"; 865 usage += "\n Related commands: addtext addrect addfrect addcirc addfcirc graphicatt"; 931 usage += "\n Usage: addline x1 y1 x2 y2 [GraphicAtt]"; 932 usage += "\n Related commands: addarrow addtext addrect addfrect "; 933 usage += "\n addmarker addcirc addfcirc addarc addfarc graphicatt"; 934 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 935 936 kw = "addarrow"; 937 usage = "Adds an arrow to the current graphic object"; 938 usage += "\n at the specified position (+ graphic attribute)"; 939 usage += "\n The Base/AxesDrawer is used to handle added lines"; 940 usage += "\n Alt<Z> to remove added elements"; 941 usage += "\n Usage: addarrow x1 y1 x2 y2 [GraphicAtt]"; 942 usage += "\n Related commands: addline addtext addrect addfrect "; 943 usage += "\n addmarker addcirc addfcirc addarc addfarc graphicatt"; 866 944 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 867 945 868 946 kw = "addrect"; 869 947 usage = "Adds a rectangle to the current graphic object"; 870 usage += "\n between the specified positions (+ colorattribute)";948 usage += "\n between the specified positions (+ graphic attribute)"; 871 949 usage += "\n The Base/AxesDrawer is used to handle added rectangle"; 872 950 usage += "\n Alt<Z> to remove added elements"; 873 usage += "\n Usage: addrect x1 y1 x2 y2 [ColAtt]"; 874 usage += "\n Related commands: addtext addline addfrect addcirc addfcirc graphicatt"; 951 usage += "\n Usage: addrect x1 y1 x2 y2 [GraphicAtt]"; 952 usage += "\n Related commands: addtext addline addarrow addfrect"; 953 usage += "\n addcirc addfcirc addarc addfarc graphicatt"; 875 954 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 876 955 877 956 kw = "addfrect"; 878 957 usage = "Adds a filled rectangle to the current graphic object"; 879 usage += "\n between the specified positions (+ colorattribute)";958 usage += "\n between the specified positions (+ graphic attribute)"; 880 959 usage += "\n The Base/AxesDrawer is used to handle added rectangle"; 881 960 usage += "\n Alt<Z> to remove added elements"; 882 usage += "\n Usage: addfrect x1 y1 x2 y2 [ColAtt]"; 883 usage += "\n Related commands: addtext addline addrect addcirc addfcirc graphicatt"; 961 usage += "\n Usage: addfrect x1 y1 x2 y2 [GraphicAtt]"; 962 usage += "\n Related commands: addtext addline addarrow addrect"; 963 usage += "\n addcirc addfcirc graphicatt"; 964 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 965 966 kw = "addmarker"; 967 usage = "Adds a marker to the current graphic object"; 968 usage += "\n at the specified position (+ graphic attribute)"; 969 usage += "\n The Base/AxesDrawer is used to handle added circles"; 970 usage += "\n Alt<Z> to remove added elements"; 971 usage += "\n Usage: addmarker xpos ypos [GraphicAtt]"; 972 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 973 usage += "\n addcirc addfcirc addarc addfarc graphicatt"; 884 974 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 885 975 886 976 kw = "addcirc"; 887 977 usage = "Adds a circle to the current graphic object"; 888 usage += "\n with the specified center and radius (+ colorattribute)";978 usage += "\n with the specified center and radius (+ graphic attribute)"; 889 979 usage += "\n The Base/AxesDrawer is used to handle added circles"; 890 980 usage += "\n Alt<Z> to remove added elements"; 891 usage += "\n Usage: addcirc xcenter ycenter radius [ColAtt]"; 892 usage += "\n Related commands: addtext addline addfrect addfrect addfcirc graphicatt"; 981 usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt]"; 982 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 983 usage += "\n addfcirc addarc addfarc graphicatt"; 893 984 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 894 985 895 986 kw = "addfcirc"; 896 987 usage = "Adds a filled circle to the current graphic object"; 897 usage += "\n with the specified center and radius (+ colorattribute)";988 usage += "\n with the specified center and radius (+ graphic attribute)"; 898 989 usage += "\n The Base/AxesDrawer is used to handle added circles"; 899 990 usage += "\n Alt<Z> to remove added elements"; 900 usage += "\n Usage: addcirc xcenter ycenter radius [ColAtt]"; 901 usage += "\n Related commands: addtext addline addfrect addfrect addcirc graphicatt"; 991 usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt]"; 992 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 993 usage += "\n addcirc addarc addfarc graphicatt"; 994 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 995 996 kw = "addarc"; 997 usage = "Adds an arc to the current graphic object"; 998 usage += "\n defined by 3 points (+ graphic attribute)"; 999 usage += "\n The Base/AxesDrawer is used to handle added arcs"; 1000 usage += "\n Alt<Z> to remove added elements"; 1001 usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt]"; 1002 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 1003 usage += "\n addcirc addfcirc addfarc graphicatt"; 1004 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 1005 1006 kw = "addfarc"; 1007 usage = "Adds a filled arc to the current graphic object"; 1008 usage += "\n defined by 3 points (+ graphic attribute)"; 1009 usage += "\n The Base/AxesDrawer is used to handle added arcs"; 1010 usage += "\n Alt<Z> to remove added elements"; 1011 usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt]"; 1012 usage += "\n Related commands: addtext addline addarrow addfrect addfrect"; 1013 usage += "\n addcirc addfcirc addfarc graphicatt"; 902 1014 mpiac->RegisterCommand(kw, usage, this, "Graphics"); 903 1015 -
trunk/SophyaPI/PIext/piaversion.h
r2231 r2243 2 2 #define PIAPPVERSION_H_SEEN 3 3 4 #define PIAPP_VERSIONNUMBER 3.6 24 #define PIAPP_VERSIONNUMBER 3.65 5 5 6 6 #endif -
trunk/SophyaPI/PIext/pistdimgapp.cc
r2231 r2243 811 811 ParseDisplayOption(sop, opts); 812 812 PIGraphicAtt gratt(opts); 813 elmgr->ElAddText(xp,yp,txt.c_str(), gratt); 813 unsigned long tpd = 0; 814 gratt.DecodeTextPosDirAtt(opts, tpd, false); 815 elmgr->ElAddText(xp,yp,txt.c_str(), gratt, tpd); 814 816 eld->Refresh(); 815 817 } 816 818 817 819 /* --Methode-- */ 818 void PIStdImgApp::AddLine(double xp1, double yp1, double xp2, double yp2, string const& sop) 820 void PIStdImgApp::AddLine(double xp1, double yp1, double xp2, double yp2, 821 string const& sop, bool fgarrow) 819 822 { 820 823 PIDrawer *eld=CurrentElDrawer(); … … 831 834 ParseDisplayOption(sop, opts); 832 835 PIGraphicAtt gratt(opts); 833 elmgr->ElAddLine(xp1, yp1, xp2, yp2, gratt); 836 if (fgarrow) 837 elmgr->ElAddArrow(xp1, yp1, xp2, yp2, gratt); 838 else elmgr->ElAddLine(xp1, yp1, xp2, yp2, gratt); 834 839 eld->Refresh(); 835 840 } … … 887 892 ParseDisplayOption(sop, opts); 888 893 PIGraphicAtt gratt(opts); 889 890 if (fgfill) elmgr->ElAddFCirc(xc, yc, r, gratt); 891 else elmgr->ElAddCirc(xc, yc, r, gratt); 894 if (r < -0.5) 895 elmgr->ElAddMarker(xc, yc, gratt); 896 else { 897 if (fgfill) elmgr->ElAddFCirc(xc, yc, r, gratt); 898 else elmgr->ElAddCirc(xc, yc, r, gratt); 899 } 900 eld->Refresh(); 901 } 902 903 /* --Methode-- */ 904 void PIStdImgApp::AddArc(double x1, double y1, double x2, double y2, 905 double x3, double y3, string const& sop, bool fgfill) 906 { 907 PIDrawer *eld=CurrentElDrawer(); 908 if (eld == NULL) return; 909 PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld); 910 PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld); 911 if ((eld2 == NULL) && (eld3 == NULL)) return; 912 PIElDrwMgr* elmgr = NULL; 913 if (eld2) elmgr = &(eld2->ElDrwMgr()); 914 else if (eld3) elmgr = &(eld3->ElDrwMgr()); 915 if (elmgr == NULL) return; 916 917 vector<string> opts; 918 ParseDisplayOption(sop, opts); 919 PIGraphicAtt gratt(opts); 920 if (fgfill) 921 elmgr->ElAddFArc(x1, y1, x2, y2, x3, y3, gratt); 922 else elmgr->ElAddArc(x1, y1, x2, y2, x3, y3, gratt); 892 923 eld->Refresh(); 893 924 } -
trunk/SophyaPI/PIext/pistdimgapp.h
r2188 r2243 68 68 void AddText(string const & txt, double xp, double yp, string const& opt); 69 69 // Ajout de lignes, rectangles, cercles (provisoires - Aout 2001) 70 void AddLine(double xp1, double yp1, double xp2, double yp2, string const& opt); 70 void AddLine(double xp1, double yp1, double xp2, double yp2, 71 string const& opt, bool fgarrow=false); 71 72 void AddRectangle(double xp1, double yp1, double xp2, double yp2, string const& opt, 72 73 bool fgfill=false); 73 74 void AddCircle(double xc, double yc, double r, string const& opt, 74 75 bool fgfill=false); 76 void AddArc(double x1, double y1, double x2, double y2, 77 double x3, double y3, string const& opt, bool fgfill=false); 75 78 76 79 // Fonction Ajout de titre de trace
Note:
See TracChangeset
for help on using the changeset viewer.