VTK  9.7.1
vtkDataRepresentation.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
40 #ifndef vtkDataRepresentation_h
41 #define vtkDataRepresentation_h
42 
44 #include "vtkViewsCoreModule.h" // For export macro
45 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
46 
47 VTK_ABI_NAMESPACE_BEGIN
48 class vtkAlgorithmOutput;
50 class vtkAnnotationLink;
51 class vtkDataObject;
52 class vtkSelection;
53 class vtkStringArray;
54 class vtkTrivialProducer;
55 class vtkView;
56 class vtkViewTheme;
57 
59 {
60 public:
61  static vtkDataRepresentation* New();
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
70  {
72  }
73 
79  vtkAnnotationLink* GetAnnotationLink() { return this->AnnotationLinkInternal; }
80  void SetAnnotationLink(vtkAnnotationLink* link);
81 
86  virtual void ApplyViewTheme(vtkViewTheme* vtkNotUsed(theme)) {}
87 
98  void Select(vtkView* view, vtkSelection* selection) { this->Select(view, selection, false); }
99  void Select(vtkView* view, vtkSelection* selection, bool extend);
100 
112  void Annotate(vtkView* view, vtkAnnotationLayers* annotations)
113  {
114  this->Annotate(view, annotations, false);
115  }
116  void Annotate(vtkView* view, vtkAnnotationLayers* annotations, bool extend);
117 
119 
123  vtkSetMacro(Selectable, bool);
124  vtkGetMacro(Selectable, bool);
125  vtkBooleanMacro(Selectable, bool);
127 
135  void UpdateSelection(vtkSelection* selection) { this->UpdateSelection(selection, false); }
136  void UpdateSelection(vtkSelection* selection, bool extend);
137 
146  {
147  this->UpdateAnnotations(annotations, false);
148  }
149  void UpdateAnnotations(vtkAnnotationLayers* annotations, bool extend);
150 
157  {
158  return this->GetInternalAnnotationOutputPort(0);
159  }
161  {
162  return this->GetInternalAnnotationOutputPort(port, 0);
163  }
164  virtual vtkAlgorithmOutput* GetInternalAnnotationOutputPort(int port, int conn);
165 
172  {
173  return this->GetInternalSelectionOutputPort(0);
174  }
176  {
177  return this->GetInternalSelectionOutputPort(port, 0);
178  }
179  virtual vtkAlgorithmOutput* GetInternalSelectionOutputPort(int port, int conn);
180 
188  {
189  return this->GetInternalOutputPort(port, 0);
190  }
191  virtual vtkAlgorithmOutput* GetInternalOutputPort(int port, int conn);
192 
194 
202  vtkSetMacro(SelectionType, int);
203  vtkGetMacro(SelectionType, int);
205 
207 
210  virtual void SetSelectionArrayNames(vtkStringArray* names);
211  vtkGetObjectMacro(SelectionArrayNames, vtkStringArray);
213 
215 
218  virtual void SetSelectionArrayName(const char* name);
219  virtual const char* GetSelectionArrayName();
221 
230  virtual vtkSelection* ConvertSelection(vtkView* view, vtkSelection* selection);
231 
232 protected:
234  ~vtkDataRepresentation() override;
235 
247  {
248  return 1;
249  }
250 
254  virtual void ProcessEvents(vtkObject* caller, unsigned long eventId, void* callData);
255 
257 
260  virtual void SetAnnotationLinkInternal(vtkAnnotationLink* link);
263 
264  // Whether its representation can handle a selection.
266 
271 
276 
277  friend class vtkView;
278  friend class vtkRenderView;
279  class Command;
280  friend class Command;
281  Command* Observer;
282 
283  // ------------------------------------------------------------------------
284  // Methods to override in subclasses
285  // ------------------------------------------------------------------------
286 
292  virtual bool AddToView(vtkView* vtkNotUsed(view)) { return true; }
293 
299  virtual bool RemoveFromView(vtkView* vtkNotUsed(view)) { return true; }
300 
306  virtual vtkAnnotationLayers* ConvertAnnotations(vtkView* view, vtkAnnotationLayers* annotations);
307 
308  vtkTrivialProducer* GetInternalInput(int port, int conn);
309  void SetInternalInput(int port, int conn, vtkTrivialProducer* producer);
310 
311 private:
313  void operator=(const vtkDataRepresentation&) = delete;
314 
315  class Internals;
316  Internals* Implementation;
317 };
318 
319 VTK_ABI_NAMESPACE_END
320 #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.
abstract base class for most VTK objects
Definition: vtkObject.h:52
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:49
Proxy object to connect input/output ports.
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:34
Producer for stand-alone data objects.
The superclass for all views.
Definition: vtkView.h:49
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:28
virtual void ApplyViewTheme(vtkViewTheme *theme)
Apply a theme to this representation.
The superclass for all representations.
virtual bool RemoveFromView(vtkView *view)
Removes the representation to the view.
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:49
virtual bool AddToView(vtkView *view)
Adds the representation to the view.
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.
#define VTK_MARSHALAUTO
vtkAlgorithmOutput * GetInputConnection(int port, int index)
Get the algorithm output port connected to an input port.
general representation of visualization data
Definition: vtkDataObject.h:55
void UpdateSelection(vtkSelection *selection)
Updates the selection in the selection link and fires a selection change event.
static vtkPassInputTypeAlgorithm * New()