VTK  9.3.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 
46 VTK_ABI_NAMESPACE_BEGIN
47 class vtkAlgorithmOutput;
49 class vtkAnnotationLink;
50 class vtkDataObject;
51 class vtkSelection;
52 class vtkStringArray;
53 class vtkTrivialProducer;
54 class vtkView;
55 class vtkViewTheme;
56 
57 class VTKVIEWSCORE_EXPORT vtkDataRepresentation : public vtkPassInputTypeAlgorithm
58 {
59 public:
60  static vtkDataRepresentation* New();
62  void PrintSelf(ostream& os, vtkIndent indent) override;
63 
69  {
71  }
72 
78  vtkAnnotationLink* GetAnnotationLink() { return this->AnnotationLinkInternal; }
79  void SetAnnotationLink(vtkAnnotationLink* link);
80 
85  virtual void ApplyViewTheme(vtkViewTheme* vtkNotUsed(theme)) {}
86 
97  void Select(vtkView* view, vtkSelection* selection) { this->Select(view, selection, false); }
98  void Select(vtkView* view, vtkSelection* selection, bool extend);
99 
111  void Annotate(vtkView* view, vtkAnnotationLayers* annotations)
112  {
113  this->Annotate(view, annotations, false);
114  }
115  void Annotate(vtkView* view, vtkAnnotationLayers* annotations, bool extend);
116 
118 
122  vtkSetMacro(Selectable, bool);
123  vtkGetMacro(Selectable, bool);
124  vtkBooleanMacro(Selectable, bool);
126 
134  void UpdateSelection(vtkSelection* selection) { this->UpdateSelection(selection, false); }
135  void UpdateSelection(vtkSelection* selection, bool extend);
136 
145  {
146  this->UpdateAnnotations(annotations, false);
147  }
148  void UpdateAnnotations(vtkAnnotationLayers* annotations, bool extend);
149 
156  {
157  return this->GetInternalAnnotationOutputPort(0);
158  }
160  {
161  return this->GetInternalAnnotationOutputPort(port, 0);
162  }
163  virtual vtkAlgorithmOutput* GetInternalAnnotationOutputPort(int port, int conn);
164 
171  {
172  return this->GetInternalSelectionOutputPort(0);
173  }
175  {
176  return this->GetInternalSelectionOutputPort(port, 0);
177  }
178  virtual vtkAlgorithmOutput* GetInternalSelectionOutputPort(int port, int conn);
179 
187  {
188  return this->GetInternalOutputPort(port, 0);
189  }
190  virtual vtkAlgorithmOutput* GetInternalOutputPort(int port, int conn);
191 
193 
201  vtkSetMacro(SelectionType, int);
202  vtkGetMacro(SelectionType, int);
204 
206 
209  virtual void SetSelectionArrayNames(vtkStringArray* names);
210  vtkGetObjectMacro(SelectionArrayNames, vtkStringArray);
212 
214 
217  virtual void SetSelectionArrayName(const char* name);
218  virtual const char* GetSelectionArrayName();
220 
229  virtual vtkSelection* ConvertSelection(vtkView* view, vtkSelection* selection);
230 
231 protected:
233  ~vtkDataRepresentation() override;
234 
246  {
247  return 1;
248  }
249 
253  virtual void ProcessEvents(vtkObject* caller, unsigned long eventId, void* callData);
254 
256 
259  virtual void SetAnnotationLinkInternal(vtkAnnotationLink* link);
262 
263  // Whether its representation can handle a selection.
265 
270 
275 
276  friend class vtkView;
277  friend class vtkRenderView;
278  class Command;
279  friend class Command;
280  Command* Observer;
281 
282  // ------------------------------------------------------------------------
283  // Methods to override in subclasses
284  // ------------------------------------------------------------------------
285 
291  virtual bool AddToView(vtkView* vtkNotUsed(view)) { return true; }
292 
298  virtual bool RemoveFromView(vtkView* vtkNotUsed(view)) { return true; }
299 
305  virtual vtkAnnotationLayers* ConvertAnnotations(vtkView* view, vtkAnnotationLayers* annotations);
306 
307  vtkTrivialProducer* GetInternalInput(int port, int conn);
308  void SetInternalInput(int port, int conn, vtkTrivialProducer* producer);
309 
310 private:
312  void operator=(const vtkDataRepresentation&) = delete;
313 
314  class Internals;
315  Internals* Implementation;
316 };
317 
318 VTK_ABI_NAMESPACE_END
319 #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:51
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
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:33
Producer for stand-alone data objects.
The superclass for all views.
Definition: vtkView.h:48
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 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:49
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:54
void UpdateSelection(vtkSelection *selection)
Updates the selection in the selection link and fires a selection change event.
static vtkPassInputTypeAlgorithm * New()