VTK
dox/Views/Core/vtkDataRepresentation.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkDataRepresentation.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright 2008 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00055 #ifndef __vtkDataRepresentation_h
00056 #define __vtkDataRepresentation_h
00057 
00058 #include "vtkViewsCoreModule.h" // For export macro
00059 #include "vtkPassInputTypeAlgorithm.h"
00060 
00061 class vtkAlgorithmOutput;
00062 class vtkAnnotationLayers;
00063 class vtkAnnotationLink;
00064 class vtkDataObject;
00065 class vtkSelection;
00066 class vtkStringArray;
00067 class vtkTrivialProducer;
00068 class vtkView;
00069 class vtkViewTheme;
00070 
00071 class VTKVIEWSCORE_EXPORT vtkDataRepresentation : public vtkPassInputTypeAlgorithm
00072 {
00073 public:
00074   static vtkDataRepresentation *New();
00075   vtkTypeMacro(vtkDataRepresentation, vtkPassInputTypeAlgorithm);
00076   void PrintSelf(ostream& os, vtkIndent indent);
00077 
00079 
00081   vtkAlgorithmOutput* GetInputConnection(int port = 0, int index = 0)
00082     { return this->Superclass::GetInputConnection(port, index); }
00084 
00086 
00088   vtkAnnotationLink* GetAnnotationLink()
00089     { return this->AnnotationLinkInternal; }
00090   void SetAnnotationLink(vtkAnnotationLink* link);
00092 
00095   virtual void ApplyViewTheme(vtkViewTheme* vtkNotUsed(theme)) { }
00096 
00098 
00105   void Select(vtkView* view, vtkSelection* selection)
00106     { this->Select(view, selection, false); }
00107   void Select(vtkView* view, vtkSelection* selection, bool extend);
00109 
00111 
00120   void Annotate(vtkView* view, vtkAnnotationLayers* annotations)
00121     { this->Annotate(view, annotations, false); }
00122   void Annotate(vtkView* view, vtkAnnotationLayers* annotations, bool extend);
00124 
00126 
00128   vtkSetMacro(Selectable, bool);
00129   vtkGetMacro(Selectable, bool);
00130   vtkBooleanMacro(Selectable, bool);
00132 
00134 
00139   void UpdateSelection(vtkSelection* selection)
00140     { this->UpdateSelection(selection, false); }
00141   void UpdateSelection(vtkSelection* selection, bool extend);
00143 
00145 
00150   void UpdateAnnotations(vtkAnnotationLayers* annotations)
00151     { this->UpdateAnnotations(annotations, false); }
00152   void UpdateAnnotations(vtkAnnotationLayers* annotations, bool extend);
00154 
00156 
00159   virtual vtkAlgorithmOutput* GetInternalAnnotationOutputPort()
00160     { return this->GetInternalAnnotationOutputPort(0); }
00161   virtual vtkAlgorithmOutput* GetInternalAnnotationOutputPort(int port)
00162     { return this->GetInternalAnnotationOutputPort(port, 0); }
00163   virtual vtkAlgorithmOutput* GetInternalAnnotationOutputPort(int port, int conn);
00165 
00167 
00170   virtual vtkAlgorithmOutput* GetInternalSelectionOutputPort()
00171     { return this->GetInternalSelectionOutputPort(0); }
00172   virtual vtkAlgorithmOutput* GetInternalSelectionOutputPort(int port)
00173     { return this->GetInternalSelectionOutputPort(port, 0); }
00174   virtual vtkAlgorithmOutput* GetInternalSelectionOutputPort(int port, int conn);
00176 
00178 
00181   virtual vtkAlgorithmOutput* GetInternalOutputPort()
00182     { return this->GetInternalOutputPort(0); }
00183   virtual vtkAlgorithmOutput* GetInternalOutputPort(int port)
00184     { return this->GetInternalOutputPort(port, 0); }
00185   virtual vtkAlgorithmOutput* GetInternalOutputPort(int port, int conn);
00187 
00189 
00193   vtkSetMacro(SelectionType, int);
00194   vtkGetMacro(SelectionType, int);
00196 
00198 
00199   virtual void SetSelectionArrayNames(vtkStringArray* names);
00200   vtkGetObjectMacro(SelectionArrayNames, vtkStringArray);
00202 
00204 
00205   virtual void SetSelectionArrayName(const char* name);
00206   virtual const char* GetSelectionArrayName();
00208 
00215   virtual vtkSelection* ConvertSelection(vtkView* view, vtkSelection* selection);
00216 
00217 protected:
00218   vtkDataRepresentation();
00219   ~vtkDataRepresentation();
00220 
00222 
00231   virtual int RequestData(
00232     vtkInformation*,
00233     vtkInformationVector**,
00234     vtkInformationVector*)
00235     { return 1; }
00237 
00240   virtual void ProcessEvents(vtkObject *caller, unsigned long eventId, void *callData);
00241 
00243 
00244   virtual void SetAnnotationLinkInternal(vtkAnnotationLink* link);
00245   vtkAnnotationLink* AnnotationLinkInternal;
00247 
00248   // Whether is represenation can handle a selection.
00249   bool Selectable;
00250 
00252   int SelectionType;
00253 
00255   vtkStringArray* SelectionArrayNames;
00256 
00257   //BTX
00258   friend class vtkView;
00259   friend class vtkRenderView;
00260   class Command;
00261   friend class Command;
00262   Command* Observer;
00263   //ETX
00264 
00265   // ------------------------------------------------------------------------
00266   // Methods to override in subclasses
00267   // ------------------------------------------------------------------------
00268 
00272   virtual bool AddToView(vtkView* vtkNotUsed(view)) { return true; }
00273 
00277   virtual bool RemoveFromView(vtkView* vtkNotUsed(view)) { return true; }
00278 
00282   virtual vtkAnnotationLayers* ConvertAnnotations(vtkView* view, vtkAnnotationLayers* annotations);
00283 
00284   vtkTrivialProducer* GetInternalInput(int port, int conn);
00285   void SetInternalInput(int port, int conn, vtkTrivialProducer* producer);
00286 
00287 private:
00288   vtkDataRepresentation(const vtkDataRepresentation&);  // Not implemented.
00289   void operator=(const vtkDataRepresentation&);  // Not implemented.
00290 
00291   //BTX
00292   class Internals;
00293   Internals* Implementation;
00294   //ETX
00295 };
00296 
00297 #endif