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 -------------------------------------------------------------------------*/
50 #ifndef vtkDataRepresentation_h
51 #define vtkDataRepresentation_h
52 
53 #include "vtkViewsCoreModule.h" // For export macro
55 
56 class vtkAlgorithmOutput;
58 class vtkAnnotationLink;
59 class vtkDataObject;
60 class vtkSelection;
61 class vtkStringArray;
62 class vtkTrivialProducer;
63 class vtkView;
64 class vtkViewTheme;
65 
66 class VTKVIEWSCORE_EXPORT vtkDataRepresentation : public vtkPassInputTypeAlgorithm
67 {
68 public:
69  static vtkDataRepresentation *New();
71  void PrintSelf(ostream& os, vtkIndent indent) override;
72 
78  { return this->Superclass::GetInputConnection(port, index); }
79 
86  { return this->AnnotationLinkInternal; }
87  void SetAnnotationLink(vtkAnnotationLink* link);
88 
93  virtual void ApplyViewTheme(vtkViewTheme* vtkNotUsed(theme)) { }
94 
105  void Select(vtkView* view, vtkSelection* selection)
106  { this->Select(view, selection, false); }
107  void Select(vtkView* view, vtkSelection* selection, bool extend);
108 
120  void Annotate(vtkView* view, vtkAnnotationLayers* annotations)
121  { this->Annotate(view, annotations, false); }
122  void Annotate(vtkView* view, vtkAnnotationLayers* annotations, bool extend);
123 
125 
129  vtkSetMacro(Selectable, bool);
130  vtkGetMacro(Selectable, bool);
131  vtkBooleanMacro(Selectable, bool);
133 
141  void UpdateSelection(vtkSelection* selection)
142  { this->UpdateSelection(selection, false); }
143  void UpdateSelection(vtkSelection* selection, bool extend);
144 
153  { this->UpdateAnnotations(annotations, false); }
154  void UpdateAnnotations(vtkAnnotationLayers* annotations, bool extend);
155 
162  { return this->GetInternalAnnotationOutputPort(0); }
164  { return this->GetInternalAnnotationOutputPort(port, 0); }
165  virtual vtkAlgorithmOutput* GetInternalAnnotationOutputPort(int port, int conn);
166 
173  { return this->GetInternalSelectionOutputPort(0); }
175  { return this->GetInternalSelectionOutputPort(port, 0); }
176  virtual vtkAlgorithmOutput* GetInternalSelectionOutputPort(int port, int conn);
177 
184  { return this->GetInternalOutputPort(0); }
186  { return this->GetInternalOutputPort(port, 0); }
187  virtual vtkAlgorithmOutput* GetInternalOutputPort(int port, int conn);
188 
190 
198  vtkSetMacro(SelectionType, int);
199  vtkGetMacro(SelectionType, int);
201 
203 
206  virtual void SetSelectionArrayNames(vtkStringArray* names);
207  vtkGetObjectMacro(SelectionArrayNames, vtkStringArray);
209 
211 
214  virtual void SetSelectionArrayName(const char* name);
215  virtual const char* GetSelectionArrayName();
217 
226  virtual vtkSelection* ConvertSelection(vtkView* view, vtkSelection* selection);
227 
228 protected:
230  ~vtkDataRepresentation() override;
231 
245  vtkInformationVector*) override
246  { return 1; }
247 
251  virtual void ProcessEvents(vtkObject *caller, unsigned long eventId, void *callData);
252 
254 
257  virtual void SetAnnotationLinkInternal(vtkAnnotationLink* link);
260 
261  // Whether is represenation can handle a selection.
263 
268 
273 
274  friend class vtkView;
275  friend class vtkRenderView;
276  class Command;
277  friend class Command;
278  Command* Observer;
279 
280  // ------------------------------------------------------------------------
281  // Methods to override in subclasses
282  // ------------------------------------------------------------------------
283 
289  virtual bool AddToView(vtkView* vtkNotUsed(view)) { return true; }
290 
296  virtual bool RemoveFromView(vtkView* vtkNotUsed(view)) { return true; }
297 
303  virtual vtkAnnotationLayers* ConvertAnnotations(vtkView* view, vtkAnnotationLayers* annotations);
304 
305  vtkTrivialProducer* GetInternalInput(int port, int conn);
306  void SetInternalInput(int port, int conn, vtkTrivialProducer* producer);
307 
308 private:
310  void operator=(const vtkDataRepresentation&) = delete;
311 
312  class Internals;
313  Internals* Implementation;
314 
315 };
316 
317 #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:53
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
A node in a selection tree.
Definition: vtkSelection.h:37
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:42
Producer for stand-alone data objects.
The superclass for all views.
Definition: vtkView.h:54
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:33
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:58
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:58
void UpdateSelection(vtkSelection *selection)
Updates the selection in the selection link and fires a selection change event.
static vtkPassInputTypeAlgorithm * New()