Workaround for #3332
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
@@ -236,13 +237,27 @@ void GeometryObject::projectShapeWithPolygonAlgo(const TopoDS_Shape& input,
|
||||
{
|
||||
// Clear previous Geometry
|
||||
clear();
|
||||
|
||||
//work around for Mantis issue #3332
|
||||
//if 3332 gets fixed in OCC, this will produce shifted views and will need
|
||||
//to be reverted.
|
||||
TopoDS_Shape inCopy;
|
||||
if (!m_isPersp) {
|
||||
gp_Pnt gCenter = findCentroid(input,
|
||||
viewAxis);
|
||||
Base::Vector3d motion(-gCenter.X(),-gCenter.Y(),-gCenter.Z());
|
||||
inCopy = moveShape(input,motion);
|
||||
} else {
|
||||
BRepBuilderAPI_Copy BuilderCopy(input);
|
||||
inCopy = BuilderCopy.Shape();
|
||||
}
|
||||
|
||||
auto start = chrono::high_resolution_clock::now();
|
||||
|
||||
Handle(HLRBRep_PolyAlgo) brep_hlrPoly = NULL;
|
||||
|
||||
try {
|
||||
TopExp_Explorer faces(input, TopAbs_FACE);
|
||||
TopExp_Explorer faces(inCopy, TopAbs_FACE);
|
||||
for (int i = 1; faces.More(); faces.Next(), i++) {
|
||||
const TopoDS_Face& f = TopoDS::Face(faces.Current());
|
||||
if (!f.IsNull()) {
|
||||
@@ -250,7 +265,8 @@ void GeometryObject::projectShapeWithPolygonAlgo(const TopoDS_Shape& input,
|
||||
}
|
||||
}
|
||||
brep_hlrPoly = new HLRBRep_PolyAlgo();
|
||||
brep_hlrPoly->Load(input);
|
||||
brep_hlrPoly->Load(inCopy);
|
||||
|
||||
if (m_isPersp) {
|
||||
double fLength = std::max(Precision::Confusion(), m_focus);
|
||||
HLRAlgo_Projector projector(viewAxis, fLength);
|
||||
@@ -265,10 +281,6 @@ void GeometryObject::projectShapeWithPolygonAlgo(const TopoDS_Shape& input,
|
||||
catch (...) {
|
||||
Standard_Failure::Raise("GeometryObject::projectShapeWithPolygonAlgo - error occurred while projecting shape");
|
||||
}
|
||||
auto end = chrono::high_resolution_clock::now();
|
||||
auto diff = end - start;
|
||||
double diffOut = chrono::duration <double, milli>(diff).count();
|
||||
Base::Console().Log("TIMING - %s GO spent: %.3f millisecs in HLRBRep_PolyAlgo & co\n", m_parentName.c_str(), diffOut);
|
||||
|
||||
try {
|
||||
HLRBRep_PolyHLRToShape polyhlrToShape;
|
||||
@@ -296,6 +308,10 @@ void GeometryObject::projectShapeWithPolygonAlgo(const TopoDS_Shape& input,
|
||||
catch (...) {
|
||||
Standard_Failure::Raise("GeometryObject::projectShapeWithPolygonAlgo - error occurred while extracting edges");
|
||||
}
|
||||
auto end = chrono::high_resolution_clock::now();
|
||||
auto diff = end - start;
|
||||
double diffOut = chrono::duration <double, milli>(diff).count();
|
||||
Base::Console().Log("TIMING - %s GO spent: %.3f millisecs in HLRBRep_PolyAlgo & co\n", m_parentName.c_str(), diffOut);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user