VTK  9.0.1
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 -------------------------------------------------------------------------*/
44 #ifndef vtkView_h
45 #define vtkView_h
46 
47 #include "vtkObject.h"
48 #include "vtkViewsCoreModule.h" // For export macro
49 
50 class vtkAlgorithmOutput;
51 class vtkCommand;
52 class vtkDataObject;
54 class vtkSelection;
55 class vtkViewTheme;
56 
57 class VTKVIEWSCORE_EXPORT vtkView : public vtkObject
58 {
59 public:
60  static vtkView* New();
61  vtkTypeMacro(vtkView, vtkObject);
62  void PrintSelf(ostream& os, vtkIndent indent) override;
63 
67  void AddRepresentation(vtkDataRepresentation* rep);
68 
72  void SetRepresentation(vtkDataRepresentation* rep);
73 
82  vtkDataRepresentation* AddRepresentationFromInputConnection(vtkAlgorithmOutput* conn);
83 
92  vtkDataRepresentation* SetRepresentationFromInputConnection(vtkAlgorithmOutput* conn);
93 
101  vtkDataRepresentation* AddRepresentationFromInput(vtkDataObject* input);
102 
110  vtkDataRepresentation* SetRepresentationFromInput(vtkDataObject* input);
111 
115  void RemoveRepresentation(vtkDataRepresentation* rep);
116 
120  void RemoveRepresentation(vtkAlgorithmOutput* rep);
121 
125  void RemoveAllRepresentations();
126 
130  int GetNumberOfRepresentations();
131 
135  vtkDataRepresentation* GetRepresentation(int index = 0);
136 
140  bool IsRepresentationPresent(vtkDataRepresentation* rep);
141 
145  virtual void Update();
146 
150  virtual void ApplyViewTheme(vtkViewTheme* vtkNotUsed(theme)) {}
151 
157  vtkCommand* GetObserver();
158 
160 
165  {
166  const char* Message;
167  double Progress;
169 
170  public:
171  ViewProgressEventCallData(const char* msg, double progress)
172  {
173  this->Message = msg;
174  this->Progress = progress;
175  }
176  ~ViewProgressEventCallData() { this->Message = nullptr; }
177 
181  const char* GetProgressMessage() const { return this->Message; }
182 
186  double GetProgress() const { return this->Progress; }
187  };
188 
198  void RegisterProgress(vtkObject* algorithm, const char* message = nullptr);
199 
203  void UnRegisterProgress(vtkObject* algorithm);
204 
205 protected:
206  vtkView();
207  ~vtkView() override;
208 
214  virtual void ProcessEvents(vtkObject* caller, unsigned long eventId, void* callData);
215 
222  virtual vtkDataRepresentation* CreateDefaultRepresentation(vtkAlgorithmOutput* conn);
223 
228  virtual void AddRepresentationInternal(vtkDataRepresentation* vtkNotUsed(rep)) {}
229  virtual void RemoveRepresentationInternal(vtkDataRepresentation* vtkNotUsed(rep)) {}
230 
232 
236  vtkSetMacro(ReuseSingleRepresentation, bool);
237  vtkGetMacro(ReuseSingleRepresentation, bool);
238  vtkBooleanMacro(ReuseSingleRepresentation, bool);
241 
242 private:
243  vtkView(const vtkView&) = delete;
244  void operator=(const vtkView&) = delete;
245 
246  class vtkImplementation;
247  vtkImplementation* Implementation;
248 
249  class Command;
250  friend class Command;
251  Command* Observer;
252 
253  class vtkInternal;
254  vtkInternal* Internal;
255 };
256 
257 #endif
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
Apply a theme to the view.
Definition: vtkView.h:150
abstract base class for most VTK objects
Definition: vtkObject.h:56
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:171
const char * GetProgressMessage() const
Get the message.
Definition: vtkView.h:181
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:57
virtual void AddRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Subclass "hooks" for notifying subclasses of vtkView when representations are added or removed...
Definition: vtkView.h:228
Proxy object to connect input/output ports.
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:42
superclass for callback/observer methods
Definition: vtkCommand.h:377
The superclass for all views.
Definition: vtkView.h:57
a simple class to control print indentation
Definition: vtkIndent.h:33
A ptr to an instance of ViewProgressEventCallData is provided in the call data when vtkCommand::ViewP...
Definition: vtkView.h:164
The superclass for all representations.
bool ReuseSingleRepresentation
Meant for use by subclasses and vtkRepresentation subclasses.
Definition: vtkView.h:238
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:59
virtual void RemoveRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Meant for use by subclasses and vtkRepresentation subclasses.
Definition: vtkView.h:229
double GetProgress() const
Get the progress value in range [0.0, 1.0].
Definition: vtkView.h:186