VTK  9.1.0
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 -------------------------------------------------------------------------*/
75 #ifndef vtkDataRepresentation_h
76 #define vtkDataRepresentation_h
77 
79 #include "vtkViewsCoreModule.h" // For export macro
80 
81 class vtkAlgorithmOutput;
83 class vtkAnnotationLink;
84 class vtkDataObject;
85 class vtkSelection;
86 class vtkStringArray;
87 class vtkTrivialProducer;
88 class vtkView;
89 class vtkViewTheme;
90 
91 class VTKVIEWSCORE_EXPORT vtkDataRepresentation : public vtkPassInputTypeAlgorithm
92 {
93 public:
96  void PrintSelf(ostream& os, vtkIndent indent) override;
97 
103  {
105  }
106 
112  vtkAnnotationLink* GetAnnotationLink() { return this->AnnotationLinkInternal; }
114 
119  virtual void ApplyViewTheme(vtkViewTheme* vtkNotUsed(theme)) {}
120 
131  void Select(vtkView* view, vtkSelection* selection) { this->Select(view, selection, false); }
132  void Select(vtkView* view, vtkSelection* selection, bool extend);
133 
145  void Annotate(vtkView* view, vtkAnnotationLayers* annotations)
146  {
147  this->Annotate(view, annotations, false);
148  }
149  void Annotate(vtkView* view, vtkAnnotationLayers* annotations, bool extend);
150 
152 
156  vtkSetMacro(Selectable, bool);
157  vtkGetMacro(Selectable, bool);
158  vtkBooleanMacro(Selectable, bool);
160 
168  void UpdateSelection(vtkSelection* selection) { this->UpdateSelection(selection, false); }
169  void UpdateSelection(vtkSelection* selection, bool extend);
170 
179  {
180  this->UpdateAnnotations(annotations, false);
181  }
182  void UpdateAnnotations(vtkAnnotationLayers* annotations, bool extend);
183 
190  {
191  return this->GetInternalAnnotationOutputPort(0);
192  }
194  {
195  return this->GetInternalAnnotationOutputPort(port, 0);
196  }
198 
205  {
206  return this->GetInternalSelectionOutputPort(0);
207  }
209  {
210  return this->GetInternalSelectionOutputPort(port, 0);
211  }
213 
221  {
222  return this->GetInternalOutputPort(port, 0);
223  }
225 
227 
235  vtkSetMacro(SelectionType, int);
236  vtkGetMacro(SelectionType, int);
238 
240 
244  vtkGetObjectMacro(SelectionArrayNames, vtkStringArray);
246 
248 
251  virtual void SetSelectionArrayName(const char* name);
252  virtual const char* GetSelectionArrayName();
254 
263  virtual vtkSelection* ConvertSelection(vtkView* view, vtkSelection* selection);
264 
265 protected:
268 
280  {
281  return 1;
282  }
283 
287  virtual void ProcessEvents(vtkObject* caller, unsigned long eventId, void* callData);
288 
290 
296 
297  // Whether its representation can handle a selection.
299 
304 
309 
310  friend class vtkView;
311  friend class vtkRenderView;
312  class Command;
313  friend class Command;
314  Command* Observer;
315 
316  // ------------------------------------------------------------------------
317  // Methods to override in subclasses
318  // ------------------------------------------------------------------------
319 
325  virtual bool AddToView(vtkView* vtkNotUsed(view)) { return true; }
326 
332  virtual bool RemoveFromView(vtkView* vtkNotUsed(view)) { return true; }
333 
340 
342  void SetInternalInput(int port, int conn, vtkTrivialProducer* producer);
343 
344 private:
346  void operator=(const vtkDataRepresentation&) = delete;
347 
348  class Internals;
349  Internals* Implementation;
350 };
351 
352 #endif
vtkDataRepresentation::GetAnnotationLink
vtkAnnotationLink * GetAnnotationLink()
The annotation link for this representation.
Definition: vtkDataRepresentation.h:112
vtkDataRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkDataRepresentation::New
static vtkDataRepresentation * New()
vtkDataRepresentation::AddToView
virtual bool AddToView(vtkView *vtkNotUsed(view))
Adds the representation to the view.
Definition: vtkDataRepresentation.h:325
vtkRenderView
A view containing a renderer.
Definition: vtkRenderView.h:84
vtkDataRepresentation::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses should override this to connect inputs to the internal pipeline as necessary.
Definition: vtkDataRepresentation.h:279
vtkDataRepresentation::UpdateAnnotations
void UpdateAnnotations(vtkAnnotationLayers *annotations, bool extend)
vtkPassInputTypeAlgorithm.h
vtkDataRepresentation::UpdateSelection
void UpdateSelection(vtkSelection *selection, bool extend)
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:145
vtkDataRepresentation::Observer
Command * Observer
Definition: vtkDataRepresentation.h:314
vtkDataRepresentation::SelectionType
int SelectionType
The selection type created by the view.
Definition: vtkDataRepresentation.h:303
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:82
vtkDataRepresentation::ProcessEvents
virtual void ProcessEvents(vtkObject *caller, unsigned long eventId, void *callData)
Clear the input shallow copy caches if the algorithm is in "release data" mode.
vtkSelection
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:163
vtkDataRepresentation::GetInternalAnnotationOutputPort
virtual vtkAlgorithmOutput * GetInternalAnnotationOutputPort(int port)
Definition: vtkDataRepresentation.h:193
vtkTrivialProducer
Producer for stand-alone data objects.
Definition: vtkTrivialProducer.h:35
vtkDataRepresentation::RemoveFromView
virtual bool RemoveFromView(vtkView *vtkNotUsed(view))
Removes the representation to the view.
Definition: vtkDataRepresentation.h:332
vtkDataRepresentation::GetInputConnection
vtkAlgorithmOutput * GetInputConnection(int port=0, int index=0)
Convenience override method for obtaining the input connection without specifying the port or index.
Definition: vtkDataRepresentation.h:102
vtkDataRepresentation::GetInternalSelectionOutputPort
virtual vtkAlgorithmOutput * GetInternalSelectionOutputPort(int port)
Definition: vtkDataRepresentation.h:208
vtkDataRepresentation::Annotate
void Annotate(vtkView *view, vtkAnnotationLayers *annotations)
Analogous to Select().
Definition: vtkDataRepresentation.h:145
vtkView
The superclass for all views.
Definition: vtkView.h:64
vtkDataRepresentation::Select
void Select(vtkView *view, vtkSelection *selection, bool extend)
vtkViewTheme
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:132
vtkDataRepresentation::SetSelectionArrayName
virtual void SetSelectionArrayName(const char *name)
If a VALUES selection, the array used to produce a selection.
vtkX3D::port
@ port
Definition: vtkX3D.h:453
vtkDataRepresentation::GetInternalAnnotationOutputPort
virtual vtkAlgorithmOutput * GetInternalAnnotationOutputPort(int port, int conn)
vtkAnnotationLayers
Stores a ordered collection of annotation sets.
Definition: vtkAnnotationLayers.h:43
vtkDataRepresentation::GetInternalOutputPort
virtual vtkAlgorithmOutput * GetInternalOutputPort(int port)
Definition: vtkDataRepresentation.h:220
vtkAlgorithm::GetInputConnection
vtkAlgorithmOutput * GetInputConnection(int port, int index)
Get the algorithm output port connected to an input port.
vtkDataRepresentation
The superclass for all representations.
Definition: vtkDataRepresentation.h:92
vtkDataRepresentation::AnnotationLinkInternal
vtkAnnotationLink * AnnotationLinkInternal
The annotation link for this representation.
Definition: vtkDataRepresentation.h:294
vtkDataRepresentation::Annotate
void Annotate(vtkView *view, vtkAnnotationLayers *annotations, bool extend)
vtkDataRepresentation::GetInternalSelectionOutputPort
virtual vtkAlgorithmOutput * GetInternalSelectionOutputPort(int port, int conn)
vtkDataRepresentation::Select
void Select(vtkView *view, vtkSelection *selection)
The view calls this method when a selection occurs.
Definition: vtkDataRepresentation.h:131
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkDataRepresentation::ConvertSelection
virtual vtkSelection * ConvertSelection(vtkView *view, vtkSelection *selection)
Convert the selection to a type appropriate for sharing with other representations through vtkAnnotat...
vtkDataRepresentation::UpdateSelection
void UpdateSelection(vtkSelection *selection)
Updates the selection in the selection link and fires a selection change event.
Definition: vtkDataRepresentation.h:168
vtkDataRepresentation::GetInternalInput
vtkTrivialProducer * GetInternalInput(int port, int conn)
vtkDataRepresentation::GetInternalAnnotationOutputPort
virtual vtkAlgorithmOutput * GetInternalAnnotationOutputPort()
The output port that contains the annotations whose selections are localized for a particular input d...
Definition: vtkDataRepresentation.h:189
vtkDataRepresentation::GetInternalSelectionOutputPort
virtual vtkAlgorithmOutput * GetInternalSelectionOutputPort()
The output port that contains the selection associated with the current annotation (normally the inte...
Definition: vtkDataRepresentation.h:204
vtkX3D::name
@ name
Definition: vtkX3D.h:225
vtkDataRepresentation::SetAnnotationLink
void SetAnnotationLink(vtkAnnotationLink *link)
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
vtkDataRepresentation::GetInternalOutputPort
virtual vtkAlgorithmOutput * GetInternalOutputPort()
Retrieves an output port for the input data object at the specified port and connection index.
Definition: vtkDataRepresentation.h:219
vtkDataRepresentation::UpdateAnnotations
void UpdateAnnotations(vtkAnnotationLayers *annotations)
Updates the selection in the selection link and fires a selection change event.
Definition: vtkDataRepresentation.h:178
vtkDataRepresentation::GetInternalOutputPort
virtual vtkAlgorithmOutput * GetInternalOutputPort(int port, int conn)
vtkDataRepresentation::SelectionArrayNames
vtkStringArray * SelectionArrayNames
If a VALUES selection, the array names used in the selection.
Definition: vtkDataRepresentation.h:308
vtkDataRepresentation::SetInternalInput
void SetInternalInput(int port, int conn, vtkTrivialProducer *producer)
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:66
vtkDataRepresentation::SetSelectionArrayNames
virtual void SetSelectionArrayNames(vtkStringArray *names)
If a VALUES selection, the arrays used to produce a selection.
vtkDataRepresentation::~vtkDataRepresentation
~vtkDataRepresentation() override
vtkStringArray
a vtkAbstractArray subclass for strings
Definition: vtkStringArray.h:146
vtkDataRepresentation::Selectable
bool Selectable
Definition: vtkDataRepresentation.h:298
vtkDataRepresentation::ApplyViewTheme
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
Apply a theme to this representation.
Definition: vtkDataRepresentation.h:119
vtkDataRepresentation::GetSelectionArrayName
virtual const char * GetSelectionArrayName()
If a VALUES selection, the array used to produce a selection.
vtkDataRepresentation::vtkDataRepresentation
vtkDataRepresentation()
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:169
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkPassInputTypeAlgorithm
Superclass for algorithms that produce output of the same type as input.
Definition: vtkPassInputTypeAlgorithm.h:52
vtkDataRepresentation::SetAnnotationLinkInternal
virtual void SetAnnotationLinkInternal(vtkAnnotationLink *link)
The annotation link for this representation.
vtkDataRepresentation::ConvertAnnotations
virtual vtkAnnotationLayers * ConvertAnnotations(vtkView *view, vtkAnnotationLayers *annotations)
Analogous to ConvertSelection(), allows subclasses to manipulate annotations before passing them off ...