![]() |
OGS
|
|
A model for the GeoTreeView implementing a tree as a double-linked list.
Definition at line 29 of file GeoTreeModel.h.
#include <GeoTreeModel.h>
Public Member Functions | |
| GeoTreeModel (QObject *parent=nullptr) | |
| ~GeoTreeModel () override | |
| void | addPointList (QString geoName, GeoLib::PointVec const &pointVec) |
| void | addPolylineList (QString geoName, GeoLib::PolylineVec const &polylineVec) |
| Adds a subtree "Polylines" to an existing geometry with the given name. | |
| void | appendPolylines (const std::string &name, GeoLib::PolylineVec const &polylineVec) |
| Appends polylines to the "Polyline"-subtree. | |
| void | addSurfaceList (QString geoName, GeoLib::SurfaceVec const &surfaceVec) |
| Adds a subtree "Surfaces" to an existing geometry with the given name. | |
| void | appendSurfaces (const std::string &name, GeoLib::SurfaceVec const &surfaceVec) |
| Appends surfaces to the "Surface"-subtree. | |
| const std::vector< GeoTreeItem * > & | getLists () |
| Returns a list of all existing geometries. | |
| void | removeGeoList (const std::string &name, GeoLib::GEOTYPE type) |
| void | renameGeometry (std::string const &old_name, std::string const &new_name) |
| void | setNameForItem (const std::string &name, GeoLib::GEOTYPE type, std::size_t id, std::string item_name) |
| vtkPolyDataAlgorithm * | vtkSource (const std::string &name, GeoLib::GEOTYPE type) const |
| Returns the vtk-object indicated by type of the geometry indicated by name. | |
| Public Member Functions inherited from TreeModel | |
| TreeModel (QObject *parent=nullptr) | |
| ~TreeModel () 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 |
| TreeItem * | getItem (const QModelIndex &index) const |
| QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
| QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
| QModelIndex | parent (const QModelIndex &index) const override |
| bool | removeRows (int position, int count, const QModelIndex &parent) override |
| int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
| int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
| TreeItem * | rootItem () const |
Private Member Functions | |
| void | addChildren (GeoObjectListItem *plyList, GeoLib::PolylineVec const &polyline_vec, std::size_t start_index, std::size_t end_index) |
| Adds children to the "Polylines" node. | |
| void | addChildren (GeoObjectListItem *sfcList, GeoLib::SurfaceVec const &surface_vec, std::size_t start_index, std::size_t end_index) |
| Adds children to the "Surfaces" node. | |
Private Attributes | |
| std::vector< GeoTreeItem * > | _lists |
Additional Inherited Members | |
| Public Slots inherited from TreeModel | |
| void | updateData () |
| Protected Attributes inherited from TreeModel | |
| TreeItem * | _rootItem |
|
explicit |
Constructor.
Definition at line 15 of file GeoTreeModel.cpp.
References TreeModel::TreeModel(), TreeModel::_rootItem, and TreeModel::parent().
|
overridedefault |
|
private |
Adds children to the "Polylines" node.
Definition at line 146 of file GeoTreeModel.cpp.
References TreeItem::appendChild(), TreeItem::child(), GeoLib::TemplateVec< T >::getNameIDMapBegin(), GeoLib::TemplateVec< T >::getNameIDMapEnd(), GeoLib::Polyline::getPoint(), GeoLib::Polyline::getPointID(), GeoLib::TemplateVec< T >::getVector(), INFO(), and TreeItem::setData().
Referenced by addPolylineList(), addSurfaceList(), appendPolylines(), and appendSurfaces().
|
private |
Adds children to the "Surfaces" node.
Definition at line 255 of file GeoTreeModel.cpp.
References TreeItem::appendChild(), TreeItem::child(), GeoLib::TemplateVec< T >::getNameIDMapBegin(), GeoLib::TemplateVec< T >::getNameIDMapEnd(), GeoLib::TemplateVec< T >::getVector(), INFO(), and TreeItem::setData().
| void GeoTreeModel::addPointList | ( | QString | geoName, |
| GeoLib::PointVec const & | pointVec ) |
Inserts a new subtree under _rootItem for a geometry with the given name along with a subtree named "Points" for that new geometry.
| geoName | Name of the new subtree. If no name is given a default name is assigned. |
| pointVec | The list of points to be added as children of that subtree (no geometry can be added with a set of points!) |
Definition at line 29 of file GeoTreeModel.cpp.
References _lists, TreeModel::_rootItem, GeoLib::TemplateVec< T >::getNameIDMapBegin(), GeoLib::TemplateVec< T >::getNameIDMapEnd(), GeoLib::TemplateVec< T >::getVector(), INFO(), and GeoLib::POINT.
| void GeoTreeModel::addPolylineList | ( | QString | geoName, |
| GeoLib::PolylineVec const & | polylineVec ) |
Adds a subtree "Polylines" to an existing geometry with the given name.
Definition at line 83 of file GeoTreeModel.cpp.
References TreeModel::_rootItem, addChildren(), TreeItem::appendChild(), ERR(), GeoLib::TemplateVec< T >::getVector(), GeoLib::POLYLINE, and GeoLib::TemplateVec< T >::size().
| void GeoTreeModel::addSurfaceList | ( | QString | geoName, |
| GeoLib::SurfaceVec const & | surfaceVec ) |
Adds a subtree "Surfaces" to an existing geometry with the given name.
Definition at line 191 of file GeoTreeModel.cpp.
References TreeModel::_rootItem, addChildren(), TreeItem::appendChild(), ERR(), GeoLib::TemplateVec< T >::getVector(), GeoLib::TemplateVec< T >::size(), and GeoLib::SURFACE.
| void GeoTreeModel::appendPolylines | ( | const std::string & | name, |
| GeoLib::PolylineVec const & | polylineVec ) |
Appends polylines to the "Polyline"-subtree.
Definition at line 121 of file GeoTreeModel.cpp.
References _lists, addChildren(), OGSError::box(), GeoLib::TemplateVec< T >::getVector(), TreeModel::parent(), and GeoLib::POLYLINE.
| void GeoTreeModel::appendSurfaces | ( | const std::string & | name, |
| GeoLib::SurfaceVec const & | surfaceVec ) |
Appends surfaces to the "Surface"-subtree.
Definition at line 229 of file GeoTreeModel.cpp.
References _lists, addChildren(), OGSError::box(), GeoLib::TemplateVec< T >::getVector(), TreeModel::parent(), and GeoLib::SURFACE.
|
inline |
Returns a list of all existing geometries.
Definition at line 52 of file GeoTreeModel.h.
References _lists.
| void GeoTreeModel::removeGeoList | ( | const std::string & | name, |
| GeoLib::GEOTYPE | type ) |
Removes a geometry (points, polylines & surfaces) or just a specified subtree indicated by type. Note that points cannot be deleted as long as other objects exist that depend on them.
Removes the TreeItem with the given name including all its children
Definition at line 337 of file GeoTreeModel.cpp.
References _lists, TreeModel::data(), TreeModel::index(), TreeModel::parent(), and TreeModel::removeRows().
| void GeoTreeModel::renameGeometry | ( | std::string const & | old_name, |
| std::string const & | new_name ) |
Definition at line 313 of file GeoTreeModel.cpp.
| void GeoTreeModel::setNameForItem | ( | const std::string & | name, |
| GeoLib::GEOTYPE | type, | ||
| std::size_t | id, | ||
| std::string | item_name ) |
Definition at line 385 of file GeoTreeModel.cpp.
References _lists, TreeItem::child(), GeoLib::POINT, GeoLib::POLYLINE, TreeItem::setData(), and GeoLib::SURFACE.
Referenced by MainWindow::showGeoNameDialog().
| vtkPolyDataAlgorithm * GeoTreeModel::vtkSource | ( | const std::string & | name, |
| GeoLib::GEOTYPE | type ) const |
Returns the vtk-object indicated by type of the geometry indicated by name.
Definition at line 363 of file GeoTreeModel.cpp.
References _lists, and TreeModel::data().
Referenced by VtkVisPipeline::addPipelineItem(), and VtkVisPipeline::removeSourceItem().
|
private |
Definition at line 88 of file GeoTreeModel.h.
Referenced by addPointList(), appendPolylines(), appendSurfaces(), getLists(), removeGeoList(), renameGeometry(), setNameForItem(), and vtkSource().