VTK
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 -------------------------------------------------------------------------*/
53 #ifndef vtkDataRepresentation_h
54 #define vtkDataRepresentation_h
55 
56 #include "vtkViewsCoreModule.h" // For export macro
58 
59 class vtkAlgorithmOutput;
61 class vtkAnnotationLink;
62 class vtkDataObject;
63 class vtkSelection;
64 class vtkStringArray;
65 class vtkTrivialProducer;
66 class vtkView;
67 class vtkViewTheme;
68 
69 class VTKVIEWSCORE_EXPORT vtkDataRepresentation : public vtkPassInputTypeAlgorithm
70 {
71 public:
72  static vtkDataRepresentation *New();
74  void PrintSelf(ostream& os, vtkIndent indent) override;
75 
81  { return this->Superclass::GetInputConnection(port, index); }
82 
89  { return this->AnnotationLinkInternal; }
90  void SetAnnotationLink(vtkAnnotationLink* link);
91 
96  virtual void ApplyViewTheme(vtkViewTheme* vtkNotUsed(theme)) { }
97 
108  void Select(vtkView* view, vtkSelection* selection)
109  { this->Select(view, selection, false); }
110  void Select(vtkView* view, vtkSelection* selection, bool extend);
111 
123  void Annotate(vtkView* view, vtkAnnotationLayers* annotations)
124  { this->Annotate(view, annotations, false); }
125  void Annotate(vtkView* view, vtkAnnotationLayers* annotations, bool extend);
126 
128 
132  vtkSetMacro(Selectable, bool);
133  vtkGetMacro(Selectable, bool);
134  vtkBooleanMacro(Selectable, bool);
136 
144  void UpdateSelection(vtkSelection* selection)
145  { this->UpdateSelection(selection, false); }
146  void UpdateSelection(vtkSelection* selection, bool extend);
147 
156  { this->UpdateAnnotations(annotations, false); }
157  void UpdateAnnotations(vtkAnnotationLayers* annotations, bool extend);
158 
165  { return this->GetInternalAnnotationOutputPort(0); }
167  { return this->GetInternalAnnotationOutputPort(port, 0); }
168  virtual vtkAlgorithmOutput* GetInternalAnnotationOutputPort(int port, int conn);
169 
176  { return this->GetInternalSelectionOutputPort(0); }
178  { return this->GetInternalSelectionOutputPort(port, 0); }
179  virtual vtkAlgorithmOutput* GetInternalSelectionOutputPort(int port, int conn);
180 
187  { return this->GetInternalOutputPort(0); }
189  { return this->GetInternalOutputPort(port, 0); }
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 
248  vtkInformationVector*) override
249  { return 1; }
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 
320 #endif
vtkDataRepresentation::GetAnnotationLink
vtkAnnotationLink * GetAnnotationLink()
The annotation link for this representation.
Definition: vtkDataRepresentation.h:88
vtkDataRepresentation::AddToView
virtual bool AddToView(vtkView *vtkNotUsed(view))
Adds the representation to the view.
Definition: vtkDataRepresentation.h:292
vtkRenderView
A view containing a renderer.
Definition: vtkRenderView.h:61
vtkDataRepresentation::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses should override this to connect inputs to the internal pipeline as necessary.
Definition: vtkDataRepresentation.h:245
vtkPassInputTypeAlgorithm.h
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkDataRepresentation::Observer
Command * Observer
Definition: vtkDataRepresentation.h:281
vtkDataRepresentation::SelectionType
int SelectionType
The selection type created by the view.
Definition: vtkDataRepresentation.h:270
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:59
vtkSelection
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:63
vtkDataRepresentation::GetInternalAnnotationOutputPort
virtual vtkAlgorithmOutput * GetInternalAnnotationOutputPort(int port)
Definition: vtkDataRepresentation.h:166
vtkTrivialProducer
Producer for stand-alone data objects.
Definition: vtkTrivialProducer.h:37
vtkDataRepresentation::RemoveFromView
virtual bool RemoveFromView(vtkView *vtkNotUsed(view))
Removes the representation to the view.
Definition: vtkDataRepresentation.h:299
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:80
vtkDataRepresentation::GetInternalSelectionOutputPort
virtual vtkAlgorithmOutput * GetInternalSelectionOutputPort(int port)
Definition: vtkDataRepresentation.h:177
vtkDataRepresentation::Annotate
void Annotate(vtkView *view, vtkAnnotationLayers *annotations)
Analogous to Select().
Definition: vtkDataRepresentation.h:123
vtkView
The superclass for all views.
Definition: vtkView.h:60
vtkViewTheme
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:48
vtkX3D::port
Definition: vtkX3D.h:447
vtkAnnotationLayers
Stores a ordered collection of annotation sets.
Definition: vtkAnnotationLayers.h:42
vtkDataRepresentation::GetInternalOutputPort
virtual vtkAlgorithmOutput * GetInternalOutputPort(int port)
Definition: vtkDataRepresentation.h:188
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:69
vtkDataRepresentation::AnnotationLinkInternal
vtkAnnotationLink * AnnotationLinkInternal
Definition: vtkDataRepresentation.h:261
vtkDataRepresentation::Select
void Select(vtkView *view, vtkSelection *selection)
The view calls this method when a selection occurs.
Definition: vtkDataRepresentation.h:108
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkDataRepresentation::UpdateSelection
void UpdateSelection(vtkSelection *selection)
Updates the selection in the selection link and fires a selection change event.
Definition: vtkDataRepresentation.h:144
vtkDataRepresentation::GetInternalAnnotationOutputPort
virtual vtkAlgorithmOutput * GetInternalAnnotationOutputPort()
The output port that contains the annotations whose selections are localized for a particular input d...
Definition: vtkDataRepresentation.h:164
vtkDataRepresentation::GetInternalSelectionOutputPort
virtual vtkAlgorithmOutput * GetInternalSelectionOutputPort()
The output port that contains the selection associated with the current annotation (normally the inte...
Definition: vtkDataRepresentation.h:175
vtkX3D::name
Definition: vtkX3D.h:219
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkDataRepresentation::GetInternalOutputPort
virtual vtkAlgorithmOutput * GetInternalOutputPort()
Retrieves an output port for the input data object at the specified port and connection index.
Definition: vtkDataRepresentation.h:186
vtkDataRepresentation::UpdateAnnotations
void UpdateAnnotations(vtkAnnotationLayers *annotations)
Updates the selection in the selection link and fires a selection change event.
Definition: vtkDataRepresentation.h:155
vtkDataRepresentation::SelectionArrayNames
vtkStringArray * SelectionArrayNames
If a VALUES selection, the array names used in the selection.
Definition: vtkDataRepresentation.h:275
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:39
vtkPassInputTypeAlgorithm::New
static vtkPassInputTypeAlgorithm * New()
vtkPassInputTypeAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkStringArray
a vtkAbstractArray subclass for strings
Definition: vtkStringArray.h:42
vtkDataRepresentation::Selectable
bool Selectable
Definition: vtkDataRepresentation.h:265
vtkDataRepresentation::ApplyViewTheme
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
Apply a theme to this representation.
Definition: vtkDataRepresentation.h:96
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkX3D::index
Definition: vtkX3D.h:246
vtkPassInputTypeAlgorithm
Superclass for algorithms that produce output of the same type as input.
Definition: vtkPassInputTypeAlgorithm.h:54