VTK
vtkQtAbstractModelAdapter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQtAbstractModelAdapter.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 -------------------------------------------------------------------------*/
34 #ifndef __vtkQtAbstractModelAdapter_h
35 #define __vtkQtAbstractModelAdapter_h
36 
37 #include "QVTKWin32Header.h"
38 #include <QAbstractItemModel>
39 #include <QItemSelection>
40 
41 class vtkDataObject;
42 class vtkSelection;
43 class QItemSelection;
44 class QVTK_EXPORT vtkQtAbstractModelAdapter : public QAbstractItemModel
45 {
46  Q_OBJECT
47 
48 public:
49 
50  // The view types.
51  enum {
53  DATA_VIEW
54  };
55 
57  QAbstractItemModel(p),
58  ViewType(FULL_VIEW),
59  KeyColumn(-1),
60  ColorColumn(-1),
61  DataStartColumn(-1),
62  DataEndColumn(-1)
63  { }
64 
66 
67  virtual void SetVTKDataObject(vtkDataObject *data) = 0;
68  virtual vtkDataObject* GetVTKDataObject() const = 0;
70 
72 
73  virtual vtkSelection* QModelIndexListToVTKIndexSelection(
74  const QModelIndexList qmil) const = 0;
75  virtual QItemSelection VTKIndexSelectionToQItemSelection(
76  vtkSelection *vtksel) const = 0;
78 
80 
83  virtual void SetViewType(int type) { this->ViewType = type; }
84  virtual int GetViewType() { return this->ViewType; }
86 
88 
91  virtual void SetKeyColumn(int col) { this->KeyColumn = col; }
92  virtual int GetKeyColumn() { return this->KeyColumn; }
93  virtual void SetKeyColumnName(const char* name) = 0;
95 
97 
101  virtual void SetColorColumn(int col) { this->ColorColumn = col; }
102  virtual int GetColorColumn() { return this->ColorColumn; }
103  virtual void SetColorColumnName(const char* name) = 0;
105 
107 
110  virtual void SetDataColumnRange(int c1, int c2)
111  { this->DataStartColumn = c1; this->DataEndColumn = c2; }
113 
114  // We make the reset() method public because it isn't always possible for
115  // an adapter to know when its input has changed, so it must be callable
116  // by an outside entity.
117  void reset() { QAbstractItemModel::reset(); }
118 
119 
120 signals:
121  void modelChanged();
122 
123 protected:
124 
128  virtual int ModelColumnToFieldDataColumn(int col) const;
129 
130  int ViewType;
135 };
136 
137 #endif
A node in a selection tree. Used to store selection results.
Definition: vtkSelection.h:43
virtual void SetKeyColumn(int col)
virtual void SetDataColumnRange(int c1, int c2)
Superclass for Qt model adapters.
general representation of visualization data
Definition: vtkDataObject.h:70
virtual void SetColorColumn(int col)
virtual void SetViewType(int type)