• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/GUISupport/Qt/vtkQtTreeModelAdapter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkQtTreeModelAdapter.h,v $
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 -------------------------------------------------------------------------*/
00034 #ifndef __vtkQtTreeModelAdapter_h
00035 #define __vtkQtTreeModelAdapter_h
00036 
00037 #include "QVTKWin32Header.h"
00038 #include "vtkType.h"
00039 #include "vtkSelection.h"
00040 
00041 #include "vtkQtAbstractModelAdapter.h"
00042 #include <QHash>
00043 
00044 class vtkTree;
00045 class vtkAdjacentVertexIterator;
00046 
00047 class QVTK_EXPORT vtkQtTreeModelAdapter : public vtkQtAbstractModelAdapter
00048 {
00049   Q_OBJECT
00050 
00051 public:
00052   vtkQtTreeModelAdapter(QObject *parent = 0, vtkTree* tree = 0);
00053   ~vtkQtTreeModelAdapter();
00054   
00056 
00057   virtual void SetVTKDataObject(vtkDataObject *data);
00058   virtual vtkDataObject* GetVTKDataObject() const;
00060   
00061   vtkIdType IdToPedigree(vtkIdType id) const;
00062   vtkIdType PedigreeToId(vtkIdType pedigree) const;
00063   QModelIndex PedigreeToQModelIndex(vtkIdType id) const;
00064   vtkIdType QModelIndexToPedigree(QModelIndex index) const;
00065   
00066   virtual void SetKeyColumnName(const char* name);
00067 
00069 
00070   void setTree(vtkTree* t);
00071   vtkTree* tree() const { return this->Tree; }
00073   
00074   QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
00075   bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
00076   Qt::ItemFlags flags(const QModelIndex &index) const;
00077   QVariant headerData(int section, Qt::Orientation orientation,
00078                       int role = Qt::DisplayRole) const;
00079   QModelIndex index(vtkIdType index) const;
00080   QModelIndex index(int row, int column,
00081                     const QModelIndex &parent = QModelIndex()) const;
00082   QModelIndex parent(const QModelIndex &index) const;
00083   int rowCount(const QModelIndex &parent = QModelIndex()) const;
00084   int columnCount(const QModelIndex &parent = QModelIndex()) const;
00085 
00086 protected:
00087   void treeModified();
00088   void GenerateHashMap(vtkIdType & row, vtkIdType id, QModelIndex index);
00089   
00090   vtkTree* Tree;
00091   vtkAdjacentVertexIterator* ChildIterator;
00092   unsigned long TreeMTime;
00093   QHash<vtkIdType, vtkIdType> IdToPedigreeHash;
00094   QHash<vtkIdType, QModelIndex> PedigreeToIndexHash;
00095   QHash<QModelIndex, vtkIdType> IndexToIdHash;
00096   QHash<vtkIdType, vtkIdType> RowToPedigreeHash;
00097 
00098   QHash<QModelIndex, QVariant> IndexToDecoration;
00099   
00100 private:
00101   vtkQtTreeModelAdapter(const vtkQtTreeModelAdapter &);  // Not implemented
00102   void operator=(const vtkQtTreeModelAdapter&);  // Not implemented.
00103 };
00104 
00105 #endif

Generated by  doxygen 1.7.1