FEM: add Groups to mesh property editor info

This commit is contained in:
Bernd Hahnebach 2016-09-26 10:55:31 +02:00 committed by Yorik van Havre
parent 084e163137
commit 17476b25dc
2 changed files with 25 additions and 2 deletions

View File

@ -67,6 +67,11 @@ PropertyFemMeshItem::PropertyFemMeshItem()
m_h->setParent(this);
m_h->setPropertyName(QLatin1String("Polyhedrons"));
this->appendChild(m_h);
m_g = static_cast<Gui::PropertyEditor::PropertyIntegerItem*>
(Gui::PropertyEditor::PropertyIntegerItem::create());
m_g->setParent(this);
m_g->setPropertyName(QLatin1String("Groups"));
this->appendChild(m_g);
}
void PropertyFemMeshItem::initialize()
@ -82,6 +87,7 @@ QVariant PropertyFemMeshItem::value(const App::Property*) const
int ctP = 0;
int ctV = 0;
int ctH = 0;
int ctG = 0;
const std::vector<App::Property*>& props = getPropertyData();
for (std::vector<App::Property*>::const_iterator pt = props.begin(); pt != props.end(); ++pt) {
@ -93,10 +99,11 @@ QVariant PropertyFemMeshItem::value(const App::Property*) const
ctP += mesh->NbPolygons();
ctV += mesh->NbVolumes();
ctH += mesh->NbPolyhedrons();
ctG += mesh->NbGroup();
}
QString str = QObject::tr("[Nodes: %1, Edges: %2, Faces: %3, Polygons: %4, Volumes: %5, Polyhedrons: %6]")
.arg(ctN).arg(ctE).arg(ctF).arg(ctP).arg(ctV).arg(ctH);
QString str = QObject::tr("[Nodes: %1, Edges: %2, Faces: %3, Polygons: %4, Volumes: %5, Polyhedrons: %6, Groups: %7]")
.arg(ctN).arg(ctE).arg(ctF).arg(ctP).arg(ctV).arg(ctH).arg(ctG);
return QVariant(str);
}
@ -208,4 +215,17 @@ int PropertyFemMeshItem::countPolyhedrons() const
return ctH;
}
int PropertyFemMeshItem::countGroups() const
{
int ctG = 0;
const std::vector<App::Property*>& props = getPropertyData();
for (std::vector<App::Property*>::const_iterator pt = props.begin(); pt != props.end(); ++pt) {
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(*pt);
SMESH_Mesh* mesh = const_cast<SMESH_Mesh*>(prop->getValue().getSMesh());
ctG += mesh->NbGroup();
}
return ctG;
}
#include "moc_PropertyFemMeshItem.cpp"

View File

@ -40,6 +40,7 @@ class PropertyFemMeshItem : public Gui::PropertyEditor::PropertyItem
Q_PROPERTY(int Polygons READ countPolygons)
Q_PROPERTY(int Volumes READ countVolumes)
Q_PROPERTY(int Polyhedrons READ countPolyhedrons)
Q_PROPERTY(int Groups READ countGroups)
TYPESYSTEM_HEADER();
virtual QWidget* createEditor(QWidget* parent, const QObject* receiver, const char* method) const;
@ -52,6 +53,7 @@ class PropertyFemMeshItem : public Gui::PropertyEditor::PropertyItem
int countPolygons() const;
int countVolumes() const;
int countPolyhedrons() const;
int countGroups() const;
protected:
virtual QVariant toolTip(const App::Property*) const;
@ -69,6 +71,7 @@ private:
Gui::PropertyEditor::PropertyIntegerItem* m_p;
Gui::PropertyEditor::PropertyIntegerItem* m_v;
Gui::PropertyEditor::PropertyIntegerItem* m_h;
Gui::PropertyEditor::PropertyIntegerItem* m_g;
};
} // namespace FemGui