From 17476b25dce167283212695acca60db7edc6a2b6 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Mon, 26 Sep 2016 10:55:31 +0200 Subject: [PATCH] FEM: add Groups to mesh property editor info --- src/Mod/Fem/Gui/PropertyFemMeshItem.cpp | 24 ++++++++++++++++++++++-- src/Mod/Fem/Gui/PropertyFemMeshItem.h | 3 +++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/Mod/Fem/Gui/PropertyFemMeshItem.cpp b/src/Mod/Fem/Gui/PropertyFemMeshItem.cpp index 7f259dd0a..35d88773f 100644 --- a/src/Mod/Fem/Gui/PropertyFemMeshItem.cpp +++ b/src/Mod/Fem/Gui/PropertyFemMeshItem.cpp @@ -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::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& props = getPropertyData(); for (std::vector::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& props = getPropertyData(); + for (std::vector::const_iterator pt = props.begin(); pt != props.end(); ++pt) { + Fem::PropertyFemMesh* prop = static_cast(*pt); + SMESH_Mesh* mesh = const_cast(prop->getValue().getSMesh()); + ctG += mesh->NbGroup(); + } + + return ctG; +} + #include "moc_PropertyFemMeshItem.cpp" diff --git a/src/Mod/Fem/Gui/PropertyFemMeshItem.h b/src/Mod/Fem/Gui/PropertyFemMeshItem.h index bcb3924b2..d6d70d977 100644 --- a/src/Mod/Fem/Gui/PropertyFemMeshItem.h +++ b/src/Mod/Fem/Gui/PropertyFemMeshItem.h @@ -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