Part: CheckGeometry: Adding shape content widget to task

This commit is contained in:
blobfish 2014-02-26 13:01:25 -05:00 committed by wmayer
parent 7ebfa3632d
commit f8b16e0bbb
2 changed files with 46 additions and 2 deletions

View File

@ -26,6 +26,7 @@
#include <BRepCheck_Result.hxx>
#include <BRepCheck_ListIteratorOfListOfStatus.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepTools_ShapeSet.hxx>
#if OCC_VERSION_HEX >= 0x060600
#include <BOPAlgo_ArgumentAnalyzer.hxx>
@ -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"

View File

@ -96,6 +96,7 @@ class TaskCheckGeometryResults : public QWidget
public:
TaskCheckGeometryResults(QWidget *parent = 0);
~TaskCheckGeometryResults();
QString getShapeContentString();
private slots:
void currentRowChanged (const QModelIndex &current, 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<FunctionMapType> 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;
};
}