1 // File: ViewerTest_ViewerCommands.cxx
2 // Created: Tue Sep 1 10:28:35 1998
3 // Author: Robert COUBLANC
4 // <rob@robox.paris1.matra-dtv.fr>
6 // Robert Boehne 30 May 2000 : Dec Osf
16 #include <Graphic3d_ExportFormat.hxx>
17 #include <ViewerTest.hxx>
18 #include <ViewerTest_EventManager.hxx>
19 #include <Visual3d_View.hxx>
20 #include <NIS_View.hxx>
21 #include <NIS_Triangulated.hxx>
22 #include <NIS_InteractiveContext.hxx>
23 #include <AIS_InteractiveContext.hxx>
24 #include <Draw_Interpretor.hxx>
26 #include <Draw_Appli.hxx>
29 #include <Graphic3d_GraphicDevice.hxx>
30 #include <Xw_GraphicDevice.hxx>
31 #include <Xw_WindowQuality.hxx>
32 #include <Xw_Window.hxx>
33 #include <X11/Xlib.h> /* contains some dangerous #defines such as Status, True etc. */
34 #include <X11/Xutil.h>
39 #include <Graphic3d_WNTGraphicDevice.hxx>
40 #include <WNT_WClass.hxx>
41 #include <WNT_Window.hxx>
43 #define _CRT_SECURE_NO_DEPRECATE
44 #pragma warning (disable:4996)
50 //==============================================================================
52 //==============================================================================
53 // VIEWER GLOBAL VARIABLES
54 //==============================================================================
56 Standard_IMPORT Standard_Boolean Draw_VirtualWindows;
58 Standard_EXPORT int ViewerMainLoop(Standard_Integer , const char** argv);
59 extern const Handle(NIS_InteractiveContext)& TheNISContext();
62 static Handle(Graphic3d_WNTGraphicDevice)& GetG3dDevice(){
63 static Handle(Graphic3d_WNTGraphicDevice) GD;
67 static Handle(WNT_Window)& VT_GetWindow() {
68 static Handle(WNT_Window) WNTWin;
73 static Handle(Graphic3d_GraphicDevice)& GetG3dDevice(){
74 static Handle(Graphic3d_GraphicDevice) GD;
77 static Handle(Xw_Window)& VT_GetWindow(){
78 static Handle(Xw_Window) XWWin;
81 static Display *display;
83 static void VProcessEvents(ClientData,int);
87 static Standard_Boolean DegenerateMode = Standard_True;
92 static void OSWindowSetup();
94 //==============================================================================
95 // EVENT GLOBAL VARIABLES
96 //==============================================================================
98 static int Start_Rot = 0;
99 static int ZClipIsOn = 0;
100 static int X_Motion= 0,Y_Motion=0; // Current cursor position
101 static int X_ButtonPress = 0, Y_ButtonPress = 0; // Last ButtonPress position
104 //==============================================================================
107 static LRESULT WINAPI ViewerWindowProc(
112 static LRESULT WINAPI AdvViewerWindowProc(
120 //==============================================================================
123 //==============================================================================
125 const Handle(MMgt_TShared)& ViewerTest::WClass()
127 static Handle(MMgt_TShared) theWClass;
129 if (theWClass.IsNull()) {
130 theWClass = new WNT_WClass ("GW3D_Class", AdvViewerWindowProc,
131 CS_VREDRAW | CS_HREDRAW, 0, 0,
132 ::LoadCursor (NULL, IDC_ARROW));
138 //==============================================================================
139 //function : ViewerInit
140 //purpose : Create the window viewer and initialize all the global variable
141 //==============================================================================
143 void ViewerTest::ViewerInit (const Standard_Integer thePxLeft, const Standard_Integer thePxTop,
144 const Standard_Integer thePxWidth, const Standard_Integer thePxHeight)
146 static Standard_Boolean isFirst = Standard_True;
148 Standard_Integer aPxLeft = 0;
149 Standard_Integer aPxTop = 460;
150 Standard_Integer aPxWidth = 409;
151 Standard_Integer aPxHeight = 409;
152 if (thePxWidth != 0 && thePxHeight != 0)
156 aPxWidth = thePxWidth;
157 aPxHeight = thePxHeight;
162 // Create the Graphic device
164 if (GetG3dDevice().IsNull()) GetG3dDevice() = new Graphic3d_WNTGraphicDevice();
165 if (VT_GetWindow().IsNull())
167 // Create the Graphic device and the window
168 Handle(WNT_GraphicDevice) g_Device = new WNT_GraphicDevice();
170 VT_GetWindow() = new WNT_Window (g_Device, "Test3d",
171 Handle(WNT_WClass)::DownCast (WClass()),
176 VT_GetWindow()->SetVirtual (Draw_VirtualWindows);
179 if (GetG3dDevice().IsNull()) GetG3dDevice() =
180 new Graphic3d_GraphicDevice (getenv ("DISPLAY"), Xw_TOM_READONLY);
181 if (VT_GetWindow().IsNull())
183 VT_GetWindow() = new Xw_Window (GetG3dDevice(),
189 VT_GetWindow()->SetVirtual (Draw_VirtualWindows);
193 Handle(V3d_Viewer) a3DViewer, a3DCollector;
194 // Viewer and View creation
196 TCollection_ExtendedString NameOfWindow("Visu3D");
198 a3DViewer = new V3d_Viewer(GetG3dDevice(), NameOfWindow.ToExtString());
199 NameOfWindow = TCollection_ExtendedString("Collector");
200 a3DCollector = new V3d_Viewer(GetG3dDevice(), NameOfWindow.ToExtString());
201 a3DViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK);
202 a3DCollector->SetDefaultBackgroundColor(Quantity_NOC_STEELBLUE);
203 Handle(NIS_View) aView =
204 Handle(NIS_View)::DownCast(ViewerTest::CurrentView());
205 if ( aView.IsNull() ) {
206 // Handle (V3d_View) V = a3DViewer->CreateView();
207 aView = new NIS_View (a3DViewer, VT_GetWindow());
208 ViewerTest::CurrentView(aView);
209 TheNISContext()->AttachView (aView);
211 Handle(V3d_View) a3DViewCol;
212 if ( a3DViewCol.IsNull() ) a3DViewCol = a3DViewer->CreateView();
215 if ( ViewerTest::GetAISContext().IsNull() ) {
216 Handle(AIS_InteractiveContext) C =
217 new AIS_InteractiveContext(a3DViewer,a3DCollector);
218 ViewerTest::SetAISContext(C);
221 // Setup for X11 or NT
223 // Viewer and View creation
225 a3DViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK);
227 Handle (V3d_View) V = ViewerTest::CurrentView();
229 V->SetDegenerateModeOn();
231 DegenerateMode = V->DegenerateModeIsOn();
233 // V->SetWindow(VT_GetWindow(), NULL, MyViewProc, NULL);
235 V->SetZClippingDepth(0.5);
236 V->SetZClippingWidth(ZCLIPWIDTH/2.);
237 a3DViewer->SetDefaultLights();
238 a3DViewer->SetLightOn();
241 #if TCL_MAJOR_VERSION < 8
242 Tk_CreateFileHandler((void*)ConnectionNumber(display),
243 TK_READABLE, VProcessEvents, (ClientData) VT_GetWindow()->XWindow() );
245 Tk_CreateFileHandler(ConnectionNumber(display),
246 TK_READABLE, VProcessEvents, (ClientData) VT_GetWindow()->XWindow() );
250 isFirst = Standard_False;
252 VT_GetWindow()->Map();
255 //==============================================================================
257 //purpose : Create the window viewer and initialize all the global variable
258 // Use Tk_CreateFileHandler on UNIX to cath the X11 Viewer event
259 //==============================================================================
261 static int VInit (Draw_Interpretor& , Standard_Integer argc, const char** argv)
263 Standard_Integer aPxLeft = (argc > 1) ? atoi (argv[1]) : 0;
264 Standard_Integer aPxTop = (argc > 2) ? atoi (argv[2]) : 0;
265 Standard_Integer aPxWidth = (argc > 3) ? atoi (argv[3]) : 0;
266 Standard_Integer aPxHeight = (argc > 4) ? atoi (argv[4]) : 0;
267 ViewerTest::ViewerInit (aPxLeft, aPxTop, aPxWidth, aPxHeight);
271 //==============================================================================
272 //function : ProcessKeyPress
273 //purpose : Handle KeyPress event from a CString
274 //==============================================================================
276 static void ProcessKeyPress( char *buf_ret )
278 //cout << "KeyPress" << endl;
279 const Handle(V3d_View) aView = ViewerTest::CurrentView();
280 const Handle(NIS_View) aNisView = Handle(NIS_View)::DownCast (aView);
281 // Letter in alphabetic order
283 if ( !strcasecmp(buf_ret, "A") ) {
285 aView->SetProj(V3d_XposYnegZpos);
287 else if ( !strcasecmp(buf_ret, "D") ) {
291 else if ( !strcasecmp(buf_ret, "F") ) {
293 if (aNisView.IsNull())
296 aNisView->FitAll3d();
298 else if ( !strcasecmp(buf_ret, "H") ) {
300 cout << "HLR" << endl;
302 if (aView->DegenerateModeIsOn()) ViewerTest::CurrentView()->SetDegenerateModeOff();
303 else aView->SetDegenerateModeOn();
304 DegenerateMode = aView->DegenerateModeIsOn();
306 ViewerTest::CurrentView()->SetDegenerateModeOff();
309 else if ( !strcasecmp(buf_ret, "D") ) {
313 else if ( !strcasecmp(buf_ret, "S") ) {
315 cout << "passage en mode 1 (shading pour les shapes)" << endl;
317 ViewerTest::CurrentView()->SetDegenerateModeOn();
319 Handle(AIS_InteractiveContext) Ctx = ViewerTest::GetAISContext();
320 if(Ctx->NbCurrents()==0 ||
321 Ctx->NbSelected()==0)
322 Ctx->SetDisplayMode(AIS_Shaded);
324 if(Ctx->HasOpenedContext()){
325 for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected())
326 Ctx->SetDisplayMode(Ctx->Interactive(),1,Standard_False);
329 for(Ctx->InitCurrent();Ctx->MoreCurrent();Ctx->NextCurrent())
330 Ctx->SetDisplayMode(Ctx->Current(),1,Standard_False);
332 Ctx->UpdateCurrentViewer();
335 else if ( !strcasecmp(buf_ret, "U") ) {
337 cout<<"passage au mode par defaut"<<endl;
339 ViewerTest::CurrentView()->SetDegenerateModeOn();
341 Handle(AIS_InteractiveContext) Ctx = ViewerTest::GetAISContext();
342 if(Ctx->NbCurrents()==0 ||
343 Ctx->NbSelected()==0)
344 Ctx->SetDisplayMode(AIS_WireFrame);
346 if(Ctx->HasOpenedContext()){
347 for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected())
348 Ctx->UnsetDisplayMode(Ctx->Interactive(),Standard_False);
351 for(Ctx->InitCurrent();Ctx->MoreCurrent();Ctx->NextCurrent())
352 Ctx->UnsetDisplayMode(Ctx->Current(),Standard_False);
354 Ctx->UpdateCurrentViewer();
358 else if ( !strcasecmp(buf_ret, "T") ) {
360 aView->SetProj(V3d_Zpos);
362 else if ( !strcasecmp(buf_ret, "B") ) {
364 aView->SetProj(V3d_Zneg);
366 else if ( !strcasecmp(buf_ret, "L") ) {
368 aView->SetProj(V3d_Xneg);
370 else if ( !strcasecmp(buf_ret, "R") ) {
372 aView->SetProj(V3d_Xpos);
375 else if ( !strcasecmp(buf_ret, "W") ) {
378 ViewerTest::CurrentView()->SetDegenerateModeOn();
380 cout << "passage en mode 0 (filaire pour les shapes)" << endl;
382 ViewerTest::CurrentView()->SetDegenerateModeOn();
384 Handle(AIS_InteractiveContext) Ctx = ViewerTest::GetAISContext();
385 if(Ctx->NbCurrents()==0 ||
386 Ctx->NbSelected()==0)
387 Ctx->SetDisplayMode(AIS_WireFrame);
389 if(Ctx->HasOpenedContext()){
390 for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected())
391 Ctx->SetDisplayMode(Ctx->Interactive(),0,Standard_False);
394 for(Ctx->InitCurrent();Ctx->MoreCurrent();Ctx->NextCurrent())
395 Ctx->SetDisplayMode(Ctx->Current(),0,Standard_False);
397 Ctx->UpdateCurrentViewer();
400 else if ( !strcasecmp(buf_ret, "Z") ) {
404 cout << "ZClipping OFF" << endl;
407 aView->SetZClippingType(V3d_OFF);
411 cout << "ZClipping ON" << endl;
414 aView->SetZClippingType(V3d_FRONT);
418 else if ( !strcasecmp(buf_ret, ",") ) {
419 ViewerTest::GetAISContext()->HilightNextDetected(ViewerTest::CurrentView());
423 else if ( !strcasecmp(buf_ret, ".") ) {
424 ViewerTest::GetAISContext()->HilightPreviousDetected(ViewerTest::CurrentView());
428 Standard_Integer Num = atoi(buf_ret);
430 ViewerTest::StandardModeActivation(Num);
434 //==============================================================================
435 //function : ProcessExpose
436 //purpose : Redraw the View on an Expose Event
437 //==============================================================================
439 static void ProcessExpose( )
440 { //cout << "Expose" << endl;
441 ViewerTest::CurrentView()->Redraw();
444 //==============================================================================
445 //function : ProcessConfigure
446 //purpose : Resize the View on an Configure Event
447 //==============================================================================
449 static void ProcessConfigure()
451 Handle(V3d_View) V = ViewerTest::CurrentView();
457 //==============================================================================
458 //function : ProcessButton1Press
460 //==============================================================================
462 static Standard_Boolean ProcessButton1Press(
465 Standard_Boolean pick,
466 Standard_Boolean shift )
468 Handle(ViewerTest_EventManager) EM = ViewerTest::CurrentEventManager();
470 Standard_Real X, Y, Z;
472 ViewerTest::CurrentView()->Convert(X_Motion, Y_Motion, X, Y, Z);
474 Draw::Set(argv[1], X);
475 Draw::Set(argv[2], Y);
476 Draw::Set(argv[3], Z);}
487 //==============================================================================
488 //function : ProcessButton3Press
489 //purpose : Start Rotation
490 //==============================================================================
492 static void ProcessButton3Press()
496 ViewerTest::CurrentView()->SetDegenerateModeOn();
497 ViewerTest::CurrentView()->StartRotation( X_ButtonPress, Y_ButtonPress );
500 //==============================================================================
501 //function : ProcessButtonRelease
502 //purpose : Start Rotation
503 //==============================================================================
505 static void ProcessButtonRelease()
511 if (!DegenerateMode) ViewerTest::CurrentView()->SetDegenerateModeOff();
515 ViewerTest::CurrentView()->SetDegenerateModeOff();
519 //==============================================================================
520 //function : ProcessZClipMotion
522 //==============================================================================
524 void ProcessZClipMotion()
526 Handle(V3d_View) a3DView = ViewerTest::CurrentView();
527 if ( Abs(X_Motion - X_ButtonPress) > 2 ) {
528 static Standard_Real CurZPos = 0.;
530 //Quantity_Length VDX, VDY;
531 //a3DView->Size(VDX,VDY);
532 //Standard_Real VDZ = a3DView->ZSize();
533 //printf("View size (%lf,%lf,%lf)\n", VDX, VDY, VDZ);
535 Quantity_Length dx = a3DView->Convert(X_Motion - X_ButtonPress);
537 // Front = Depth + width/2.
538 Standard_Real D = 0.5;
539 Standard_Real W = 0.1;
545 //printf("dx %lf Depth %lf Width %lf\n", dx, D, W);
547 a3DView->SetZClippingType(V3d_OFF);
548 a3DView->SetZClippingDepth(D);
549 a3DView->SetZClippingWidth(W);
550 a3DView->SetZClippingType(V3d_FRONT);
554 X_ButtonPress = X_Motion;
555 Y_ButtonPress = Y_Motion;
559 //==============================================================================
560 //function : ProcessControlButton1Motion
562 //==============================================================================
564 static void ProcessControlButton1Motion()
566 ViewerTest::CurrentView()->Zoom( X_ButtonPress, Y_ButtonPress, X_Motion, Y_Motion);
568 X_ButtonPress = X_Motion;
569 Y_ButtonPress = Y_Motion;
572 //==============================================================================
573 //function : ProcessControlButton2Motion
575 //==============================================================================
577 static void ProcessControlButton2Motion()
579 Quantity_Length dx = ViewerTest::CurrentView()->Convert(X_Motion - X_ButtonPress);
580 Quantity_Length dy = ViewerTest::CurrentView()->Convert(Y_Motion - Y_ButtonPress);
582 dy = -dy; // Xwindow Y axis is from top to Bottom
584 ViewerTest::CurrentView()->Panning( dx, dy );
586 X_ButtonPress = X_Motion;
587 Y_ButtonPress = Y_Motion;
590 //==============================================================================
591 //function : ProcessControlButton3Motion
593 //==============================================================================
595 static void ProcessControlButton3Motion()
597 if ( Start_Rot ) ViewerTest::CurrentView()->Rotation( X_Motion, Y_Motion);
600 //==============================================================================
601 //function : ProcessPointerMotion
603 //==============================================================================
605 static void ProcessMotion()
607 //pre-hilights detected objects at mouse position
609 Handle(ViewerTest_EventManager) EM = ViewerTest::CurrentEventManager();
610 EM->MoveTo(X_Motion, Y_Motion);
614 void ViewerTest::GetMousePosition(Standard_Integer& Xpix,Standard_Integer& Ypix)
616 Xpix = X_Motion;Ypix=Y_Motion;
619 //==============================================================================
621 //purpose : Switch to an Axonometric view
623 //==============================================================================
625 static int VAxo(Draw_Interpretor& di, Standard_Integer , const char** )
626 { if ( ViewerTest::CurrentView().IsNull() ) {
627 di<<"La commande vinit n'a pas ete appele avant"<<"\n";
628 // VInit(di, argc, argv);
631 ViewerTest::CurrentView()->SetProj(V3d_XposYnegZpos);
636 //==============================================================================
638 //purpose : Switch to a Top View
640 //==============================================================================
642 static int VTop(Draw_Interpretor& di, Standard_Integer , const char** )
645 if ( ViewerTest::CurrentView().IsNull() ) {
646 di<<"La commande vinit n'a pas ete appele avant"<<"\n";
648 // VInit(di, , argv);
651 ViewerTest::CurrentView()->SetProj(V3d_Zpos);
656 //==============================================================================
658 //purpose : Dsiplay help on viewer Keyboead and mouse commands
660 //==============================================================================
662 static int VHelp(Draw_Interpretor& di, Standard_Integer , const char** )
665 di << "Q : Quit the application" << "\n";
667 di << "========================="<<"\n";
668 di << "F : FitAll" << "\n";
669 di << "T : TopView" << "\n";
670 di << "A : AxonometricView" << "\n";
671 di << "R : ResetView" << "\n";
673 di << "========================="<<"\n";
674 di << "S : Shading" << "\n";
675 di << "W : Wireframe" << "\n";
676 di << "H : HidelLineRemoval" << "\n";
678 di << "========================="<<"\n";
679 di << "Selection mode "<<"\n";
680 di << "0 : Shape" <<"\n";
681 di << "1 : Vertex" <<"\n";
682 di << "2 : Edge" <<"\n";
683 di << "3 : Wire" <<"\n";
684 di << "4 : Face" <<"\n";
685 di << "5 : Shell" <<"\n";
686 di << "6 : Solid" <<"\n";
687 di << "7 : Compound" <<"\n";
689 di << "=========================="<<"\n";
690 di << "D : Remove Selected Object"<<"\n";
691 di << "=========================="<<"\n";
696 Standard_Boolean IsDragged = Standard_False;
698 Standard_Integer xx1, yy1, xx2, yy2;
699 //the first and last point in viewer co-ordinates
701 Standard_Boolean DragFirst;
706 static Standard_Boolean Ppick = 0;
707 static Standard_Integer Pargc = 0;
708 static const char** Pargv = NULL;
711 static LRESULT WINAPI AdvViewerWindowProc( HWND hwnd,
716 if ( !ViewerTest::CurrentView().IsNull() ) {
718 WPARAM fwKeys = wParam;
723 IsDragged = Standard_False;
726 HDC hdc = GetDC( hwnd );
727 HGDIOBJ anObj = SelectObject( hdc, GetStockObject( WHITE_PEN ) );
728 SelectObject( hdc, GetStockObject( HOLLOW_BRUSH ) );
729 SetROP2( hdc, R2_NOT );
730 Rectangle( hdc, xx1, yy1, xx2, yy2 );
731 ReleaseDC( hwnd, hdc );
733 const Handle(ViewerTest_EventManager) EM =
734 ViewerTest::CurrentEventManager();
735 if ( fwKeys & MK_SHIFT )
736 EM->ShiftSelect( min( xx1, xx2 ), max( yy1, yy2 ),
737 max( xx1, xx2 ), min( yy1, yy2 ));
739 EM->Select( min( xx1, xx2 ), max( yy1, yy2 ),
740 max( xx1, xx2 ), min( yy1, yy2 ));
742 return ViewerWindowProc( hwnd, Msg, wParam, lParam );
745 if( fwKeys == MK_LBUTTON || fwKeys == ( MK_LBUTTON | MK_SHIFT ) )
747 IsDragged = Standard_True;
748 DragFirst = Standard_True;
749 xx1 = LOWORD(lParam);
750 yy1 = HIWORD(lParam);
752 return ViewerWindowProc( hwnd, Msg, wParam, lParam );
759 HDC hdc = GetDC( hwnd );
761 HGDIOBJ anObj = SelectObject( hdc, GetStockObject( WHITE_PEN ) );
762 SelectObject( hdc, GetStockObject( HOLLOW_BRUSH ) );
763 SetROP2( hdc, R2_NOT );
766 Rectangle( hdc, xx1, yy1, xx2, yy2 );
768 DragFirst = Standard_False;
769 xx2 = LOWORD(lParam);
770 yy2 = HIWORD(lParam);
772 Rectangle( hdc, xx1, yy1, xx2, yy2 );
774 SelectObject( hdc, anObj );
776 ReleaseDC( hwnd, hdc );
779 return ViewerWindowProc( hwnd, Msg, wParam, lParam );
783 return ViewerWindowProc( hwnd, Msg, wParam, lParam );
787 return ViewerWindowProc( hwnd, Msg, wParam, lParam );
791 static LRESULT WINAPI ViewerWindowProc( HWND hwnd,
796 /*static Standard_Boolean Ppick = 0;
797 static Standard_Integer Pargc = 0;
798 static char** Pargv = NULL;*/
802 if ( !ViewerTest::CurrentView().IsNull() ) {
807 // do not destroy the window - just hide it!
808 VT_GetWindow()->Unmap();
811 //cout << "\t WM_PAINT" << endl;
812 BeginPaint(hwnd, &ps);
818 //cout << "\t WM_SIZE" << endl;
823 //cout << "\t WM_KEYDOWN " << (int) wParam << endl;
825 if ( (wParam != VK_SHIFT) && (wParam != VK_CONTROL) ) {
827 c[0] = (char) wParam;
836 //cout << "\t WM_xBUTTONUP" << endl;
838 ProcessButtonRelease();
845 //cout << "\t WM_xBUTTONDOWN" << endl;
846 WPARAM fwKeys = wParam;
850 X_ButtonPress = LOWORD(lParam);
851 Y_ButtonPress = HIWORD(lParam);
853 if ( Msg == WM_LBUTTONDOWN) {
854 if(fwKeys & MK_CONTROL) {
855 Ppick = ProcessButton1Press( Pargc, Pargv, Ppick, (fwKeys & MK_SHIFT) );
857 ProcessButton1Press( Pargc, Pargv, Ppick, (fwKeys & MK_SHIFT) );
859 else if ( Msg == WM_RBUTTONDOWN ) {
861 ProcessButton3Press( );
868 //cout << "\t WM_MOUSEMOVE" << endl;
869 WPARAM fwKeys = wParam;
870 X_Motion = LOWORD(lParam);
871 Y_Motion = HIWORD(lParam);
874 fwKeys & ( MK_LBUTTON|MK_MBUTTON|MK_RBUTTON ) ) {
876 X_ButtonPress = LOWORD(lParam);
877 Y_ButtonPress = HIWORD(lParam);
879 if ( fwKeys & MK_RBUTTON ) {
881 ProcessButton3Press();
885 if ( fwKeys & MK_CONTROL ) {
886 if ( fwKeys & MK_LBUTTON ) {
887 ProcessControlButton1Motion();
889 else if ( fwKeys & MK_MBUTTON ||
890 ((fwKeys&MK_LBUTTON) &&
891 (fwKeys&MK_RBUTTON) ) ){
892 ProcessControlButton2Motion();
894 else if ( fwKeys & MK_RBUTTON ) {
895 ProcessControlButton3Motion();
899 else if ( fwKeys & MK_SHIFT ) {
900 if ( fwKeys & MK_MBUTTON ||
901 ((fwKeys&MK_LBUTTON) &&
902 (fwKeys&MK_RBUTTON) ) ) {
903 cout << "ProcessZClipMotion()" << endl;
904 ProcessZClipMotion();
909 if (( fwKeys & MK_MBUTTON || ((fwKeys&MK_LBUTTON) && (fwKeys&MK_RBUTTON) ) )){
910 ProcessZClipMotion();
919 return( DefWindowProc( hwnd, Msg, wParam, lParam ));
924 return DefWindowProc( hwnd, Msg, wParam, lParam );
930 //==============================================================================
931 //function : ViewerMainLoop
932 //purpose : Get a Event on the view and dispatch it
933 //==============================================================================
936 static int ViewerMainLoop(Standard_Integer argc, const char** argv)
939 //cout << "No yet implemented on WNT" << endl;
940 /*static Standard_Boolean Ppick = 0;
941 static Standard_Integer Pargc = 0;
942 static char** Pargv = NULL;*/
944 //Ppick = (argc > 0)? -1 : 0;
945 Ppick = (argc > 0)? 1 : 0;
953 cout << "Start picking" << endl;
955 //while ( Ppick == -1 ) {
956 while ( Ppick == 1 ) {
957 // Wait for a ProcessButton1Press() to toggle pick to 1 or 0
958 if (GetMessage(&msg, NULL, 0, 0) ) {
959 TranslateMessage(&msg);
960 DispatchMessage(&msg);
964 cout << "Picking done" << endl;
973 int min( int a, int b )
981 int max( int a, int b )
989 int ViewerMainLoop(Standard_Integer argc, const char** argv)
991 { Standard_Boolean pick = argc > 0;
995 static XEvent report;
997 XNextEvent( display, &report );
998 // cout << "rep type = " << report.type << endl;
999 // cout << "rep button = " << report.xbutton.button << endl;
1001 switch ( report.type ) {
1007 case ConfigureNotify:
1018 XComposeStatus status_in_out;
1020 ret_len = XLookupString( ( XKeyEvent *)&report ,
1021 (char *) buf_ret , 10 ,
1022 &ks_ret , &status_in_out ) ;
1025 buf_ret[ret_len] = '\0' ;
1028 ProcessKeyPress( buf_ret);
1033 // cout << "ButtonPress" << endl;
1035 X_ButtonPress = report.xbutton.x;
1036 Y_ButtonPress = report.xbutton.y;
1038 if ( report.xbutton.button == Button1 )
1039 if( report.xbutton.state & ControlMask )
1040 pick = ProcessButton1Press( argc, argv, pick,
1041 ( report.xbutton.state & ShiftMask) );
1044 IsDragged = Standard_True;
1045 xx1 = X_ButtonPress;
1046 yy1 = Y_ButtonPress;
1047 DragFirst = Standard_True;
1049 else if ( report.xbutton.button == Button3 )
1051 ProcessButton3Press();
1056 // cout<<"relachement du bouton "<<(report.xbutton.button==3 ? "3": "on s'en fout") <<endl;
1057 // cout << IsDragged << endl;
1058 // cout << DragFirst << endl;
1064 Aspect_Handle aWindow = VT_GetWindow()->XWindow();
1065 GC gc = XCreateGC( display, aWindow, 0, 0 );
1066 // XSetFunction( display, gc, GXinvert );
1067 XDrawRectangle( display, aWindow, gc, min( xx1, xx2 ), min( yy1, yy2 ), abs( xx2-xx1 ), abs( yy2-yy1 ) );
1070 Handle( AIS_InteractiveContext ) aContext = ViewerTest::GetAISContext();
1071 if( aContext.IsNull() )
1073 cout << "The context is null. Please use vinit before createmesh" << endl;
1077 Standard_Boolean ShiftPressed = ( report.xbutton.state & ShiftMask );
1078 if( report.xbutton.button==1 )
1082 aContext->ShiftSelect();
1083 // cout << "shift select" << endl;
1088 // cout << "select" << endl;
1093 aContext->ShiftSelect( min( xx1, xx2 ), min( yy1, yy2 ),
1094 max( xx1, xx2 ), max( yy1, yy2 ),
1095 ViewerTest::CurrentView());
1096 // cout << "shift select" << endl;
1100 aContext->Select( min( xx1, xx2 ), min( yy1, yy2 ),
1101 max( xx1, xx2 ), max( yy1, yy2 ),
1102 ViewerTest::CurrentView() );
1103 // cout << "select" << endl;
1106 ProcessButtonRelease();
1108 IsDragged = Standard_False;
1111 ProcessButtonRelease();
1118 X_Motion = report.xmotion.x;
1119 Y_Motion = report.xmotion.y;
1123 Aspect_Handle aWindow = VT_GetWindow()->XWindow();
1124 GC gc = XCreateGC( display, aWindow, 0, 0 );
1125 XSetFunction( display, gc, GXinvert );
1128 XDrawRectangle( display, aWindow, gc, min( xx1, xx2 ), min( yy1, yy2 ), abs( xx2-xx1 ), abs( yy2-yy1 ) );
1132 DragFirst = Standard_False;
1134 //cout << "draw rect : " << xx2 << ", " << yy2 << endl;
1135 XDrawRectangle( display, aWindow, gc, min( xx1, xx2 ), min( yy1, yy2 ), abs( xx2-xx1 ), abs( yy2-yy1 ) );
1140 //cout << "MotionNotify " << X_Motion << "," << Y_Motion << endl;
1142 // remove all the ButtonMotionMask
1143 while( XCheckMaskEvent( display, ButtonMotionMask, &report) ) ;
1145 if ( ZClipIsOn && report.xmotion.state & ShiftMask ) {
1146 if ( Abs(X_Motion - X_ButtonPress) > 2 ) {
1148 Quantity_Length VDX, VDY;
1150 ViewerTest::CurrentView()->Size(VDX,VDY);
1151 Standard_Real VDZ =0 ;
1152 VDZ = ViewerTest::CurrentView()->ZSize();
1154 // printf("%lf,%lf,%lf\n", VDX, VDY, VDZ);
1155 printf("%f,%f,%f\n", VDX, VDY, VDZ);
1157 Quantity_Length dx = 0 ;
1158 dx = ViewerTest::CurrentView()->Convert(X_Motion - X_ButtonPress);
1162 dx = dx / VDX * VDZ;
1166 // Front = Depth + width/2.
1167 //ViewerTest::CurrentView()->SetZClippingDepth(dx);
1168 //ViewerTest::CurrentView()->SetZClippingWidth(0.);
1170 ViewerTest::CurrentView()->Redraw();
1174 if ( report.xmotion.state & ControlMask ) {
1175 if ( report.xmotion.state & Button1Mask ) {
1176 ProcessControlButton1Motion();
1178 else if ( report.xmotion.state & Button2Mask ) {
1179 ProcessControlButton2Motion();
1181 else if ( report.xmotion.state & Button3Mask ) {
1182 ProcessControlButton3Motion();
1197 //==============================================================================
1198 //function : VProcessEvents
1199 //purpose : call by Tk_CreateFileHandler() to be able to manage the
1200 // event in the Viewer window
1201 //==============================================================================
1203 static void VProcessEvents(ClientData,int)
1205 //cout << "VProcessEvents" << endl;
1208 while (XPending(display)) {
1209 ViewerMainLoop( 0, NULL);
1214 //==============================================================================
1215 //function : OSWindowSetup
1216 //purpose : Setup for the X11 window to be able to cath the event
1217 //==============================================================================
1220 static void OSWindowSetup()
1225 Window window = VT_GetWindow()->XWindow();
1227 Standard_Address theDisplay = GetG3dDevice()->XDisplay();
1228 display = (Display * ) theDisplay;
1229 // display = (Display *)GetG3dDevice()->XDisplay();
1231 XSynchronize(display, 1);
1233 VT_GetWindow()->Map();
1235 // X11 : For keyboard on SUN
1237 wmhints.flags = InputHint;
1240 XSetWMHints( display, window, &wmhints);
1242 XSelectInput( display, window, ExposureMask | KeyPressMask |
1243 ButtonPressMask | ButtonReleaseMask |
1244 StructureNotifyMask |
1246 Button1MotionMask | Button2MotionMask |
1250 XSynchronize(display, 0);
1259 //==============================================================================
1262 //purpose : Fitall, no DRAW arguments
1263 //Draw arg : No args
1264 //==============================================================================
1266 static int VFit(Draw_Interpretor& , Standard_Integer , const char** )
1268 const Handle(V3d_View) aView = ViewerTest::CurrentView();
1269 Handle(NIS_View) V = Handle(NIS_View)::DownCast(aView);
1270 if (V.IsNull() == Standard_False) {
1272 } else if (aView.IsNull() == Standard_False) {
1278 //==============================================================================
1280 //purpose : ZFitall, no DRAW arguments
1281 //Draw arg : No args
1282 //==============================================================================
1284 static int VZFit(Draw_Interpretor& , Standard_Integer , const char** )
1286 Handle(V3d_View) V = ViewerTest::CurrentView();
1287 if ( !V.IsNull() ) V->ZFitAll(); return 0; }
1290 static int VRepaint(Draw_Interpretor& , Standard_Integer , const char** )
1292 Handle(V3d_View) V = ViewerTest::CurrentView();
1293 if ( !V.IsNull() ) V->Redraw(); return 0;
1297 //==============================================================================
1299 //purpose : Remove all the object from the viewer
1300 //Draw arg : No args
1301 //==============================================================================
1303 static int VClear(Draw_Interpretor& , Standard_Integer , const char** )
1305 Handle(V3d_View) V = ViewerTest::CurrentView();
1307 ViewerTest::Clear();
1311 //==============================================================================
1314 //==============================================================================
1316 static int VPick(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1317 { if (ViewerTest::CurrentView().IsNull() ) return 1;
1320 di << argv[0] << "Invalid number of arguments" << "\n";
1324 while (ViewerMainLoop( argc, argv)) {
1332 //==============================================================================
1333 //function : InitViewerTest
1334 //purpose : initialisation de toutes les variables static de ViewerTest (dp)
1335 //==============================================================================
1337 void ViewerTest_InitViewerTest (const Handle(AIS_InteractiveContext)& context)
1339 Handle(V3d_Viewer) viewer = context->CurrentViewer();
1340 ViewerTest::SetAISContext(context);
1341 viewer->InitActiveViews();
1342 Handle(V3d_View) view = viewer->ActiveView();
1343 if (viewer->MoreActiveViews()) ViewerTest::CurrentView(view);
1344 ViewerTest::ResetEventManager();
1345 Handle(Aspect_GraphicDevice) device = viewer->Device();
1346 Handle(Aspect_Window) window = view->Window();
1349 VT_GetWindow() = Handle(Xw_Window)::DownCast(window);
1350 GetG3dDevice() = Handle(Graphic3d_GraphicDevice)::DownCast(device);
1352 static int first = 1;
1354 #if TCL_MAJOR_VERSION < 8
1355 Tk_CreateFileHandler((void*)ConnectionNumber(display),
1356 TK_READABLE, VProcessEvents, (ClientData) 0);
1358 Tk_CreateFileHandler(ConnectionNumber(display),
1359 TK_READABLE, VProcessEvents, (ClientData) 0);
1367 //==============================================================================
1369 //purpose : Load image as background
1370 //==============================================================================
1372 static int VSetBg(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1374 if (argc < 2 || argc > 3)
1376 di << "Usage : " << argv[0] << " imagefile [filltype] : Load image as background" << "\n";
1380 Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
1381 if(AISContext.IsNull())
1383 di << "use 'vinit' command before " << argv[0] << "\n";
1387 Aspect_FillMethod aFillType = Aspect_FM_CENTERED;
1390 const char* szType = argv[2];
1391 if (strcmp(szType, "NONE" ) == 0) aFillType = Aspect_FM_NONE;
1392 else if (strcmp(szType, "CENTERED") == 0) aFillType = Aspect_FM_CENTERED;
1393 else if (strcmp(szType, "TILED" ) == 0) aFillType = Aspect_FM_TILED;
1394 else if (strcmp(szType, "STRETCH" ) == 0) aFillType = Aspect_FM_STRETCH;
1397 di << "Wrong fill type : " << szType << "\n";
1398 di << "Must be one of CENTERED, TILED, STRETCH, NONE" << "\n";
1403 Handle(V3d_View) V3dView = ViewerTest::CurrentView();
1404 V3dView->SetBackgroundImage(argv[1], aFillType, Standard_True);
1409 //==============================================================================
1410 //function : VSetGradientBg
1411 //purpose : Mount gradient background
1412 //==============================================================================
1413 static int VSetGradientBg(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1417 di << "Usage : " << argv[0] << " R1 G1 B1 R2 G2 B2 Type : Mount gradient background" << "\n";
1418 di << "R1,G1,B1,R2,G2,B2 = [0..255]" << "\n";
1419 di << "Type must be one of 0 = NONE, 1 = HOR, 2 = VER, 3 = DIAG1, 4 = DIAG2" << "\n";
1420 di << " 5 = CORNER1, 6 = CORNER2, 7 = CORNER3, 8 = CORNER4" << "\n";
1424 Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
1425 if(AISContext.IsNull())
1427 di << "use 'vinit' command before " << argv[0] << "\n";
1433 Standard_Real R1 = atof(argv[1])/255.;
1434 Standard_Real G1 = atof(argv[2])/255.;
1435 Standard_Real B1 = atof(argv[3])/255.;
1436 Quantity_Color aColor1(R1,G1,B1,Quantity_TOC_RGB);
1438 Standard_Real R2 = atof(argv[4])/255.;
1439 Standard_Real G2 = atof(argv[5])/255.;
1440 Standard_Real B2 = atof(argv[6])/255.;
1442 Quantity_Color aColor2(R2,G2,B2,Quantity_TOC_RGB);
1443 int aType = atoi(argv[7]);
1444 if( aType < 0 || aType > 8 )
1446 di << "Wrong fill type " << "\n";
1447 di << "Must be one of 0 = NONE, 1 = HOR, 2 = VER, 3 = DIAG1, 4 = DIAG2" << "\n";
1448 di << " 5 = CORNER1, 6 = CORNER2, 7 = CORNER3, 8 = CORNER4" << "\n";
1452 Aspect_GradientFillMethod aMethod = Aspect_GradientFillMethod(aType);
1454 Handle(V3d_View) V3dView = ViewerTest::CurrentView();
1455 V3dView->SetBgGradientColors( aColor1, aColor2, aMethod, 1);
1461 //==============================================================================
1463 //purpose : View Scaling
1464 //==============================================================================
1466 static int VScale(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1468 Handle(V3d_View) V3dView = ViewerTest::CurrentView();
1469 if ( V3dView.IsNull() ) return 1;
1472 di << argv[0] << "Invalid number of arguments" << "\n";
1475 V3dView->SetAxialScale( atof(argv[1]), atof(argv[2]), atof(argv[3]) );
1478 //==============================================================================
1479 //function : VTestZBuffTrihedron
1480 //purpose : Displays a V3d_ZBUFFER'ed trihedron at the bottom left corner of the view
1481 //==============================================================================
1483 static int VTestZBuffTrihedron(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1485 Handle(V3d_View) V3dView = ViewerTest::CurrentView();
1486 if ( V3dView.IsNull() ) return 1;
1488 // Set up default trihedron parameters
1489 V3dView->ZBufferTriedronSetup();
1490 V3dView->TriedronDisplay( Aspect_TOTP_LEFT_LOWER, Quantity_NOC_WHITE, 0.1, V3d_ZBUFFER );
1495 //==============================================================================
1496 //function : VRotate
1497 //purpose : Camera Rotating
1498 //==============================================================================
1500 static int VRotate( Draw_Interpretor& di, Standard_Integer argc, const char** argv ) {
1501 Handle(V3d_View) V3dView = ViewerTest::CurrentView();
1502 if ( V3dView.IsNull() ) {
1507 V3dView->Rotate( atof(argv[1]), atof(argv[2]), atof(argv[3]) );
1509 } else if ( argc == 7 ) {
1510 V3dView->Rotate( atof(argv[1]), atof(argv[2]), atof(argv[3]), atof(argv[4]), atof(argv[5]), atof(argv[6]) );
1513 di << argv[0] << " Invalid number of arguments" << "\n";
1518 //==============================================================================
1520 //purpose : View zoom in / out (relative to current zoom)
1521 //==============================================================================
1523 static int VZoom( Draw_Interpretor& di, Standard_Integer argc, const char** argv ) {
1524 Handle(V3d_View) V3dView = ViewerTest::CurrentView();
1525 if ( V3dView.IsNull() ) {
1530 Standard_Real coef = atof(argv[1]);
1531 if ( coef <= 0.0 ) {
1532 di << argv[1] << "Invalid value" << "\n";
1535 V3dView->SetZoom( atof(argv[1]) );
1538 di << argv[0] << " Invalid number of arguments" << "\n";
1543 //==============================================================================
1545 //purpose : View panning (in pixels)
1546 //==============================================================================
1548 static int VPan( Draw_Interpretor& di, Standard_Integer argc, const char** argv ) {
1549 Handle(V3d_View) V3dView = ViewerTest::CurrentView();
1550 if ( V3dView.IsNull() ) return 1;
1553 V3dView->Pan( atoi(argv[1]), atoi(argv[2]) );
1556 di << argv[0] << " Invalid number of arguments" << "\n";
1562 //==============================================================================
1563 //function : VExport
1564 //purpose : Export teh view to a vector graphic format (PS, EMF, PDF)
1565 //==============================================================================
1567 static int VExport(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1569 Handle(V3d_View) V3dView = ViewerTest::CurrentView();
1570 if ( V3dView.IsNull() ) return 1;
1573 di << argv[0] << "Invalid number of arguments" << "\n";
1577 TCollection_AsciiString aFormat( argv[2] );
1578 aFormat.UpperCase();
1579 Graphic3d_ExportFormat exFormat;
1580 if ( aFormat == "PS" )
1581 exFormat = Graphic3d_EF_PostScript;
1582 if ( aFormat == "EPS" )
1583 exFormat = Graphic3d_EF_EnhPostScript;
1584 if ( aFormat == "TEX" )
1585 exFormat = Graphic3d_EF_TEX;
1586 if ( aFormat == "PDF" )
1587 exFormat = Graphic3d_EF_PDF;
1588 if ( aFormat == "SVG" )
1589 exFormat = Graphic3d_EF_SVG;
1590 if ( aFormat == "PGF" )
1591 exFormat = Graphic3d_EF_PGF;
1592 V3dView->View()->Export( argv[1], exFormat );
1596 //==============================================================================
1597 //function : VColorScale
1598 //purpose : representation color scale
1599 //==============================================================================
1600 #include <V3d_ColorScale.hxx>
1602 static int VColorScale (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1604 if ( argc != 1 && argc != 4 && argc != 5 && argc != 6 && argc != 8 )
1606 di << "Usage : " << argv[0] << " [RangeMin = 0 RangeMax = 100 Intervals = 10 HeightFont = 16 Position = Right X = 0 Y = 0] " << "\n";
1610 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
1611 if(aContext.IsNull()) {
1612 di << argv[0] << " ERROR : use 'vinit' command before " << "\n";
1616 Standard_Real minRange = 0. , maxRange = 100. ;
1618 Standard_Integer numIntervals = 10 ;
1619 Standard_Real textHeight = 16. ;
1620 Aspect_TypeOfColorScalePosition position = Aspect_TOCSP_RIGHT;
1621 Standard_Real X = 0., Y = 0. ;
1627 minRange = atof( argv[1] );
1628 maxRange = atof( argv[2] );
1629 numIntervals = atoi( argv[3] );
1632 textHeight = atof( argv[4] );
1634 position = (Aspect_TypeOfColorScalePosition)atoi( argv[5] );
1637 X = atof( argv[6] );
1638 Y = atof( argv[7] );
1641 Handle(V3d_View) curView = ViewerTest::CurrentView( );
1642 if ( curView.IsNull( ) )
1644 Handle(Aspect_ColorScale) aCSV = curView->ColorScale( );
1645 Handle(V3d_ColorScale) aCS = ( Handle( V3d_ColorScale )::DownCast( aCSV ) );
1646 if( ! aCS.IsNull( ) )
1648 aCS->SetPosition( X , Y );
1649 aCS->SetHeight( 0.95) ;
1650 aCS->SetTextHeight( textHeight );
1651 aCS->SetRange( minRange , maxRange );
1652 aCS->SetNumberOfIntervals( numIntervals );
1653 aCS->SetLabelPosition( position );
1654 if( !curView->ColorScaleIsDisplayed() )
1655 curView->ColorScaleDisplay( );
1660 //==============================================================================
1661 //function : VGraduatedTrihedron
1662 //purpose : Displays a graduated trihedron
1663 //==============================================================================
1664 static int VGraduatedTrihedron(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1666 Handle(V3d_View) V3dView = ViewerTest::CurrentView();
1667 if (V3dView.IsNull())
1672 di << argv[0] << " Invalid number of arguments" << "\n";
1676 Standard_CString xname = "X (mm)";
1677 Standard_CString yname = "Y (mm)";
1678 Standard_CString zname = "Z (mm)";
1684 di << argv[0] << " Define all X, Y and Z axes names, please" << "\n";
1692 int display = atoi(argv[1]);
1694 V3dView->GraduatedTrihedronDisplay(xname, yname, zname,
1695 Standard_True/*xdrawname*/, Standard_True/*ydrawname*/, Standard_True/*zdrawname*/,
1696 Standard_True/*xdrawvalues*/, Standard_True/*ydrawvalues*/, Standard_True/*zdrawvalues*/,
1697 Standard_True/*drawgrid*/,
1698 Standard_True/*drawaxes*/,
1699 5/*nbx*/, 5/*nby*/, 5/*nbz*/,
1700 10/*xoffset*/, 10/*yoffset*/, 10/*zoffset*/,
1701 30/*xaxisoffset*/, 30/*yaxisoffset*/, 30/*zaxisoffset*/,
1702 Standard_True/*xdrawtickmarks*/, Standard_True/*ydrawtickmarks*/, Standard_True/*zdrawtickmarks*/,
1703 10/*xtickmarklength*/, 10/*ytickmarklength*/, 10/*ztickmarklength*/);
1705 V3dView->GraduatedTrihedronErase();
1707 ViewerTest::GetAISContext()->UpdateCurrentViewer();
1712 //=======================================================================
1713 //function : ViewerCommands
1715 //=======================================================================
1717 void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
1720 const char *group = "ZeViewer";
1721 theCommands.Add("vinit" ,
1722 "vinit : vinit [leftPx topPx widthPx heightPx] : Create the Viewer window",
1723 __FILE__,VInit,group);
1724 theCommands.Add("vhelp" ,
1725 "vhelp : display help on the viewer commands",
1726 __FILE__,VHelp,group);
1727 theCommands.Add("vtop" ,
1728 "vtop or <T> : Top view" ,
1729 __FILE__,VTop,group);
1730 theCommands.Add("vaxo" ,
1731 " vaxo or <A> : Axonometric view ",
1732 __FILE__,VAxo,group);
1733 theCommands.Add("vpick" ,
1734 "vpick : vpick X Y Z [shape subshape] ( all variables as string )",
1736 theCommands.Add("vfit" ,
1737 "vfit or <F> : vfit",
1738 __FILE__,VFit,group);
1739 theCommands.Add("vzfit" ,
1741 __FILE__,VZFit,group);
1742 theCommands.Add("vrepaint",
1743 "vrepaint : vrepaint, force redraw",
1744 __FILE__,VRepaint,group);
1745 theCommands.Add("vclear",
1747 __FILE__,VClear,group);
1748 theCommands.Add("vsetbg",
1749 "vsetbg : vsetbg imagefile [filltype] : Load image as background",
1750 __FILE__,VSetBg,group);
1751 theCommands.Add("vsetgradientbg",
1752 "vsetgradientbg : vsetgradientbg r1 g1 b1 r2 g2 b2 filltype : Mount gradient background",
1753 __FILE__,VSetGradientBg,group);
1754 theCommands.Add("vscale",
1755 "vscale : vscale X Y Z",
1756 __FILE__,VScale,group);
1757 theCommands.Add("vzbufftrihedron",
1758 "vzbufftrihedron : Displays a V3d_ZBUFFER'ed trihedron at the bottom left corner of the view",
1759 __FILE__,VTestZBuffTrihedron,group);
1760 theCommands.Add("vrotate",
1761 "vrotate : vrotate AX AY AZ [X Y Z]",
1762 __FILE__,VRotate,group);
1763 theCommands.Add("vzoom",
1764 "vzoom : vzoom coef",
1765 __FILE__,VZoom,group);
1766 theCommands.Add("vpan",
1767 "vpan : vpan dx dy",
1768 __FILE__,VPan,group);
1769 theCommands.Add("vexport",
1770 "vexport : vexport full_file_path {PS | EPS | TEX | PDF | SVG | PGV } : exports the view to a vector file of a given format",
1771 __FILE__,VExport,group);
1772 theCommands.Add("vcolorscale",
1773 "vcolorscale : vcolorscale [RangeMin = 0 RangeMax = 100 Intervals = 10 HeightFont = 16 Position = 2 X = 0 Y = 0]: draw color scale",
1774 __FILE__,VColorScale,group);
1775 theCommands.Add("vgraduatedtrihedron",
1776 "vgraduatedtrihedron : 1/0 (display/erase) [Xname Yname Zname]",
1777 __FILE__,VGraduatedTrihedron,group);