VTK
dox/Views/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 -------------------------------------------------------------------------*/
00058 #ifndef __vtkDataRepresentation_h
00059 #define __vtkDataRepresentation_h
00060 
00061 #include "vtkPassInputTypeAlgorithm.h"
00062 
00063 class vtkAlgorithmOutput;
00064 class vtkAnnotationLayers;
00065 class vtkAnnotationLink;
00066 class vtkDataObject;
00067 class vtkSelection;
00068 class vtkStringArray;
00069 class vtkView;
00070 class vtkViewTheme;
00071 
00072 class VTK_VIEWS_EXPORT vtkDataRepresentation : public vtkPassInputTypeAlgorithm
00073 {
00074 public:
00075   static vtkDataRepresentation *New();
00076   vtkTypeMacro(vtkDataRepresentation, vtkPassInputTypeAlgorithm);
00077   void PrintSelf(ostream& os, vtkIndent indent);
00078 
00080 
00082   vtkAlgorithmOutput* GetInputConnection(int port = 0, int index = 0)
00083     { return this->Superclass::GetInputConnection(port, index); }
00085   
00087 
00089   vtkAnnotationLink* GetAnnotationLink()
00090     { return this->AnnotationLinkInternal; }
00091   void SetAnnotationLink(vtkAnnotationLink* link);
00093 
00096   virtual void ApplyViewTheme(vtkViewTheme* vtkNotUsed(theme)) { }
00097 
00099 
00106   void Select(vtkView* view, vtkSelection* selection)
00107     { this->Select(view, selection, false); }
00108   void Select(vtkView* view, vtkSelection* selection, bool extend);
00110 
00112 
00121   void Annotate(vtkView* view, vtkAnnotationLayers* annotations)
00122     { this->Annotate(view, annotations, false); }
00123   void Annotate(vtkView* view, vtkAnnotationLayers* annotations, bool extend);
00125 
00127 
00129   vtkSetMacro(Selectable, bool);
00130   vtkGetMacro(Selectable, bool);
00131   vtkBooleanMacro(Selectable, bool);
00133   
00135 
00140   void UpdateSelection(vtkSelection* selection)
00141     { this->UpdateSelection(selection, false); }
00142   void UpdateSelection(vtkSelection* selection, bool extend);
00144 
00146 
00151   void UpdateAnnotations(vtkAnnotationLayers* annotations)
00152     { this->UpdateAnnotations(annotations, false); }
00153   void UpdateAnnotations(vtkAnnotationLayers* annotations, bool extend);
00155 
00157 
00160   virtual vtkAlgorithmOutput* GetInternalAnnotationOutputPort()
00161     { return this->GetInternalAnnotationOutputPort(0); }
00162   virtual vtkAlgorithmOutput* GetInternalAnnotationOutputPort(int port)
00163     { return this->GetInternalAnnotationOutputPort(port, 0); }
00164   virtual vtkAlgorithmOutput* GetInternalAnnotationOutputPort(int port, int conn);
00166 
00168 
00171   virtual vtkAlgorithmOutput* GetInternalSelectionOutputPort()
00172     { return this->GetInternalSelectionOutputPort(0); }
00173   virtual vtkAlgorithmOutput* GetInternalSelectionOutputPort(int port)
00174     { return this->GetInternalSelectionOutputPort(port, 0); }
00175   virtual vtkAlgorithmOutput* GetInternalSelectionOutputPort(int port, int conn);
00177 
00179 
00182   virtual vtkAlgorithmOutput* GetInternalOutputPort()
00183     { return this->GetInternalOutputPort(0); }
00184   virtual vtkAlgorithmOutput* GetInternalOutputPort(int port)
00185     { return this->GetInternalOutputPort(port, 0); }
00186   virtual vtkAlgorithmOutput* GetInternalOutputPort(int port, int conn);
00188  
00190 
00194   vtkSetMacro(SelectionType, int);
00195   vtkGetMacro(SelectionType, int);
00197 
00199 
00200   virtual void SetSelectionArrayNames(vtkStringArray* names);
00201   vtkGetObjectMacro(SelectionArrayNames, vtkStringArray);
00203 
00205 
00206   virtual void SetSelectionArrayName(const char* name);
00207   virtual const char* GetSelectionArrayName();
00209 
00216   virtual vtkSelection* ConvertSelection(vtkView* view, vtkSelection* selection);
00217 
00218 protected:
00219   vtkDataRepresentation();
00220   ~vtkDataRepresentation();
00221   
00223 
00232   virtual int RequestData(
00233     vtkInformation*,
00234     vtkInformationVector**,
00235     vtkInformationVector*)
00236     { return 1; }
00238 
00241   virtual void ProcessEvents(vtkObject *caller, unsigned long eventId, void *callData);
00242 
00244 
00245   virtual void SetAnnotationLinkInternal(vtkAnnotationLink* link);
00246   vtkAnnotationLink* AnnotationLinkInternal;
00248 
00249   // Whether is represenation can handle a selection.
00250   bool Selectable;
00251 
00253   int SelectionType;
00254 
00256   vtkStringArray* SelectionArrayNames;
00257 
00258   //BTX
00259   friend class vtkView;
00260   friend class vtkRenderView;
00261   class Command;
00262   friend class Command;
00263   Command* Observer;
00264   //ETX
00265 
00266   // ------------------------------------------------------------------------
00267   // Methods to override in subclasses
00268   // ------------------------------------------------------------------------
00269 
00273   virtual bool AddToView(vtkView* vtkNotUsed(view)) { return true; }
00274   
00278   virtual bool RemoveFromView(vtkView* vtkNotUsed(view)) { return true; }
00279 
00283   virtual vtkAnnotationLayers* ConvertAnnotations(vtkView* view, vtkAnnotationLayers* annotations);
00284 
00285 private:
00286   vtkDataRepresentation(const vtkDataRepresentation&);  // Not implemented.
00287   void operator=(const vtkDataRepresentation&);  // Not implemented.
00288 
00289   //BTX
00290   class Internals;
00291   Internals* Implementation;
00292   //ETX
00293 };
00294 
00295 #endif