From f8b16e0bbb3d3cb20a17b2665857cb7e6432b7c7 Mon Sep 17 00:00:00 2001 From: blobfish Date: Wed, 26 Feb 2014 13:01:25 -0500 Subject: [PATCH] Part: CheckGeometry: Adding shape content widget to task --- src/Mod/Part/Gui/TaskCheckGeometry.cpp | 43 ++++++++++++++++++++++++-- src/Mod/Part/Gui/TaskCheckGeometry.h | 5 +++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.cpp b/src/Mod/Part/Gui/TaskCheckGeometry.cpp index 78491cff7..205fb8b4b 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.cpp +++ b/src/Mod/Part/Gui/TaskCheckGeometry.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #if OCC_VERSION_HEX >= 0x060600 #include @@ -426,6 +427,8 @@ void TaskCheckGeometryResults::goCheck() continue; checkedCount++; checkedMap.Clear(); + + buildShapeContent(baseName, shape); BRepCheck_Analyzer shapeCheck(shape); if (!shapeCheck.IsValid()) @@ -536,6 +539,25 @@ void TaskCheckGeometryResults::checkSub(const BRepCheck_Analyzer &shapeCheck, co } } +void TaskCheckGeometryResults::buildShapeContent(const QString &baseName, const TopoDS_Shape &shape) +{ + std::ostringstream stream; + if (!shapeContentString.empty()) + stream << std::endl << std::endl; + stream << baseName.toAscii().data() << ":" << std::endl; + + BRepTools_ShapeSet set; + set.Add(shape); + set.DumpExtent(stream); + + shapeContentString += stream.str(); +} + +QString TaskCheckGeometryResults::getShapeContentString() +{ + return QString::fromStdString(shapeContentString); +} + int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, ResultEntry *theRoot, const QString &baseName) { //ArgumentAnalyser was moved at version 6.6. no back port for now. @@ -835,7 +857,7 @@ void PartGui::goSetupResultUnorientableShapeFace(ResultEntry *entry) //////////////////////////////////////////////////////////////////////////////////////////////// -TaskCheckGeometryDialog::TaskCheckGeometryDialog() +TaskCheckGeometryDialog::TaskCheckGeometryDialog() : widget(0), contentLabel(0) { this->setButtonPosition(TaskDialog::South); widget = new TaskCheckGeometryResults(); @@ -844,11 +866,28 @@ TaskCheckGeometryDialog::TaskCheckGeometryDialog() widget->windowTitle(), false, 0); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); + + contentLabel = new QTextEdit(); + contentLabel->setText(widget->getShapeContentString()); + shapeContentBox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("Part_CheckGeometry"), + tr("Shape Content"), true, 0); + shapeContentBox->groupLayout()->addWidget(contentLabel); + shapeContentBox->hideGroupBox(); + Content.push_back(shapeContentBox); } TaskCheckGeometryDialog::~TaskCheckGeometryDialog() { - + if (widget) + { + delete widget; + widget = 0; + } + if (contentLabel) + { + delete contentLabel; + contentLabel = 0; + } } #include "moc_TaskCheckGeometry.cpp" diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.h b/src/Mod/Part/Gui/TaskCheckGeometry.h index cb066dac6..fed142656 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.h +++ b/src/Mod/Part/Gui/TaskCheckGeometry.h @@ -96,6 +96,7 @@ class TaskCheckGeometryResults : public QWidget public: TaskCheckGeometryResults(QWidget *parent = 0); ~TaskCheckGeometryResults(); + QString getShapeContentString(); private slots: void currentRowChanged (const QModelIndex ¤t, const QModelIndex &previous); @@ -111,12 +112,14 @@ private: bool split(QString &input, QString &doc, QString &object, QString &sub); void setupFunctionMap(); int goBOPSingleCheck(const TopoDS_Shape &shapeIn, ResultEntry *theRoot, const QString &baseName); + void buildShapeContent(const QString &baseName, const TopoDS_Shape &shape); ResultModel *model; QTreeView *treeView; QLabel *message; TopTools_MapOfShape checkedMap; SoSeparator *currentSeparator; std::vector functionMap; + std::string shapeContentString; }; class TaskCheckGeometryDialog : public Gui::TaskView::TaskDialog @@ -135,6 +138,8 @@ public: private: TaskCheckGeometryResults* widget; Gui::TaskView::TaskBox* taskbox; + Gui::TaskView::TaskBox* shapeContentBox; + QTextEdit *contentLabel; }; }