PCH: Part GUI

This commit is contained in:
Abdullah Tahiri
2019-05-03 13:44:09 +02:00
committed by abdullahtahiriyo
parent 635ce5cd81
commit 7ea21c84c3
12 changed files with 370 additions and 293 deletions

View File

@@ -30,36 +30,36 @@
# include <QThread>
# include <QTreeWidget>
# include <Python.h>
#endif
# include <Standard_Version.hxx>
# include <BRepCheck_Analyzer.hxx>
# include <BRepCheck_Result.hxx>
# include <BRepCheck_ListIteratorOfListOfStatus.hxx>
# include <BRepBuilderAPI_Copy.hxx>
# include <BRepTools_ShapeSet.hxx>
#include <Standard_Version.hxx>
#include <BRepCheck_Analyzer.hxx>
#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>
# include <BOPAlgo_ListOfCheckResult.hxx>
# endif
#if OCC_VERSION_HEX >= 0x060600
#include <BOPAlgo_ArgumentAnalyzer.hxx>
#include <BOPAlgo_ListOfCheckResult.hxx>
#endif
# include <TopoDS.hxx>
# include <TopoDS_Compound.hxx>
# include <TopTools_IndexedMapOfShape.hxx>
# include <TopExp.hxx>
# include <TopExp_Explorer.hxx>
# include <Bnd_Box.hxx>
# include <BRepBndLib.hxx>
# include <ShapeAnalysis_FreeBounds.hxx>
# include <gp_Trsf.hxx>
# include <Inventor/nodes/SoSeparator.h>
# include <Inventor/nodes/SoSwitch.h>
# include <Inventor/nodes/SoDrawStyle.h>
# include <Inventor/nodes/SoCube.h>
# include <Inventor/nodes/SoMaterial.h>
# include <Inventor/nodes/SoTransform.h>
# include <Inventor/nodes/SoResetTransform.h>
#endif //_PreComp_
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>
#include <ShapeAnalysis_FreeBounds.hxx>
#include <gp_Trsf.hxx>
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/nodes/SoSwitch.h>
#include <Inventor/nodes/SoDrawStyle.h>
#include <Inventor/nodes/SoCube.h>
#include <Inventor/nodes/SoMaterial.h>
#include <Inventor/nodes/SoTransform.h>
#include <Inventor/nodes/SoResetTransform.h>
#include "../App/PartFeature.h"
#include <Gui/BitmapFactory.h>
#include <Gui/Selection.h>
@@ -169,7 +169,7 @@ QVector<QString> buildBOPCheckResultVector()
results.push_back(QObject::tr("BOPAlgo GeomAbs_C0")); //BOPAlgo_GeomAbs_C0
results.push_back(QObject::tr("BOPAlgo_InvalidCurveOnSurface")); //BOPAlgo_InvalidCurveOnSurface
results.push_back(QObject::tr("BOPAlgo NotValid")); //BOPAlgo_NotValid
return results;
}
@@ -366,7 +366,7 @@ void ResultModel::setResults(ResultEntry *resultsIn)
}
ResultEntry* ResultModel::getEntry(const QModelIndex &index)
{
{
return nodeFromIndex(index);
}
@@ -407,7 +407,7 @@ void TaskCheckGeometryResults::setupInterface()
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(message);
layout->addWidget(treeView);
this->setLayout(layout);
this->setLayout(layout);
}
void TaskCheckGeometryResults::goCheck()
@@ -448,7 +448,7 @@ void TaskCheckGeometryResults::goCheck()
continue;
checkedCount++;
checkedMap.Clear();
buildShapeContent(baseName, shape);
BRepCheck_Analyzer shapeCheck(shape);
@@ -473,7 +473,7 @@ void TaskCheckGeometryResults::goCheck()
//BOPAlgo_ArgumentAnalyzer can be really slow!
//so only run it when the shape seems valid to BRepCheck_Analyzer And
//when the option is set.
ParameterGrp::handle group = App::GetApplication().GetUserParameter().
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod")->GetGroup("Part")->GetGroup("CheckGeometry");
bool runSignal = group->GetBool("RunBOPCheck", false);
@@ -583,11 +583,11 @@ void TaskCheckGeometryResults::buildShapeContent(const QString &baseName, const
if (!shapeContentString.empty())
stream << std::endl << std::endl;
stream << baseName.toLatin1().data() << ":" << std::endl;
BRepTools_ShapeSet set;
set.Add(shape);
set.DumpExtent(stream);
shapeContentString += stream.str();
}
@@ -602,13 +602,13 @@ int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, Resu
//ArgumentAnalyser was moved at version 6.6. no back port for now.
#if OCC_VERSION_HEX >= 0x060600
//Reference use: src/BOPTest/BOPTest_CheckCommands.cxx
//I don't why we need to make a copy, but it doesn't work without it.
//BRepAlgoAPI_Check also makes a copy of the shape.
//didn't use BRepAlgoAPI_Check because it calls BRepCheck_Analyzer itself and
//doesn't give us access to it. so I didn't want to run BRepCheck_Analyzer twice to get invalid results.
//BOPAlgo_ArgumentAnalyzer can check 2 objects with respect to a boolean op.
//this is left for another time.
TopoDS_Shape BOPCopy = BRepBuilderAPI_Copy(shapeIn).Shape();
@@ -636,7 +636,7 @@ int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, Resu
BOPCheck.CurveOnSurfaceMode() = true;
BOPCheck.MergeEdgeMode() = true;
#endif
#ifdef FC_DEBUG
Base::TimeInfo start_time;
#endif
@@ -647,7 +647,7 @@ BOPCheck.Perform();
float bopAlgoTime = Base::TimeInfo::diffTimeF(start_time,Base::TimeInfo());
std::cout << std::endl << "BopAlgo check time is: " << bopAlgoTime << std::endl << std::endl;
#endif
if (!BOPCheck.HasFaulty())
return 0;
@@ -667,7 +667,7 @@ BOPCheck.Perform();
for (; BOPResultsIt.More(); BOPResultsIt.Next())
{
const BOPAlgo_CheckResult &current = BOPResultsIt.Value();
#if OCC_VERSION_HEX < 0x070000
const BOPCol_ListOfShape &faultyShapes1 = current.GetFaultyShapes1();
BOPCol_ListIteratorOfListOfShape faultyShapes1It(faultyShapes1);
@@ -687,7 +687,7 @@ BOPCheck.Perform();
faultyEntry->viewProviderRoot = currentSeparator;
entry->viewProviderRoot->ref();
goSetupResultBoundingBox(faultyEntry);
if (faultyShape.ShapeType() == TopAbs_FACE)
{
goSetupResultTypedSelection(faultyEntry, faultyShape, TopAbs_FACE);
@@ -843,7 +843,7 @@ void PartGui::goSetupResultBoundingBox(ResultEntry *entry)
Standard_Real xmin, ymin, zmin, xmax, ymax, zmax;
boundingBox.Get(xmin, ymin, zmin, xmax, ymax, zmax);
SbVec3f boundCenter((xmax - xmin)/2 + xmin, (ymax - ymin)/2 + ymin, (zmax - zmin)/2 + zmin);
entry->boxSep = new SoSeparator();
entry->viewProviderRoot->addChild(entry->boxSep);
entry->boxSwitch = new SoSwitch();
@@ -862,7 +862,7 @@ void PartGui::goSetupResultBoundingBox(ResultEntry *entry)
SoResetTransform *reset = new SoResetTransform();
group->addChild(reset);
SoTransform *position = new SoTransform();
position->translation.setValue(boundCenter);
group->addChild(position);
@@ -935,7 +935,7 @@ TaskCheckGeometryDialog::TaskCheckGeometryDialog() : widget(0), contentLabel(0)
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"),