OGS
BaseItem.h
Go to the documentation of this file.
1 
14 #pragma once
15 
17 #include <QModelIndex>
18 #include <vtkPolyDataAlgorithm.h>
19 
20 namespace GeoLib
21 {
22 class Point;
23 }
24 
31 class BaseItem
32 {
33 public:
34  explicit BaseItem(const QString& listName,
35  const std::vector<GeoLib::Point*>* stations = nullptr)
36  : _stations(stations), _vtkSource(VtkStationSource::New())
37  {
38  // create the vtk-object for 3d-visualisation of this list
39  static_cast<VtkStationSource*>(_vtkSource)->setStations(stations);
40  static_cast<VtkStationSource*>(_vtkSource)->SetName(listName);
41  }
42 
44  {
45  _vtkSource->Delete();
46  }
47 
49  QModelIndex modelIndex() const { return _modelIndex; }
50 
52  void setModelIndex( QModelIndex index ) { _modelIndex = index; }
53 
54  const std::vector<GeoLib::Point*>* getStations() { return _stations; }
55 
57  vtkPolyDataAlgorithm* vtkSource() const { return _vtkSource; }
58 
59 private:
60  QModelIndex _modelIndex;
61  const std::vector<GeoLib::Point*>* _stations;
62 
65  vtkPolyDataAlgorithm* _vtkSource;
66 };
Definition of the VtkStationSource class.
A BaseItem contains additional Information about a subtree in the StationTreeModel.
Definition: BaseItem.h:32
const std::vector< GeoLib::Point * > * getStations()
Definition: BaseItem.h:54
QModelIndex modelIndex() const
Returns the associated QModelIndex which belongs to a Qt model.
Definition: BaseItem.h:49
~BaseItem()
Definition: BaseItem.h:43
void setModelIndex(QModelIndex index)
Sets the model index.
Definition: BaseItem.h:52
vtkPolyDataAlgorithm * vtkSource() const
Returns the Vtk polydata source object.
Definition: BaseItem.h:57
vtkPolyDataAlgorithm * _vtkSource
Definition: BaseItem.h:65
const std::vector< GeoLib::Point * > * _stations
Definition: BaseItem.h:61
BaseItem(const QString &listName, const std::vector< GeoLib::Point * > *stations=nullptr)
Definition: BaseItem.h:34
QModelIndex _modelIndex
Definition: BaseItem.h:60
VTK source object for the visualisation of station data (including boreholes)