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 -------------------------------------------------------------------------*/
69 #ifndef vtkDataRepresentation_h
70 #define vtkDataRepresentation_h
71 
73 #include "vtkViewsCoreModule.h" // For export macro
74 
75 class vtkAlgorithmOutput;
77 class vtkAnnotationLink;
78 class vtkDataObject;
79 class vtkSelection;
80 class vtkStringArray;
81 class vtkTrivialProducer;
82 class vtkView;
83 class vtkViewTheme;
84 
85 class VTKVIEWSCORE_EXPORT vtkDataRepresentation : public vtkPassInputTypeAlgorithm
86 {
87 public:
90  void PrintSelf(ostream& os, vtkIndent indent) override;
91 
97  {
99  }
100 
106  vtkAnnotationLink* GetAnnotationLink() { return this->AnnotationLinkInternal; }
108 
113  virtual void ApplyViewTheme(vtkViewTheme* vtkNotUsed(theme)) {}
114 
125  void Select(vtkView* view, vtkSelection* selection) { this->Select(view, selection, false); }
126  void Select(vtkView* view, vtkSelection* selection, bool extend);
127 
139  void Annotate(vtkView* view, vtkAnnotationLayers* annotations)
140  {
141  this->Annotate(view, annotations, false);
142  }
143  void Annotate(vtkView* view, vtkAnnotationLayers* annotations, bool extend);
144 
146 
150  vtkSetMacro(Selectable, bool);
151  vtkGetMacro(Selectable, bool);
152  vtkBooleanMacro(Selectable, bool);
154 
162  void UpdateSelection(vtkSelection* selection) { this->UpdateSelection(selection, false); }
163  void UpdateSelection(vtkSelection* selection, bool extend);
164 
173  {
174  this->UpdateAnnotations(annotations, false);
175  }
176  void UpdateAnnotations(vtkAnnotationLayers* annotations, bool extend);
177 
184  {
185  return this->GetInternalAnnotationOutputPort(0);
186  }
188  {
189  return this->GetInternalAnnotationOutputPort(port, 0);
190  }
192 
199  {
200  return this->GetInternalSelectionOutputPort(0);
201  }
203  {
204  return this->GetInternalSelectionOutputPort(port, 0);
205  }
207 
215  {
216  return this->GetInternalOutputPort(port, 0);
217  }
219 
221 
229  vtkSetMacro(SelectionType, int);
230  vtkGetMacro(SelectionType, int);
232 
234 
238  vtkGetObjectMacro(SelectionArrayNames, vtkStringArray);
240 
242 
245  virtual void SetSelectionArrayName(const char* name);
246  virtual const char* GetSelectionArrayName();
248 
257  virtual vtkSelection* ConvertSelection(vtkView* view, vtkSelection* selection);
258 
259 protected:
262 
274  {
275  return 1;
276  }
277 
281  virtual void ProcessEvents(vtkObject* caller, unsigned long eventId, void* callData);
282 
284 
290 
291  // Whether its representation can handle a selection.
293 
298 
303 
304  friend class vtkView;
305  friend class vtkRenderView;
306  class Command;
307  friend class Command;
308  Command* Observer;
309 
310  // ------------------------------------------------------------------------
311  // Methods to override in subclasses
312  // ------------------------------------------------------------------------
313 
319  virtual bool AddToView(vtkView* vtkNotUsed(view)) { return true; }
320 
326  virtual bool RemoveFromView(vtkView* vtkNotUsed(view)) { return true; }
327 
334 
336  void SetInternalInput(int port, int conn, vtkTrivialProducer* producer);
337 
338 private:
340  void operator=(const vtkDataRepresentation&) = delete;
341 
342  class Internals;
343  Internals* Implementation;
344 };
345 
346 #endif
Proxy object to connect input/output ports.
vtkAlgorithmOutput * GetInputConnection(int port, int index)
Get the algorithm output port connected to an input port.
Stores a ordered collection of annotation sets.
general representation of visualization data
The superclass for all representations.
vtkAnnotationLink * GetAnnotationLink()
The annotation link for this representation.
static vtkDataRepresentation * New()
virtual vtkAlgorithmOutput * GetInternalSelectionOutputPort(int port, int conn)
vtkAnnotationLink * AnnotationLinkInternal
The annotation link for this representation.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int SelectionType
The selection type created by the view.
virtual vtkAlgorithmOutput * GetInternalOutputPort(int port, int conn)
virtual bool RemoveFromView(vtkView *vtkNotUsed(view))
Removes the representation to the view.
virtual vtkAnnotationLayers * ConvertAnnotations(vtkView *view, vtkAnnotationLayers *annotations)
Analogous to ConvertSelection(), allows subclasses to manipulate annotations before passing them off ...
void Annotate(vtkView *view, vtkAnnotationLayers *annotations)
Analogous to Select().
void SetAnnotationLink(vtkAnnotationLink *link)
virtual void SetSelectionArrayNames(vtkStringArray *names)
If a VALUES selection, the arrays used to produce a selection.
virtual vtkAlgorithmOutput * GetInternalAnnotationOutputPort(int port, int conn)
virtual void ApplyViewTheme(vtkViewTheme *vtkNotUsed(theme))
Apply a theme to this representation.
void UpdateAnnotations(vtkAnnotationLayers *annotations, bool extend)
void UpdateAnnotations(vtkAnnotationLayers *annotations)
Updates the selection in the selection link and fires a selection change event.
vtkStringArray * SelectionArrayNames
If a VALUES selection, the array names used in the selection.
virtual void ProcessEvents(vtkObject *caller, unsigned long eventId, void *callData)
Clear the input shallow copy caches if the algorithm is in "release data" mode.
~vtkDataRepresentation() override
virtual vtkAlgorithmOutput * GetInternalOutputPort()
Retrieves an output port for the input data object at the specified port and connection index.
virtual void SetAnnotationLinkInternal(vtkAnnotationLink *link)
The annotation link for this representation.
virtual vtkAlgorithmOutput * GetInternalAnnotationOutputPort(int port)
void Select(vtkView *view, vtkSelection *selection, bool extend)
void UpdateSelection(vtkSelection *selection)
Updates the selection in the selection link and fires a selection change event.
vtkTrivialProducer * GetInternalInput(int port, int conn)
virtual bool AddToView(vtkView *vtkNotUsed(view))
Adds the representation to the view.
virtual const char * GetSelectionArrayName()
If a VALUES selection, the array used to produce a selection.
virtual vtkAlgorithmOutput * GetInternalOutputPort(int port)
vtkAlgorithmOutput * GetInputConnection(int port=0, int index=0)
Convenience override method for obtaining the input connection without specifying the port or index.
void Select(vtkView *view, vtkSelection *selection)
The view calls this method when a selection occurs.
void UpdateSelection(vtkSelection *selection, bool extend)
virtual void SetSelectionArrayName(const char *name)
If a VALUES selection, the array used to produce a selection.
virtual vtkSelection * ConvertSelection(vtkView *view, vtkSelection *selection)
Convert the selection to a type appropriate for sharing with other representations through vtkAnnotat...
virtual vtkAlgorithmOutput * GetInternalSelectionOutputPort()
The output port that contains the selection associated with the current annotation (normally the inte...
void Annotate(vtkView *view, vtkAnnotationLayers *annotations, bool extend)
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses should override this to connect inputs to the internal pipeline as necessary.
virtual vtkAlgorithmOutput * GetInternalAnnotationOutputPort()
The output port that contains the annotations whose selections are localized for a particular input d...
virtual vtkAlgorithmOutput * GetInternalSelectionOutputPort(int port)
void SetInternalInput(int port, int conn, vtkTrivialProducer *producer)
a simple class to control print indentation
Definition: vtkIndent.h:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
abstract base class for most VTK objects
Definition: vtkObject.h:73
Superclass for algorithms that produce output of the same type as input.
A view containing a renderer.
Definition: vtkRenderView.h:78
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:163
a vtkAbstractArray subclass for strings
Producer for stand-alone data objects.
Sets theme colors for a graphical view.
Definition: vtkViewTheme.h:132
The superclass for all views.
Definition: vtkView.h:55
@ port
Definition: vtkX3D.h:453
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252