OGS
GeoObjectListItem.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include "Base/TreeItem.h"
7
8#include "GeoLib/GeoType.h"
9
13#include <QModelIndex>
14#include <vtkPolyDataAlgorithm.h>
15
23{
24public:
26 GeoObjectListItem(const QList<QVariant>& data,
27 TreeItem* parent,
28 const std::vector<GeoLib::Point*>* geo_data = nullptr,
30 : TreeItem(data, parent),
32 _type(type)
33 {
34 QString geo_name = parent->data(0).toString();
35 static_cast<VtkPointsSource*>(_vtkSource)->setPoints(geo_data);
36 static_cast<VtkPointsSource*>(_vtkSource)->SetName(geo_name + " - Points");
37 }
38
40 GeoObjectListItem(const QList<QVariant>& data,
41 TreeItem* parent,
42 const std::vector<GeoLib::Polyline*>* geo_data = nullptr,
44 : TreeItem(data, parent),
46 _type(type)
47 {
48 QString geo_name = parent->data(0).toString();
49 static_cast<VtkPolylinesSource*>(_vtkSource)->setPolylines(geo_data);
50 static_cast<VtkPolylinesSource*>(_vtkSource)->SetName(geo_name + " - Polylines");
51 }
52
54 GeoObjectListItem(const QList<QVariant>& data,
55 TreeItem* parent,
56 const std::vector<GeoLib::Surface*>* geo_data = nullptr,
58 : TreeItem(data, parent),
60 _type(type)
61 {
62 QString geo_name = parent->data(0).toString();
63 static_cast<VtkSurfacesSource*>(_vtkSource)->setSurfaces(geo_data);
64 static_cast<VtkSurfacesSource*>(_vtkSource)->SetName(geo_name + " - Surfaces");
65 }
66
67 ~GeoObjectListItem() override { _vtkSource->Delete(); }
70
72 vtkPolyDataAlgorithm* vtkSource() const { return _vtkSource; }
73
74private:
77 vtkPolyDataAlgorithm* _vtkSource;
78
80};
vtkPolyDataAlgorithm * _vtkSource
vtkPolyDataAlgorithm * vtkSource() const
Returns the Vtk polydata source object.
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
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.
TreeItem(QList< QVariant > data, TreeItem *parent)
Definition TreeItem.cpp:12
virtual QVariant data(int column) const
Definition TreeItem.cpp:83
void SetName(QString name)
Sets the name.
VtkPointsSource is a VTK source object for the visualization of point data. As a vtkPolyDataAlgorithm...
void setPoints(const std::vector< GeoLib::Point * > *points)
Sets the points as a vector.
VtkPolylinesSource is a VTK source object for the visualisation of polyline data. As a vtkPolyDataAlg...
void setPolylines(const std::vector< GeoLib::Polyline * > *polylines)
Sets the polyline vector.
VTK source object for the visualisation of surfaces. Technically, surfaces are displayed as triangula...
void setSurfaces(const std::vector< GeoLib::Surface * > *surfaces)
Sets the surfaces vector.
GEOTYPE
Definition GeoType.h:12