VTK  9.7.1
vtkView.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
34 #ifndef vtkView_h
35 #define vtkView_h
36 
37 #include "vtkObject.h"
38 #include "vtkViewsCoreModule.h" // For export macro
39 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
40 
41 VTK_ABI_NAMESPACE_BEGIN
42 class vtkAlgorithmOutput;
43 class vtkCommand;
44 class vtkDataObject;
46 class vtkSelection;
47 class vtkViewTheme;
48 
49 class VTKVIEWSCORE_EXPORT VTK_MARSHALAUTO vtkView : public vtkObject
50 {
51 public:
52  static vtkView* New();
53  vtkTypeMacro(vtkView, vtkObject);
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
59  void AddRepresentation(vtkDataRepresentation* rep);
60 
64  void SetRepresentation(vtkDataRepresentation* rep);
65 
74  vtkDataRepresentation* AddRepresentationFromInputConnection(vtkAlgorithmOutput* conn);
75 
84  vtkDataRepresentation* SetRepresentationFromInputConnection(vtkAlgorithmOutput* conn);
85 
93  vtkDataRepresentation* AddRepresentationFromInput(vtkDataObject* input);
94 
102  vtkDataRepresentation* SetRepresentationFromInput(vtkDataObject* input);
103 
107  void RemoveRepresentation(vtkDataRepresentation* rep);
108 
112  void RemoveRepresentation(vtkAlgorithmOutput* rep);
113 
117  void RemoveAllRepresentations();
118 
122  int GetNumberOfRepresentations();
123 
127  vtkDataRepresentation* GetRepresentation(int index = 0);
128 
132  bool IsRepresentationPresent(vtkDataRepresentation* rep);
133 
137  virtual void Update();
138 
142  virtual void ApplyViewTheme(vtkViewTheme* vtkNotUsed(theme)) {}
143 
149  vtkCommand* GetObserver();
150 
152 
157  {
158  const char* Message;
159  double Progress;
161 
162  public:
163  ViewProgressEventCallData(const char* msg, double progress)
164  {
165  this->Message = msg;
166  this->Progress = progress;
167  }
168  ~ViewProgressEventCallData() { this->Message = nullptr; }
169 
173  const char* GetProgressMessage() const { return this->Message; }
174 
178  double GetProgress() const { return this->Progress; }
179  };
180 
190  void RegisterProgress(vtkObject* algorithm, const char* message = nullptr);
191 
195  void UnRegisterProgress(vtkObject* algorithm);
196 
197 protected:
198  vtkView();
199  ~vtkView() override;
200 
206  virtual void ProcessEvents(vtkObject* caller, unsigned long eventId, void* callData);
207 
214  virtual vtkDataRepresentation* CreateDefaultRepresentation(vtkAlgorithmOutput* conn);
215 
220  virtual void AddRepresentationInternal(vtkDataRepresentation* vtkNotUsed(rep)) {}
221  virtual void RemoveRepresentationInternal(vtkDataRepresentation* vtkNotUsed(rep)) {}
222 
224 
228  vtkSetMacro(ReuseSingleRepresentation, bool);
229  vtkGetMacro(ReuseSingleRepresentation, bool);
230  vtkBooleanMacro(ReuseSingleRepresentation, bool);
233 
234 private:
235  vtkView(const vtkView&) = delete;
236  void operator=(const vtkView&) = delete;
237 
238  class vtkImplementation;
239  vtkImplementation* Implementation;
240 
241  class Command;
242  friend class Command;
243  Command* Observer;
244 
245  class vtkInternal;
246  vtkInternal* Internal;
247 };
248 
249 VTK_ABI_NAMESPACE_END
250 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void AddRepresentationInternal(vtkDataRepresentation *rep)
Subclass "hooks" for notifying subclasses of vtkView when representations are added or removed...
Definition: vtkView.h:220
ViewProgressEventCallData(const char *msg, double progress)
Definition: vtkView.h:163
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:49
Proxy object to connect input/output ports.
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:34
superclass for callback/observer methods
Definition: vtkCommand.h:384
The superclass for all views.
Definition: vtkView.h:49
a simple class to control print indentation
Definition: vtkIndent.h:28
A ptr to an instance of ViewProgressEventCallData is provided in the call data when vtkCommand::ViewP...
Definition: vtkView.h:156
const char * GetProgressMessage() const
Get the message.
Definition: vtkView.h:173
The superclass for all representations.
virtual void RemoveRepresentationInternal(vtkDataRepresentation *rep)
Meant for use by subclasses and vtkRepresentation subclasses.
Definition: vtkView.h:221
virtual void ApplyViewTheme(vtkViewTheme *theme)
Apply a theme to the view.
Definition: vtkView.h:142
bool ReuseSingleRepresentation
Meant for use by subclasses and vtkRepresentation subclasses.
Definition: vtkView.h:230
#define VTK_MARSHALAUTO
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:55
double GetProgress() const
Get the progress value in range [0.0, 1.0].
Definition: vtkView.h:178