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 -------------------------------------------------------------------------*/
41 #ifndef vtkView_h
42 #define vtkView_h
43 
44 #include "vtkObject.h"
45 #include "vtkViewsCoreModule.h" // For export macro
46 
47 class vtkAlgorithmOutput;
48 class vtkCommand;
49 class vtkDataObject;
51 class vtkSelection;
52 class vtkViewTheme;
53 
54 class VTKVIEWSCORE_EXPORT vtkView : public vtkObject
55 {
56 public:
57  static vtkView* New();
58  vtkTypeMacro(vtkView, vtkObject);
59  void PrintSelf(ostream& os, vtkIndent indent) override;
60 
65 
70 
80 
90 
99 
108 
113 
118 
123 
128 
133 
138 
142  virtual void Update();
143 
147  virtual void ApplyViewTheme(vtkViewTheme* vtkNotUsed(theme)) {}
148 
155 
157 
162  {
163  const char* Message;
164  double Progress;
166 
167  public:
168  ViewProgressEventCallData(const char* msg, double progress)
169  {
170  this->Message = msg;
171  this->Progress = progress;
172  }
173  ~ViewProgressEventCallData() { this->Message = nullptr; }
174 
178  const char* GetProgressMessage() const { return this->Message; }
179 
183  double GetProgress() const { return this->Progress; }
184  };
185 
195  void RegisterProgress(vtkObject* algorithm, const char* message = nullptr);
196 
200  void UnRegisterProgress(vtkObject* algorithm);
201 
202 protected:
204  ~vtkView() override;
205 
211  virtual void ProcessEvents(vtkObject* caller, unsigned long eventId, void* callData);
212 
220 
225  virtual void AddRepresentationInternal(vtkDataRepresentation* vtkNotUsed(rep)) {}
226  virtual void RemoveRepresentationInternal(vtkDataRepresentation* vtkNotUsed(rep)) {}
227 
229 
233  vtkSetMacro(ReuseSingleRepresentation, bool);
234  vtkGetMacro(ReuseSingleRepresentation, bool);
235  vtkBooleanMacro(ReuseSingleRepresentation, bool);
238 
239 private:
240  vtkView(const vtkView&) = delete;
241  void operator=(const vtkView&) = delete;
242 
243  class vtkImplementation;
244  vtkImplementation* Implementation;
245 
246  class Command;
247  friend class Command;
248  Command* Observer;
249 
250  class vtkInternal;
251  vtkInternal* Internal;
252 };
253 
254 #endif
Proxy object to connect input/output ports.
superclass for callback/observer methods
Definition: vtkCommand.h:378
general representation of visualization data
Definition: vtkDataObject.h:60
The superclass for all representations.
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:54
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:58
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:43
A ptr to an instance of ViewProgressEventCallData is provided in the call data when vtkCommand::ViewP...
Definition: vtkView.h:162
double GetProgress() const
Get the progress value in range [0.0, 1.0].
Definition: vtkView.h:183
ViewProgressEventCallData(const char *msg, double progress)
Definition: vtkView.h:168
const char * GetProgressMessage() const
Get the message.
Definition: vtkView.h:178
The superclass for all views.
Definition: vtkView.h:55
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
Apply a theme to the view.
Definition: vtkView.h:147
vtkDataRepresentation * AddRepresentationFromInputConnection(vtkAlgorithmOutput *conn)
Convenience method which creates a simple representation with the connection and adds it to the view.
static vtkView * New()
void RemoveRepresentation(vtkAlgorithmOutput *rep)
Removes any representation with this connection from the view.
void UnRegisterProgress(vtkObject *algorithm)
Unregister objects previously registered with RegisterProgress.
vtkDataRepresentation * AddRepresentationFromInput(vtkDataObject *input)
Convenience method which creates a simple representation with the specified input and adds it to the ...
virtual void Update()
Update the view.
virtual vtkDataRepresentation * CreateDefaultRepresentation(vtkAlgorithmOutput *conn)
Create a default vtkDataRepresentation for the given vtkAlgorithmOutput.
vtkDataRepresentation * SetRepresentationFromInputConnection(vtkAlgorithmOutput *conn)
Convenience method which sets the representation with the connection and adds it to the view.
virtual void AddRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Subclass "hooks" for notifying subclasses of vtkView when representations are added or removed.
Definition: vtkView.h:225
vtkDataRepresentation * GetRepresentation(int index=0)
The representation at a specified index.
virtual void ProcessEvents(vtkObject *caller, unsigned long eventId, void *callData)
Called to process events.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void RegisterProgress(vtkObject *algorithm, const char *message=nullptr)
Meant for use by subclasses and vtkRepresentation subclasses.
~vtkView() override
int GetNumberOfRepresentations()
Returns the number of representations from first port(0) in this view.
void RemoveAllRepresentations()
Removes all representations from the view.
vtkDataRepresentation * SetRepresentationFromInput(vtkDataObject *input)
Convenience method which sets the representation to the specified input and adds it to the view.
virtual void RemoveRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Definition: vtkView.h:226
void SetRepresentation(vtkDataRepresentation *rep)
Set the representation to the view.
void RemoveRepresentation(vtkDataRepresentation *rep)
Removes the representation from the view.
bool IsRepresentationPresent(vtkDataRepresentation *rep)
Check to see if a representation is present in the view.
vtkCommand * GetObserver()
Returns the observer that the subclasses can use to listen to additional events.
void AddRepresentation(vtkDataRepresentation *rep)
Adds the representation to the view.
bool ReuseSingleRepresentation
Definition: vtkView.h:235
@ index
Definition: vtkX3D.h:252
@ progress
Definition: vtkX3D.h:458