VTK  9.1.0
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 -------------------------------------------------------------------------*/
50 #ifndef vtkView_h
51 #define vtkView_h
52 
53 #include "vtkObject.h"
54 #include "vtkViewsCoreModule.h" // For export macro
55 
56 class vtkAlgorithmOutput;
57 class vtkCommand;
58 class vtkDataObject;
60 class vtkSelection;
61 class vtkViewTheme;
62 
63 class VTKVIEWSCORE_EXPORT vtkView : public vtkObject
64 {
65 public:
66  static vtkView* New();
67  vtkTypeMacro(vtkView, vtkObject);
68  void PrintSelf(ostream& os, vtkIndent indent) override;
69 
74 
79 
89 
99 
108 
117 
122 
127 
132 
137 
142 
147 
151  virtual void Update();
152 
156  virtual void ApplyViewTheme(vtkViewTheme* vtkNotUsed(theme)) {}
157 
164 
166 
171  {
172  const char* Message;
173  double Progress;
175 
176  public:
177  ViewProgressEventCallData(const char* msg, double progress)
178  {
179  this->Message = msg;
180  this->Progress = progress;
181  }
182  ~ViewProgressEventCallData() { this->Message = nullptr; }
183 
187  const char* GetProgressMessage() const { return this->Message; }
188 
192  double GetProgress() const { return this->Progress; }
193  };
194 
204  void RegisterProgress(vtkObject* algorithm, const char* message = nullptr);
205 
209  void UnRegisterProgress(vtkObject* algorithm);
210 
211 protected:
213  ~vtkView() override;
214 
220  virtual void ProcessEvents(vtkObject* caller, unsigned long eventId, void* callData);
221 
229 
234  virtual void AddRepresentationInternal(vtkDataRepresentation* vtkNotUsed(rep)) {}
235  virtual void RemoveRepresentationInternal(vtkDataRepresentation* vtkNotUsed(rep)) {}
236 
238 
242  vtkSetMacro(ReuseSingleRepresentation, bool);
243  vtkGetMacro(ReuseSingleRepresentation, bool);
244  vtkBooleanMacro(ReuseSingleRepresentation, bool);
247 
248 private:
249  vtkView(const vtkView&) = delete;
250  void operator=(const vtkView&) = delete;
251 
252  class vtkImplementation;
253  vtkImplementation* Implementation;
254 
255  class Command;
256  friend class Command;
257  Command* Observer;
258 
259  class vtkInternal;
260  vtkInternal* Internal;
261 };
262 
263 #endif
Proxy object to connect input/output ports.
superclass for callback/observer methods
Definition: vtkCommand.h:394
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:63
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:54
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:171
double GetProgress() const
Get the progress value in range [0.0, 1.0].
Definition: vtkView.h:192
ViewProgressEventCallData(const char *msg, double progress)
Definition: vtkView.h:177
const char * GetProgressMessage() const
Get the message.
Definition: vtkView.h:187
The superclass for all views.
Definition: vtkView.h:64
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
Apply a theme to the view.
Definition: vtkView.h:156
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:234
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
Meant for use by subclasses and vtkRepresentation subclasses.
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.
vtkView()
Meant for use by subclasses and vtkRepresentation subclasses.
virtual void RemoveRepresentationInternal(vtkDataRepresentation *vtkNotUsed(rep))
Meant for use by subclasses and vtkRepresentation subclasses.
Definition: vtkView.h:235
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
Meant for use by subclasses and vtkRepresentation subclasses.
Definition: vtkView.h:244
@ index
Definition: vtkX3D.h:252
@ progress
Definition: vtkX3D.h:458