OGS
GeoObjectListItem.h
Go to the documentation of this file.
1 
15 #pragma once
16 
17 #include "Base/TreeItem.h"
18 
19 #include "GeoLib/GeoType.h"
20 
21 #include "VtkVis/VtkPointsSource.h"
24 #include <QModelIndex>
25 #include <vtkPolyDataAlgorithm.h>
26 
34 {
35 public:
37  GeoObjectListItem(const QList<QVariant>& data,
38  TreeItem* parent,
39  const std::vector<GeoLib::Point*>* geo_data = nullptr,
41  : TreeItem(data, parent),
43  _type(type)
44  {
45  QString geo_name = parent->data(0).toString();
46  static_cast<VtkPointsSource*>(_vtkSource)->setPoints(geo_data);
47  static_cast<VtkPointsSource*>(_vtkSource)->SetName(geo_name + " - Points");
48  }
49 
51  GeoObjectListItem(const QList<QVariant>& data,
52  TreeItem* parent,
53  const std::vector<GeoLib::Polyline*>* geo_data = nullptr,
55  : TreeItem(data, parent),
57  _type(type)
58  {
59  QString geo_name = parent->data(0).toString();
60  static_cast<VtkPolylinesSource*>(_vtkSource)->setPolylines(geo_data);
61  static_cast<VtkPolylinesSource*>(_vtkSource)->SetName(geo_name + " - Polylines");
62  }
63 
65  GeoObjectListItem(const QList<QVariant>& data,
66  TreeItem* parent,
67  const std::vector<GeoLib::Surface*>* geo_data = nullptr,
69  : TreeItem(data, parent),
71  _type(type)
72  {
73  QString geo_name = parent->data(0).toString();
74  static_cast<VtkSurfacesSource*>(_vtkSource)->setSurfaces(geo_data);
75  static_cast<VtkSurfacesSource*>(_vtkSource)->SetName(geo_name + " - Surfaces");
76  }
77 
78  ~GeoObjectListItem() override { _vtkSource->Delete(); }
81 
83  vtkPolyDataAlgorithm* vtkSource() const { return _vtkSource; }
84 
85 private:
88  vtkPolyDataAlgorithm* _vtkSource;
89 
91 };
Definition of the GEOTYPE enumeration.
Definition of the TreeItem class.
Definition of the VtkPointsSource class.
Definition of the VtkPolylinesSource class.
Definition of the VtkSurfacesSource class.
vtkPolyDataAlgorithm * _vtkSource
GeoLib::GEOTYPE getType()
Returns the type of geo-objects contained in the subtree of this item.
GeoObjectListItem(const QList< QVariant > &data, TreeItem *parent, const std::vector< GeoLib::Point * > *geo_data=nullptr, GeoLib::GEOTYPE type=GeoLib::GEOTYPE::POINT)
Constructor for the TreeItem specifying the "Points"-subtree of a geometry.
GeoLib::GEOTYPE _type
GeoObjectListItem(const QList< QVariant > &data, TreeItem *parent, const std::vector< GeoLib::Polyline * > *geo_data=nullptr, GeoLib::GEOTYPE type=GeoLib::GEOTYPE::POLYLINE)
Constructor for the TreeItem specifying the "Polylines"-subtree of a geometry.
~GeoObjectListItem() override
vtkPolyDataAlgorithm * vtkSource() const
Returns the Vtk polydata source object.
GeoObjectListItem(const QList< QVariant > &data, TreeItem *parent, const std::vector< GeoLib::Surface * > *geo_data=nullptr, GeoLib::GEOTYPE type=GeoLib::GEOTYPE::SURFACE)
Constructor for the TreeItem specifying the "Surfaces"-subtree of a geometry.
Objects nodes for the TreeModel.
Definition: TreeItem.h:28
virtual QVariant data(int column) const
Definition: TreeItem.cpp:94
VtkPointsSource is a VTK source object for the visualization of point data. As a vtkPolyDataAlgorithm...
VtkPolylinesSource is a VTK source object for the visualisation of polyline data. As a vtkPolyDataAlg...
VTK source object for the visualisation of surfaces. Technically, surfaces are displayed as triangula...
GEOTYPE
Definition: GeoType.h:25