1 // Created on: 1995-02-23
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
28 #include <Standard_Stream.hxx>
29 #include <Standard_SStream.hxx>
31 #if defined(HAVE_IOS) || defined(WNT)
33 #elif defined(HAVE_IOS_H)
37 #include <Draw_Display.hxx>
38 #include <Draw_Appli.hxx>
39 #include <Draw_Number.hxx>
40 #include <Draw_Axis3D.hxx>
41 #include <Draw_Axis2D.hxx>
42 #include <Draw_Grid.hxx>
43 #include <Draw_Drawable3D.hxx>
44 #include <Draw_SequenceOfDrawable3D.hxx>
45 #include <Draw_VMap.hxx>
46 #include <Draw_ProgressIndicator.hxx>
49 extern Draw_Viewer dout;
59 Standard_Boolean Draw_ParseFailed;
61 static Standard_Boolean autodisp = Standard_True;
62 static Standard_Boolean repaint2d,repaint3d;
64 extern Draw_Interpretor theCommands;
66 //===============================================
67 // dictionnary of variables
68 // Variables are stored in a map Integer, Transient
69 // The Integer Value is the content of the TCl variable
70 //===============================================
72 static Draw_VMap theVariables;
74 //=======================================================================
75 //function : FindVariable
77 //=======================================================================
79 static Standard_Integer p_id;
80 static Standard_Integer p_X;
81 static Standard_Integer p_Y;
82 static Standard_Integer p_b;
83 static const char* p_Name = "";
86 static Draw_SaveAndRestore* Draw_First = NULL;
88 //=======================================================================
89 //function : Draw_SaveAndRestore
91 //=======================================================================
93 Draw_SaveAndRestore::Draw_SaveAndRestore
95 Standard_Boolean (*test)(const Handle(Draw_Drawable3D)&),
96 void (*save)(const Handle(Draw_Drawable3D)&, ostream&),
97 Handle(Draw_Drawable3D) (*restore) (istream&),
98 Standard_Boolean display) :
109 Standard_Boolean Draw_SaveAndRestore::Test(const Handle(Draw_Drawable3D)&d)
110 {return (*myTest) (d);}
112 void Draw_SaveAndRestore::Save(const Handle(Draw_Drawable3D)& d,
116 Handle(Draw_Drawable3D) Draw_SaveAndRestore::Restore(istream& is) const
117 {return (*myRestore) (is);}
119 //=======================================================================
120 // numeric save and restore
121 //=======================================================================
123 static Standard_Boolean numtest(const Handle(Draw_Drawable3D)& d)
125 return d->IsInstance(STANDARD_TYPE(Draw_Number));
128 static void numsave(const Handle(Draw_Drawable3D)&d, ostream& OS)
130 Handle(Draw_Number) N = Handle(Draw_Number)::DownCast(d);
131 #if (defined(HAVE_IOS) && !defined(__sgi) && !defined(IRIX)) || ( defined(WNT) && !defined(USE_OLD_STREAMS))
132 ios::fmtflags F = OS.flags();
133 OS.setf(ios::scientific);
137 long form = OS.setf(ios::scientific);
138 int prec = OS.precision(15);
139 int w = OS.width(30);
141 OS << N->Value()<<"\n";
142 #if (defined(HAVE_IOS) && !defined(__sgi) && !defined(IRIX)) || (defined(WNT)&& !defined(USE_OLD_STREAMS))
151 static Handle(Draw_Drawable3D) numrestore (istream& is)
155 Handle(Draw_Number) N = new Draw_Number(val);
160 static Draw_SaveAndRestore numsr("Draw_Number",
161 numtest,numsave,numrestore,
164 //=======================================================================
166 //=======================================================================
168 static Standard_Integer save(Draw_Interpretor& di, Standard_Integer n, const char** a)
170 if (n <= 2) return 1;
173 const char* name = a[2];
177 if (!fic.open(name,ios::out)) {
178 di << "Cannot open file for writing "<<name;
182 Handle(Draw_Drawable3D) D = Draw::Get(a[1]);
185 Draw_SaveAndRestore* tool = Draw_First;
186 Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
187 progress->SetScale ( 0, 100, 1 );
188 progress->NewScope(100,"Writing");
192 if (tool->Test(D)) break;
196 os << tool->Name() << "\n";
197 Draw::SetProgressBar(progress);
202 di << "No method for saving " << a[1];
205 Draw::SetProgressBar( 0 );
206 progress->EndScope();
212 Standard_Boolean res = Standard_False;
217 res = os.good() && !errno;
220 di<<"File has not been written";
228 //=======================================================================
230 //=======================================================================
232 static Standard_Integer restore(Draw_Interpretor& di, Standard_Integer n, const char** a)
235 if (n <= 2) return 1;
237 const char* fname = a[1];
238 const char* name = a[2];
242 if (!fic.open(fname,ios::in)) {
243 di << "Cannot open file for reading : "<<fname;
251 Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
252 progress->NewScope(100,"Reading");
255 Draw_SaveAndRestore* tool = Draw_First;
257 if (!strcmp(typ,tool->Name())) break;
258 Draw::SetProgressBar(progress);
262 Handle(Draw_Drawable3D) D = tool->Restore(in);
263 Draw::Set(name,D,tool->Disp() && autodisp);
266 di << "Cannot restore a " << typ;
269 Draw::SetProgressBar( 0 );
270 progress->EndScope();
278 //=======================================================================
280 //=======================================================================
282 static Standard_Integer display(Draw_Interpretor& di, Standard_Integer n, const char** a)
284 if (n <= 1) return 1;
286 for (Standard_Integer i = 1; i < n; i++) {
287 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
299 //=======================================================================
300 // erase, clear, donly
301 //=======================================================================
303 static Standard_Integer erase(Draw_Interpretor& di, Standard_Integer n, const char** a)
305 static Standard_Boolean draw_erase_mute = Standard_False;
307 if (!strcasecmp(a[1],"-mute")) {
308 draw_erase_mute = Standard_True;
313 Standard_Boolean donly = !strcasecmp(a[0],"donly");
315 if (n <= 1 || donly) {
316 // clear, 2dclear, donly, erase (without arguments)
319 // solve the names for "." before erasing
321 for (i = 1; i < n; i++) {
322 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
324 if ((a[i][0] == '.') && (a[i][1] == '\0'))
325 cout << "Missed !!!" << endl;
331 // sauvegarde des proteges visibles
332 Draw_SequenceOfDrawable3D prot;
333 for (i = 1; i <= theVariables.Extent(); i++) {
334 const Handle(Draw_Drawable3D)& D = *((Handle(Draw_Drawable3D)*)&theVariables(i));
336 if (D->Protected() && D->Visible())
341 // effacement de toutes les variables
342 Standard_Integer erasemode = 1;
343 if (a[0][0] == '2') erasemode = 2;
344 if (a[0][0] == 'c') erasemode = 3;
346 // effacement des graphiques non variables
349 else if (erasemode == 3)
354 // affichage pour donly
356 for (i = 1; i < n; i++) {
357 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
361 if (!draw_erase_mute) di << a[i] << " ";
367 // afficahge des proteges
368 for (i = 1; i <= prot.Length(); i++)
374 for (Standard_Integer i = 1; i < n; i++) {
375 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
378 dout.RemoveDrawable(D);
379 if (!draw_erase_mute) di << D->Name() << " ";
386 draw_erase_mute = Standard_False;
387 repaint2d = Standard_False;
388 repaint3d = Standard_False;
395 //=======================================================================
397 //=======================================================================
399 static Standard_Integer draw(Draw_Interpretor& , Standard_Integer n, const char** a)
402 Standard_Integer id = atoi(a[1]);
403 if (!dout.HasView(id)) {
404 cout << "bad view number in draw"<<endl;
407 Standard_Integer mo = atoi(a[2]);
408 Draw_Display d = dout.MakeDisplay(id);
411 for (i = 3; i < n; i++) {
412 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
413 if (!D.IsNull()) D->DrawOn(d);
419 //=======================================================================
420 // protect, unprotect
421 //=======================================================================
423 static Standard_Integer protect(Draw_Interpretor& di, Standard_Integer n, const char** a)
425 if (n <= 1) return 1;
426 Standard_Boolean prot = *a[0] != 'u';
427 for (Standard_Integer i = 1; i < n; i++) {
428 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
437 //=======================================================================
439 //=======================================================================
441 static Standard_Integer autodisplay(Draw_Interpretor& di, Standard_Integer n, const char** a)
444 autodisp = !autodisp;
446 autodisp = !(!strcasecmp(a[1],"0"));
457 //=======================================================================
459 //=======================================================================
461 static Standard_Integer whatis(Draw_Interpretor& di, Standard_Integer n, const char** a)
463 if (n <= 1) return 1;
464 for (Standard_Integer i = 1; i < n; i++) {
465 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
474 //=======================================================================
476 //=======================================================================
478 static Standard_Integer value(Draw_Interpretor& di, Standard_Integer n, const char** a)
480 if (n != 2) return 1;
486 //=======================================================================
489 //=======================================================================
490 static Standard_Integer dname(Draw_Interpretor& di, Standard_Integer n, const char** a)
496 Standard_PCharacter pC;
498 Handle(Draw_Drawable3D) aD;
500 for (i = 1; i < n; ++i) {
501 aD = Draw::Get(a[i]);
503 //modified by NIZNHY-PKV Tue Jun 10 10:18:13 2008f
505 pC=(Standard_PCharacter)aD->Name();
507 //modified by NIZNHY-PKV Tue Jun 10 10:18:18 2008t
513 //=======================================================================
515 //=======================================================================
518 static Standard_Integer dump(Draw_Interpretor& DI, Standard_Integer n, const char** a)
522 for (i = 1; i < n; i++) {
523 Handle(Draw_Drawable3D) D = Draw::Get(a[i]);
525 Standard_SStream sss;
527 sss << "\n\n*********** Dump of " << a[i] << " *************\n";
535 //=======================================================================
537 //=======================================================================
539 static Standard_Integer copy(Draw_Interpretor& , Standard_Integer n, const char** a)
542 Standard_Boolean cop = !strcasecmp(a[0],"copy");
544 Handle(Draw_Drawable3D) D;
545 for (Standard_Integer i = 1; i < n; i += 2) {
546 if (i+1 >= n) return 0;
553 Draw::Set(a[i],Handle(Draw_Drawable3D()));
561 //=======================================================================
564 //=======================================================================
566 static Standard_Integer repaintall(Draw_Interpretor& , Standard_Integer , const char** )
568 if (repaint2d) dout.Repaint2D();
569 repaint2d = Standard_False;
570 if (repaint3d) dout.Repaint3D();
571 repaint3d = Standard_False;
576 //=======================================================================
579 //=======================================================================
581 static Standard_Integer set(Draw_Interpretor& di, Standard_Integer n, const char** a)
584 Standard_Integer i = 1;
586 for (i = 1; i < n; i += 2) {
588 if (i+1 < n) val = atof(a[i+1]);
595 //=======================================================================
598 //=======================================================================
600 static Standard_Integer isdraw(Draw_Interpretor& di, Standard_Integer n, const char** a)
602 if (n != 2) return 1;
603 Handle(Draw_Drawable3D) D = Draw::Get(a[1],Standard_False);
611 //=======================================================================
614 //=======================================================================
616 Standard_Integer isprot(Draw_Interpretor& di, Standard_Integer n, const char** a)
618 if (n != 2) return 1;
619 Handle(Draw_Drawable3D) D = Draw::Get(a[1],Standard_False);
632 //=======================================================================
635 //=======================================================================
637 static Standard_Integer pick(Draw_Interpretor& , Standard_Integer n, const char** a)
641 Standard_Integer X,Y,b;
642 Standard_Boolean wait = (n == 6);
643 if (!wait) id = atoi(a[1]);
644 dout.Select(id,X,Y,b,wait);
645 Standard_Real z = dout.Zoom(id);
646 gp_Pnt P((Standard_Real)X /z,(Standard_Real)Y /z,0);
652 Draw::Set(a[2],P.X());
653 Draw::Set(a[3],P.Y());
654 Draw::Set(a[4],P.Z());
660 //=======================================================================
663 //=======================================================================
665 static Standard_Integer lastrep(Draw_Interpretor& di, Standard_Integer n, const char** a)
669 Draw::Set(a[1],p_id);
675 Standard_Real z = dout.Zoom(p_id);
676 gp_Pnt P((Standard_Real)p_X /z,(Standard_Real)p_Y /z,0);
678 dout.GetTrsf(p_id,T);
681 Draw::Set(a[2],P.X());
682 Draw::Set(a[3],P.Y());
683 Draw::Set(a[4],P.Z());
686 di << "Too many args";
689 Draw::Set(a[n-1],p_b);
695 //=======================================================================
698 //=======================================================================
699 void Draw::Set(const Standard_CString name,
700 const Handle(Draw_Drawable3D)& D)
702 Draw::Set(name,D,autodisp);
706 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
707 static char* tracevar(ClientData CD, Tcl_Interp*,const char*,const char*, Standard_Integer)
709 static char* tracevar(ClientData CD, Tcl_Interp*, char*, char*, Standard_Integer)
712 // protect if the map was destroyed before the interpretor
713 if (theVariables.IsEmpty()) return NULL;
716 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
717 Handle(Draw_Drawable3D)& D = *((Handle(Draw_Drawable3D)*)&theVariables((long)CD));
719 Standard_Integer index = (Standard_Integer) CD;
720 Handle(Draw_Drawable3D)& D = *((Handle(Draw_Drawable3D)*)&theVariables(index));
725 return (char*) "variable is protected";
728 dout.RemoveDrawable(D);
730 repaint3d = Standard_True;
732 repaint2d = Standard_True;
739 //=======================================================================
742 //=======================================================================
743 void Draw::Set(const Standard_CString name,
744 const Handle(Draw_Drawable3D)& D,
745 const Standard_Boolean displ)
747 Standard_PCharacter pName;
749 pName=(Standard_PCharacter)name;
751 if ((name[0] == '.') && (name[1] == '\0')) {
753 dout.RemoveDrawable(D);
754 if (displ) dout << D;
759 Tcl_UnsetVar(theCommands.Interp(),pName,0);
761 Standard_Integer ival = theVariables.Extent() + 1;
762 theVariables.Bind(ival,D);
764 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
765 D->Name((const Standard_CString)Tcl_SetVar(theCommands.Interp(),name,name,0));
767 D->Name(Tcl_SetVar(theCommands.Interp(),pName,pName,0));
770 // set the trace function
771 Tcl_TraceVar(theCommands.Interp(),pName,TCL_TRACE_UNSETS,
772 tracevar,(ClientData)ival);
778 else if (D->Visible())
779 dout.RemoveDrawable(D);
783 //=======================================================================
786 //=======================================================================
787 void Draw::Set(const Standard_CString Name, const Standard_Real val)
789 if ((Name[0] == '.') && (Name[1] == '\0')) return;
790 Standard_CString aName = Name;
791 Handle(Draw_Drawable3D) D = Draw::Get(aName,Standard_False);
792 Handle(Draw_Number) N;
794 N = Handle(Draw_Number)::DownCast(D);
797 N = new Draw_Number(val);
798 Draw::Set(aName,N,Standard_False);
803 //=======================================================================
806 //=======================================================================
807 Handle(Draw_Drawable3D) Draw::Get(Standard_CString& name,
808 const Standard_Boolean )
810 Standard_PCharacter pName;
812 pName=(Standard_PCharacter)name;
814 Standard_Boolean pick = ((name[0] == '.') && (name[1] == '\0'));
815 Handle(Draw_Drawable3D) D;
817 cout << "Pick an object" << endl;
818 dout.Select(p_id,p_X,p_Y,p_b);
819 dout.Pick(p_id,p_X,p_Y,5,D,0);
822 name = p_Name = D->Name();
823 //p_Name = (char *)D->Name();
829 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
830 Standard_Address index =
831 Tcl_VarTraceInfo(theCommands.Interp(),name,TCL_TRACE_UNSETS,
834 D = Handle(Draw_Drawable3D)::DownCast(theVariables((long)index));
836 Standard_Integer index = (Standard_Integer)
837 Tcl_VarTraceInfo(theCommands.Interp(),
842 D = Handle(Draw_Drawable3D)::DownCast(theVariables(index));
845 if (D.IsNull() && complain)
846 cout <<name<<" does not exist"<<endl;
852 //=======================================================================
855 //=======================================================================
856 Standard_Boolean Draw::Get(const Standard_CString name,
859 if ((name[0] == '.') && (name[1] == '\0')) {
860 return Standard_False;
862 Standard_CString aName = name;
863 Handle(Draw_Drawable3D) D = Draw::Get(aName,Standard_False);
865 Handle(Draw_Number) N = Handle(Draw_Number)::DownCast(D);
868 return Standard_True;
871 return Standard_False;
874 //=======================================================================
875 //function : LastPick
877 //=======================================================================
878 void Draw::LastPick(Standard_Integer& view,
881 Standard_Integer& button)
888 //=======================================================================
891 //=======================================================================
894 repaint2d = Standard_True;
895 repaint3d = Standard_True;
898 //=======================================================================
899 //function : trigonometric functions
901 //=======================================================================
903 //static Standard_Integer trigo (Draw_Interpretor& di, Standard_Integer n, const char** a)
904 static Standard_Integer trigo (Draw_Interpretor& di, Standard_Integer , const char** a)
907 Standard_Real x = atof(a[1]);
909 if (!strcasecmp(a[0],"cos"))
911 else if (!strcasecmp(a[0],"sin"))
913 else if (!strcasecmp(a[0],"tan"))
915 else if (!strcasecmp(a[0],"sqrt"))
917 else if (!strcasecmp(a[0],"acos"))
919 else if (!strcasecmp(a[0],"asin"))
921 else if (!strcasecmp(a[0],"atan2"))
922 di << ATan2(x,atof(a[2]));
928 //=======================================================================
930 //=======================================================================
935 static Standard_Boolean Numeric(char c)
937 return (c == '.' || (c >= '0' && c <= '9'));
940 static Standard_Boolean Alphabetic(char c)
942 return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c == '_'));
945 static Standard_Real Parse(char*&);
947 static Standard_Real ParseValue(char*& name)
949 while (*name == ' ' || *name == '\t') name++;
960 cout << "Mismatched parenthesis" << endl;
966 x = ParseValue(name);
971 x = - ParseValue(name);
979 while (Numeric(*p)) p++;
980 // process scientific notation
981 if ((*p == 'e') || (*p == 'E')) {
982 if (Numeric(*(p+1)) || *(p+1) == '+' || *(p+1) == '-')
985 while (Numeric(*p) || Alphabetic(*p)) p++;
989 if (Numeric(*name)) // numeric litteral
991 else if (!Draw::Get((Standard_CString) name,x)) { // variable
993 // search for a function ...
996 Standard_Integer argc = 1;
998 while ((*q == ' ') && (*q == '\t')) q++;
1000 Standard_Integer pc = 1;
1003 while ((pc > 0) && *q) {
1004 if (*q == '(') pc++;
1005 if (*q == ')') pc--;
1006 if ((pc == 1) && (*q == ',')) argc++;
1010 cout << "Unclosed parenthesis"<< endl;
1014 // build function call
1015 // replace , and first and last () by space
1017 Standard_Integer i = 2;
1018 while (*p != '(') p++;
1023 if (*p == '(') pc++;
1024 if (*p == ')') pc--;
1025 if ((pc == 1) && (*p == ',')) {
1036 // call the function, save the current result
1038 if (*theCommands.Result()) {
1039 sv = new char [strlen(theCommands.Result())];
1040 strcpy(sv,theCommands.Result());
1041 theCommands.Reset();
1043 if (theCommands.Eval(name) != 0) {
1044 cout << "Call of function " << name << " failed" << endl;
1048 x = atof(theCommands.Result());
1049 theCommands.Reset();
1058 Draw_ParseFailed = Standard_True;
1066 while (*name == ' ' || *name == '\t') name++;
1071 static Standard_Real ParseFactor(char*& name)
1073 Standard_Real x = ParseValue(name);
1077 if (c == '\0') return x;
1082 x *= ParseValue(name);
1086 x /= ParseValue(name);
1097 static Standard_Real Parse(char*& name)
1099 Standard_Real x = ParseFactor(name);
1103 if (c == '\0') return x;
1108 x += ParseFactor(name);
1112 x -= ParseFactor(name);
1122 //=======================================================================
1125 //=======================================================================
1126 Standard_Real Draw::Atof(const Standard_CString name)
1129 char* n = new char[1+strlen(name)];
1132 Standard_Real x = Parse(n);
1133 while ((*n == ' ') || (*n == '\t')) n++;
1134 if (*n) Draw_ParseFailed = Standard_True;
1139 Standard_Integer Draw::Atoi(const Standard_CString name)
1141 return (Standard_Integer ) Draw::Atof(name);
1143 //=======================================================================
1145 //purpose : set a TCL var
1146 //=======================================================================
1147 void Draw::Set(const Standard_CString Name, const Standard_CString val)
1149 Standard_PCharacter pName, pVal;
1151 pName=(Standard_PCharacter)Name;
1152 pVal=(Standard_PCharacter)val;
1154 Tcl_SetVar(theCommands.Interp(), pName, pVal, 0);
1156 //=======================================================================
1157 // Command management
1158 // refresh the screen
1159 //=======================================================================
1161 static void before()
1163 repaint2d = Standard_False;
1164 repaint3d = Standard_False;
1167 void Draw_RepaintNowIfNecessary()
1169 if (repaint2d) dout.Repaint2D();
1170 if (repaint3d) dout.Repaint3D();
1171 repaint2d = Standard_False;
1172 repaint3d = Standard_False;
1175 static void after(Standard_Integer)
1177 Draw_RepaintNowIfNecessary();
1180 extern void (*Draw_BeforeCommand)();
1181 extern void (*Draw_AfterCommand)(Standard_Integer);
1184 //=======================================================================
1185 //function : Commands
1187 //=======================================================================
1188 void Draw::VariableCommands(Draw_Interpretor& theCommands)
1190 static Standard_Boolean Done = Standard_False;
1192 Done = Standard_True;
1194 // set up start and stop command
1195 Draw_BeforeCommand = &before;
1196 Draw_AfterCommand = &after;
1198 // set up some variables
1201 Handle(Draw_Axis3D) theAxes3d = new Draw_Axis3D(gp_Pnt(0,0,0),Draw_bleu,20);
1203 Draw::Set(n,theAxes3d);
1204 theAxes3d->Protected(Standard_True);
1206 Handle(Draw_Axis2D) theAxes2d = new Draw_Axis2D(gp_Pnt2d(0,0),Draw_bleu,20);
1208 Draw::Set(n,theAxes2d);
1209 theAxes2d->Protected(Standard_True);
1213 Draw::Get(n)->Protected(Standard_True);
1216 Draw::Set(n,RealLast());
1217 Draw::Get(n)->Protected(Standard_True);
1220 Draw::Set(n,RealFirst());
1221 Draw::Get(n)->Protected(Standard_True);
1224 Handle(Draw_Grid) theGrid = new Draw_Grid();
1225 Draw::Set(n, theGrid);
1226 theGrid->Protected(Standard_True);
1231 g = "DRAW Numeric functions";
1233 theCommands.Add("cos" ,"cos(x)" ,__FILE__,trigo,g);
1234 theCommands.Add("sin" ,"sin(x)" ,__FILE__,trigo,g);
1235 theCommands.Add("tan" ,"tan(x)" ,__FILE__,trigo,g);
1236 theCommands.Add("acos" ,"acos(x)" ,__FILE__,trigo,g);
1237 theCommands.Add("asin" ,"asin(x)" ,__FILE__,trigo,g);
1238 theCommands.Add("atan2" ,"atan2(x,y)" ,__FILE__,trigo,g);
1239 theCommands.Add("sqrt","sqrt(x)",__FILE__,trigo,g);
1241 g = "DRAW Variables management";
1243 theCommands.Add("protect","protect name ...",__FILE__,protect,g);
1244 theCommands.Add("unprotect","unprotect name ...",__FILE__,protect,g);
1246 theCommands.Add("bsave","bsave name filename",__FILE__,save,g);
1247 theCommands.Add("brestore","brestore filename name",__FILE__,restore,g);
1249 theCommands.Add("isdraw","isdraw var, return 1 if Draw value",__FILE__,isdraw,g);
1250 theCommands.Add("isprot","isprot var, return 1 if Draw var is protected",__FILE__,isprot,g);
1252 theCommands.Add("autodisplay","toggle autodisplay [0/1]",__FILE__,autodisplay,g);
1253 theCommands.Add("display","display [name1 name2 ...], no names display all",__FILE__,display,g);
1254 theCommands.Add("donly","donly [name1 name2 ...], erase and display",__FILE__,erase,g);
1255 theCommands.Add("erase","erase [name1 name2 ...], no names erase all",__FILE__,erase,g);
1256 theCommands.Add("draw","draw view mode [name1 name2 ...], draw on view with mode",__FILE__,draw,g);
1257 theCommands.Add("clear","clear display",__FILE__,erase,g);
1258 theCommands.Add("2dclear","clear display (2d objects)",__FILE__,erase,g);
1259 theCommands.Add("repaint","repaint, force redraw",__FILE__,repaintall,g);
1261 theCommands.Add("dtyp", "dtyp name1 name2",__FILE__,whatis,g);
1262 theCommands.Add("dval", "dval name, return value",__FILE__,value,g);
1263 theCommands.Add("dname", "dname name, print name",__FILE__,dname,g);
1264 theCommands.Add("dump", "dump name1 name2 ...",__FILE__,dump,g);
1265 theCommands.Add("copy", "copy name1 toname1 name2 toname2 ...",__FILE__,copy,g);
1266 // san - 02/08/2002 - `rename` command changed to `renamevar` since it conflicts with
1267 // the built-in Tcl command `rename`
1268 //theCommands.Add("rename","rename name1 toname1 name2 toname2 ...",__FILE__,copy,g);
1269 theCommands.Add("renamevar","renamevar name1 toname1 name2 toname2 ...",__FILE__,copy,g);
1270 theCommands.Add("dset","var1 value1 vr2 value2 ...",__FILE__,set,g);
1272 theCommands.Add("pick","pick id X Y Z b [nowait]",__FILE__,pick,g);
1273 theCommands.Add("lastrep","lastrep id X Y [Z] b, return name",__FILE__,lastrep,g);