SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
SWMMObjectTreeModel Class Reference

#include <swmmobjecttreemodel.h>

Inheritance diagram for SWMMObjectTreeModel:
Collaboration diagram for SWMMObjectTreeModel:

Public Types

enum  Role {
  RoleCategory = Qt::UserRole + 10 ,
  RoleRow = Qt::UserRole + 11 ,
  RoleIsLeaf = Qt::UserRole + 12 ,
  RoleObjectRef = Qt::UserRole + 13 ,
  RoleSection = Qt::UserRole + 14 ,
  RoleDataCategory = Qt::UserRole + 15
}
 
enum  Section : int {
  SectionNetwork = 0 ,
  SectionDivider = 1 ,
  SectionData = 2
}
 

Public Slots

void reload ()
 
void scheduleReload ()
 

Public Member Functions

 SWMMObjectTreeModel (QObject *parent=nullptr)
 
 ~SWMMObjectTreeModel () override
 
void setLayer (SWMMModelLayer *layer)
 
SWMMModelLayer::Category categoryAtTopRow (int topRow) const
 
int topRowForCategory (SWMMModelLayer::Category c) const
 
QModelIndex indexFor (SWMMModelLayer::Category c, int row) const
 
QModelIndex indexFor (const SWMMObjectRef &ref) const
 
Section sectionAtTopRow (int topRow) const
 
SWMMModelLayer::DataCategory dataCategoryAtTopRow (int topRow) const
 
int topRowForDataCategory (SWMMModelLayer::DataCategory c) const
 
QModelIndex index (int row, int column, const QModelIndex &parent={}) const override
 
QModelIndex parent (const QModelIndex &child) const override
 
int rowCount (const QModelIndex &parent={}) const override
 
int columnCount (const QModelIndex &parent={}) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
Qt::DropActions supportedDropActions () const override
 
QStringList mimeTypes () const override
 
QMimeData * mimeData (const QModelIndexList &indexes) const override
 
bool canDropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override
 
bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
 

Member Enumeration Documentation

◆ Role

Enumerator
RoleCategory 
RoleRow 
RoleIsLeaf 
RoleObjectRef 
RoleSection 
RoleDataCategory 

◆ Section

Slice BM.0 — top-level partitioning of the tree.

Enumerator
SectionNetwork 

Spatial categories (Junctions … Rain Gages)

SectionDivider 

Visual separator row (non-selectable)

SectionData 

Non-spatial data objects (Curves … Inlets)

Constructor & Destructor Documentation

◆ SWMMObjectTreeModel()

SWMMObjectTreeModel::SWMMObjectTreeModel ( QObject *  parent = nullptr)
explicit

◆ ~SWMMObjectTreeModel()

SWMMObjectTreeModel::~SWMMObjectTreeModel ( )
overridedefault

Member Function Documentation

◆ canDropMimeData()

bool SWMMObjectTreeModel::canDropMimeData ( const QMimeData *  data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex &  parent 
) const
override
Here is the call graph for this function:
Here is the caller graph for this function:

◆ categoryAtTopRow()

SWMMModelLayer::Category SWMMObjectTreeModel::categoryAtTopRow ( int  topRow) const

Which SWMMModelLayer::Category is rendered at top-level row topRow, or NumCategories if the row is out of range or the row is a data / divider row.

Here is the caller graph for this function:

◆ columnCount()

int SWMMObjectTreeModel::columnCount ( const QModelIndex &  parent = {}) const
override

◆ data()

QVariant SWMMObjectTreeModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dataCategoryAtTopRow()

SWMMModelLayer::DataCategory SWMMObjectTreeModel::dataCategoryAtTopRow ( int  topRow) const

Slice BM.0 — which SWMMModelLayer::DataCategory is rendered at top-level row topRow, or NumDataCategories when out of range or the row is in another section.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dropMimeData()

bool SWMMObjectTreeModel::dropMimeData ( const QMimeData *  data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex &  parent 
)
override
Here is the call graph for this function:

◆ flags()

Qt::ItemFlags SWMMObjectTreeModel::flags ( const QModelIndex &  index) const
override
Here is the call graph for this function:

◆ headerData()

QVariant SWMMObjectTreeModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override

◆ index()

QModelIndex SWMMObjectTreeModel::index ( int  row,
int  column,
const QModelIndex &  parent = {} 
) const
override
Here is the call graph for this function:
Here is the caller graph for this function:

◆ indexFor() [1/2]

QModelIndex SWMMObjectTreeModel::indexFor ( const SWMMObjectRef ref) const

Convenience: model index for a selection-bus object. Walks the layer's name→(cat,row) map — O(1) hash lookup. Returns an invalid QModelIndex when the object is unknown.

Here is the call graph for this function:

◆ indexFor() [2/2]

QModelIndex SWMMObjectTreeModel::indexFor ( SWMMModelLayer::Category  c,
int  row 
) const

Model index for a specific leaf (category, row), or invalid if either is out of range / the category is hidden.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mimeData()

QMimeData * SWMMObjectTreeModel::mimeData ( const QModelIndexList &  indexes) const
override
Here is the call graph for this function:

◆ mimeTypes()

QStringList SWMMObjectTreeModel::mimeTypes ( ) const
override

◆ parent()

QModelIndex SWMMObjectTreeModel::parent ( const QModelIndex &  child) const
override
Here is the call graph for this function:

◆ reload

void SWMMObjectTreeModel::reload ( )
slot

Full reset — call when the layer's SoA has been replaced wholesale (model reload / CRS reproject / add-node that shifts the category counts).

Here is the caller graph for this function:

◆ rowCount()

int SWMMObjectTreeModel::rowCount ( const QModelIndex &  parent = {}) const
override
Here is the call graph for this function:

◆ scheduleReload

void SWMMObjectTreeModel::scheduleReload ( )
slot

Coalescing wrapper — schedules a single reload() on the next event-loop turn no matter how many change signals fire this turn. Data-object mutations arrive in bursts (a registry rename fires remove+add pairs; bulk imports fire per object) and some fire BEFORE the mutation completes (providerAboutToBeRemoved), so the deferred reload both dedupes and reads post-mutation state.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sectionAtTopRow()

SWMMObjectTreeModel::Section SWMMObjectTreeModel::sectionAtTopRow ( int  topRow) const

Slice BM.0 — section discriminator for a top-level row.

Here is the caller graph for this function:

◆ setData()

bool SWMMObjectTreeModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
override
Here is the call graph for this function:

◆ setLayer()

void SWMMObjectTreeModel::setLayer ( SWMMModelLayer layer)

Bind the model to a SWMM layer. Triggers beginResetModel / endResetModel and rebuilds the cached visible-category list. Pass nullptr to detach.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ supportedDropActions()

Qt::DropActions SWMMObjectTreeModel::supportedDropActions ( ) const
override

◆ topRowForCategory()

int SWMMObjectTreeModel::topRowForCategory ( SWMMModelLayer::Category  c) const

Top-level row for a given category, or -1 when that category contains no visible objects (empty categories are omitted).

Here is the caller graph for this function:

◆ topRowForDataCategory()

int SWMMObjectTreeModel::topRowForDataCategory ( SWMMModelLayer::DataCategory  c) const

Slice BM.0 — top-level row for a given data category, or -1 when empty / not currently shown.


The documentation for this class was generated from the following files: