VTK
vtkView.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkView.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 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
47 #ifndef vtkView_h
48 #define vtkView_h
49 
50 #include "vtkViewsCoreModule.h" // For export macro
51 #include "vtkObject.h"
52 
53 class vtkAlgorithmOutput;
54 class vtkCommand;
55 class vtkDataObject;
57 class vtkSelection;
58 class vtkViewTheme;
59 
60 class VTKVIEWSCORE_EXPORT vtkView : public vtkObject
61 {
62 public:
63  static vtkView *New();
64  vtkTypeMacro(vtkView, vtkObject);
65  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
70  void AddRepresentation(vtkDataRepresentation* rep);
71 
75  void SetRepresentation(vtkDataRepresentation* rep);
76 
85  vtkDataRepresentation* AddRepresentationFromInputConnection(vtkAlgorithmOutput* conn);
86 
95  vtkDataRepresentation* SetRepresentationFromInputConnection(vtkAlgorithmOutput* conn);
96 
104  vtkDataRepresentation* AddRepresentationFromInput(vtkDataObject* input);
105 
113  vtkDataRepresentation* SetRepresentationFromInput(vtkDataObject* input);
114 
118  void RemoveRepresentation(vtkDataRepresentation* rep);
119 
123  void RemoveRepresentation(vtkAlgorithmOutput* rep);
124 
128  void RemoveAllRepresentations();
129 
133  int GetNumberOfRepresentations();
134 
138  vtkDataRepresentation* GetRepresentation(int index = 0);
139 
143  bool IsRepresentationPresent(vtkDataRepresentation* rep);
144 
148  virtual void Update();
149 
153  virtual void ApplyViewTheme(vtkViewTheme* vtkNotUsed(theme)) { }
154 
160  vtkCommand* GetObserver();
161 
163 
168  {
169  const char* Message;
170  double Progress;
172 
173  public:
174  ViewProgressEventCallData(const char* msg, double progress)
175  {
176  this->Message = msg;
177  this->Progress = progress;
178  }
180  {
181  this->Message = nullptr;
182  }
183 
187  const char* GetProgressMessage() const
188  { return this->Message; }
189 
193  double GetProgress() const
194  { return this->Progress; }
195  };
196 
206  void RegisterProgress(vtkObject* algorithm, const char* message=nullptr);
207 
211  void UnRegisterProgress(vtkObject* algorithm);
212 
213 protected:
214  vtkView();
215  ~vtkView() override;
216 
222  virtual void ProcessEvents(vtkObject* caller, unsigned long eventId,
223  void* callData);
224 
231  virtual vtkDataRepresentation* CreateDefaultRepresentation(vtkAlgorithmOutput* conn);
232 
237  virtual void AddRepresentationInternal(vtkDataRepresentation* vtkNotUsed(rep)) {}
238  virtual void RemoveRepresentationInternal(vtkDataRepresentation* vtkNotUsed(rep)) {}
239 
241 
245  vtkSetMacro(ReuseSingleRepresentation, bool);
246  vtkGetMacro(ReuseSingleRepresentation, bool);
247  vtkBooleanMacro(ReuseSingleRepresentation, bool);
250 
251 private:
252  vtkView(const vtkView&) = delete;
253  void operator=(const vtkView&) = delete;
254 
255  class vtkImplementation;
256  vtkImplementation* Implementation;
257 
258  class Command;
259  friend class Command;
260  Command* Observer;
261 
262  class vtkInternal;
263  vtkInternal* Internal;
264 
265 };
266 
267 #endif
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
Apply a theme to the view.
Definition: vtkView.h:153
abstract base class for most VTK objects
Definition: vtkObject.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
ViewProgressEventCallData(const char *msg, double progress)
Definition: vtkView.h:174
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:63
virtual void AddRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Subclass "hooks" for notifying subclasses of vtkView when representations are added or removed...
Definition: vtkView.h:237
Proxy object to connect input/output ports.
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:48
superclass for callback/observer methods
Definition: vtkCommand.h:370
The superclass for all views.
Definition: vtkView.h:60
a simple class to control print indentation
Definition: vtkIndent.h:39
A ptr to an instance of ViewProgressEventCallData is provided in the call data when vtkCommand::ViewP...
Definition: vtkView.h:167
const char * GetProgressMessage() const
Get the message.
Definition: vtkView.h:187
The superclass for all representations.
bool ReuseSingleRepresentation
Meant for use by subclasses and vtkRepresentation subclasses.
Definition: vtkView.h:247
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
general representation of visualization data
Definition: vtkDataObject.h:64
virtual void RemoveRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Meant for use by subclasses and vtkRepresentation subclasses.
Definition: vtkView.h:238
double GetProgress() const
Get the progress value in range [0.0, 1.0].
Definition: vtkView.h:193