VTK  9.2.6
vtkDataRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDataRepresentation.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 -------------------------------------------------------------------------*/
56 #ifndef vtkDataRepresentation_h
57 #define vtkDataRepresentation_h
58 
60 #include "vtkViewsCoreModule.h" // For export macro
61 
62 class vtkAlgorithmOutput;
64 class vtkAnnotationLink;
65 class vtkDataObject;
66 class vtkSelection;
67 class vtkStringArray;
68 class vtkTrivialProducer;
69 class vtkView;
70 class vtkViewTheme;
71 
72 class VTKVIEWSCORE_EXPORT vtkDataRepresentation : public vtkPassInputTypeAlgorithm
73 {
74 public:
75  static vtkDataRepresentation* New();
77  void PrintSelf(ostream& os, vtkIndent indent) override;
78 
84  {
86  }
87 
93  vtkAnnotationLink* GetAnnotationLink() { return this->AnnotationLinkInternal; }
94  void SetAnnotationLink(vtkAnnotationLink* link);
95 
100  virtual void ApplyViewTheme(vtkViewTheme* vtkNotUsed(theme)) {}
101 
112  void Select(vtkView* view, vtkSelection* selection) { this->Select(view, selection, false); }
113  void Select(vtkView* view, vtkSelection* selection, bool extend);
114 
126  void Annotate(vtkView* view, vtkAnnotationLayers* annotations)
127  {
128  this->Annotate(view, annotations, false);
129  }
130  void Annotate(vtkView* view, vtkAnnotationLayers* annotations, bool extend);
131 
133 
137  vtkSetMacro(Selectable, bool);
138  vtkGetMacro(Selectable, bool);
139  vtkBooleanMacro(Selectable, bool);
141 
149  void UpdateSelection(vtkSelection* selection) { this->UpdateSelection(selection, false); }
150  void UpdateSelection(vtkSelection* selection, bool extend);
151 
160  {
161  this->UpdateAnnotations(annotations, false);
162  }
163  void UpdateAnnotations(vtkAnnotationLayers* annotations, bool extend);
164 
171  {
172  return this->GetInternalAnnotationOutputPort(0);
173  }
175  {
176  return this->GetInternalAnnotationOutputPort(port, 0);
177  }
178  virtual vtkAlgorithmOutput* GetInternalAnnotationOutputPort(int port, int conn);
179 
186  {
187  return this->GetInternalSelectionOutputPort(0);
188  }
190  {
191  return this->GetInternalSelectionOutputPort(port, 0);
192  }
193  virtual vtkAlgorithmOutput* GetInternalSelectionOutputPort(int port, int conn);
194 
202  {
203  return this->GetInternalOutputPort(port, 0);
204  }
205  virtual vtkAlgorithmOutput* GetInternalOutputPort(int port, int conn);
206 
208 
216  vtkSetMacro(SelectionType, int);
217  vtkGetMacro(SelectionType, int);
219 
221 
224  virtual void SetSelectionArrayNames(vtkStringArray* names);
225  vtkGetObjectMacro(SelectionArrayNames, vtkStringArray);
227 
229 
232  virtual void SetSelectionArrayName(const char* name);
233  virtual const char* GetSelectionArrayName();
235 
244  virtual vtkSelection* ConvertSelection(vtkView* view, vtkSelection* selection);
245 
246 protected:
248  ~vtkDataRepresentation() override;
249 
261  {
262  return 1;
263  }
264 
268  virtual void ProcessEvents(vtkObject* caller, unsigned long eventId, void* callData);
269 
271 
274  virtual void SetAnnotationLinkInternal(vtkAnnotationLink* link);
277 
278  // Whether its representation can handle a selection.
280 
285 
290 
291  friend class vtkView;
292  friend class vtkRenderView;
293  class Command;
294  friend class Command;
295  Command* Observer;
296 
297  // ------------------------------------------------------------------------
298  // Methods to override in subclasses
299  // ------------------------------------------------------------------------
300 
306  virtual bool AddToView(vtkView* vtkNotUsed(view)) { return true; }
307 
313  virtual bool RemoveFromView(vtkView* vtkNotUsed(view)) { return true; }
314 
320  virtual vtkAnnotationLayers* ConvertAnnotations(vtkView* view, vtkAnnotationLayers* annotations);
321 
322  vtkTrivialProducer* GetInternalInput(int port, int conn);
323  void SetInternalInput(int port, int conn, vtkTrivialProducer* producer);
324 
325 private:
327  void operator=(const vtkDataRepresentation&) = delete;
328 
329  class Internals;
330  Internals* Implementation;
331 };
332 
333 #endif
virtual vtkAlgorithmOutput * GetInternalOutputPort()
Retrieves an output port for the input data object at the specified port and connection index...
int SelectionType
The selection type created by the view.
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
Apply a theme to this representation.
abstract base class for most VTK objects
Definition: vtkObject.h:62
Superclass for algorithms that produce output of the same type as input.
Store vtkAlgorithm input/output information.
virtual vtkAlgorithmOutput * GetInternalAnnotationOutputPort(int port)
virtual vtkAlgorithmOutput * GetInternalOutputPort(int port)
virtual vtkAlgorithmOutput * GetInternalAnnotationOutputPort()
The output port that contains the annotations whose selections are localized for a particular input d...
void Select(vtkView *view, vtkSelection *selection)
The view calls this method when a selection occurs.
virtual vtkAlgorithmOutput * GetInternalSelectionOutputPort(int port)
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses should override this to connect inputs to the internal pipeline as necessary.
a vtkAbstractArray subclass for strings
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:59
virtual bool AddToView(vtkView *vtkNotUsed(view))
Adds the representation to the view.
Proxy object to connect input/output ports.
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:48
Producer for stand-alone data objects.
The superclass for all views.
Definition: vtkView.h:63
vtkAlgorithmOutput * GetInputConnection(int port=0, int index=0)
Convenience override method for obtaining the input connection without specifying the port or index...
vtkStringArray * SelectionArrayNames
If a VALUES selection, the array names used in the selection.
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual bool RemoveFromView(vtkView *vtkNotUsed(view))
Removes the representation to the view.
The superclass for all representations.
vtkAnnotationLink * GetAnnotationLink()
The annotation link for this representation.
void Annotate(vtkView *view, vtkAnnotationLayers *annotations)
Analogous to Select().
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
A view containing a renderer.
Definition: vtkRenderView.h:64
Stores a ordered collection of annotation sets.
virtual vtkAlgorithmOutput * GetInternalSelectionOutputPort()
The output port that contains the selection associated with the current annotation (normally the inte...
vtkAnnotationLink * AnnotationLinkInternal
The annotation link for this representation.
Store zero or more vtkInformation instances.
void UpdateAnnotations(vtkAnnotationLayers *annotations)
Updates the selection in the selection link and fires a selection change event.
vtkAlgorithmOutput * GetInputConnection(int port, int index)
Get the algorithm output port connected to an input port.
general representation of visualization data
Definition: vtkDataObject.h:65
void UpdateSelection(vtkSelection *selection)
Updates the selection in the selection link and fires a selection change event.
static vtkPassInputTypeAlgorithm * New()