1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
/*=========================================================================
Program: Visualization Toolkit
Module: $RCSfile: vtkDataRepresentation.h,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*----------------------------------------------------------------------------
Copyright (c) Sandia Corporation
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
----------------------------------------------------------------------------*/
// .NAME vtkDataRepresentation - The superclass for all representations
//
// .SECTION Description
// vtkDataRepresentation the superclass for representations of data objects.
// This class itself may be instantiated and used as a representation
// that simply holds a connection to a pipeline.
//
// If there are multiple representations present in a view, you should use
// a subclass of vtkDataRepresentation. The representation is
// responsible for taking the input pipeline connection and converting it
// to an object usable by a view. In the most common case, the representation
// will contain the pipeline necessary to convert a data object into an actor
// or set of actors.
//
// The representation has a concept of a selection. If the user performs a
// selection operation on the view, the view forwards this on to its
// representations. The representation is responsible for displaying that
// selection in an appropriate way.
//
// Representation selections may also be linked. The representation shares
// the selection by converting it into a view-independent format, then
// setting the selection on its vtkSelectionLink. Other representations
// sharing the same selection link instance will get the same selection
// from the selection link when the view is updated. The application is
// responsible for linking representations as appropriate by setting the
// same vtkSelectionLink on each linked representation.
#ifndef __vtkDataRepresentation_h
#define __vtkDataRepresentation_h
#include "vtkObject.h"
class vtkAlgorithmOutput;
class vtkDataObject;
class vtkSelection;
class vtkSelectionLink;
class vtkView;
class VTK_VIEWS_EXPORT vtkDataRepresentation : public vtkObject
{
public:
static vtkDataRepresentation *New();
vtkTypeRevisionMacro(vtkDataRepresentation, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// A convenience method that calls SetInputConnection on the producer's
// connection.
void SetInput(vtkDataObject* input);
// Description:
// Sets the input pipeline connection to this representation.
// This method should be overridden by subclasses to connect to the
// internal pipeline.
virtual void SetInputConnection(vtkAlgorithmOutput* conn);
vtkGetObjectMacro(InputConnection, vtkAlgorithmOutput);
// Description:
// Handle a selection a view. Subclasses should not generally override this.
// This function calls ConvertSelection() to (possibly) convert the selection
// into something appropriate for linked representations.
// This function then calls UpdateSelection() with the result of the
// conversion.
void Select(vtkView* view, vtkSelection* selection);
// Description:
// Copies the selection into the representation's linked selection
// and triggers a SelectionChanged event.
void UpdateSelection(vtkSelection* selection);
// Description:
// The selection linking object.
// Set the same selection link on multiple representations to link views.
// Subclasses should override SetSelectionLink to additionally connect
// the selection link into the internal selection pipeline.
vtkGetObjectMacro(SelectionLink, vtkSelectionLink);
virtual void SetSelectionLink(vtkSelectionLink* link);
protected:
vtkDataRepresentation();
~vtkDataRepresentation();
// Decription:
// Adds the representation to the view. This is called from
// vtkView::AddRepresentation(). Subclasses should override this method.
virtual bool AddToView(vtkView* vtkNotUsed(view)) { return true; }
// Decription:
// Removes the representation to the view. This is called from
// vtkView::RemoveRepresentation(). Subclasses should override this method.
virtual bool RemoveFromView(vtkView* vtkNotUsed(view)) { return true; }
// Description:
// Convert the selection to a type appropriate for sharing with other
// representations through vtkSelectionLink, possibly using the view.
// For the superclass, we just return the same selection.
// Subclasses may do something more fancy, like convert the selection
// from a frustrum to a list of pedigree ids. If the selection cannot
// be applied to this representation, return NULL.
virtual vtkSelection* ConvertSelection(vtkView* view, vtkSelection* selection);
// The input connection.
vtkAlgorithmOutput* InputConnection;
// The linked selection.
vtkSelectionLink* SelectionLink;
//BTX
friend class vtkView;
//ETX
private:
vtkDataRepresentation(const vtkDataRepresentation&); // Not implemented.
void operator=(const vtkDataRepresentation&); // Not implemented.
};
#endif
|