OGS
|
A model for the GeoTreeView implementing a tree as a double-linked list.
Definition at line 40 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 26 of file GeoTreeModel.cpp.
References TreeModel::_rootItem.
|
overridedefault |
|
private |
Adds children to the "Polylines" node.
Definition at line 157 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.
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 40 of file GeoTreeModel.cpp.
References _lists, TreeModel::_rootItem, TreeItem::appendChild(), GeoLib::TemplateVec< T >::getNameIDMapBegin(), GeoLib::TemplateVec< T >::getNameIDMapEnd(), GeoLib::TemplateVec< T >::getVector(), INFO(), and GeoLib::POINT.
Referenced by GEOModels::addPointVec(), and GEOModels::updateGeometry().
void GeoTreeModel::addPolylineList | ( | QString | geoName, |
GeoLib::PolylineVec const & | polylineVec ) |
Adds a subtree "Polylines" to an existing geometry with the given name.
Definition at line 94 of file GeoTreeModel.cpp.
References TreeModel::_rootItem, addChildren(), TreeItem::appendChild(), TreeItem::child(), TreeItem::childCount(), TreeItem::data(), ERR(), GeoLib::TemplateVec< T >::getVector(), GeoLib::POLYLINE, and GeoLib::TemplateVec< T >::size().
Referenced by GEOModels::addPolylineVec(), and GEOModels::updateGeometry().
void GeoTreeModel::addSurfaceList | ( | QString | geoName, |
GeoLib::SurfaceVec const & | surfaceVec ) |
Adds a subtree "Surfaces" to an existing geometry with the given name.
Definition at line 202 of file GeoTreeModel.cpp.
References TreeModel::_rootItem, addChildren(), TreeItem::appendChild(), TreeItem::child(), TreeItem::childCount(), TreeItem::data(), ERR(), GeoLib::TemplateVec< T >::getVector(), GeoLib::TemplateVec< T >::size(), and GeoLib::SURFACE.
Referenced by GEOModels::addSurfaceVec(), and GEOModels::updateGeometry().
void GeoTreeModel::appendPolylines | ( | const std::string & | name, |
GeoLib::PolylineVec const & | polylineVec ) |
Appends polylines to the "Polyline"-subtree.
Definition at line 132 of file GeoTreeModel.cpp.
References _lists, addChildren(), OGSError::box(), GeoLib::TemplateVec< T >::getVector(), TreeModel::parent(), and GeoLib::POLYLINE.
Referenced by GEOModels::appendPolylineVec().
void GeoTreeModel::appendSurfaces | ( | const std::string & | name, |
GeoLib::SurfaceVec const & | surfaceVec ) |
Appends surfaces to the "Surface"-subtree.
Definition at line 240 of file GeoTreeModel.cpp.
References _lists, addChildren(), OGSError::box(), GeoLib::TemplateVec< T >::getVector(), TreeModel::parent(), and GeoLib::SURFACE.
Referenced by GEOModels::appendSurfaceVec().
|
inline |
Returns a list of all existing geometries.
Definition at line 63 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 348 of file GeoTreeModel.cpp.
References _lists, TreeModel::data(), TreeModel::index(), TreeModel::parent(), and TreeModel::removeRows().
Referenced by GEOModels::removePointVec(), GEOModels::removePolylineVec(), GEOModels::removeSurfaceVec(), and GEOModels::updateGeometry().
void GeoTreeModel::renameGeometry | ( | std::string const & | old_name, |
std::string const & | new_name ) |
Definition at line 324 of file GeoTreeModel.cpp.
References _lists, and INFO().
Referenced by GEOModels::renameGeometry().
void GeoTreeModel::setNameForItem | ( | const std::string & | name, |
GeoLib::GEOTYPE | type, | ||
std::size_t | id, | ||
std::string | item_name ) |
Definition at line 396 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 374 of file GeoTreeModel.cpp.
References _lists, and TreeModel::data().
Referenced by VtkVisPipeline::addPipelineItem(), and VtkVisPipeline::removeSourceItem().
|
private |
Definition at line 99 of file GeoTreeModel.h.
Referenced by addPointList(), appendPolylines(), appendSurfaces(), getLists(), removeGeoList(), renameGeometry(), setNameForItem(), and vtkSource().