From a0454af685d54e3349d0059aa0c2a29278720b83 Mon Sep 17 00:00:00 2001 From: Sebastian Hoogen Date: Thu, 17 Jul 2014 21:51:07 +0200 Subject: [PATCH] remove all references to BRepMesh --- src/Mod/Drawing/App/DrawingExport.cpp | 1 - src/Mod/Drawing/App/FeatureViewPart.cpp | 84 ---------------- src/Mod/Drawing/App/ProjectionAlgos.cpp | 26 ++--- src/Mod/Part/App/TopoShape.cpp | 107 --------------------- src/Mod/Part/App/TopoShapePyImp.cpp | 4 +- src/Mod/Part/Gui/ViewProvider.cpp | 4 +- src/Mod/Part/Gui/ViewProviderExt.cpp | 1 - src/Mod/Part/Gui/ViewProviderReference.cpp | 1 - 8 files changed, 16 insertions(+), 212 deletions(-) diff --git a/src/Mod/Drawing/App/DrawingExport.cpp b/src/Mod/Drawing/App/DrawingExport.cpp index fb480c3d8..32b31f4a4 100644 --- a/src/Mod/Drawing/App/DrawingExport.cpp +++ b/src/Mod/Drawing/App/DrawingExport.cpp @@ -59,7 +59,6 @@ #include #include #include -#include #include #include diff --git a/src/Mod/Drawing/App/FeatureViewPart.cpp b/src/Mod/Drawing/App/FeatureViewPart.cpp index ec100db57..e6ea2643c 100644 --- a/src/Mod/Drawing/App/FeatureViewPart.cpp +++ b/src/Mod/Drawing/App/FeatureViewPart.cpp @@ -52,7 +52,6 @@ #include #include #include -#include #include @@ -94,88 +93,6 @@ FeatureViewPart::~FeatureViewPart() { } -#if 0 - -App::DocumentObjectExecReturn *FeatureViewPart::execute(void) -{ - std::stringstream result; - std::string ViewName = Label.getValue(); - - App::DocumentObject* link = Source.getValue(); - if (!link) - return new App::DocumentObjectExecReturn("No object linked"); - if (!link->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) - return new App::DocumentObjectExecReturn("Linked object is not a Part object"); - TopoDS_Shape shape = static_cast(link)->Shape.getShape()._Shape; - if (shape.IsNull()) - return new App::DocumentObjectExecReturn("Linked shape object is empty"); - - Handle( HLRBRep_Algo ) brep_hlr = new HLRBRep_Algo; - brep_hlr->Add( shape ); - - gp_Ax2 transform(gp_Pnt(0,0,0),gp_Dir(0,0,1)); - HLRAlgo_Projector projector( transform ); - brep_hlr->Projector( projector ); - brep_hlr->Update(); - brep_hlr->Hide(); - - // extracting the result sets: - HLRBRep_HLRToShape shapes( brep_hlr ); - - TopoDS_Shape VisiblyEdges; - VisiblyEdges = shapes.VCompound(); - - TopoDS_Shape HiddenEdges; - HiddenEdges = shapes.HCompound(); - - BRepMesh::Mesh(VisiblyEdges,0.1); - //HLRBRep_HLRToShape Tool(Hider); - //TopoDS_Shape V = Tool.VCompound ();// artes vives vues - //TopoDS_Shape V1 = Tool.Rg1LineVCompound();// artes rgulires vues - //TopoDS_Shape VN = Tool.RgNLineVCompound();// artes de couture vues - //TopoDS_Shape VO = Tool.OutLineVCompound();// contours apparents vus - //TopoDS_Shape VI = Tool.IsoLineVCompound();// isoparamtriques vues - //TopoDS_Shape H = Tool.HCompound ();// artes vives caches - //TopoDS_Shape H1 = Tool.Rg1LineHCompound();// artes rgulires caches - //TopoDS_Shape HN = Tool.RgNLineHCompound();// artes de couture caches - //TopoDS_Shape HO = Tool.OutLineHCompound();// contours apparents cachs - //TopoDS_Shape HI = Tool.IsoLineHCompound();// isoparamtriques caches - - result << "" << endl; - - TopExp_Explorer edges( VisiblyEdges, TopAbs_EDGE ); - for (int i = 1 ; edges.More(); edges.Next(),i++ ) { - TopoDS_Edge edge = TopoDS::Edge( edges.Current() ); - TopLoc_Location location; - Handle( Poly_Polygon3D ) polygon = BRep_Tool::Polygon3D( edge, location ); - if ( !polygon.IsNull() ) { - const TColgp_Array1OfPnt& nodes = polygon->Nodes(); - char c = 'M'; - result << "" << endl; - } - } - - result << "" << endl; - - // Apply the resulting fragment - ViewResult.setValue(result.str().c_str()); - - return App::DocumentObject::StdReturn; -} -#else App::DocumentObjectExecReturn *FeatureViewPart::execute(void) { std::stringstream result; @@ -218,7 +135,6 @@ App::DocumentObjectExecReturn *FeatureViewPart::execute(void) } } -#endif // Python Drawing feature --------------------------------------------------------- diff --git a/src/Mod/Drawing/App/ProjectionAlgos.cpp b/src/Mod/Drawing/App/ProjectionAlgos.cpp index d091d897a..d8ae5c1f4 100644 --- a/src/Mod/Drawing/App/ProjectionAlgos.cpp +++ b/src/Mod/Drawing/App/ProjectionAlgos.cpp @@ -59,7 +59,7 @@ #include #include #include -#include +#include #include #include #include @@ -172,7 +172,7 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, double scale, double to if (!H.IsNull() && (type & WithHidden)) { double width = hiddenscale; - BRepMesh::Mesh(H,tolerance); + BRepMesh_IncrementalMesh(H,tolerance); result << " # include # include -# include # include # include # include @@ -145,7 +144,6 @@ #endif # include # include -# include # include # include # include @@ -2289,7 +2287,6 @@ void TopoShape::getFaces(std::vector &aPoints, std::vector &aTopo, float accuracy, uint16_t flags) const { -#if 1 if (this->_Shape.IsNull()) return; std::set vertices; @@ -2360,110 +2357,6 @@ void TopoShape::getFaces(std::vector &aPoints, points[it->i] = it->toPoint(); for (std::vector::iterator it = points.begin(); it != points.end(); ++it) aPoints.push_back(Base::Vector3d(it->X(),it->Y(),it->Z())); -#endif -#if 0 - BRepMesh::Mesh (this->_Shape, accuracy); - std::set vertices; - for (TopExp_Explorer xp(this->_Shape,TopAbs_FACE); xp.More(); xp.Next()) { - TopoDS_Face face = TopoDS::Face(xp.Current()); - TopAbs_Orientation orient = face.Orientation(); - // change orientation of the triangles - Standard_Boolean reversed = false; - if (orient != TopAbs_FORWARD) { - reversed = true; - } - TopLoc_Location aLoc; - Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(face, aLoc); - if (aPoly.IsNull()) continue; - - // getting the transformation of the shape/face - gp_Trsf myTransf; - Standard_Boolean identity = true; - if(!aLoc.IsIdentity()) { - identity = false; - myTransf = aLoc.Transformation(); - } - - // cycling through the poly mesh - const TColgp_Array1OfPnt& Nodes = aPoly->Nodes(); - for (Standard_Integer i=1;i<=Nodes.Length();i++) { - Standard_Real X1, Y1, Z1; - gp_Pnt p = Nodes.Value(i); - p.Transform(myTransf); - p.Coord (X1, Y1, Z1); - } - - const Poly_Array1OfTriangle& Triangles = aPoly->Triangles(); - try { - for (Standard_Integer i=1;i<=Triangles.Length();i++) { - Standard_Integer V1, V2, V3; - Poly_Triangle triangle = Triangles.Value(i); - triangle.Get(V1, V2, V3); - if (reversed) - std::swap(V1,V2); - gp_Pnt P1, P2, P3; - Data::ComplexGeoData::Facet face; - std::set::iterator it; - - // 1st vertex - P1 = Nodes(V1); - P1.Transform(myTransf); - MeshVertex v1(P1); - it = vertices.find(v1); - if (it == vertices.end()) { - v1.i = vertices.size(); - face.I1 = v1.i; - vertices.insert(v1); - } - else { - face.I1 = it->i; - } - - // 2nd vertex - P2 = Nodes(V2); - P2.Transform(myTransf); - MeshVertex v2(P2); - it = vertices.find(v2); - if (it == vertices.end()) { - v2.i = vertices.size(); - face.I2 = v2.i; - vertices.insert(v2); - } - else { - face.I2 = it->i; - } - - // 3rd vertex - P3 = Nodes(V3); - P3.Transform(myTransf); - MeshVertex v3(P3); - it = vertices.find(v3); - if (it == vertices.end()) { - v3.i = vertices.size(); - face.I3 = v3.i; - vertices.insert(v3); - } - else { - face.I3 = it->i; - } - - // make sure that we don't insert invalid facets - if (face.I1 != face.I2 && - face.I2 != face.I3 && - face.I3 != face.I1) - aTopo.push_back(face); - } - } - catch(Standard_Failure) { - } - } - - std::map points; - for (std::set::iterator it = vertices.begin(); it != vertices.end(); ++it) - points[it->i] = it->toPoint(); - for (std::map::iterator it = points.begin(); it != points.end(); ++it) - aPoints.push_back(Base::Vector3d(it->second.X(),it->second.Y(),it->second.Z())); -#endif } void TopoShape::setFaces(const std::vector &Points, diff --git a/src/Mod/Part/App/TopoShapePyImp.cpp b/src/Mod/Part/App/TopoShapePyImp.cpp index ed5a900f7..4e01da16a 100644 --- a/src/Mod/Part/App/TopoShapePyImp.cpp +++ b/src/Mod/Part/App/TopoShapePyImp.cpp @@ -24,7 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ # include -# include +# include # include # include # include @@ -250,7 +250,7 @@ PyObject* TopoShapePy::writeInventor(PyObject * args) return NULL; std::stringstream result; - BRepMesh::Mesh(getTopoShapePtr()->_Shape,dev); + BRepMesh_IncrementalMesh(getTopoShapePtr()->_Shape,dev); if (mode == 0) getTopoShapePtr()->exportFaceSet(dev, angle, result); else if (mode == 1) diff --git a/src/Mod/Part/Gui/ViewProvider.cpp b/src/Mod/Part/Gui/ViewProvider.cpp index aa0d171a6..bf7acf375 100644 --- a/src/Mod/Part/Gui/ViewProvider.cpp +++ b/src/Mod/Part/Gui/ViewProvider.cpp @@ -27,7 +27,6 @@ # include # include # include -# include # include # include # include @@ -468,7 +467,7 @@ void ViewProviderPartBase::updateData(const App::Property* prop) Standard_Real deflection = ((xMax-xMin)+(yMax-yMin)+(zMax-zMin))/300.0 * this->meshDeviation; - BRepMesh::Mesh(cShape,deflection); + BRepMesh_IncrementalMesh(cShape,deflection); //BRepMesh_IncrementalMesh MESH(cShape,meshDeviation); // We must reset the location here because the transformation data // are set in the placement property @@ -720,7 +719,6 @@ Standard_Boolean ViewProviderPartBase::computeFaces(SoGroup* FaceRoot, const Top FaceRoot->addChild(pcShapeMaterial); -// BRepMesh::Mesh(myShape,1.0); BRepMesh_IncrementalMesh MESH(myShape,defl); int i = 1; diff --git a/src/Mod/Part/Gui/ViewProviderExt.cpp b/src/Mod/Part/Gui/ViewProviderExt.cpp index d06ee62ce..823d44ec0 100644 --- a/src/Mod/Part/Gui/ViewProviderExt.cpp +++ b/src/Mod/Part/Gui/ViewProviderExt.cpp @@ -30,7 +30,6 @@ # include # include # include -# include # include # include # include diff --git a/src/Mod/Part/Gui/ViewProviderReference.cpp b/src/Mod/Part/Gui/ViewProviderReference.cpp index 79b322df8..f6dde6203 100644 --- a/src/Mod/Part/Gui/ViewProviderReference.cpp +++ b/src/Mod/Part/Gui/ViewProviderReference.cpp @@ -26,7 +26,6 @@ #ifndef _PreComp_ # include # include -# include # include # include # include