// Created on: 2000-12-26 // Created by: Vladislav ROMASHKO // Copyright (c) 2000-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #include #include #include #include #include #include #include #include #include // OCAF #include #include #include #include // Specific #include //======================================================================= //function : QANewBRepNaming_Limitation //purpose : //======================================================================= QANewBRepNaming_Limitation::QANewBRepNaming_Limitation() {} //======================================================================= //function : QANewBRepNaming_Limitation //purpose : //======================================================================= QANewBRepNaming_Limitation::QANewBRepNaming_Limitation(const TDF_Label& ResultLabel) :QANewBRepNaming_BooleanOperationFeat(ResultLabel) {} //======================================================================= //function : Load //purpose : //======================================================================= void QANewBRepNaming_Limitation::Load(QANewModTopOpe_Limitation& MS) const { TopoDS_Shape ResSh = MS.Shape(); const TopoDS_Shape& ObjSh = MS.Shape1(); const TopAbs_ShapeEnum& ObjType = ShapeType(ObjSh); if (ResSh.IsNull()) { #ifdef MDTV_DEB cout<<"QANewBRepNaming_Limitation::Load(): The result of the boolean operation is null"<Set(0); TNaming_Builder Builder (ResultLabel()); TopoDS_Shape aResult = MS.Shape(); if (aResult.ShapeType() == TopAbs_COMPOUND) { Standard_Integer nbSubResults = 0; TopoDS_Iterator itr(aResult); for (; itr.More(); itr.Next()) nbSubResults++; if (nbSubResults == 1) { itr.Initialize(aResult); if (itr.More()) aResult = itr.Value(); } } if (MS.Shape1().IsNull()) Builder.Generated(aResult); else Builder.Modify(MS.Shape1(), aResult); } //======================================================================= //function : LoadDegenerated //purpose : //======================================================================= void QANewBRepNaming_Limitation::LoadDegenerated(QANewModTopOpe_Limitation& MS) const { TopTools_IndexedMapOfShape allEdges; TopExp::MapShapes(MS.Shape1(), TopAbs_EDGE, allEdges); Standard_Integer i = 1; for (; i <= allEdges.Extent(); i++) { if (BRep_Tool::Degenerated(TopoDS::Edge(allEdges.FindKey(i)))) { if (MS.IsDeleted(allEdges.FindKey(i))) { TNaming_Builder DegeneratedBuilder(DeletedDegeneratedEdges()); DegeneratedBuilder.Generated(allEdges.FindKey(i)); #ifdef MDTV_DEB TDataStd_Name::Set(DegeneratedBuilder.NamedShape()->Label(), "DeletedDegenerated"); #endif } } } } //======================================================================= //function : LoadContent //purpose : //======================================================================= void QANewBRepNaming_Limitation::LoadContent(QANewModTopOpe_Limitation& MS) const { if (MS.Shape().ShapeType() == TopAbs_COMPSOLID || MS.Shape().ShapeType() == TopAbs_COMPOUND) { TopoDS_Iterator itr(MS.Shape()); Standard_Integer nbShapes = 0; while (itr.More()) { nbShapes++; itr.Next(); } if (nbShapes > 1) { for (itr.Initialize(MS.Shape()); itr.More(); itr.Next()) { TNaming_Builder bContent(Content()); bContent.Generated(MS.Shape1(),itr.Value()); bContent.Generated(MS.Shape2(),itr.Value()); } } } }