0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / IVtkDraw / IVtkDraw.cxx
CommitLineData
52f99d93 1// Created on: 2012-02-03
2//
3// Copyright (c) 2012-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16
17#ifdef NOMINMAX
18#undef NOMINMAX /* avoid #define min() and max() */
19#endif
20#ifdef NOMSG
21#undef NOMSG /* avoid #define SendMessage etc. */
22#endif
23#ifdef NODRAWTEXT
24#undef NODRAWTEXT /* avoid #define DrawText etc. */
25#endif
26#ifdef NONLS
27#undef NONLS /* avoid #define CompareString etc. */
28#endif
29#ifdef NOGDI
30#undef NOGDI /* avoid #define SetPrinter (winspool.h) etc. */
31#endif
32#ifdef NOSERVICE
33#undef NOSERVICE
34#endif
35#ifdef NOKERNEL
36#undef NOKERNEL
37#endif
38#ifdef NOUSER
39#undef NOUSER
40#endif
41#ifdef NOMCX
42#undef NOMCX
43#endif
44#ifdef NOIME
45#undef NOIME
46#endif
47
48#include <stdio.h>
49#ifdef HAVE_STRINGS_H
50# include <strings.h>
51#endif
52
53#ifdef _WIN32
52f99d93 54#include <windows.h>
55#include <WNT_WClass.hxx>
56#include <WNT_Window.hxx>
57#endif
58
59#include <Draw.hxx>
60#include <Draw_Interpretor.hxx>
61#include <Draw_PluginMacro.hxx>
62#include <TCollection_AsciiString.hxx>
63#include <TopoDS_Shape.hxx>
64#include <BRep_Builder.hxx>
65#include <BRepTools.hxx>
66#include <DBRep.hxx>
67#include <NCollection_DoubleMap.hxx>
68#include <NCollection_List.hxx>
69#include <NCollection_DataMap.hxx>
70#include <TopTools_DataMapOfIntegerShape.hxx>
71#include <OpenGl_GraphicDriver.hxx>
72#include <Aspect_DisplayConnection.hxx>
73
74#include <IVtk_Types.hxx>
75#include <IVtkVTK_ShapeData.hxx>
76#include <IVtkOCC_Shape.hxx>
77#include <IVtkOCC_ShapeMesher.hxx>
78#include <IVtkTools_ShapeDataSource.hxx>
79#include <IVtkTools_ShapeObject.hxx>
80#include <IVtkTools_SubPolyDataFilter.hxx>
81#include <IVtkTools_DisplayModeFilter.hxx>
82#include <IVtkTools_ShapePicker.hxx>
83
84#include <IVtkDraw.hxx>
85#include <IVtkDraw_HighlightAndSelectionPipeline.hxx>
86#include <IVtkDraw_Interactor.hxx>
87
a9660929 88// prevent disabling some MSVC warning messages by VTK headers
89#ifdef _MSC_VER
90#pragma warning(push)
91#pragma warning(disable: 4244)
92#endif
52f99d93 93#include <vtkAlgorithmOutput.h>
94#include <vtkAppendPolyData.h>
95#include <vtkBMPWriter.h>
96#include <vtkCamera.h>
97#include <vtkCellData.h>
98#include <vtkCommand.h>
99#include <vtkGeometryFilter.h>
100#include <vtkIdTypeArray.h>
101#include <vtkImageResize.h>
102#include <vtkImageWriter.h>
103#include <vtkInteractorStyleTrackballCamera.h>
104#include <vtkJPEGWriter.h>
105#include <vtkPNGWriter.h>
106#include <vtkPNMWriter.h>
107#include <vtkPolyDataMapper.h>
108#include <vtkProperty.h>
109#include <vtkRenderWindow.h>
110#include <vtkRenderer.h>
111#include <vtkRenderWindowInteractor.h>
112#include <vtkSmartPointer.h>
113#include <vtkTIFFWriter.h>
114#include <vtkWindowToImageFilter.h>
52f99d93 115#ifndef _WIN32
116#include <X11/X.h>
117#include <X11/Shell.h>
118#include <X11/Xlib.h>
119#include <GL/glx.h>
120#include <Xw_Window.hxx>
121#include <vtkXRenderWindowInteractor.h>
122#include <vtkXOpenGLRenderWindow.h>
123#include <X11/Xutil.h>
124#include <tk.h>
125#endif
a9660929 126#ifdef _MSC_VER
127#pragma warning(pop)
128#endif
52f99d93 129
130// workaround name conflicts with OCCT methods (in class TopoDS_Shape for example)
131#ifdef Convex
132 #undef Convex
133#endif
134#ifdef Status
135 #undef Status
136#endif
137
138//================================================================
139// TYPE DEFINITIONS
140//================================================================
141
142typedef NCollection_DoubleMap<TopoDS_Shape, TCollection_AsciiString> DoubleMapOfShapesAndNames;
143typedef NCollection_DoubleMap<vtkSmartPointer<vtkActor>, TCollection_AsciiString> DoubleMapOfActorsAndNames;
144
145typedef IVtkDraw_HighlightAndSelectionPipeline PipelinePtr;
52f99d93 146
147//================================================================
148// GLOBAL VARIABLES
149//================================================================
150
151Standard_IMPORT Standard_Boolean Draw_VirtualWindows;
152
153static Handle(Aspect_DisplayConnection)& GetDisplayConnection()
154{
155 static Handle(Aspect_DisplayConnection) aDisplayConnection;
156 return aDisplayConnection;
157}
158
159static void SetDisplayConnection (const Handle(Aspect_DisplayConnection)& theDisplayConnection)
160{
161 GetDisplayConnection() = theDisplayConnection;
162}
163
164static DoubleMapOfShapesAndNames& GetMapOfShapes()
165{
166 static DoubleMapOfShapesAndNames aMap;
167 return aMap;
168}
169
170static DoubleMapOfActorsAndNames& GetMapOfActors()
171{
172 static DoubleMapOfActorsAndNames aMap;
173 return aMap;
174}
175
176static vtkSmartPointer<vtkRenderer>& GetRenderer()
177{
178 static vtkSmartPointer<vtkRenderer> aRenderer;
179 return aRenderer;
180}
181
182static Handle(ShapePipelineMap)& GetPipelines()
183{
184 static Handle(ShapePipelineMap) aPLMap;
185 if (aPLMap.IsNull())
186 {
187 aPLMap = new ShapePipelineMap();
188 }
189
190 return aPLMap;
191}
192
193static Handle(PipelinePtr) GetPipeline (const IVtk_IdType& theShapeID)
194{
195 Handle(PipelinePtr) aPtr;
196 GetPipelines()->Find (theShapeID, aPtr);
197 return aPtr;
198}
199
200//! Get VTK render pipeline with shape ID got from actor.
201static Handle(PipelinePtr) PipelineByActor (const vtkSmartPointer<vtkActor>& theActor)
202{
203 IVtk_IdType aShapeID = IVtkTools_ShapeObject::GetShapeSource (theActor)->GetShape()->GetId();
204 return GetPipeline (aShapeID);
205}
206
207//! Get VTK render pipeline with actor that has the input name.
208static Handle(PipelinePtr) PipelineByActorName (const TCollection_AsciiString& theName)
209{
210 const vtkSmartPointer<vtkActor>& anActor = GetMapOfActors().Find2 (theName);
211 return PipelineByActor (anActor);
212}
213
52f99d93 214#ifdef _WIN32
215
216static Handle(WNT_Window)& GetWindow()
217{
218 static Handle(WNT_Window) aWindow;
219 return aWindow;
220}
221
222#else
223
224static Handle(Xw_Window)& GetWindow()
225{
226 static Handle(Xw_Window) aXWWin;
227 return aXWWin;
228}
229
230#endif
231
232static vtkSmartPointer<IVtkDraw_Interactor>& GetInteractor()
233{
234 static vtkSmartPointer<IVtkDraw_Interactor> anInteractor;
235 return anInteractor;
236}
237
238static vtkSmartPointer<IVtkTools_ShapePicker>& GetPicker()
239{
240 static vtkSmartPointer<IVtkTools_ShapePicker> aPicker;
241 return aPicker;
242}
243
244//! Generate identical number for shape
245Standard_Integer GenerateId()
246{
247 static unsigned int aShapesCounter = (unsigned int )-1;
248 return (Standard_Integer )++aShapesCounter;
249}
250
251//=========================================================
252// Function : WClass
253// Purpose :
254//=========================================================
1bd04b5a 255const Handle(WNT_WClass)& IVtkDraw::WClass()
52f99d93 256{
1bd04b5a 257 static Handle(WNT_WClass) aWindowClass;
bd6c4619 258#ifdef _WIN32
52f99d93 259 if (aWindowClass.IsNull())
260 {
1bd04b5a 261 aWindowClass = new WNT_WClass ("GWVTK_Class", NULL,
52f99d93 262 CS_VREDRAW | CS_HREDRAW, 0, 0,
ad03c234 263 ::LoadCursorW (NULL, IDC_ARROW));
52f99d93 264 }
265#endif
266 return aWindowClass;
267}
268
269//==============================================================
270// Function : ViewerInit
271// Purpose :
272//==============================================================
273void IVtkDraw::ViewerInit (Standard_Integer thePxLeft,
274 Standard_Integer thePxTop,
275 Standard_Integer thePxWidth,
276 Standard_Integer thePxHeight)
277{
278 static Standard_Boolean isFirst = Standard_True;
279
280 Standard_Integer aPxLeft = 0;
281 Standard_Integer aPxTop = 460;
282 Standard_Integer aPxWidth = 409;
283 Standard_Integer aPxHeight = 409;
284
285 if (thePxLeft != 0)
286 {
287 aPxLeft = thePxLeft;
288 }
289 if (thePxTop != 0)
290 {
291 aPxTop = thePxTop;
292 }
293 if (thePxWidth != 0)
294 {
295 aPxWidth = thePxWidth;
296 }
297 if (thePxHeight != 0)
298 {
299 aPxHeight = thePxHeight;
300 }
301
302 if (isFirst)
303 {
304 SetDisplayConnection (new Aspect_DisplayConnection ());
bd6c4619 305#ifdef _WIN32
52f99d93 306 if (GetWindow().IsNull())
307 {
1bd04b5a 308 GetWindow() = new WNT_Window ("IVtkTest", WClass(),
52f99d93 309 WS_OVERLAPPEDWINDOW,
310 aPxLeft, aPxTop,
311 aPxWidth, aPxHeight,
312 Quantity_NOC_BLACK);
313 GetWindow()->SetVirtual (Draw_VirtualWindows);
314 }
315#else
316
317 if (GetWindow().IsNull())
318 {
319 GetWindow() = new Xw_Window (GetDisplayConnection(),
320 "IVtkTest",
321 aPxLeft, aPxTop,
322 aPxWidth, aPxHeight);
323 GetWindow()->SetVirtual (Draw_VirtualWindows);
324 }
325#endif
326 // Init pipeline
327 GetRenderer() = vtkSmartPointer<vtkRenderer>::New();
328
329 vtkSmartPointer<vtkRenderWindow> aRenWin = vtkSmartPointer<vtkRenderWindow>::New();
330 aRenWin->AddRenderer (GetRenderer());
331 GetRenderer()->GetActiveCamera()->ParallelProjectionOn();
332 aRenWin->SetSize (aPxWidth, aPxHeight);
333
bd6c4619 334#ifdef _WIN32
52f99d93 335 aRenWin->SetWindowId((void*)GetWindow()->HWindow());
336#else
337 Window aWindowId = GetWindow()->XWindow();
338 aRenWin->SetWindowId ((void*)aWindowId);
339 Display *aDisplayId = GetDisplayConnection()->GetDisplay();
340 aRenWin->SetDisplayId (aDisplayId);
341
342 // Setup XWindow
343 XSynchronize (aDisplayId, 1);
344 GetWindow()->Map();
345
346 // X11 : For keyboard on SUN
347 XWMHints wmhints;
348 wmhints.flags = InputHint;
349 wmhints.input = 1;
350
351 XSetWMHints (aDisplayId, aWindowId, &wmhints);
352
353 XSelectInput (aDisplayId, aWindowId, ExposureMask | KeyPressMask |
354 ButtonPressMask | ButtonReleaseMask |
355 StructureNotifyMask |
356 PointerMotionMask |
357 Button1MotionMask | Button2MotionMask |
358 Button3MotionMask
359 );
360
361 XSynchronize (aDisplayId, 0);
362
363#endif
364
365 // Init interactor
366 GetInteractor() = vtkSmartPointer<IVtkDraw_Interactor>::New();
367 GetInteractor()->SetRenderWindow (aRenWin);
368 GetInteractor()->SetOCCWindow (GetWindow());
369
370 vtkSmartPointer<vtkInteractorStyleTrackballCamera>
371 aStyle = vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
372 GetInteractor()->SetInteractorStyle (aStyle);
373
374 // Init picker
375 GetPicker() = vtkSmartPointer<IVtkTools_ShapePicker>::New();
896faa72 376 GetPicker()->SetTolerance (0.025f);
52f99d93 377 GetPicker()->SetRenderer (GetRenderer());
378
379 GetInteractor()->SetShapePicker (GetPicker());
380 GetInteractor()->SetPipelines (GetPipelines());
381 GetInteractor()->Initialize();
382
383 aRenWin->SetOffScreenRendering(Draw_VirtualWindows);
384 aRenWin->Render();
385
386 isFirst = Standard_False;
387 }
388
389 GetWindow()->Map();
390}
391
392//================================================================
393// Function : VtkInit
394// Purpose :
395//================================================================
396static Standard_Integer VtkInit (Draw_Interpretor& ,
397 Standard_Integer theArgNum,
398 const char** theArgs)
399{
400 Standard_Integer aPxLeft = (theArgNum > 1) ? atoi(theArgs[1]) : 0;
401 Standard_Integer aPxTop = (theArgNum > 2) ? atoi(theArgs[2]) : 0;
402 Standard_Integer aPxWidth = (theArgNum > 3) ? atoi(theArgs[3]) : 0;
403 Standard_Integer aPxHeight = (theArgNum > 4) ? atoi(theArgs[4]) : 0;
404
405 IVtkDraw::ViewerInit (aPxLeft, aPxTop, aPxWidth, aPxHeight);
406 return 0;
407}
408
409
410//================================================================
411// Function : CreateActor
412// Purpose :
413//================================================================
414vtkActor* CreateActor (const Standard_Integer theId,
415 const TopoDS_Shape& theShape)
416{
417 if ( theShape.IsNull() )
418 {
419 return NULL;
420 }
421
422 Handle(PipelinePtr) aPL = new PipelinePtr (theShape, theId);
423 GetPipelines()->Bind (theId, aPL);
424
425 return aPL->Actor();
426}
427
428//================================================================
429// Function : VtkDisplay
430// Purpose :
431//================================================================
432
433static Standard_Integer VtkDisplay (Draw_Interpretor& theDI,
434 Standard_Integer theArgNum,
435 const char** theArgs)
436{
437 // Check viewer
438 if (!GetInteractor()->IsEnabled())
439 {
440 theDI << theArgs[0] << " error : call ivtkinit before\n";
441 return 1; // TCL_ERROR
442 }
443
444 // Check arguments
445 if (theArgNum < 2)
446 {
447 theDI << theArgs[0] << " error : expects at least 1 argument\n";
448 return 1; // TCL_ERROR
449 }
450
451 TCollection_AsciiString aName;
452 TopoDS_Shape anOldShape, aNewShape;
a2f76b15 453 vtkSmartPointer<vtkRenderer>& aRenderer = GetRenderer();
52f99d93 454 for (Standard_Integer anIndex = 1; anIndex < theArgNum; ++anIndex)
455 {
456 // Get name of shape
457 aName = theArgs[anIndex];
458 // Get shape from DRAW
459 aNewShape = DBRep::Get (theArgs[anIndex]);
460
461 // The shape is already in the map
462 if (GetMapOfShapes().IsBound2 (aName))
463 {
464 // Get shape from map
465 anOldShape = GetMapOfShapes().Find2 (aName);
466 // Equal shapes
467 if (anOldShape.IsEqual (aNewShape))
468 {
469 // Get actor from map and display it
470 PipelineByActorName (aName)->AddToRenderer (aRenderer);
471 }
472 // Different shapes
473 else
474 {
475 if (aNewShape.IsNull()) continue;
476 // Create actor from DRAW shape
477 vtkActor* anActor = CreateActor (GenerateId(), aNewShape);
478 // Remove old actor from render
479 PipelineByActorName (aName)->RemoveFromRenderer (aRenderer);
480 // Update maps
481 GetMapOfShapes().UnBind2 (aName);
482 GetMapOfShapes().Bind (aNewShape, aName);
483 GetMapOfActors().UnBind2 (aName);
484 GetMapOfActors().Bind (anActor, aName);
485 // Display new actor
486 PipelineByActorName (aName)->AddToRenderer (aRenderer);
487 // Compute selection for displayed actors
488 GetPicker()->SetSelectionMode (SM_Shape, Standard_True);
489 }
490 }
491 // There is no shape with given name in map
492 else
493 {
494 if (aNewShape.IsNull()) continue;
495 // Create actor from DRAW shape
a2f76b15 496 Standard_Integer anId = GenerateId();
497 vtkSmartPointer<vtkActor> anActor = CreateActor (anId, aNewShape);
52f99d93 498 // Update maps
499 GetMapOfShapes().Bind (aNewShape, aName);
500 GetMapOfActors().Bind (anActor, aName);
501 // Display actor
a2f76b15 502 GetPipeline(anId)->AddToRenderer(aRenderer);
52f99d93 503
504 // Compute selection for displayed actors
505 GetPicker()->SetSelectionMode (SM_Shape, Standard_True);
506 }
507 }
508
509 // Redraw window
510 aRenderer->ResetCamera();
511 GetInteractor()->GetRenderWindow()->Render();
512
513 return 0;
514}
515
516//================================================================
517// Function : VtkErase
518// Purpose :
519//================================================================
520static Standard_Integer VtkErase (Draw_Interpretor& theDI,
521 Standard_Integer theArgNum,
522 const char** theArgs)
523{
524 // Check viewer
525 if (!GetInteractor()->IsEnabled())
526 {
527 theDI << theArgs[0] << " error : call ivtkinit before\n";
528 return 1; // TCL_ERROR
529 }
530
531 vtkSmartPointer<vtkRenderer> aRenderer = GetRenderer();
532 // Erase all objects
533 if (theArgNum == 1)
534 {
535 DoubleMapOfActorsAndNames::Iterator anIterator (GetMapOfActors());
536 while (anIterator.More())
537 {
538 PipelineByActor (anIterator.Key1())->RemoveFromRenderer (aRenderer);
539 anIterator.Next();
540 }
541 }
542 // Erase named objects
543 else
544 {
545 TCollection_AsciiString aName;
546 for (Standard_Integer anIndex = 1; anIndex < theArgNum; ++anIndex)
547 {
548 aName = theArgs[anIndex];
549 if (GetMapOfActors().IsBound2 (aName))
550 {
551 PipelineByActorName (aName)->RemoveFromRenderer (aRenderer);
552 }
553 }
554 }
555
556 // Redraw window
557 aRenderer->ResetCamera();
558 GetInteractor()->GetRenderWindow()->Render();
559 return 0;
560}
561
562//================================================================
a2f76b15 563// Function : VtkRemove
564// Purpose : Remove the actor from memory.
565//================================================================
566static Standard_Integer VtkRemove(Draw_Interpretor& theDI,
567 Standard_Integer theArgNum,
568 const char** theArgs)
569{
570 // Check viewer
571 if (!GetInteractor()->IsEnabled())
572 {
573 theDI << theArgs[0] << " error : call ivtkinit before\n";
574 return 1; // TCL_ERROR
575 }
576
577 vtkSmartPointer<vtkRenderer> aRenderer = GetRenderer();
578
579 // Remove all objects
580 if (theArgNum == 1)
581 {
582 // Remove all actors from the renderer
583 DoubleMapOfActorsAndNames::Iterator anIterator(GetMapOfActors());
584 while (anIterator.More())
585 {
586 vtkSmartPointer<IVtkTools_ShapeDataSource> aSrc =
587 IVtkTools_ShapeObject::GetShapeSource(anIterator.Key1());
588 if (aSrc.GetPointer() != NULL && !(aSrc->GetShape().IsNull()))
589 {
590 GetPicker()->RemoveSelectableObject(aSrc->GetShape());
591 }
592 else
593 {
594 aRenderer->RemoveActor(anIterator.Key1());
595 }
596 anIterator.Next();
597 }
598 // Remove all pipelines from the renderer
599 for (ShapePipelineMap::Iterator anIt(*GetPipelines()); anIt.More(); anIt.Next())
600 {
601 anIt.Value()->RemoveFromRenderer(aRenderer);
602 }
603 // Clear maps and remove all TopoDS_Shapes, actors and pipelines
604 GetMapOfShapes().Clear();
605 GetMapOfActors().Clear();
606 GetPipelines()->Clear();
607 }
608 // Remove named objects
609 else
610 {
611 TCollection_AsciiString aName;
612 for (Standard_Integer anIndex = 1; anIndex < theArgNum; ++anIndex)
613 {
614 aName = theArgs[anIndex];
615 if (GetMapOfActors().IsBound2(aName))
616 {
617 // Remove the actor and its pipeline (if found) from the renderer
618 vtkSmartPointer<vtkActor> anActor = GetMapOfActors().Find2(aName);
619 vtkSmartPointer<IVtkTools_ShapeDataSource> aSrc =
620 IVtkTools_ShapeObject::GetShapeSource(anActor);
621 if (aSrc.GetPointer() != NULL && !(aSrc->GetShape().IsNull()))
622 {
623 IVtk_IdType aShapeID = aSrc->GetShape()->GetId();
624 GetPicker()->RemoveSelectableObject(aSrc->GetShape());
625 GetPipeline(aSrc->GetShape()->GetId())->RemoveFromRenderer(aRenderer);
626 GetPipelines()->UnBind(aShapeID); // Remove a pipepline
627 }
628 else
629 {
630 aRenderer->RemoveActor(anActor);
631 }
632 // Remove the TopoDS_Shape and the actor
633 GetMapOfShapes().UnBind2(aName); // Remove a TopoDS shape
634 GetMapOfActors().UnBind2(aName); // Remove an actor
635 }
636 }
637 }
638
639 // Redraw window
640 aRenderer->ResetCamera();
641 GetInteractor()->GetRenderWindow()->Render();
642 return 0;
643}
644
645//================================================================
52f99d93 646// Function : VtkSetDisplayMode
647// Purpose :
648// Draw args : ivtksetdispmode [name] mode(0,1)
649//================================================================
650static Standard_Integer VtkSetDisplayMode (Draw_Interpretor& theDI,
651 Standard_Integer theArgNum,
652 const char** theArgs)
653{
654 // Check viewer
655 if (!GetInteractor()->IsEnabled())
656 {
657 theDI << theArgs[0] << " error: call ivtkinit before\n";
658 return 1; // TCL_ERROR
659 }
660
661 // Check arguments
662 if (theArgNum != 2 && theArgNum != 3)
663 {
664 theDI << theArgs[0] << " error: expects 1 or 2 arguments\n";
665 return 1; // TCL_ERROR
666 }
667
668 vtkSmartPointer<vtkActor> anActor;
669 // Set disp mode for all objects
670 if (theArgNum == 2)
671 {
672 // Get mode
673 Standard_Integer aMode = Draw::Atoi (theArgs[1]);
674 DoubleMapOfActorsAndNames::Iterator anIter (GetMapOfActors());
675 while (anIter.More())
676 {
677 anActor = anIter.Key1();
678 IVtkTools_ShapeDataSource* aSrc = IVtkTools_ShapeObject::GetShapeSource (anActor);
679 if (aSrc)
680 {
681 IVtkOCC_Shape::Handle anOccShape = aSrc->GetShape();
682 if (!anOccShape.IsNull())
683 {
684 IVtkTools_DisplayModeFilter* aFilter = GetPipeline ( anOccShape->GetId() )->GetDisplayModeFilter();
685 aFilter->SetDisplayMode((IVtk_DisplayMode)aMode);
686 aFilter->Modified();
687 aFilter->Update();
688 }
689 }
690 anIter.Next();
691 }
692 }
693 // Set disp mode for named object
694 else
695 {
696 Standard_Integer aMode = atoi(theArgs[2]);
697 TCollection_AsciiString aName = theArgs[1];
698 if (GetMapOfActors().IsBound2 (aName))
699 {
700 anActor = GetMapOfActors().Find2 (aName);
701 vtkSmartPointer<IVtkTools_ShapeDataSource> aSrc = IVtkTools_ShapeObject::GetShapeSource (anActor);
702 if (aSrc)
703 {
704 IVtkOCC_Shape::Handle anOccShape = aSrc->GetShape();
705 if (!anOccShape.IsNull())
706 {
707 IVtkTools_DisplayModeFilter* aFilter = GetPipeline (anOccShape->GetId())->GetDisplayModeFilter();
708 aFilter->SetDisplayMode ((IVtk_DisplayMode)aMode);
709 aFilter->Modified();
710 aFilter->Update();
711 }
712 }
713 }
714 }
715
716 // Redraw window
717 GetInteractor()->Render();
718 return 0;
719}
720
721//================================================================
4db6748c 722// Function : VtkSetBoundaryDraw
723// Purpose :
724// Draw args : ivtksetboundingdraw [name] draw on/off(0,1)
725//================================================================
726static Standard_Integer VtkSetBoundaryDraw(Draw_Interpretor& theDI,
727 Standard_Integer theArgNum,
728 const char** theArgs)
729{
730 // Check viewer
731 if (!GetInteractor()->IsEnabled())
732 {
733 theDI << theArgs[0] << " error: call ivtkinit before\n";
734 return 1; // TCL_ERROR
735 }
736
737 // Check arguments
738 if (theArgNum != 2 && theArgNum != 3)
739 {
740 theDI << theArgs[0] << " error: expects 1 or 2 arguments\n";
741 return 1; // TCL_ERROR
742 }
743
744 vtkSmartPointer<vtkActor> anActor;
745 // Set disp mode for all objects
746 if (theArgNum == 2)
747 {
748 // Get mode
749 Standard_Integer toDraw = Draw::Atoi(theArgs[1]);
750 DoubleMapOfActorsAndNames::Iterator anIter(GetMapOfActors());
751 while (anIter.More())
752 {
753 anActor = anIter.Key1();
754 // Set Red color for boundary edges
755 vtkLookupTable* aTable = (vtkLookupTable*)anActor->GetMapper()->GetLookupTable();
756 IVtkTools::SetLookupTableColor(aTable, MT_SharedEdge, 1., 0., 0., 1.);
757
758 IVtkTools_ShapeDataSource* aSrc = IVtkTools_ShapeObject::GetShapeSource(anActor);
759 if (aSrc)
760 {
761 IVtkOCC_Shape::Handle anOccShape = aSrc->GetShape();
762 if (!anOccShape.IsNull())
763 {
764 IVtkTools_DisplayModeFilter* aFilter = GetPipeline(anOccShape->GetId())->GetDisplayModeFilter();
765 aFilter->SetDisplayMode(DM_Shading);
766 aFilter->SetFaceBoundaryDraw(toDraw != 0);
767 aFilter->Modified();
768 aFilter->Update();
769 }
770 }
771 anIter.Next();
772 }
773 }
774 // Set disp mode for named object
775 else
776 {
777 Standard_Integer toDraw = Draw::Atoi(theArgs[2]);
778 TCollection_AsciiString aName = theArgs[1];
779 if (GetMapOfActors().IsBound2(aName))
780 {
781 anActor = GetMapOfActors().Find2(aName);
782 // Set Red color for boundary edges
783 vtkLookupTable* aTable = (vtkLookupTable*)anActor->GetMapper()->GetLookupTable();
784 IVtkTools::SetLookupTableColor(aTable, MT_SharedEdge, 1., 0., 0., 1.);
785
786 vtkSmartPointer<IVtkTools_ShapeDataSource> aSrc = IVtkTools_ShapeObject::GetShapeSource(anActor);
787 if (aSrc)
788 {
789 IVtkOCC_Shape::Handle anOccShape = aSrc->GetShape();
790 if (!anOccShape.IsNull())
791 {
792 IVtkTools_DisplayModeFilter* aFilter = GetPipeline(anOccShape->GetId())->GetDisplayModeFilter();
793 aFilter->SetDisplayMode(DM_Shading);
794 aFilter->SetFaceBoundaryDraw(toDraw != 0);
795 aFilter->Modified();
796 aFilter->Update();
797 }
798 }
799 }
800 }
801
802 // Redraw window
803 GetInteractor()->Render();
804 return 0;
805}
806
807
808//================================================================
52f99d93 809// Function : VtkSetSelectionMode
810// Purpose :
811// Draw args : ivtksetselmode [name] mode on/off(0,1)
812//================================================================
813static Standard_Integer VtkSetSelectionMode (Draw_Interpretor& theDI,
814 Standard_Integer theArgNum,
815 const char** theArgs)
816{
817 // Check viewer
818 if (!GetInteractor()->IsEnabled())
819 {
820 theDI << theArgs[0] << " error: call ivtkinit before\n";
821 return 1; // TCL_ERROR
822 }
823
824 // Check arguments
825 if (theArgNum != 3 && theArgNum != 4)
826 {
827 theDI << theArgs[0] << " error: expects 2 or 3 arguments\n";
828 return 1; // TCL_ERROR
829 }
830
831 vtkSmartPointer<vtkActor> anActor;
832 Standard_Integer aMode;
833 Standard_Boolean isTurnOn;
834 // Set sel mode for all objects
835 if (theArgNum == 3)
836 {
837 aMode = atoi (theArgs[1]);
dde68833 838 isTurnOn = (atoi (theArgs[2]) != 0);
52f99d93 839 if (aMode < 0 || aMode > 8)
840 {
841 theDI << theArgs[0] << " error: only 0-8 selection modes are supported\n";
842 return 1; // TCL_ERROR
843 }
844 DoubleMapOfActorsAndNames::Iterator anIter (GetMapOfActors());
845 while (anIter.More())
846 {
847 anActor = anIter.Key1();
848
849 if (aMode == SM_Shape && isTurnOn)
850 {
851 IVtk_SelectionModeList aList = GetPicker()->GetSelectionModes (anActor);
852 IVtk_SelectionModeList::Iterator anIt (aList);
853 // Turn off all sel modes differed from SM_Shape
854 while (anIt.More())
855 {
856 IVtk_SelectionMode aCurMode = anIt.Value();
857 if (SM_Shape != aCurMode)
858 {
859 GetPicker()->SetSelectionMode (anActor, aCurMode, Standard_False);
860 }
861 anIt.Next();
862 }
863 GetPicker()->SetSelectionMode (anActor, SM_Shape);
864 }
865
866 if (aMode != SM_Shape)
867 {
868 if (isTurnOn)
869 {
870 GetPicker()->SetSelectionMode (anActor, (IVtk_SelectionMode)aMode);
871 GetPicker()->SetSelectionMode (anActor, SM_Shape, Standard_False);
872 if (aMode == SM_Vertex)
873 {
874 GetPipeline( IVtkTools_ShapeObject::GetShapeSource(anActor)->GetShape()->GetId() )->SharedVerticesSelectionOn();
875 }
876 }
877 else
878 {
879 GetPicker()->SetSelectionMode (anActor, (IVtk_SelectionMode)aMode, Standard_False);
880 IVtk_SelectionModeList aList = GetPicker()->GetSelectionModes (anActor);
881 if (!aList.Size())
882 {
883 GetPicker()->SetSelectionMode(anActor, SM_Shape);
884 }
885 if (aMode == SM_Vertex)
886 {
887 GetPipeline( IVtkTools_ShapeObject::GetShapeSource(anActor)->GetShape()->GetId() )->SharedVerticesSelectionOff();
888 }
889 }
890 }
891 anIter.Next();
892 }
893 }
894
895 // Set sel mode for named object
896 if (theArgNum == 4)
897 {
898 aMode = atoi (theArgs[2]);
dde68833 899 isTurnOn = (atoi (theArgs[3]) != 0);
52f99d93 900
901 if (aMode < 0 || aMode > 8)
902 {
903 theDI << theArgs[0] << " error: only 0-8 selection modes are supported\n";
904 return 1; // TCL_ERROR
905 }
906
907 TCollection_AsciiString aName = theArgs[1];
908 if (GetMapOfActors().IsBound2 (aName))
909 {
910 anActor = GetMapOfActors().Find2 (aName);
911
912 if (aMode == SM_Shape && isTurnOn)
913 {
914 IVtk_SelectionModeList aList = GetPicker()->GetSelectionModes (anActor);
915 IVtk_SelectionModeList::Iterator anIt (aList);
916 // Turn off all sel modes differed from SM_Shape
917 while (anIt.More())
918 {
919 IVtk_SelectionMode aCurMode = anIt.Value();
920 if (SM_Shape != aCurMode)
921 {
922 GetPicker()->SetSelectionMode (anActor, aCurMode, Standard_False);
923 }
924 anIt.Next();
925 }
926 GetPicker()->SetSelectionMode (anActor, SM_Shape);
927 }
928
929 if (aMode != SM_Shape)
930 {
931 if (isTurnOn)
932 {
933 GetPicker()->SetSelectionMode (anActor, (IVtk_SelectionMode)aMode);
934 GetPicker()->SetSelectionMode (anActor, SM_Shape, Standard_False);
935 if (aMode == SM_Vertex)
936 {
937 GetPipeline( IVtkTools_ShapeObject::GetShapeSource(anActor)->GetShape()->GetId() )->SharedVerticesSelectionOn();
938 }
939 }
940 else
941 {
942 GetPicker()->SetSelectionMode (anActor, (IVtk_SelectionMode)aMode, Standard_False);
943 IVtk_SelectionModeList aList = GetPicker()->GetSelectionModes (anActor);
944 if (!aList.Size())
945 {
946 GetPicker()->SetSelectionMode(anActor, SM_Shape);
947 }
948 if (aMode == SM_Vertex)
949 {
950 GetPipeline( IVtkTools_ShapeObject::GetShapeSource(anActor)->GetShape()->GetId() )->SharedVerticesSelectionOff();
951 }
952 }
953 }
954 }
955 }
956
957 // Redraw window
958 GetInteractor()->Render();
959
960 return 0;
961}
962
963//================================================================
964// Function : VtkMoveTo
965// Purpose :
966// Draw args : ivtkmoveto x y
967//================================================================
968static Standard_Integer VtkMoveTo(Draw_Interpretor& theDI,
969 Standard_Integer theArgNum,
970 const char** theArgs)
971{
972 // Check viewer
973 if (!GetInteractor()->IsEnabled())
974 {
975 theDI << theArgs[0] << " error: call ivtkinit before\n";
976 return 1; // TCL_ERROR
977 }
978
979 // Check args
980 if (theArgNum != 3)
981 {
982 theDI << theArgs[0] << " error: expects 2 arguments\n";
983 return 1; // TCL_ERROR
984 }
985
986 Standard_Integer anY = GetInteractor()->GetRenderWindow()->GetSize()[1] - atoi (theArgs[2]) - 1;
987 GetInteractor()->MoveTo (atoi (theArgs[1]), anY);
1e756cb9 988
989 gp_XYZ aPickPnt;
990 GetInteractor()->Selector()->GetPickPosition (aPickPnt.ChangeData());
991 theDI << aPickPnt.X() << " " << aPickPnt.Y() << " " << aPickPnt.Z();
52f99d93 992 return 0;
993}
994
995//================================================================
996// Function : VtkSelect
997// Purpose :
998// Draw args : ivtkselect x y
999//================================================================
1000static Standard_Integer VtkSelect (Draw_Interpretor& theDI,
1001 Standard_Integer theArgNum,
1002 const char** theArgs)
1003{
1004 // Check viewer
1005 if (!GetInteractor()->IsEnabled())
1006 {
1007 theDI << theArgs[0] << " error: call ivtkinit before\n";
1008 return 1; // TCL_ERROR
1009 }
1010
1011 // Check args
1012 if (theArgNum != 3)
1013 {
1014 theDI << theArgs[0] << " error: expects 3 arguments\n";
1015 return 1; // TCL_ERROR
1016 }
1017
a2f76b15 1018 Standard_Integer anY = GetInteractor()->GetRenderWindow()->GetSize()[1] - atoi (theArgs[2]) - 1;
52f99d93 1019 GetInteractor()->MoveTo (atoi (theArgs[1]), anY);
1020 GetInteractor()->OnSelection();
1021 return 0;
1022
1023}
1024
1025//===================================================================
1026// Fubction : VtkFit
1027// Purpose :
1028// Draw args : ivtkfit
1029//===================================================================
1030
1031static Standard_Integer VtkFit (Draw_Interpretor& theDI,
1032 Standard_Integer,
1033 const char** theArgs)
1034{
1035 // Check viewer
1036 if (!GetInteractor()->IsEnabled())
1037 {
1038 theDI << theArgs[0] << " error : call ivtkinit before \n";
1039 return 1; //TCL_ERROR
1040 }
1041
1042 GetRenderer()->ResetCamera();
1043 GetInteractor()->Render();
1044 return 0;
1045}
1046
1047//===================================================================
1048// Fubction : VtkDump
1049// Purpose :
1050// Draw args : ivtkdump FullFilename.{png|bmp|jpeg|tiff|pnm}
1051// [buffer={rgb|rgba|depth}] [width height]
1052// [stereoproj={L|R}]
1053//===================================================================
1054static Standard_Integer VtkDump (Draw_Interpretor& theDI,
1055 Standard_Integer theArgNum,
1056 const char** theArgs)
1057{
1058 // Check viewer
1059 if (!GetInteractor()->IsEnabled())
1060 {
1061 std::cout << theArgs[0] << " error : call ivtkinit before \n";
1062 return 1;
1063 }
1064
1065 if (theArgNum < 2)
1066 {
1067 theDI << theArgs[0] << " error : wrong number of parameters. Type 'help"
1068 << theArgs[0] << "' for more information.\n";
1069 }
1070 vtkSmartPointer<vtkWindowToImageFilter> anImageFilter = vtkSmartPointer<vtkWindowToImageFilter>::New();
1071
1072 anImageFilter->SetInput (GetInteractor()->GetRenderWindow());
1073 // Set custom buffer type
1074 if (theArgNum > 2)
1075 {
1076 TCollection_AsciiString aBufferType (theArgs[2]);
1077 aBufferType.LowerCase();
1078 if (aBufferType.IsEqual ("rgb"))
1079 {
1080 anImageFilter->SetInputBufferTypeToRGB();
1081 }
1082 else if (aBufferType.IsEqual ("rgba"))
1083 {
1084 anImageFilter->SetInputBufferTypeToRGBA();
1085 }
1086 else if (aBufferType.IsEqual ("depth"))
1087 {
1088 anImageFilter->SetInputBufferTypeToZBuffer();
1089 }
1090 }
1091 anImageFilter->Update();
1092
1093 // Set custom stereo projection options
1094 if (theArgNum > 5 && GetRenderer()->GetRenderWindow()->GetStereoRender())
1095 {
1096 Standard_CString aStereoProjStr = theArgs[5];
1097
1098 Standard_Integer aStereoType = GetRenderer()->GetRenderWindow()->GetStereoType();
1099 if (strcasecmp (aStereoProjStr, "L"))
1100 {
1101 GetRenderer()->GetRenderWindow()->SetStereoTypeToLeft();
1102 GetRenderer()->GetRenderWindow()->StereoUpdate();
1103 anImageFilter->Update();
1104 GetRenderer()->GetRenderWindow()->SetStereoType (aStereoType);
1105 }
1106 else if (strcasecmp (aStereoProjStr, "R"))
1107 {
1108 GetRenderer()->GetRenderWindow()->SetStereoTypeToRight();
1109 GetRenderer()->GetRenderWindow()->StereoUpdate();
1110 anImageFilter->Update();
1111 GetRenderer()->GetRenderWindow()->SetStereoType (aStereoType);
1112 }
1113 else
1114 {
1115 theDI << theArgs[0] << " error: unknown value for stereo projection.\n";
1116 return 1;
1117 }
1118 }
1119
1120 // Set parameters for image writer
1121 vtkSmartPointer<vtkImageWriter> anImageWriter;
1122 TCollection_AsciiString aFilename (theArgs[1]);
1123 Standard_Integer anExtStart = aFilename.SearchFromEnd (TCollection_AsciiString("."));
1124 TCollection_AsciiString aFormat = (anExtStart == -1) ? TCollection_AsciiString("")
1125 : aFilename.SubString (anExtStart + 1, aFilename.Length());
1126 aFormat.LowerCase();
1127
1128 if (aFormat.IsEqual ("png"))
1129 {
1130 anImageWriter = vtkSmartPointer<vtkPNGWriter>::New();
1131 }
1132 else if (aFormat.IsEqual ("bmp"))
1133 {
1134 anImageWriter = vtkSmartPointer<vtkBMPWriter>::New();
1135 }
1136 else if (aFormat.IsEqual ("jpeg"))
1137 {
1138 anImageWriter = vtkSmartPointer<vtkJPEGWriter>::New();
1139 }
1140 else if (aFormat.IsEqual ("tiff"))
1141 {
1142 anImageWriter = vtkSmartPointer<vtkTIFFWriter>::New();
1143 }
1144 else if (aFormat.IsEqual ("pnm"))
1145 {
1146 anImageWriter = vtkSmartPointer<vtkPNMWriter>::New();
1147 }
1148 else // aFormat is unsupported or not set.
1149 {
1150 if (aFormat.IsEmpty())
1151 {
1152 theDI << theArgs[0] << " warning: the image format is not set.\n"
1153 << "The image will be saved into PNG format.\n";
1154 anImageWriter = vtkSmartPointer<vtkPNGWriter>::New();
1155 aFormat = TCollection_AsciiString ("png");
1156 if (anExtStart != -1)
1157 {
1158 aFilename.Split (anExtStart);
1159 }
1160 else
1161 {
1162 aFilename += ".";
1163 }
1164 aFilename += aFormat;
1165 }
1166 else
1167 {
1168 theDI << theArgs[0] << " error: the image format "
1169 << aFormat.ToCString() <<" is not supported.\n";
1170 return 1;
1171 }
1172
1173 }
1174
1175 anImageWriter->SetFileName (aFilename.ToCString());
1176
1177 Standard_Integer aWidth = (theArgNum > 3) ? atoi (theArgs[3]) : 0;
1178 Standard_Integer aHeight = (theArgNum > 4) ? atoi (theArgs[4]) : 0;
1179 if (aWidth >= 0 || aHeight >= 0)
1180 {
1181 // Scale image
1182 vtkSmartPointer<vtkImageResize> anImageResize = vtkSmartPointer<vtkImageResize>::New();
1183#if VTK_MAJOR_VERSION <= 5
1184 anImageResize->SetInput (anImageFilter->GetOutput());
1185#else
1186 anImageResize->SetInputData (anImageFilter->GetOutput());
1187#endif
1188
1189 anImageResize->SetOutputDimensions (aWidth, aHeight, 1);
1190 anImageResize->Update();
1191 anImageWriter->SetInputConnection (anImageResize->GetOutputPort());
1192 }
1193 else
1194 {
1195 anImageWriter->SetInputConnection (anImageFilter->GetOutputPort());
1196 }
1197 anImageWriter->Write();
1198
1199 return 0;
1200}
1201
1202//===================================================================
1203// Fubction : VtkBackgroundColor
1204// Purpose :
1205// Draw args : ivtkbgcolor r g b
1206// r,g,b = [0..255]
1207//===================================================================
1208static Standard_Integer VtkBackgroundColor (Draw_Interpretor& theDI,
1209 Standard_Integer theArgNum,
1210 const char** theArgs)
1211{
1212 if (theArgNum != 4 && theArgNum != 7)
1213 {
1214 theDI << theArgs[0] << " error : wrong number of parameters.\n"
1215 << "Type 'help " << theArgs[0] << "' for more information.\n";
1216 return 1;
1217 }
1218
1219 // Check viewer
1220 if (!GetInteractor()->IsEnabled())
1221 {
1222 std::cout << theArgs[0] << " error : call ivtkinit before \n";
1223 return 1;
1224 }
1225
1226 Standard_Real aR = Draw::Atof(theArgs[1])/255.0;
1227 Standard_Real aG = Draw::Atof(theArgs[2])/255.0;
1228 Standard_Real aB = Draw::Atof(theArgs[3])/255.0;
1229
1230 GetRenderer()->SetGradientBackground(false);
1231 GetRenderer()->SetBackground (aR, aG, aB);
1232
1233 if (theArgNum == 7)
1234 {
1235 Standard_Real aR2 = Draw::Atof(theArgs[4])/255.0;
1236 Standard_Real aG2 = Draw::Atof(theArgs[5])/255.0;
1237 Standard_Real aB2 = Draw::Atof(theArgs[6])/255.0;
1238
1239 GetRenderer()->SetBackground2(aR2, aG2, aB2);
1240 GetRenderer()->SetGradientBackground(true);
1241 }
1242
1243 GetInteractor()->Render();
1244
1245 return 0;
1246}
1247
1248//================================================================
1249// Function : Commands
1250// Purpose :
1251//================================================================
1252void IVtkDraw::Commands (Draw_Interpretor& theCommands)
1253{
1254 const char *group = "VtkViewer";
1255
1256 theCommands.Add("ivtkinit",
1257 "ivtkinit usage:\n"
1258 "ivtkinit [leftPx topPx widthPx heightPx]"
1259 "\n\t\t: Creates the Vtk window",
1260 __FILE__, VtkInit, group);
1261
1262 theCommands.Add("ivtkdisplay",
1263 "ivtkdisplay usage:\n"
1264 "ivtkdisplay name1 name2 ..."
1265 "\n\t\t: Displayes named objects in current view.",
1266 __FILE__, VtkDisplay, group);
1267
1268 theCommands.Add("ivtkerase",
1269 "ivtkerase usage:\n"
1270 "ivtkerase [name1 name2 ...]"
1271 "\n\t\t: Removes from renderer named objects or all objects.",
1272 __FILE__, VtkErase, group);
a2f76b15 1273
1274 theCommands.Add("ivtkremove",
1275 "ivtkremove usage:\n"
1276 "ivtkremove [name1 name2 ...]"
1277 "\n\t\t: Removes from renderer and from memory named objects or all objects.",
1278 __FILE__, VtkRemove, group);
52f99d93 1279
1280 theCommands.Add("ivtksetdispmode",
1281 "ivtksetdispmode usage:\n"
1282 "ivtksetdispmode [name] mode (0,1)"
1283 "\n\t\t: Sets or unsets display mode 'mode' to the object with name 'name' or to all objects"
1284 "if name is not defined.",
1285 __FILE__, VtkSetDisplayMode, group);
1286
4db6748c 1287 theCommands.Add("ivtksetboundingdraw",
1288 "ivtksetboundingdraw usage:\n"
1289 "ivtksetboundingdraw [name] draw on/off (0,1)"
1290 "\n\t\t: Sets or unsets boundaries drawing for shading display mode to the object with name 'name' or to all objects"
1291 "if name is not defined.",
1292 __FILE__, VtkSetBoundaryDraw, group);
1293
52f99d93 1294 theCommands.Add("ivtksetselmode",
1295 "ivtksetselmode usage:\n"
1296 " ivtksetselmode [name] mode on/off(0,1)"
1297 "\n\t\t: Sets or unsets selection mode 'mode' to the object with name 'name' or to the all displayed objects.",
1298 __FILE__, VtkSetSelectionMode, group);
1299
1300 theCommands.Add("ivtkmoveto",
1301 "ivtkmoveto usage:\n"
1302 "ivtkmoveto x y"
1303 "\n\t\t: Moves position to the pixel with coordinates (x,y). The object on this position is highlighted.",
1304 __FILE__, VtkMoveTo, group);
1305
1306 theCommands.Add("ivtkselect",
1307 "ivtkselect usage:\n"
1308 "ivtkselect x y"
1309 "\n\t\t: Selects object which correspond to the pixel with input coordinates (x,y).",
1310 __FILE__, VtkSelect, group);
1311
1312 theCommands.Add("ivtkfit",
1313 "ivtkfit usage:\n"
1314 "ivtkfit"
1315 "\n\t\t: Fits view according all displayed objects.",
1316 __FILE__, VtkFit, group);
1317
1318 theCommands.Add("ivtkdump",
1319 "ivtkdump usage:\n"
1320 "ivtkdump <FullFilename>.{png|bmp|jpeg|tiff|pnm} [buffer={rgb|rgba|depth}] [width height] [stereoproj={L|R}]"
1321 "\n\t\t: Dumps contents of viewer window to PNG, BMP, JPEG, TIFF or PNM file",
1322 __FILE__, VtkDump, group);
1323
1324 theCommands.Add("ivtkbgcolor",
1325 "ivtkbgcolor usage:\n"
1326 "ivtkbgcolor r g b [r2 g2 b2]\n"
1327 "\n\t\t: Sets uniform background color or gradient one if second triple of paramers is set."
1328 "Color parameters r,g,b = [0..255].",
1329 __FILE__, VtkBackgroundColor, group);
1330}
1331
1332
1333//================================================================
1334// Function : Factory
1335// Purpose :
1336//================================================================
1337void IVtkDraw::Factory (Draw_Interpretor& theDI)
1338{
1339 // definition of Viewer Commands
1340 IVtkDraw::Commands (theDI);
1341}
1342
1343// Declare entry point PLUGINFACTORY
1344DPLUGIN(IVtkDraw)
1345