File: ArrayGroupModel.h

package info (click to toggle)
vtk9 9.5.2%2Bdfsg3-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 205,916 kB
  • sloc: cpp: 2,336,565; ansic: 327,116; python: 111,200; yacc: 4,104; java: 3,977; sh: 3,032; xml: 2,771; perl: 2,189; lex: 1,787; makefile: 178; javascript: 165; objc: 153; tcl: 59
file content (56 lines) | stat: -rw-r--r-- 1,661 bytes parent folder | download | duplicates (5)
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
#ifndef ArrayGroupModel_h
#define ArrayGroupModel_h

#include <QAbstractTableModel>

// #include <vtkDataSetAttributes.h>
// #include <vtkDataArray.h>
#include <vtkStringToken.h>

class vtkAbstractArray;
class vtkCellGrid;
class vtkDataSetAttributes;

class ArrayGroupModel : public QAbstractTableModel
{
public:
  ArrayGroupModel(vtkCellGrid* data, vtkStringToken groupName, QObject* parent = nullptr);
  ~ArrayGroupModel() override;

  bool setGroupName(vtkStringToken groupName, bool signalChange = false);
  vtkStringToken groupName() const { return this->GroupName; }

  int rowCount(const QModelIndex& parent) const override;
  int columnCount(const QModelIndex& parent) const override;
  QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
  QVariant data(const QModelIndex& index, int role) const override;
  bool setData(const QModelIndex& index, const QVariant& value, int role) override;
  Qt::ItemFlags flags(const QModelIndex& index) const override; //  return Qt::ItemIsEditable.

Q_SIGNALS:
  void modelChanged();

protected:
  vtkCellGrid* Data;
  vtkStringToken GroupName;
  vtkDataSetAttributes* CurrentTable{ nullptr };
  std::unordered_map<vtkStringToken, int> ArrayColumnStart;
  struct ColumnData
  {
    ColumnData() = default;
    ColumnData(const ColumnData&) = default;
    ColumnData(vtkAbstractArray* array, int comp, const std::string& label)
      : Array(array)
      , Component(comp)
      , Label(label)
    {
    }

    vtkAbstractArray* Array{ nullptr };
    int Component{ 0 };
    std::string Label;
  };
  std::vector<ColumnData> ColumnToArrayComponent;
};

#endif // ArrayGroupModel_h