VTK
vtkSynchronizedRenderWindows.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSynchronizedRenderWindows.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
27 #ifndef vtkSynchronizedRenderWindows_h
28 #define vtkSynchronizedRenderWindows_h
29 
30 #include "vtkRenderingParallelModule.h" // For export macro
31 #include "vtkObject.h"
32 
33 class vtkRenderWindow;
35 class vtkCommand;
37 
38 class VTKRENDERINGPARALLEL_EXPORT vtkSynchronizedRenderWindows : public vtkObject
39 {
40 public:
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
46 
51  void SetRenderWindow(vtkRenderWindow*);
52  vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
54 
56 
60  void SetParallelController(vtkMultiProcessController*);
61  vtkGetObjectMacro(ParallelController, vtkMultiProcessController);
63 
65 
75  void SetIdentifier(unsigned int id);
76  vtkGetMacro(Identifier, unsigned int);
78 
80 
85  vtkSetMacro(ParallelRendering, bool);
86  vtkGetMacro(ParallelRendering, bool);
87  vtkBooleanMacro(ParallelRendering, bool);
89 
90  // Turns on/off render event propagation. When on (the default) and
91  // ParallelRendering is on, process 0 will send an RMI call to all remote
92  // processes to perform a synchronized render. When off, render must be
93  // manually called on each process.
94  vtkSetMacro(RenderEventPropagation, bool);
95  vtkGetMacro(RenderEventPropagation, bool);
96  vtkBooleanMacro(RenderEventPropagation, bool);
97 
102  virtual void AbortRender();
103 
105 
110  vtkSetMacro(RootProcessId, int);
111  vtkGetMacro(RootProcessId, int);
113 
114  enum
115  {
116  SYNC_RENDER_TAG = 15001,
117  };
118 protected:
120  ~vtkSynchronizedRenderWindows() override;
121 
123  {
124  int WindowSize[2];
125  int TileScale[2];
126  double TileViewport[4];
128 
129  // Save/restore the struct to/from a stream.
130  void Save(vtkMultiProcessStream& stream);
131  bool Restore(vtkMultiProcessStream& stream);
132  void CopyFrom(vtkRenderWindow*);
133  void CopyTo(vtkRenderWindow*);
134  };
135 
136  // These methods are called on all processes as a consequence of corresponding
137  // events being called on the render window.
138  virtual void HandleStartRender();
139  virtual void HandleEndRender() {}
140  virtual void HandleAbortRender() {}
141 
142  virtual void MasterStartRender();
143  virtual void SlaveStartRender();
144 
145  unsigned int Identifier;
149 
152 
153 private:
155  void operator=(const vtkSynchronizedRenderWindows&) = delete;
156 
157  class vtkObserver;
158  vtkObserver* Observer;
159  friend class vtkObserver;
160 
161 };
162 
163 #endif
164 
165 
abstract base class for most VTK objects
Definition: vtkObject.h:59
synchronizes render windows across processes.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
stream used to pass data across processes using vtkMultiProcessController.
superclass for callback/observer methods
Definition: vtkCommand.h:370
a simple class to control print indentation
Definition: vtkIndent.h:39
create a window for renderers to draw into
vtkMultiProcessController * ParallelController
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Multiprocessing communication superclass.