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.
21 // **************************************************************
24 // Modif : DFO 05/11/96
30 #include <Draw_Appli.hxx>
32 #include <Draw_Drawable3D.hxx>
33 #include <Draw_Grid.hxx>
34 #include <Draw_Display.hxx>
35 #include <Draw_Text3D.hxx>
36 #include <Draw_Text2D.hxx>
38 #include <Standard_Stream.hxx>
42 extern Draw_Viewer dout;
43 extern Standard_Boolean Draw_Batch;
49 extern Standard_Boolean Draw_BlackBackGround;
52 #define DEFROTATE (5 * M_PI/ 180.)
53 #define DEFMAGNIFY 1.1
54 #define DEFPANNING 0.1
57 #define DEFGRIDSTEP 100.0
58 static Standard_Real steprot = DEFROTATE;
59 static Standard_Real steppan = DEFPANNING;
60 static Standard_Real stepmagnify = DEFMAGNIFY;
61 static Standard_Real stepfocal = DEFFOCAL;
62 static Standard_Real frame = DEFFRAME;
63 static Standard_Real DefaultGridStep = DEFGRIDSTEP ;
66 static char Draw_fontname[FONTLENGTH]="Helvetica";
67 static char Draw_fontsize[FONTLENGTH]="150";
68 static char Draw_fontnamedefault[FONTLENGTH]="Helvetica";
69 static char Draw_fontsizedefault[FONTLENGTH]="150";
71 // *******************************************************************
73 // *******************************************************************
75 static Standard_Integer ViewId(const Standard_CString a)
77 Standard_Integer id = atoi(a);
78 if ((id < 0) || (id >= MAXVIEW)) {
79 cout << "Incorrect view-id, must be in 0.."<<MAXVIEW-1<<endl;
82 if (!dout.HasView(id)) {
83 cout <<"View "<<id<<" does not exist."<<endl;
89 static void SetTitle(const Standard_Integer id)
91 if (dout.HasView(id)) {
93 sprintf(title,"%d : %s - Zoom %f",id,dout.GetType(id),dout.Zoom(id));
94 dout.SetTitle(id,title);
98 //=======================================================================
101 //=======================================================================
103 static Standard_Integer zoom(Draw_Interpretor& , Standard_Integer n, const char** a)
105 // one argument -> All Views
106 // two argument -> First is the view
107 Standard_Boolean z2d = !strcasecmp(a[0],"2dzoom");
109 Standard_Real z = atof(a[1]);
110 for (Standard_Integer id = 0; id < MAXVIEW; id++) {
111 if (dout.HasView(id)) {
112 if ((z2d && !dout.Is3D(id)) || (!z2d && dout.Is3D(id))) {
115 dout.RepaintView(id);
122 Standard_Integer id = ViewId(a[1]);
123 if (id < 0) return 1;
124 Standard_Real z = atof(a[2]);
126 dout.RepaintView(id);
134 //=======================================================================
137 //=======================================================================
139 static Standard_Integer wzoom(Draw_Interpretor& di, Standard_Integer, const char**)
141 Standard_Integer id1,X1,Y1,b;
142 Standard_Integer X2,Y2;
143 Standard_Real dX1,dY1,dX2,dY2;
144 di << "Pick first corner"<<"\n";
145 dout.Select(id1,X1,Y1,b);
152 Standard_Real z = dout.Zoom(id1);
155 dX1-=P0.X(); dY1-=P0.Y();
158 if (b != 1) return 0;
159 if (id1 < 0) return 0;
160 Draw_Display d = dout.MakeDisplay(id1);
161 d.SetColor(Draw_blanc);
163 Standard_Real dOX2 = dX1;
164 Standard_Real dOY2 = dY1;
165 d.Draw(gp_Pnt2d(dX1,dY1),gp_Pnt2d(dX1,dOY2));
166 d.Draw(gp_Pnt2d(dX1,dOY2),gp_Pnt2d(dOX2,dOY2));
167 d.Draw(gp_Pnt2d(dOX2,dOY2),gp_Pnt2d(dOX2,dY1));
168 d.Draw(gp_Pnt2d(dOX2,dY1),gp_Pnt2d(dX1,dY1));
171 Standard_Integer X,Y,W,H;
172 dout.GetPosSize(id1,X,Y,W,H);
173 di << "Pick second corner"<<"\n";
176 dout.Select(id1,X2,Y2,b,Standard_False);
178 dX2-=P0.X(); dY2-=P0.Y();
181 d.Draw(gp_Pnt2d(dX1,dY1),gp_Pnt2d(dX1,dOY2));
182 d.Draw(gp_Pnt2d(dX1,dOY2),gp_Pnt2d(dOX2,dOY2));
183 d.Draw(gp_Pnt2d(dOX2,dOY2),gp_Pnt2d(dOX2,dY1));
184 d.Draw(gp_Pnt2d(dOX2,dY1),gp_Pnt2d(dX1,dY1));
185 d.Draw(gp_Pnt2d(dX1,dY1),gp_Pnt2d(dX1,dY2));
186 d.Draw(gp_Pnt2d(dX1,dY2),gp_Pnt2d(dX2,dY2));
187 d.Draw(gp_Pnt2d(dX2,dY2),gp_Pnt2d(dX2,dY1));
188 d.Draw(gp_Pnt2d(dX2,dY1),gp_Pnt2d(dX1,dY1));
193 d.Draw(gp_Pnt2d(dX1,dY1),gp_Pnt2d(dX1,dOY2));
194 d.Draw(gp_Pnt2d(dX1,dOY2),gp_Pnt2d(dOX2,dOY2));
195 d.Draw(gp_Pnt2d(dOX2,dOY2),gp_Pnt2d(dOX2,dY1));
196 d.Draw(gp_Pnt2d(dOX2,dY1),gp_Pnt2d(dX1,dY1));
198 if (b != 1) return 0;
200 if ((X1 == X2) || (Y1 == Y2)) return 0;
202 zx = (Standard_Real) Abs(X2-X1) / (Standard_Real) W;
203 zy = (Standard_Real) Abs(Y2-Y1) / (Standard_Real) H;
204 if (zy > zx) zx = zy;
206 if (X2 < X1) X1 = X2;
207 if (Y2 > Y1) Y1 = Y2;
208 X1 = (Standard_Integer ) (X1*zx);
209 Y1 = (Standard_Integer ) (Y1*zx);
211 dout.SetZoom(id1,zx*dout.Zoom(id1));
212 dout.SetPan(id1,-X1,-Y1);
213 dout.RepaintView(id1);
218 //=======================================================================
221 //=======================================================================
223 static Standard_Integer wclick(Draw_Interpretor& di, Standard_Integer, const char**)
225 Standard_Integer id1,X1,Y1,b;
227 di << "Just click."<<"\n";
228 dout.Select(id1,X1,Y1,b);
232 //=======================================================================
235 //=======================================================================
237 static Standard_Integer view(Draw_Interpretor& di, Standard_Integer n, const char** a)
239 if (Draw_Batch) return 1;
241 if ((n >= 3) && (n != 4)) {
242 Standard_Integer id = atoi(a[1]);
243 if ((id < 0) || (id >= MAXVIEW)) {
244 di <<"View-id must be in 0.."<<MAXVIEW-1<<"\n";
247 Standard_Integer X = 0;
248 Standard_Integer Y = 0;
249 Standard_Integer W = 500;
250 Standard_Integer H = 500;
251 // if view exist, get old values
252 if (dout.HasView(id))
253 dout.GetPosSize(id,X,Y,W,H);
262 dout.MakeView(id,a[2],X,Y,W,H);
263 if (!dout.HasView(id)) {
264 di << "View creation failed"<<"\n";
268 dout.DisplayView(id);
272 // create a view on a given window
273 Standard_Integer id = atoi(a[1]);
274 if ((id < 0) || (id >= MAXVIEW)) {
275 di <<"View-id must be in 0.."<<MAXVIEW-1<<"\n";
278 dout.MakeView(id,a[2],a[3]);
279 if (!dout.HasView(id)) {
280 di << "View creation failed"<<"\n";
284 dout.DisplayView(id);
291 //=======================================================================
294 //=======================================================================
296 static Standard_Integer delview(Draw_Interpretor& , Standard_Integer n, const char** a)
299 for (Standard_Integer id = 0; id < MAXVIEW; id++)
304 Standard_Integer id = ViewId(a[1]);
305 if (id < 0) return 1;
313 //=======================================================================
316 //=======================================================================
318 static Standard_Integer fit(Draw_Interpretor& , Standard_Integer n, const char** a)
320 Standard_Boolean f2d = !strcasecmp(a[0],"2dfit");
322 Standard_Real zoom = RealLast();
324 for ( id = 0; id < MAXVIEW; id++) {
325 if (dout.HasView(id)) {
326 if ((f2d && !dout.Is3D(id)) || (!f2d && dout.Is3D(id))) {
327 // dout.FitView(id,frame);
328 dout.FitView(id,(Standard_Integer ) frame);
329 if (dout.Zoom(id) < zoom) zoom = dout.Zoom(id);
333 for (id = 0; id < MAXVIEW; id++) {
334 if (dout.HasView(id)) {
335 if ((f2d && !dout.Is3D(id)) || (!f2d && dout.Is3D(id))) {
336 dout.SetZoom(id,zoom);
337 dout.RepaintView(id);
345 Standard_Integer id = ViewId(a[1]);
346 if (id < 0) return 1;
347 // dout.FitView(id,frame);
348 dout.FitView(id,(Standard_Integer ) frame);
349 dout.RepaintView(id);
357 //=======================================================================
360 //=======================================================================
362 static Standard_Integer focal(Draw_Interpretor& , Standard_Integer n, const char** a)
364 Standard_Integer start = 0;
365 Standard_Integer end = MAXVIEW-1;
367 Standard_Integer anid = ViewId(a[1]);
368 if (anid < 0) return 1;
371 Standard_Real df = 1.;
372 if (!strcasecmp(a[0],"fu"))
374 if (!strcasecmp(a[0],"fd"))
377 for (Standard_Integer id = start; id <= end; id++) {
378 if (!strcasecmp(dout.GetType(id),"PERS")) {
379 dout.SetFocal(id,dout.Focal(id) * df);
380 dout.RepaintView(id);
386 //=======================================================================
387 //function : setfocal
389 //=======================================================================
391 static Standard_Integer setfocal(Draw_Interpretor& di, Standard_Integer n, const char** a)
394 for (Standard_Integer id = 0; id < MAXVIEW; id++) {
395 if (!strcasecmp(dout.GetType(id),"PERS"))
396 di << "Focal view "<<id<<" is "<<dout.Focal(id)<<"\n";
400 Standard_Real f = atof(a[1]);
401 for (Standard_Integer id = 0; id < MAXVIEW; id++) {
402 if (!strcasecmp(dout.GetType(id),"PERS"))
410 //=======================================================================
413 //=======================================================================
415 //static Standard_Integer magnify(Draw_Interpretor& di, Standard_Integer n, const char** a)
416 static Standard_Integer magnify(Draw_Interpretor& , Standard_Integer n, const char** a)
418 Standard_Integer start = 0;
419 Standard_Integer end = MAXVIEW-1;
421 Standard_Integer anid = ViewId(a[1]);
422 if (anid < 0) return 1;
425 Standard_Boolean v2d = (a[0][0] == '2'); // 2dmu, 2dmd
426 const char* com = a[0];
428 Standard_Real dz = 1.;
429 if (!strcasecmp(com,"mu")) // mu, 2dmu
434 for (Standard_Integer id = start; id <= end; id++) {
435 if (dout.HasView(id)) {
436 if ((v2d && !dout.Is3D(id)) || (!v2d && dout.Is3D(id))) {
437 dout.SetZoom(id,dout.Zoom(id) * dz);
439 dout.RepaintView(id);
446 Standard_EXPORT Standard_Integer Draw_magnify(Draw_Interpretor& di, Standard_Integer n, const char** a)
448 return magnify(di,n,a);
451 //=======================================================================
454 //=======================================================================
456 static Standard_Integer rotate(Draw_Interpretor& , Standard_Integer n, const char** a)
458 Standard_Integer start = 0;
459 Standard_Integer end = MAXVIEW-1;
461 Standard_Integer anid = ViewId(a[1]);
462 if (anid < 0) return 1;
468 if (!strcasecmp(a[0],"u")) {
472 if (!strcasecmp(a[0],"d")) {
476 if (!strcasecmp(a[0],"l")) {
480 if (!strcasecmp(a[0],"r")) {
485 for (Standard_Integer id = start; id <= end; id++) {
486 if ((!strcasecmp(dout.GetType(id),"AXON")) ||
487 (!strcasecmp(dout.GetType(id),"PERS"))) {
488 dout.RotateView(id,D,ang);
489 dout.RepaintView(id);
495 //=======================================================================
498 //=======================================================================
500 static Standard_Integer panning(Draw_Interpretor& , Standard_Integer n, const char** a)
502 Standard_Integer start = 0;
503 Standard_Integer end = MAXVIEW-1;
505 Standard_Integer anid = ViewId(a[1]);
506 if (anid < 0) return 1;
509 Standard_Integer DX = 0;
510 Standard_Integer DY = 0;
511 Standard_Integer X,Y,W,H;
513 Standard_Boolean v2d = (a[0][0] == '2'); // pu2d, pd2d, pr2d, pl2d
514 const char* com = a[0];
517 if (!strcasecmp(com,"pu")) // pu , 2dpu
519 if (!strcasecmp(com,"pd")) // pd , 2dpd
521 if (!strcasecmp(com,"pl")) // pl , 2dpl
523 if (!strcasecmp(com,"pr")) // pr , 2dpr
526 for (Standard_Integer id = start; id <= end; id++) {
527 if (dout.HasView(id)) {
528 if ((v2d && !dout.Is3D(id)) || (!v2d && dout.Is3D(id))) {
529 dout.GetPosSize(id,X,Y,W,H);
530 // dout.PanView(id,W * DX * steppan, H * DY * steppan);
531 dout.PanView(id,(Standard_Integer )( W * DX * steppan),(Standard_Integer )( H * DY * steppan));
532 dout.RepaintView(id);
539 //=======================================================================
542 //=======================================================================
544 static Standard_Integer ptv(Draw_Interpretor& , Standard_Integer n, const char** a)
547 Standard_Integer start = 0;
548 Standard_Integer end = MAXVIEW-1;
551 Standard_Integer anid = ViewId(a[1]);
552 if (anid < 0) return 1;
564 for (Standard_Integer id = start; id <= end; id++) {
567 T.SetTranslationPart(gp_Vec(0,0,0));
569 T1.SetTranslationPart(gp_Vec(-X,-Y,-Z));
570 gp_Trsf aLocalTrsf(T*T1);
571 dout.SetTrsf(id,aLocalTrsf);
572 // dout.SetTrsf(id,T*T1);
573 dout.RepaintView(id);
578 //=======================================================================
581 //=======================================================================
583 static Standard_Integer dptv(Draw_Interpretor& , Standard_Integer n, const char** a)
585 Standard_Real DX,DY,DZ;
586 Standard_Integer start = 0;
587 Standard_Integer end = MAXVIEW-1;
590 Standard_Integer anid = ViewId(a[1]);
591 if (anid < 0) return 1;
603 for (Standard_Integer id = start; id <= end; id++) {
607 T1.SetTranslationPart(gp_Vec(-DX,-DY,-DZ));
610 dout.RepaintView(id);
616 //=======================================================================
619 //=======================================================================
621 static Standard_Integer color(Draw_Interpretor& di, Standard_Integer n, const char** a)
624 Draw_BlackBackGround = !Draw_BlackBackGround;
626 else if (!dout.DefineColor(atoi(a[1]),a[2])) {
627 di << "Could not allocate color "<<a[2]<<"\n";
635 //=======================================================================
636 //function : hardcopy
637 //purpose : hardcopy --> hardcopy of view 1
640 // hardcopy name view --> hardcopy of view <view>
643 // hardcopy name view format --> hardcopy of view <view>
645 // in format <a4,a3,a2,a1,a0>
646 //=======================================================================
648 static Standard_Integer hardcopy(Draw_Interpretor& ,
649 Standard_Integer n, const char** a)
651 // Inch = 25.40001969 mm.
653 // format par default papier a4 210 297 mm avec marge de 3 mm.
655 Standard_Real rap = 28.4;
656 Standard_Real cad = 3;
657 Standard_Real dx = 210;
658 Standard_Real dy = 210 * Sqrt(2.);
660 Standard_Integer iview = 1;
661 const char* file = "a4.ps";
665 iview = ViewId(a[2]);
666 if (iview < 0) return 1;
668 if (!strcmp(a[3],"a7")) {
669 cad = cad / (2 * Sqrt(2));
670 dx = dx / (2 * Sqrt(2));
671 dy = dy / (2 * Sqrt(2));
673 else if (!strcmp(a[3],"a6")) {
678 else if (!strcmp(a[3],"a5")) {
683 else if (!strcmp(a[3],"a4")) {
688 else if (!strcmp(a[3],"a3")) {
693 else if (!strcmp(a[3],"a2")) {
698 else if (!strcmp(a[3],"a1")) {
699 cad = cad * 2 * Sqrt(2);
700 dx = dx * 2 * Sqrt(2);
701 dy = dy * 2 * Sqrt(2);
703 else if (!strcmp(a[3],"a0")) {
712 Standard_Integer pxmin = (Standard_Integer)(cad * rap);
713 Standard_Integer pymin = (Standard_Integer)(cad * rap);
714 Standard_Integer pxmax = (Standard_Integer)((dx - cad) * rap);
715 Standard_Integer pymax = (Standard_Integer)((dy - cad) * rap);
719 Standard_Integer vxmin,vymin,vxmax,vymax;
720 if (dout.HasView(iview)) {
721 dout.GetFrame(iview,vxmin,vymin,vxmax,vymax);
722 Standard_Real kx = (Standard_Real) (pxmax - pxmin) / (vxmax - vxmin);
723 Standard_Real ky = (Standard_Real) (pymax - pymin) / (vymax - vymin);
724 Standard_Real k = Min(Abs(kx),Abs(ky));
725 kx = (kx > 0) ? k : -k;
726 ky = (ky > 0) ? k : -k;
727 pxmax = (Standard_Integer )( pxmin + kx * (vxmax - vxmin));
728 pymax = (Standard_Integer )( pymin + ky * (vymax - vymin));
730 // si on veut choisir l'orientation : 90 rotate
732 // ecriture du header
734 os << "%!PS-Adobe-3.0 EPSF-3.0\n";
735 os << "%%BoundingBox: " << pxmin << " " << pymin << " "
736 << pxmax << " " << pymax << "\n";
737 os << "%%Pages: 1\n";
738 os << "%%DocumentFonts: "<<Draw_fontname<<"\n";
739 os << "%%EndComments\n";
741 os << "/"<<Draw_fontname<<" findfont\n"<<Draw_fontsize<<" scalefont\nsetfont\n";
742 os << "/m {moveto} bind def\n";
743 os << "/l {lineto} bind def\n";
744 os <<".1 .1 scale\n";
748 os <<"3 setlinewidth\n0 setgray\nnewpath\n";
749 os << pxmin << " " << pymin << " m\n";
750 os << pxmax << " " << pymin << " l\n";
751 os << pxmax << " " << pymax << " l\n";
752 os << pxmin << " " << pymax << " l\n";
753 os << "closepath\nstroke\n";
758 os << pxmin << " " << pymin << " m\n";
759 os << pxmax << " " << pymin << " l\n";
760 os << pxmax << " " << pymax << " l\n";
761 os << pxmin << " " << pymax << " l\n";
762 os << "closepath\nclip\n";
764 dout.PostScriptView(iview,
765 vxmin,vymin,vxmax,vymax,
766 pxmin,pymin,pxmax,pymax,os);
774 static Standard_Integer dfont(Draw_Interpretor& di,
775 Standard_Integer n, const char** a)
778 strcpy(Draw_fontname, Draw_fontnamedefault);
779 strcpy(Draw_fontsize, Draw_fontsizedefault);
780 } else if ( n == 2 ) {
781 strcpy(Draw_fontname, a[1]);
782 } else if ( n == 3 ) {
783 strcpy(Draw_fontname, a[1]);
784 strcpy(Draw_fontsize, a[2]);
786 di<<Draw_fontname<<" "<<Draw_fontsize<<"\n";
790 //=======================================================================
793 //=======================================================================
795 static Standard_Integer hcolor(Draw_Interpretor& di, Standard_Integer n, const char** a)
798 di << "code de couleur (Draw.cxx) : " << "\n" ;
799 di << "0 = White,\t 1 = Red,\t 2 = Green,\t 3 = Blue" << "\n" ;
800 di << "4 = Cyan,\t 5 = Gold,\t 6 = Magenta,\t 7 = Maroon" << "\n" ;
801 di << "8 = Orange,\t 9 = Pink,\t 10 = Salmon,\t 11 = Violet" << "\n" ;
802 di << "12 = Yellow,\t 13 = Khaki,\t 14 = Coral" << "\n" ;
803 di << "1 <= width <= 11, 0 (noir) <= gray <= 1 (blanc)" << "\n" ;
805 dout.PostColor(atoi(a[1]),atoi(a[2]),atof(a[3]));
810 //=======================================================================
812 //purpose : xwd file from a view
813 //=======================================================================
815 extern void Draw_RepaintNowIfNecessary();
817 static Standard_Integer xwd(Draw_Interpretor& , Standard_Integer n, const char** a)
821 // enforce repaint if necessary
822 Draw_RepaintNowIfNecessary();
824 Standard_Integer id = 1;
825 const char* file = a[1];
830 if (!dout.SaveView(id,file))
836 //=======================================================================
838 //purpose : Creation/Suppression d'une grille.
839 //=======================================================================
841 static Standard_Integer grid (Draw_Interpretor& , Standard_Integer NbArg, const char **Arg)
843 Standard_Real StepX, StepY, StepZ ;
847 StepX = DefaultGridStep ;
848 StepY = DefaultGridStep ;
849 StepZ = DefaultGridStep ;
852 StepX = Abs (atof (Arg[1])) ;
853 StepY = Abs (atof (Arg[1])) ;
854 StepZ = Abs (atof (Arg[1])) ;
857 StepX = Abs (atof (Arg[1])) ;
858 StepY = Abs (atof (Arg[2])) ;
859 StepZ = Abs (atof (Arg[2])) ;
862 StepX = Abs (atof (Arg[1])) ;
863 StepY = Abs (atof (Arg[2])) ;
864 StepZ = Abs (atof (Arg[3])) ;
871 const char *temp = "grid";
873 char temp1[] = "grid";
874 const char *temp = temp1;
876 Handle (Draw_Grid) Grille = Handle(Draw_Grid)::DownCast (Draw::Get(temp)) ;
878 Grille->Steps (StepX, StepY, StepZ) ;
884 //=======================================================================
887 //=======================================================================
889 static Standard_Integer dflush (Draw_Interpretor& , Standard_Integer, const char **)
895 //=======================================================================
898 //=======================================================================
900 static Standard_Integer dtext(Draw_Interpretor& di, Standard_Integer n, const char** a)
903 Standard_Boolean is3d;
905 Standard_Integer id,X,Y,b;
906 di << "Pick position with button 1, other button escape"<<"\n";
907 dout.Select(id,X,Y,b);
910 Standard_Real z = dout.Zoom(id);
911 P.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z,0);
916 is3d = dout.Is3D(id);
920 P.SetCoord(atof(a[1]),atof(a[2]),is3d ? atof(a[3]) : 0);
926 Handle(Draw_Text3D) D = new Draw_Text3D(P,a[n-1],Draw_vert);
930 Handle(Draw_Text2D) D = new Draw_Text2D(gp_Pnt2d(P.X(),P.Y()),
937 void Draw::GraphicCommands(Draw_Interpretor& theCommands)
939 static Standard_Boolean Done = Standard_False;
941 Done = Standard_True;
943 const char* g = "DRAW Graphic Commands";
944 theCommands.Add("wclick","wait for a mouse click",
946 theCommands.Add("zoom","zoom [view-id] z, or zoom z for all 3d views",
948 theCommands.Add("2dzoom","2dzoom [view-id] z, or zoom2d z for all 2d views",
950 theCommands.Add("wzoom","zoom on a window",
952 theCommands.Add("view","view view-id type X(0) Y(0) W(500) H(500)",
954 theCommands.Add("delete","delete [view-id]",
956 theCommands.Add("fit","fit [view-id]",
958 theCommands.Add("2dfit","2dfit [view-id]",
960 theCommands.Add("fu","fu [view-id], focal up",
962 theCommands.Add("fd","fd [view-id], focal down",
964 theCommands.Add("focal","focal [f]",
965 __FILE__,setfocal,g);
966 theCommands.Add("mu","mu [view-id], magnify up",
968 theCommands.Add("2dmu","2dmu [view-id], magnify up",
970 theCommands.Add("md","md [view-id], magnify down",
972 theCommands.Add("2dmd","2dmd [view-id], magnify down",
974 theCommands.Add("u","u [view-id], rotate up",
976 theCommands.Add("d","d [view-id], rotate down",
978 theCommands.Add("l","l [view-id], rotate left",__FILE__,rotate,g);
979 theCommands.Add("r","r [view-id], rotate right",__FILE__,rotate,g);
980 theCommands.Add("pu","pu [view-id], panning up",__FILE__,panning,g);
981 theCommands.Add("pd","pd [view-id], panning down",__FILE__,panning,g);
982 theCommands.Add("pl","pl [view-id], panning left",__FILE__,panning,g);
983 theCommands.Add("pr","pr [view-id], panning right",__FILE__,panning,g);
984 theCommands.Add("2dpu","2dpu [view-id], panning up",__FILE__,panning,g);
985 theCommands.Add("2dpd","2dpd [view-id], panning down",__FILE__,panning,g);
986 theCommands.Add("2dpl","2dpl [view-id], panning left",__FILE__,panning,g);
987 theCommands.Add("2dpr","2dpr [view-id], panning right",__FILE__,panning,g);
988 theCommands.Add("ptv","ptv [view-id], X , Y , Z",
990 theCommands.Add("dptv","dptv [view-id], dX , dY , dZ",
992 theCommands.Add("color","color i colorname, define color i",
994 theCommands.Add("hardcopy","hardcopy [file = a4.ps] [view-id = 1] [format = a4]", __FILE__,hardcopy,g);
995 theCommands.Add("xwd","xwd [id = 1] <filename>.{png|bmp|jpg|gif}\n\t\t: Dump contents of viewer window to PNG, BMP, JPEG or GIF file",
997 theCommands.Add("hcolor","hcolor icol width gray (< 1, 0 black)",
999 theCommands.Add("grid", "grid [stepX(100) [stepY [stepZ]]] / 0",
1001 theCommands.Add("dflush","dflush, flush the viewer",
1003 theCommands.Add("dtext","dtext [x y [z]] string",
1005 theCommands.Add("dfont","dfont [name size] : set name and size of Draw font, or reset to default",