X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_DFLoader.cpp;h=d73f37bfab86a966b96ad25e5699238c2939248d;hb=a1a5b623ecd05592423fdb2d95e8da70abad9a42;hp=d309de4a26e573d85a930dae7f92738f839161bf;hpb=61da4e89d2ec63daa429d304f928482a0e6fa0b7;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_DFLoader.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_DFLoader.cpp index d309de4a2..d73f37bfa 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_DFLoader.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_DFLoader.cpp @@ -1,6 +1,21 @@ -// File: GeomAlgoAPI_DFLoader.cpp -// Created: 23 October 2014 -// Author: Sergey Zaritchny +// Copyright (C) 2014-2022 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #include #include @@ -11,93 +26,23 @@ //function : refineResult //purpose : //======================================================================= -const TopoDS_Shape GeomAlgoAPI_DFLoader::refineResult(const TopoDS_Shape& theResult) +const TopoDS_Shape GeomAlgoAPI_DFLoader::refineResult(const TopoDS_Shape& theResult) { - TopoDS_Shape aResult; - if (theResult.ShapeType() == TopAbs_COMPOUND) { - Standard_Integer nbSubResults = 0; - TopoDS_Iterator itr(theResult); - for (; itr.More(); itr.Next()) nbSubResults++; - if (nbSubResults == 1) { - itr.Initialize(theResult); - if (itr.More()) aResult = itr.Value(); + TopoDS_Shape aResult = theResult; + const TopAbs_ShapeEnum aShType = theResult.ShapeType(); + if(aShType == TopAbs_COMPOUND || aShType == TopAbs_SHELL || aShType == TopAbs_WIRE) { + Standard_Integer aSubResultsNb = 0; + TopoDS_Iterator anIt(theResult); + for(; anIt.More(); anIt.Next()) { + ++aSubResultsNb; } - } - return aResult; -} -/* -//======================================================================= -//function : loadDeletedShapes -//purpose : load deleted shapes in DF -//======================================================================= -void GeomAlgoAPI_DFLoader::loadDeletedShapes (BRepBuilderAPI_MakeShape& theMS, - const TopoDS_Shape& theShapeIn, - const TopAbs_ShapeEnum theKindOfShape, - TNaming_Builder& theBuilder) -{ - TopTools_MapOfShape aView; - TopExp_Explorer ShapeExplorer (theShapeIn, theKindOfShape); - for (; ShapeExplorer.More(); ShapeExplorer.Next ()) { - const TopoDS_Shape& aRoot = ShapeExplorer.Current (); - if (!aView.Add(aRoot)) continue; - if (theMS.IsDeleted (aRoot)) { - theBuilder.Delete (aRoot); - } - } -} - -//======================================================================= -//function : loadAndOrientModifiedShapes -//purpose : load modified shapes in DF with preliminary orientation adjustment -//======================================================================= -void GeomAlgoAPI_DFLoader::loadAndOrientModifiedShapes (BRepBuilderAPI_MakeShape& theMS, - const TopoDS_Shape& theShapeIn, - const TopAbs_ShapeEnum theKindOfShape, - TNaming_Builder& theBuilder, - const TopTools_DataMapOfShapeShape& theSubShapes) -{ - TopTools_MapOfShape aView; - TopExp_Explorer aShapeExplorer (theShapeIn, theKindOfShape); - for (; aShapeExplorer.More(); aShapeExplorer.Next ()) { - const TopoDS_Shape& aRoot = aShapeExplorer.Current (); - if (!aView.Add(aRoot)) continue; - const TopTools_ListOfShape& aShapes = theMS.Modified (aRoot); - TopTools_ListIteratorOfListOfShape aShapesIterator (aShapes); - for (;aShapesIterator.More (); aShapesIterator.Next ()) { - TopoDS_Shape aNewShape = aShapesIterator.Value (); - if (theSubShapes.IsBound(aNewShape)) { - aNewShape.Orientation((theSubShapes(aNewShape)).Orientation()); + if(aSubResultsNb == 1) { + anIt.Initialize(theResult); + if(anIt.More()) { + aResult = anIt.Value(); } - if (!aRoot.IsSame (aNewShape)) theBuilder.Modify (aRoot, aNewShape ); } } -} - -//======================================================================= -//function : loadAndOrientGeneratedShapes -//purpose : load generated shapes in DF with preliminary orientation adjustment -//======================================================================= -void GeomAlgoAPI_DFLoader::loadAndOrientGeneratedShapes (BRepBuilderAPI_MakeShape& theMS, - const TopoDS_Shape& theShapeIn, - const TopAbs_ShapeEnum theKindOfShape, - TNaming_Builder& theBuilder, - const TopTools_DataMapOfShapeShape& theSubShapes) -{ - TopTools_MapOfShape aView; - TopExp_Explorer aShapeExplorer (theShapeIn, theKindOfShape); - for (; aShapeExplorer.More(); aShapeExplorer.Next ()) { - const TopoDS_Shape& aRoot = aShapeExplorer.Current (); - if (!aView.Add(aRoot)) continue; - const TopTools_ListOfShape& aShapes = theMS.Generated (aRoot); - TopTools_ListIteratorOfListOfShape aShapesIterator (aShapes); - for (;aShapesIterator.More (); aShapesIterator.Next ()) { - TopoDS_Shape aNewShape = aShapesIterator.Value (); - if (theSubShapes.IsBound(aNewShape)) { - aNewShape.Orientation((theSubShapes(aNewShape)).Orientation()); - } - if (!aRoot.IsSame (aNewShape)) theBuilder.Generated (aRoot,aNewShape ); - } - } + return aResult; } -*/ \ No newline at end of file