From: vsv Date: Mon, 7 Nov 2016 15:52:24 +0000 (+0300) Subject: Issue #1834: Fix length of lines X-Git-Tag: V_2.6.0~110 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6f2932a147e8e5b2eb226b8fea2c2bf9fec16a0e;p=modules%2Fshaper.git Issue #1834: Fix length of lines --- diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp index 21458a9ce..d198302d7 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp @@ -32,14 +32,16 @@ void GeomAlgoAPI_Boolean::build(const ListOfShape& theObjects, // Getting objects. TopTools_ListOfShape anObjects; - for(ListOfShape::const_iterator anObjectsIt = theObjects.begin(); anObjectsIt != theObjects.end(); anObjectsIt++) + for(ListOfShape::const_iterator + anObjectsIt = theObjects.begin(); anObjectsIt != theObjects.end(); anObjectsIt++) { anObjects.Append((*anObjectsIt)->impl()); } // Getting tools. TopTools_ListOfShape aTools; - for(ListOfShape::const_iterator aToolsIt = theTools.begin(); aToolsIt != theTools.end(); aToolsIt++) + for(ListOfShape::const_iterator + aToolsIt = theTools.begin(); aToolsIt != theTools.end(); aToolsIt++) { aTools.Append((*aToolsIt)->impl()); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp index 360f46bd2..1f8b01832 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp @@ -36,7 +36,7 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::line( aRes->setImpl(new TopoDS_Shape(anEdge)); return aRes; } -std::shared_ptr GeomAlgoAPI_EdgeBuilder::line( +std::shared_ptr GeomAlgoAPI_EdgeBuilder::line( double theDX, double theDY, double theDZ) { diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Exception.h b/src/GeomAlgoAPI/GeomAlgoAPI_Exception.h index 8bdeaa3f3..790af42b5 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Exception.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Exception.h @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + #ifndef GeomAlgoAPI_Exception_H_ #define GeomAlgoAPI_Exception_H_ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp index 25c0a005a..e0aff60b9 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp @@ -22,9 +22,10 @@ #include //================================================================================================== -std::shared_ptr GeomAlgoAPI_FaceBuilder::squareFace(const std::shared_ptr theCenter, - const std::shared_ptr theNormal, - const double theSize) +std::shared_ptr GeomAlgoAPI_FaceBuilder::squareFace( + const std::shared_ptr theCenter, + const std::shared_ptr theNormal, + const double theSize) { const gp_Pnt& aCenter = theCenter->impl(); const gp_Dir& aDir = theNormal->impl(); @@ -38,8 +39,9 @@ std::shared_ptr GeomAlgoAPI_FaceBuilder::squareFace(const std::sha } //================================================================================================== -std::shared_ptr GeomAlgoAPI_FaceBuilder::squareFace(const std::shared_ptr thePlane, - const double theSize) +std::shared_ptr GeomAlgoAPI_FaceBuilder::squareFace( + const std::shared_ptr thePlane, + const double theSize) { // half of the size in each direction from the center BRepBuilderAPI_MakeFace aFaceBuilder(thePlane->impl(), @@ -52,8 +54,9 @@ std::shared_ptr GeomAlgoAPI_FaceBuilder::squareFace(const std::sha } //================================================================================================== -std::shared_ptr GeomAlgoAPI_FaceBuilder::planarFace(const std::shared_ptr theCenter, - const std::shared_ptr theNormal) +std::shared_ptr GeomAlgoAPI_FaceBuilder::planarFace( + const std::shared_ptr theCenter, + const std::shared_ptr theNormal) { const gp_Pnt& aCenter = theCenter->impl(); const gp_Dir& aDir = theNormal->impl(); @@ -65,9 +68,10 @@ std::shared_ptr GeomAlgoAPI_FaceBuilder::planarFace(const std::sha } //================================================================================================== -std::shared_ptr GeomAlgoAPI_FaceBuilder::planarFace(const std::shared_ptr thePlane, - const double theX, const double theY, - const double theWidth, const double theHeight) +std::shared_ptr GeomAlgoAPI_FaceBuilder::planarFace( + const std::shared_ptr thePlane, + const double theX, const double theY, + const double theWidth, const double theHeight) { double aA, aB, aC, aD; thePlane->coefficients(aA, aB, aC, aD); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.h b/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.h index 4b6524929..23173e50b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.h @@ -43,13 +43,15 @@ class GEOMALGOAPI_EXPORT GeomAlgoAPI_FaceBuilder const double theWidth, const double theHeight); /// Creates a planar face by three vertices. - static std::shared_ptr planarFaceByThreeVertices(const std::shared_ptr theVertex1, - const std::shared_ptr theVertex2, - const std::shared_ptr theVertex3); + static std::shared_ptr planarFaceByThreeVertices( + const std::shared_ptr theVertex1, + const std::shared_ptr theVertex2, + const std::shared_ptr theVertex3); /// Creates a planar face parallel to theFace and passing through theVertex. - static std::shared_ptr planarFaceByFaceAndVertex(const std::shared_ptr theFace, - const std::shared_ptr theVertex); + static std::shared_ptr planarFaceByFaceAndVertex( + const std::shared_ptr theFace, + const std::shared_ptr theVertex); }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp index a1b29f5cb..273937e2d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp @@ -37,7 +37,8 @@ void GeomAlgoAPI_Intersection::build(const ListOfShape& theObjects, // Getting objects. TopTools_ListOfShape anObjects; - for (ListOfShape::const_iterator anObjectsIt = theObjects.begin(); anObjectsIt != theObjects.end(); anObjectsIt++) { + for (ListOfShape::const_iterator + anObjectsIt = theObjects.begin(); anObjectsIt != theObjects.end(); anObjectsIt++) { const TopoDS_Shape& aShape = (*anObjectsIt)->impl(); if(!aShape.IsNull()) { anObjects.Append(aShape); @@ -47,7 +48,8 @@ void GeomAlgoAPI_Intersection::build(const ListOfShape& theObjects, // Getting tools. TopTools_ListOfShape aTools; - for (ListOfShape::const_iterator aToolsIt = theTools.begin(); aToolsIt != theTools.end(); aToolsIt++) { + for (ListOfShape::const_iterator + aToolsIt = theTools.begin(); aToolsIt != theTools.end(); aToolsIt++) { const TopoDS_Shape& aShape = (*aToolsIt)->impl(); if(!aShape.IsNull()) { aTools.Append(aShape); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp index 14b3bcb38..289427164 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp @@ -240,7 +240,8 @@ bool GeomAlgoAPI_MakeShape::checkValid(std::string theMessage){ } if (aNbVolumes != 1) { - myError = theMessage + " :: connexity error, the resulting shape is made of several separate solids."; + myError = theMessage + + " :: connexity error, the resulting shape is made of several separate solids."; return false; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h index 6fc03c6f8..649684ee0 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h @@ -37,7 +37,8 @@ public: /// \brief Constructor by builder and builder type. /// \param[in] theBuilder pointer to the builder. /// \param[in] theBuilderType builder type. - template explicit GeomAlgoAPI_MakeShape(T* theBuilder, const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape) + template explicit GeomAlgoAPI_MakeShape(T* theBuilder, + const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape) : GeomAPI_Interface(theBuilder), myBuilderType(theBuilderType) { @@ -47,7 +48,8 @@ public: /// \brief Initializes internals. /// \param[in] theBuilder pointer to the builder. /// \param[in] theBuilderType builder type. - template void initialize(T* theBuilder, const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape) + template void initialize(T* theBuilder, + const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape) { setImpl(theBuilder); myBuilderType = theBuilderType; @@ -89,7 +91,8 @@ public: GEOMALGOAPI_EXPORT virtual bool check() { return true; }; /// \return the list of created faces. - GEOMALGOAPI_EXPORT std::map< std::string, std::shared_ptr > getCreatedFaces() {return myCreatedFaces;} + GEOMALGOAPI_EXPORT std::map< std::string, std::shared_ptr > getCreatedFaces() + {return myCreatedFaces;} /// \return the error. GEOMALGOAPI_EXPORT std::string getError() { return myError; } @@ -114,9 +117,12 @@ protected: void setShape(const std::shared_ptr theShape); protected: - std::shared_ptr myMap; ///< Data map to keep correct orientation of sub-shapes. - std::string myError; /// Error occurred during the execution of an algorithm. - std::map< std::string, std::shared_ptr > myCreatedFaces; /// Map of created faces with their name for naming. + /// Data map to keep correct orientation of sub-shapes. + std::shared_ptr myMap; + /// Error occurred during the execution of an algorithm. + std::string myError; + /// Map of created faces with their name for naming. + std::map< std::string, std::shared_ptr > myCreatedFaces; private: /// \brief Initializes internals. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.cpp index 3c00ea205..86a01cf6a 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.cpp @@ -41,7 +41,8 @@ void GeomAlgoAPI_MakeShapeList::init(const ListOfMakeShape& theMakeShapeList) } //================================================================================================= -void GeomAlgoAPI_MakeShapeList::appendAlgo(const std::shared_ptr theMakeShape) +void GeomAlgoAPI_MakeShapeList::appendAlgo( + const std::shared_ptr theMakeShape) { myListOfMakeShape.push_back(theMakeShape); if(!myMap.get()) { @@ -78,7 +79,8 @@ void GeomAlgoAPI_MakeShapeList::modified(const std::shared_ptr th bool GeomAlgoAPI_MakeShapeList::isDeleted(const std::shared_ptr theShape) { - for(ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin(); aBuilderIt != myListOfMakeShape.end(); aBuilderIt++) { + for(ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin(); + aBuilderIt != myListOfMakeShape.end(); aBuilderIt++) { std::shared_ptr aMakeShape = *aBuilderIt; if(aMakeShape->isDeleted(theShape)) { return true; @@ -103,16 +105,19 @@ void GeomAlgoAPI_MakeShapeList::result(const std::shared_ptr theS aResultShapesMap.Add(theShape->impl()); aResultShapesList.Append(theShape->impl()); - for(ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin(); aBuilderIt != myListOfMakeShape.end(); aBuilderIt++) { + for(ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin(); + aBuilderIt != myListOfMakeShape.end(); aBuilderIt++) { std::shared_ptr aMakeShape = *aBuilderIt; NCollection_Map aTempShapes; bool hasResults = false; - for(NCollection_Map::Iterator aShapeIt(anAlgoShapes); aShapeIt.More(); aShapeIt.Next()) { + for(NCollection_Map::Iterator + aShapeIt(anAlgoShapes); aShapeIt.More(); aShapeIt.Next()) { std::shared_ptr aShape(new GeomAPI_Shape); aShape->setImpl(new TopoDS_Shape(aShapeIt.Value())); ListOfShape aGeneratedShapes; aMakeShape->generated(aShape, aGeneratedShapes); - for(ListOfShape::const_iterator anIt = aGeneratedShapes.cbegin(); anIt != aGeneratedShapes.cend(); anIt++) { + for(ListOfShape::const_iterator + anIt = aGeneratedShapes.cbegin(); anIt != aGeneratedShapes.cend(); anIt++) { const TopoDS_Shape& anItShape = (*anIt)->impl(); aTempShapes.Add(anItShape); if(aResultShapesMap.Add(anItShape) == Standard_True) { @@ -122,7 +127,8 @@ void GeomAlgoAPI_MakeShapeList::result(const std::shared_ptr theS } ListOfShape aModifiedShapes; aMakeShape->modified(aShape, aModifiedShapes); - for(ListOfShape::const_iterator anIt = aModifiedShapes.cbegin(); anIt != aModifiedShapes.cend(); anIt++) { + for(ListOfShape::const_iterator + anIt = aModifiedShapes.cbegin(); anIt != aModifiedShapes.cend(); anIt++) { const TopoDS_Shape& anItShape = (*anIt)->impl(); aTempShapes.Add(anItShape); if(aResultShapesMap.Add(anItShape) == Standard_True) { @@ -133,7 +139,8 @@ void GeomAlgoAPI_MakeShapeList::result(const std::shared_ptr theS if(hasResults) { const TopoDS_Shape& aTopoDSShape = aShapeIt.Value(); if(aResultShapesMap.Remove(aTopoDSShape) == Standard_True) { - for(NCollection_List::Iterator aResIt(aResultShapesList); aResIt.More(); aResIt.Next()) { + for(NCollection_List::Iterator + aResIt(aResultShapesList); aResIt.More(); aResIt.Next()) { if(aTopoDSShape.IsEqual(aResIt.Value())) { aResultShapesList.Remove(aResIt); break; @@ -145,7 +152,8 @@ void GeomAlgoAPI_MakeShapeList::result(const std::shared_ptr theS anAlgoShapes.Unite(aTempShapes); } - for(NCollection_List::Iterator aShapeIt(aResultShapesList); aShapeIt.More(); aShapeIt.Next()) { + for(NCollection_List::Iterator + aShapeIt(aResultShapesList); aShapeIt.More(); aShapeIt.Next()) { std::shared_ptr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(aShapeIt.Value())); theHistory.push_back(aShape); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp index 06849b9f1..a19419b73 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp @@ -47,13 +47,15 @@ void GeomAlgoAPI_Partition::build(const ListOfShape& theObjects, this->setBuilderType(OCCT_BOPAlgo_Builder); // Getting objects. - for (ListOfShape::const_iterator anObjectsIt = theObjects.begin(); anObjectsIt != theObjects.end(); anObjectsIt++) { + for (ListOfShape::const_iterator + anObjectsIt = theObjects.begin(); anObjectsIt != theObjects.end(); anObjectsIt++) { const TopoDS_Shape& aShape = (*anObjectsIt)->impl(); anOperation->AddArgument(aShape); } // Getting tools. - for (ListOfShape::const_iterator aToolsIt = theTools.begin(); aToolsIt != theTools.end(); aToolsIt++) { + for (ListOfShape::const_iterator + aToolsIt = theTools.begin(); aToolsIt != theTools.end(); aToolsIt++) { const TopoDS_Shape& aShape = (*aToolsIt)->impl(); anOperation->AddTool(aShape); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp index 6f9d183aa..76df6cbb9 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp @@ -15,18 +15,21 @@ #include //================================================================================================= -GeomAlgoAPI_PaveFiller::GeomAlgoAPI_PaveFiller(const ListOfShape& theListOfShape, const bool theIsMakeCompSolids) +GeomAlgoAPI_PaveFiller::GeomAlgoAPI_PaveFiller(const ListOfShape& theListOfShape, + const bool theIsMakeCompSolids) { build(theListOfShape, theIsMakeCompSolids); } //================================================================================================= -void GeomAlgoAPI_PaveFiller::build(const ListOfShape& theListOfShape, const bool theIsMakeCompSolids) +void GeomAlgoAPI_PaveFiller::build(const ListOfShape& theListOfShape, + const bool theIsMakeCompSolids) { BOPAlgo_PaveFiller aPaveFiller; BOPCol_ListOfShape aListOfShape; - for(ListOfShape::const_iterator anIt = theListOfShape.cbegin(); anIt != theListOfShape.cend(); anIt++) { + for(ListOfShape::const_iterator + anIt = theListOfShape.cbegin(); anIt != theListOfShape.cend(); anIt++) { const TopoDS_Shape& aShape = (*anIt)->impl(); if(aShape.ShapeType() == TopAbs_COMPOUND) { for(TopoDS_Iterator anIter(aShape); anIter.More(); anIter.Next()) { diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.h b/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.h index d14aacbac..5a63fbf5e 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.h @@ -14,14 +14,16 @@ /// \class GeomAlgoAPI_PaveFiller /// \ingroup DataAlgo -/// \brief Finds the common parts from the list of shapes and breaks it to shapes with shared subshapes. +/// \brief Finds the common parts from the list of shapes and +/// breaks it to shapes with shared subshapes. class GeomAlgoAPI_PaveFiller : public GeomAlgoAPI_MakeShape { public: /// \brief Constructor. /// \param[in] theListOfShape list of shape which should be splitted. /// \param[in] theIsMakeCompSolids if true gather shapes with shared faces to compsolids. - GEOMALGOAPI_EXPORT GeomAlgoAPI_PaveFiller(const ListOfShape& theListOfShape, const bool theIsMakeCompSolids = false); + GEOMALGOAPI_EXPORT GeomAlgoAPI_PaveFiller(const ListOfShape& theListOfShape, + const bool theIsMakeCompSolids = false); private: /// Builds resulting shape. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp index 04b310006..ca7b81140 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp @@ -183,7 +183,8 @@ void GeomAlgoAPI_Pipe::build(const ListOfShape& theBaseShapes, const ListOfShape& theLocations, const GeomShapePtr thePathShape) { - if(theBaseShapes.empty() || (!theLocations.empty() && theLocations.size() != theBaseShapes.size())) { + if(theBaseShapes.empty() || + (!theLocations.empty() && theLocations.size() != theBaseShapes.size())) { return; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h index 8c7113b2a..fb0f0b6c0 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h @@ -15,7 +15,8 @@ /// \class GeomAlgoAPI_Pipe /// \ingroup DataAlgo -/// \brief Allows to create extrusion of objects along a path. It produces the following results from objects:\n +/// \brief Allows to create extrusion of objects along a path. +/// It produces the following results from objects:\n /// Vertex -> Edge\n /// Edge -> Face\n /// Wire -> Shell\n diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp index de553626b..af06ddd81 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp @@ -117,10 +117,12 @@ void GeomAlgoAPI_Placement::build(const std::shared_ptr& theSourc if (hasDirection[0] || hasDirection[1]) { // plane - line int anInd = hasDirection[0] ? 0 : 1; gp_Vec aVec = aSrcDstNormals[1 - anInd].Crossed(aSrcDstDirections[anInd]); - if (aVec.SquareMagnitude() < Precision::SquareConfusion()) { // normal and direction are collinear + if (aVec.SquareMagnitude() < Precision::SquareConfusion()) { + // normal and direction are collinear aVec = aSrcDstNormals[1 - anInd].Crossed( gp_Vec(aSrcDstPoints[1 - anInd], aSrcDstPoints[anInd])); - if (aVec.SquareMagnitude() < Precision::SquareConfusion()) { // normal and points direction are collinear + if (aVec.SquareMagnitude() < Precision::SquareConfusion()) { + // normal and points direction are collinear if (Abs(aSrcDstNormals[1 - anInd].Y()) >= Precision::Confusion() || Abs(aSrcDstNormals[1 - anInd].Z()) >= Precision::Confusion()) aVec = gp::DX(); @@ -196,7 +198,6 @@ void GeomAlgoAPI_Placement::build(const std::shared_ptr& theSourc if (theSimpleTransform) { // just add transformation TopLoc_Location aDelta(aTrsf); // store the accumulated information about the result and this delta - //myTrsf = std::shared_ptr(new GeomAPI_Trsf(new gp_Trsf(aTrsf * aSourceShape.Location().Transformation()))); myTrsf.reset(new GeomAPI_Trsf(new gp_Trsf(aTrsf))); TopoDS_Shape aResult = aSourceShape.Moved(aDelta); std::shared_ptr aShape(new GeomAPI_Shape()); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Placement.h b/src/GeomAlgoAPI/GeomAlgoAPI_Placement.h index 7fa31bcd5..b15249340 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Placement.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Placement.h @@ -25,9 +25,11 @@ public: /// \param[in] theDestSolid invariant shape /// \param[in] theSourceShape a shape on the solid to be made coincident with destination object /// \param[in] theDestShape destination object - /// \param[in] theIsReverse indicates that the solid materials should be on the same side against the destination plane + /// \param[in] theIsReverse indicates that the solid materials should be on the same side + /// against the destination plane /// \param[in] theIsCentering indicates the planes should be centered - /// \param[in] theSimpleTransform makes just transformation of shape without changing of topology or geometry + /// \param[in] theSimpleTransform makes just transformation of shape + /// without changing of topology or geometry GEOMALGOAPI_EXPORT GeomAlgoAPI_Placement(const std::shared_ptr theSourceSolid, const std::shared_ptr theDestSolid, const std::shared_ptr theSourceShape, diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp index e7414346d..69cdabbfd 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp @@ -26,7 +26,8 @@ #include //================================================================================================== -std::shared_ptr GeomAlgoAPI_PointBuilder::vertex(const std::shared_ptr thePoint) +std::shared_ptr + GeomAlgoAPI_PointBuilder::vertex(const std::shared_ptr thePoint) { const gp_Pnt& aPnt = thePoint->impl(); BRepBuilderAPI_MakeVertex aMaker(aPnt); @@ -50,7 +51,8 @@ std::shared_ptr GeomAlgoAPI_PointBuilder::vertex(const double th } //================================================================================================== -std::shared_ptr GeomAlgoAPI_PointBuilder::point(const std::shared_ptr theVertex) +std::shared_ptr + GeomAlgoAPI_PointBuilder::point(const std::shared_ptr theVertex) { TopoDS_Shape aShape = theVertex->impl(); if ((!aShape.IsNull()) && (aShape.ShapeType() == TopAbs_VERTEX)) { @@ -63,10 +65,11 @@ std::shared_ptr GeomAlgoAPI_PointBuilder::point(const std::shared_p } //================================================================================================== -std::shared_ptr GeomAlgoAPI_PointBuilder::vertexOnEdge(const std::shared_ptr theEdge, - const double theValue, - const bool theIsPercent, - const bool theIsReverse) +std::shared_ptr GeomAlgoAPI_PointBuilder::vertexOnEdge( + const std::shared_ptr theEdge, + const double theValue, + const bool theIsPercent, + const bool theIsReverse) { std::shared_ptr aVertex; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.h b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.h index 28703d91d..be219a503 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.h @@ -33,7 +33,8 @@ public: /// \brief Creates vertex by edge and distance on it. /// \param[in] theEdge edge. /// \param[in] theValue distance value. - /// \param[in] theIsPercent if true theValue will be treated as a percentage of theEdge total length. + /// \param[in] theIsPercent if true theValue will be treated + /// as a percentage of theEdge total length. /// \param[in] theIsReverse if true the distance will be measured from the edge end point. /// \return created vertex. static std::shared_ptr vertexOnEdge(const std::shared_ptr theEdge, @@ -45,22 +46,25 @@ public: /// \param[in] theVertex vertex to project. /// \param[in] thePlane face for projection. Should be planar. /// \return created vertex. - static std::shared_ptr vertexByProjection(const std::shared_ptr theVertex, - const std::shared_ptr thePlane); + static std::shared_ptr + vertexByProjection(const std::shared_ptr theVertex, + const std::shared_ptr thePlane); /// \brief Creates vertex by intersection two coplanar lines. /// \param[in] theEdge1 first linear edge. /// \param[in] theEdge2 second linear edge. /// \return created vertex. - static std::shared_ptr vertexByIntersection(const std::shared_ptr theEdge1, - const std::shared_ptr theEdge2); + static std::shared_ptr + vertexByIntersection(const std::shared_ptr theEdge1, + const std::shared_ptr theEdge2); /// \brief Creates vertex by intersection line and plane. /// \param[in] theEdge linear edge. /// \param[in] theFace planar face. /// \return created vertex. - static std::shared_ptr vertexByIntersection(const std::shared_ptr theEdge, - const std::shared_ptr theFace); + static std::shared_ptr + vertexByIntersection(const std::shared_ptr theEdge, + const std::shared_ptr theFace); /// Return point by shape vertex static std::shared_ptr point(const std::shared_ptr theVertex); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp index 49204ee90..acc94d25f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp @@ -57,7 +57,8 @@ GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape, const double theToSize, const double theFromSize) { - build(theBaseShape, std::shared_ptr(), GeomShapePtr(), theToSize, GeomShapePtr(), theFromSize); + build(theBaseShape, std::shared_ptr(), GeomShapePtr(), + theToSize, GeomShapePtr(), theFromSize); } //================================================================================================== @@ -76,7 +77,8 @@ GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape, const GeomShapePtr theFromShape, const double theFromSize) { - build(theBaseShape, std::shared_ptr(), theToShape, theToSize, theFromShape, theFromSize); + build(theBaseShape, std::shared_ptr(), theToShape, + theToSize, theFromShape, theFromSize); } //================================================================================================== @@ -99,7 +101,8 @@ void GeomAlgoAPI_Prism::build(const GeomShapePtr& theBaseShape, const double theFromSize) { if(!theBaseShape.get() || - (((!theFromShape.get() && !theToShape.get()) || (theFromShape.get() && theToShape.get() && theFromShape->isEqual(theToShape))) + (((!theFromShape.get() && !theToShape.get()) || + (theFromShape.get() && theToShape.get() && theFromShape->isEqual(theToShape))) && (theFromSize == -theToSize))) { return; } @@ -187,22 +190,26 @@ void GeomAlgoAPI_Prism::build(const GeomShapePtr& theBaseShape, // Moving base shape. gp_Trsf aTrsf; aTrsf.SetTranslation(aDirVec * -theFromSize); - BRepBuilderAPI_Transform* aTransformBuilder = new BRepBuilderAPI_Transform(aBaseShape, aTrsf); + BRepBuilderAPI_Transform* aTransformBuilder = + new BRepBuilderAPI_Transform(aBaseShape, aTrsf); if(!aTransformBuilder) { return; } - this->appendAlgo(std::shared_ptr(new GeomAlgoAPI_MakeShape(aTransformBuilder))); + this->appendAlgo(std::shared_ptr( + new GeomAlgoAPI_MakeShape(aTransformBuilder))); if(!aTransformBuilder->IsDone()) { return; } TopoDS_Shape aMovedBase = aTransformBuilder->Shape(); // Making prism. - BRepPrimAPI_MakePrism* aPrismBuilder = new BRepPrimAPI_MakePrism(aMovedBase, aDirVec * (theFromSize + theToSize)); + BRepPrimAPI_MakePrism* aPrismBuilder = + new BRepPrimAPI_MakePrism(aMovedBase, aDirVec * (theFromSize + theToSize)); if(!aPrismBuilder) { return; } - this->appendAlgo(std::shared_ptr(new GeomAlgoAPI_MakeShape(aPrismBuilder))); + this->appendAlgo(std::shared_ptr( + new GeomAlgoAPI_MakeShape(aPrismBuilder))); if(!aPrismBuilder->IsDone()) { return; } @@ -230,12 +237,14 @@ void GeomAlgoAPI_Prism::build(const GeomShapePtr& theBaseShape, bool aSign = aFromLoc->xyz()->dot(aBaseDir->xyz()) > aToLoc->xyz()->dot(aBaseDir->xyz()); - std::shared_ptr aFromPnt(new GeomAPI_Pnt(aFromLoc->xyz()->added(aBaseDir->xyz()->multiplied( - aSign ? theFromSize : -theFromSize)))); + std::shared_ptr aFromPnt( + new GeomAPI_Pnt(aFromLoc->xyz()->added(aBaseDir->xyz()->multiplied( + aSign ? theFromSize : -theFromSize)))); aBoundingFromShape = GeomAlgoAPI_FaceBuilder::planarFace(aFromPnt, aFromDir); - std::shared_ptr aToPnt(new GeomAPI_Pnt(aToLoc->xyz()->added(aBaseDir->xyz()->multiplied( - aSign ? -theToSize : theToSize)))); + std::shared_ptr aToPnt( + new GeomAPI_Pnt(aToLoc->xyz()->added(aBaseDir->xyz()->multiplied( + aSign ? -theToSize : theToSize)))); aBoundingToShape = GeomAlgoAPI_FaceBuilder::planarFace(aToPnt, aToDir); // Getting bounding box for base shape. @@ -286,18 +295,21 @@ void GeomAlgoAPI_Prism::build(const GeomShapePtr& theBaseShape, if(!aTransformBuilder) { return; } - this->appendAlgo(std::shared_ptr(new GeomAlgoAPI_MakeShape(aTransformBuilder))); + this->appendAlgo(std::shared_ptr( + new GeomAlgoAPI_MakeShape(aTransformBuilder))); if(!aTransformBuilder->IsDone()) { return; } TopoDS_Shape aMovedBase = aTransformBuilder->Shape(); // Making prism. - BRepPrimAPI_MakePrism* aPrismBuilder = new BRepPrimAPI_MakePrism(aMovedBase, aDirVec * 2 * aPrismLength); + BRepPrimAPI_MakePrism* aPrismBuilder = + new BRepPrimAPI_MakePrism(aMovedBase, aDirVec * 2 * aPrismLength); if(!aPrismBuilder) { return; } - this->appendAlgo(std::shared_ptr(new GeomAlgoAPI_MakeShape(aPrismBuilder))); + this->appendAlgo(std::shared_ptr( + new GeomAlgoAPI_MakeShape(aPrismBuilder))); if(!aPrismBuilder->IsDone()) { return; } @@ -358,7 +370,8 @@ void GeomAlgoAPI_Prism::build(const GeomShapePtr& theBaseShape, if(!aToCutBuilder->IsDone()) { return; } - this->appendAlgo(std::shared_ptr(new GeomAlgoAPI_MakeShape(aToCutBuilder))); + this->appendAlgo(std::shared_ptr( + new GeomAlgoAPI_MakeShape(aToCutBuilder))); aResult = aToCutBuilder->Shape(); if(aResult.ShapeType() == TopAbs_COMPOUND) { aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); @@ -378,7 +391,8 @@ void GeomAlgoAPI_Prism::build(const GeomShapePtr& theBaseShape, if(!aFromCutBuilder->IsDone()) { return; } - this->appendAlgo(std::shared_ptr(new GeomAlgoAPI_MakeShape(aFromCutBuilder))); + this->appendAlgo(std::shared_ptr( + new GeomAlgoAPI_MakeShape(aFromCutBuilder))); aResult = aFromCutBuilder->Shape(); TopoDS_Iterator aCheckIt(aResult); if(!aCheckIt.More()) { @@ -457,11 +471,13 @@ void storeGenerationHistory(GeomAlgoAPI_Prism* thePrismAlgo, if(theType == TopAbs_VERTEX) { gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape)); IntTools_Context anIntTools; - if(anIntTools.IsValidPointForFace(aPnt, theToFace, Precision::Confusion()) == Standard_True) { + if(anIntTools.IsValidPointForFace(aPnt, + theToFace, Precision::Confusion()) == Standard_True) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); thePrismAlgo->addToShape(aGeomSh); } - if(anIntTools.IsValidPointForFace(aPnt, theFromFace, Precision::Confusion()) == Standard_True) { + if(anIntTools.IsValidPointForFace(aPnt, + theFromFace, Precision::Confusion()) == Standard_True) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); thePrismAlgo->addFromShape(aGeomSh); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.h b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.h index be17e8b7a..af7f4501b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.h @@ -34,7 +34,8 @@ public: /// \brief Creates extrusion for the given shape along the normal for this shape. /// \param[in] theBaseShape vertex, edge, wire, face or shell. - /// \param[in] theDirection direction of extrusion. Can be empty if theBaseShape is planar wire or face. + /// \param[in] theDirection direction of extrusion. + /// Can be empty if theBaseShape is planar wire or face. /// \param[in] theToSize offset for "to" plane. /// \param[in] theFromSize offset for "from" plane. GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape, @@ -44,9 +45,11 @@ public: /// \brief Creates extrusion for the given shape along the normal for this shape. /// \param[in] theBaseShape planar face or wire to be extruded. - /// \param[in] theToShape top bounding shape. Can be empty. In this case offset will be applied to the basis. + /// \param[in] theToShape top bounding shape. Can be empty. + /// In this case offset will be applied to the basis. /// \param[in] theToSize offset for "to" plane. - /// \param[in] theFromShape bottom bounding shape. Can be empty. In this case offset will be applied to the basis. + /// \param[in] theFromShape bottom bounding shape. Can be empty. + /// In this case offset will be applied to the basis. /// \param[in] theFromSize offset for "from" plane. GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape, const GeomShapePtr theToShape, @@ -56,10 +59,13 @@ public: /// \brief Creates extrusion for the given shape along the normal for this shape. /// \param[in] theBaseShape planar face or wire to be extruded. - /// \param[in] theDirection direction of extrusion. Can be empty if theBaseShape is planar wire or face. - /// \param[in] theToShape top bounding shape. Can be empty. In this case offset will be applied to the basis. + /// \param[in] theDirection direction of extrusion. + /// Can be empty if theBaseShape is planar wire or face. + /// \param[in] theToShape top bounding shape. Can be empty. + /// In this case offset will be applied to the basis. /// \param[in] theToSize offset for "to" plane. - /// \param[in] theFromShape bottom bounding shape. Can be empty. In this case offset will be applied to the basis. + /// \param[in] theFromShape bottom bounding shape. Can be empty. + /// In this case offset will be applied to the basis. /// \param[in] theFromSize offset for "from" plane. GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape, const std::shared_ptr theDirection, diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp index 9ff572fb4..82c9b6ab4 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp @@ -104,7 +104,8 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh const double theFromAngle) { if(!theBaseShape || !theAxis || - (((!theFromShape && !theToShape) || (theFromShape && theToShape && theFromShape->isEqual(theToShape))) + (((!theFromShape && !theToShape) || + (theFromShape && theToShape && theFromShape->isEqual(theToShape))) && (theFromAngle == -theToAngle))) { return; } @@ -188,7 +189,8 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh if(!aBaseTransform) { return; } - this->appendAlgo(std::shared_ptr(new GeomAlgoAPI_MakeShape(aBaseTransform))); + this->appendAlgo(std::shared_ptr( + new GeomAlgoAPI_MakeShape(aBaseTransform))); if(!aBaseTransform->IsDone()) { return; } @@ -196,13 +198,14 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh // Making revolution to the angle equal to the sum of "from angle" and "to angle". BRepPrimAPI_MakeRevol* aRevolBuilder = new BRepPrimAPI_MakeRevol(aRotatedBase, - anAxis, - (theFromAngle + theToAngle) / 180 * M_PI, - Standard_True); + anAxis, + (theFromAngle + theToAngle) / 180 * M_PI, + Standard_True); if(!aRevolBuilder) { return; } - this->appendAlgo(std::shared_ptr(new GeomAlgoAPI_MakeShape(aRevolBuilder))); + this->appendAlgo(std::shared_ptr( + new GeomAlgoAPI_MakeShape(aRevolBuilder))); if(!aRevolBuilder->IsDone()) { return; } @@ -217,11 +220,13 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh } } else if(theFromShape && theToShape) { // Case 2: When both bounding planes were set. // Making revolution to the 360 angle. - BRepPrimAPI_MakeRevol* aRevolBuilder = new BRepPrimAPI_MakeRevol(aBaseShape, anAxis, 2 * M_PI, Standard_True); + BRepPrimAPI_MakeRevol* aRevolBuilder = + new BRepPrimAPI_MakeRevol(aBaseShape, anAxis, 2 * M_PI, Standard_True); if(!aRevolBuilder) { return; } - this->appendAlgo(std::shared_ptr(new GeomAlgoAPI_MakeShape(aRevolBuilder))); + this->appendAlgo(std::shared_ptr( + new GeomAlgoAPI_MakeShape(aRevolBuilder))); if(!aRevolBuilder->IsDone()) { return; } @@ -234,7 +239,8 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh // Getting planes from bounding face. GeomLib_IsPlanarSurface isFromPlanar(BRep_Tool::Surface(aFromFace)); GeomLib_IsPlanarSurface isToPlanar(BRep_Tool::Surface(aToFace)); - if(!isFromPlanar.IsPlanar() || !isToPlanar.IsPlanar()) {// non-planar shapes is not supported for revolution bounding + if(!isFromPlanar.IsPlanar() || !isToPlanar.IsPlanar()) { + // non-planar shapes is not supported for revolution bounding return; } @@ -256,8 +262,12 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh // Rotating bounding planes to the specified angle. gp_Trsf aFromTrsf; gp_Trsf aToTrsf; - double aFromRotAngle = ((aFromPln.Axis().Direction() * aBasePlane->Axis().Direction()) > 0) ? -theFromAngle : theFromAngle; - double aToRotAngle = ((aToPln.Axis().Direction() * aBasePlane->Axis().Direction()) > 0) ? -theToAngle : theToAngle; + double aFromRotAngle = + ((aFromPln.Axis().Direction() * aBasePlane->Axis().Direction()) > 0) ? -theFromAngle : + theFromAngle; + double aToRotAngle = + ((aToPln.Axis().Direction() * aBasePlane->Axis().Direction()) > 0) ? -theToAngle : + theToAngle; aFromTrsf.SetRotation(anAxis,aFromRotAngle / 180.0 * M_PI); aToTrsf.SetRotation(anAxis, aToRotAngle / 180.0 * M_PI); BRepBuilderAPI_Transform aFromTransform(aFromSolid, aFromTrsf, true); @@ -273,7 +283,8 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh if(!aFromCutBuilder->IsDone()) { return; } - this->appendAlgo(std::shared_ptr(new GeomAlgoAPI_MakeShape(aFromCutBuilder))); + this->appendAlgo(std::shared_ptr( + new GeomAlgoAPI_MakeShape(aFromCutBuilder))); aResult = aFromCutBuilder->Shape(); if(aResult.ShapeType() == TopAbs_COMPOUND) { aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); @@ -285,7 +296,8 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh if(!aToCutBuilder->IsDone()) { return; } - this->appendAlgo(std::shared_ptr(new GeomAlgoAPI_MakeShape(aToCutBuilder))); + this->appendAlgo(std::shared_ptr( + new GeomAlgoAPI_MakeShape(aToCutBuilder))); aResult = aToCutBuilder->Shape(); TopoDS_Iterator aCheckIt(aResult); if(!aCheckIt.More()) { @@ -305,7 +317,8 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh aResult = aGeomShape->impl(); } - // If after cut we got more than one solids then take closest to the center of mass of the base face. + // If after cut we got more than one solids then take closest + // to the center of mass of the base face. aResult = findClosest(aResult, aBaseCentre); // Setting naming. @@ -317,11 +330,13 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh } } else { //Case 3: When only one bounding plane was set. // Making revolution to the 360 angle. - BRepPrimAPI_MakeRevol* aRevolBuilder = new BRepPrimAPI_MakeRevol(aBaseShape, anAxis, 2 * M_PI, Standard_True); + BRepPrimAPI_MakeRevol* aRevolBuilder = + new BRepPrimAPI_MakeRevol(aBaseShape, anAxis, 2 * M_PI, Standard_True); if(!aRevolBuilder) { return; } - this->appendAlgo(std::shared_ptr(new GeomAlgoAPI_MakeShape(aRevolBuilder))); + this->appendAlgo(std::shared_ptr( + new GeomAlgoAPI_MakeShape(aRevolBuilder))); if(!aRevolBuilder->IsDone()) { return; } @@ -376,7 +391,8 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh if(!aBoundingCutBuilder->IsDone()) { return; } - this->appendAlgo(std::shared_ptr(new GeomAlgoAPI_MakeShape(aBoundingCutBuilder))); + this->appendAlgo(std::shared_ptr( + new GeomAlgoAPI_MakeShape(aBoundingCutBuilder))); aResult = aBoundingCutBuilder->Shape(); if(aResult.ShapeType() == TopAbs_COMPOUND) { aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); @@ -406,7 +422,8 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh aBasePlane->Axis().Direction().Z())); GeomShapePtr aPln = GeomAlgoAPI_FaceBuilder::planarFace(theCenter, theNormal); aList.push_back(aSh); - std::list > aBoundingPoints = GeomAlgoAPI_ShapeTools::getBoundingBox(aList); + std::list > + aBoundingPoints = GeomAlgoAPI_ShapeTools::getBoundingBox(aList); aSh = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPln, aBoundingPoints); aModifiedBaseShape = aSh->impl(); } else { @@ -440,7 +457,8 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh TopoDS_Shape aCutResult = aBaseCutBuilder->Shape(); TopoDS_Iterator aCheckIt(aCutResult); if(aCheckIt.More()) { - this->appendAlgo(std::shared_ptr(new GeomAlgoAPI_MakeShape(aBaseCutBuilder))); + this->appendAlgo(std::shared_ptr( + new GeomAlgoAPI_MakeShape(aBaseCutBuilder))); aResult = aCutResult; if(aResult.ShapeType() == TopAbs_COMPOUND) { aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); @@ -467,15 +485,19 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr& theBaseSh aResult = aGeomShape->impl(); } - // If after cut we got more than one solids then take closest to the center of mass of the base face. + // If after cut we got more than one solids then take + // closest to the center of mass of the base face. aResult = findClosest(aResult, aBaseCentre); // Setting naming. if(aShapeTypeToExp == TopAbs_COMPOUND) { - storeGenerationHistory(this, aResult, TopAbs_EDGE, aRotatedBoundingFace, aModifiedBaseShape, isFromFaceSet); - storeGenerationHistory(this, aResult, TopAbs_FACE, aRotatedBoundingFace, aModifiedBaseShape, isFromFaceSet); + storeGenerationHistory(this, aResult, TopAbs_EDGE, + aRotatedBoundingFace, aModifiedBaseShape, isFromFaceSet); + storeGenerationHistory(this, aResult, TopAbs_FACE, + aRotatedBoundingFace, aModifiedBaseShape, isFromFaceSet); } else { - storeGenerationHistory(this, aResult, aShapeTypeToExp, aRotatedBoundingFace, aModifiedBaseShape, isFromFaceSet); + storeGenerationHistory(this, aResult, aShapeTypeToExp, + aRotatedBoundingFace, aModifiedBaseShape, isFromFaceSet); } } @@ -524,7 +546,7 @@ TopoDS_Solid makeSolidFromShape(const TopoDS_Shape& theShape) return aSolid; } -//================================================================================================== +//================================================================================================ gp_Pnt centreOfMass(const TopoDS_Shape& theShape) { TopAbs_ShapeEnum aShType = theShape.ShapeType(); @@ -541,7 +563,7 @@ gp_Pnt centreOfMass(const TopoDS_Shape& theShape) return aGProps.CentreOfMass(); } -//================================================================================================== +//================================================================================================ TopoDS_Shape findClosest(const TopoDS_Shape& theShape, const gp_Pnt& thePoint) { TopoDS_Shape aResult = theShape; @@ -565,7 +587,7 @@ TopoDS_Shape findClosest(const TopoDS_Shape& theShape, const gp_Pnt& thePoint) return aResult; } -//================================================================================================== +//================================================================================================ void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo, const TopoDS_Shape& theBase, const TopAbs_ShapeEnum theType, @@ -581,7 +603,7 @@ void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo, } } -//================================================================================================== +//================================================================================================ void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo, const TopoDS_Shape& theResult, const TopAbs_ShapeEnum theType, @@ -594,11 +616,13 @@ void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo, if(theType == TopAbs_VERTEX) { gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape)); IntTools_Context anIntTools; - if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theToFace), Precision::Confusion()) == Standard_True) { + if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theToFace), + Precision::Confusion()) == Standard_True) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); theRevolutionAlgo->addToShape(aGeomSh); } - if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theFromFace), Precision::Confusion()) == Standard_True) { + if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theFromFace), + Precision::Confusion()) == Standard_True) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); theRevolutionAlgo->addFromShape(aGeomSh); } @@ -645,13 +669,17 @@ void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo, if(theType == TopAbs_VERTEX) { gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape)); IntTools_Context anIntTools; - if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theRotatedBoundingFace), Precision::Confusion()) == Standard_True) { + if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theRotatedBoundingFace), + Precision::Confusion()) == Standard_True) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); - theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) : theRevolutionAlgo->addToShape(aGeomSh); + theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) : + theRevolutionAlgo->addToShape(aGeomSh); } - if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theModifiedBaseShape), Precision::Confusion()) == Standard_True) { + if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theModifiedBaseShape), + Precision::Confusion()) == Standard_True) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); - theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) : theRevolutionAlgo->addFromShape(aGeomSh); + theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) : + theRevolutionAlgo->addFromShape(aGeomSh); } } else if(theType == TopAbs_EDGE) { TopoDS_Edge anEdge = TopoDS::Edge(aShape); @@ -659,25 +687,30 @@ void storeGenerationHistory(GeomAlgoAPI_Revolution* theRevolutionAlgo, anEdgeCheck.Perform(); if(anEdgeCheck.MaxDistance() < Precision::Confusion()) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); - theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) : theRevolutionAlgo->addToShape(aGeomSh); + theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) : + theRevolutionAlgo->addToShape(aGeomSh); } anEdgeCheck.Init(anEdge, TopoDS::Face(theModifiedBaseShape)); anEdgeCheck.Perform(); if(anEdgeCheck.MaxDistance() < Precision::Confusion()) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); - theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) : theRevolutionAlgo->addFromShape(aGeomSh); + theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) : + theRevolutionAlgo->addFromShape(aGeomSh); } } else { Handle(Geom_Surface) aFaceSurface = BRep_Tool::Surface(TopoDS::Face(aShape)); - Handle(Geom_Surface) aBoundingSurface = BRep_Tool::Surface(TopoDS::Face(theRotatedBoundingFace)); + Handle(Geom_Surface) aBoundingSurface = + BRep_Tool::Surface(TopoDS::Face(theRotatedBoundingFace)); Handle(Geom_Surface) aBaseSurface = BRep_Tool::Surface(TopoDS::Face(theModifiedBaseShape)); if(aFaceSurface == aBoundingSurface) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); - theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) : theRevolutionAlgo->addToShape(aGeomSh); + theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) : + theRevolutionAlgo->addToShape(aGeomSh); } if(aFaceSurface == aBaseSurface) { aGeomSh->setImpl(new TopoDS_Shape(aShape)); - theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) : theRevolutionAlgo->addFromShape(aGeomSh); + theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) : + theRevolutionAlgo->addFromShape(aGeomSh); } } } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h index 6a75f2e21..7bb8530e4 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h @@ -39,9 +39,11 @@ public: /// \brief Creates revolution for the given shape. /// \param[in] theBaseShape face for revolution. /// \param[in] theAxis axis for revolution. - /// \param[in] theToShape to bounding shape. Can be empty. In this case offset will be applied to the basis. + /// \param[in] theToShape to bounding shape. Can be empty. + /// In this case offset will be applied to the basis. /// \param[in] theToAngle to angle. - /// \param[in] theFromShape from bounding shape. Can be empty. In this case offset will be applied to the basis. + /// \param[in] theFromShape from bounding shape. Can be empty. + /// In this case offset will be applied to the basis. /// \param[in] theFromAngle from angle. GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(const GeomShapePtr theBaseShape, const std::shared_ptr theAxis, diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp index 48f57b50b..1ba29f83d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp @@ -122,7 +122,6 @@ std::shared_ptr STEPImport(const std::string& theFileName, Standard_Integer nbs = aReader.NbShapes(); if (!ok || nbs == 0) { - // THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::ImportStep", SALOME::BAD_PARAM); continue; // skip empty root } /* For a single entity */ @@ -149,7 +148,6 @@ std::shared_ptr STEPImport(const std::string& theFileName, for (Standard_Integer i = 1; i <= nbs; i++) { TopoDS_Shape aShape = aReader.Shape(i); if (aShape.IsNull()) { - // THROW_SALOME_CORBA_EXCEPTION("Null shape in GEOM_Gen_i::ImportStep", SALOME::BAD_PARAM) ; //return aResShape; continue; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.h b/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.h index aa11b861e..19ae52661 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.h @@ -14,7 +14,8 @@ /// \class GeomAlgoAPI_Sewing /// \ingroup DataAlgo -/// \brief Allows creation of connected topology (shells) from a set of separate topological elements (faces). +/// \brief Allows creation of connected topology (shells) +/// from a set of separate topological elements (faces). class GeomAlgoAPI_Sewing : public GeomAlgoAPI_MakeShape { public: diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp index 6945ee370..8112334bb 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp @@ -16,9 +16,10 @@ namespace GeomAlgoAPI_ShapeAPI { - //========================================================================================================= - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeBox(const double theDx, const double theDy, - const double theDz) throw (GeomAlgoAPI_Exception) + //======================================================================================= + std::shared_ptr GeomAlgoAPI_ShapeAPI::makeBox( + const double theDx, const double theDy, + const double theDz) throw (GeomAlgoAPI_Exception) { GeomAlgoAPI_Box aBoxAlgo(theDx,theDy,theDz); @@ -37,9 +38,10 @@ namespace GeomAlgoAPI_ShapeAPI return aBoxAlgo.shape(); } - //========================================================================================================= - std::shared_ptr GeomAlgoAPI_ShapeAPI::makeBox(std::shared_ptr theFirstPoint, - std::shared_ptr theSecondPoint) throw (GeomAlgoAPI_Exception) + //====================================================================================== + std::shared_ptr GeomAlgoAPI_ShapeAPI::makeBox( + std::shared_ptr theFirstPoint, + std::shared_ptr theSecondPoint) throw (GeomAlgoAPI_Exception) { GeomAlgoAPI_BoxPoints aBoxAlgo(theFirstPoint, theSecondPoint); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.h b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.h index 02ebef9dd..dc9328be1 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.h @@ -27,14 +27,15 @@ public: /// \param theDy The dimension on Y /// \param theDz The dimension on Z /// \return a shape - static std::shared_ptr makeBox(const double theDx, const double theDy, const double theDz) throw (GeomAlgoAPI_Exception); + static std::shared_ptr makeBox(const double theDx, const double theDy, + const double theDz) throw (GeomAlgoAPI_Exception); /// Creates a box using the two points that defined a diagonal. /// \param theFirstPoint One extermity of the diagonal /// \param theSecondPoint The other extremity of the diagonal /// \return a shape static std::shared_ptr makeBox(std::shared_ptr theFirstPoint, - std::shared_ptr theSecondPoint) throw (GeomAlgoAPI_Exception); + std::shared_ptr theSecondPoint) throw (GeomAlgoAPI_Exception); }; } #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.cpp index d710493b9..cc3e24bfe 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.cpp @@ -65,7 +65,8 @@ void GeomAlgoAPI_ShapeBuilder::removeInternal(const std::shared_ptrshapeType(); if(aBaseShapeType == GeomAPI_Shape::WIRE) { aResultShape = theShape->emptyCopied(); - std::shared_ptr aMakeShapeCustom(new GeomAlgoAPI_MakeShapeCustom()); + std::shared_ptr + aMakeShapeCustom(new GeomAlgoAPI_MakeShapeCustom()); for(GeomAPI_ShapeIterator anIter(theShape); anIter.more(); anIter.next()) { GeomShapePtr aSubShape = anIter.current(); GeomShapePtr aSubShapeCopy = aSubShape->emptyCopied(); @@ -82,7 +83,8 @@ void GeomAlgoAPI_ShapeBuilder::removeInternal(const std::shared_ptrimpl(); BRepBuilderAPI_Copy* aCopyBuilder = new BRepBuilderAPI_Copy(aBaseShape); - this->appendAlgo(std::shared_ptr(new GeomAlgoAPI_MakeShape(aCopyBuilder))); + this->appendAlgo(std::shared_ptr( + new GeomAlgoAPI_MakeShape(aCopyBuilder))); if(!aCopyBuilder->IsDone()) { return; } @@ -126,7 +128,8 @@ void GeomAlgoAPI_ShapeBuilder::addInternal(const std::shared_ptr // Copy sub-shapes from list to new shape. BRep_Builder aBuilder; std::shared_ptr aMakeShapeCustom(new GeomAlgoAPI_MakeShapeCustom()); - for(ListOfShape::const_iterator anIt = theShapesToAdd.cbegin(); anIt != theShapesToAdd.cend(); ++anIt) { + for(ListOfShape::const_iterator + anIt = theShapesToAdd.cbegin(); anIt != theShapesToAdd.cend(); ++anIt) { TopoDS_Shape aShapeToAdd = (*anIt)->impl(); TopoDS_Shape aModShapeToAdd = aShapeToAdd; aModShapeToAdd.Orientation(TopAbs_INTERNAL); @@ -157,7 +160,8 @@ void GeomAlgoAPI_ShapeBuilder::addInternal(const std::shared_ptr if(aBaseShapeType == TopAbs_WIRE) { if(aShapeToAddType == TopAbs_VERTEX) { // Find on which edge vertex is lie and add to this edge. - for(TopExp_Explorer aResultExp(aResultShape, TopAbs_EDGE); aResultExp.More(); aResultExp.Next()) { + for(TopExp_Explorer + aResultExp(aResultShape, TopAbs_EDGE); aResultExp.More(); aResultExp.Next()) { TopoDS_Shape anEdge = aResultExp.Current(); BRepExtrema_DistShapeShape aDist(anEdge, aShapeToAdd); aDist.Perform(); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp index 8eb3259c3..3258f9590 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp @@ -74,7 +74,8 @@ double GeomAlgoAPI_ShapeTools::volume(const std::shared_ptr theSh } //================================================================================================== -std::shared_ptr GeomAlgoAPI_ShapeTools::centreOfMass(const std::shared_ptr theShape) +std::shared_ptr + GeomAlgoAPI_ShapeTools::centreOfMass(const std::shared_ptr theShape) { GProp_GProps aGProps; if(!theShape) { @@ -98,10 +99,11 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::centreOfMass(const std::sha } //================================================================================================== -std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes(const std::shared_ptr theCompound, - const GeomAPI_Shape::ShapeType theType, - ListOfShape& theCombinedShapes, - ListOfShape& theFreeShapes) +std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes( + const std::shared_ptr theCompound, + const GeomAPI_Shape::ShapeType theType, + ListOfShape& theCombinedShapes, + ListOfShape& theFreeShapes) { GeomShapePtr aResult = theCompound; @@ -144,7 +146,8 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes(const std:: // Get all shapes with common subshapes and free shapes. NCollection_Map aFreeShapes; NCollection_Vector> aShapesWithCommonSubshapes; - for(BOPCol_IndexedDataMapOfShapeListOfShape::Iterator anIter(aMapSA); anIter.More(); anIter.Next()) { + for(BOPCol_IndexedDataMapOfShapeListOfShape::Iterator + anIter(aMapSA); anIter.More(); anIter.Next()) { const TopoDS_Shape& aShape = anIter.Key(); BOPCol_ListOfShape& aListOfShape = anIter.ChangeValue(); if(aListOfShape.IsEmpty()) { @@ -166,9 +169,11 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes(const std:: aFreeShapes.Remove(aF); aFreeShapes.Remove(aL); aListOfShape.Clear(); - for(NCollection_List::Iterator aTempIter(aTempList); aTempIter.More(); aTempIter.Next()) { + for(NCollection_List::Iterator + aTempIter(aTempList); aTempIter.More(); aTempIter.Next()) { const TopoDS_Shape& aTempShape = aTempIter.Value(); - for(BOPCol_IndexedDataMapOfShapeListOfShape::Iterator anIter(aMapSA); anIter.More(); anIter.Next()) { + for(BOPCol_IndexedDataMapOfShapeListOfShape::Iterator + anIter(aMapSA); anIter.More(); anIter.Next()) { BOPCol_ListOfShape& aTempListOfShape = anIter.ChangeValue(); if(aTempListOfShape.IsEmpty()) { continue; @@ -198,21 +203,25 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes(const std:: } // Combine shapes with common subshapes. - for(NCollection_Vector>::Iterator anIter(aShapesWithCommonSubshapes); anIter.More(); anIter.Next()) { + for(NCollection_Vector>::Iterator + anIter(aShapesWithCommonSubshapes); anIter.More(); anIter.Next()) { TopoDS_Shell aShell; TopoDS_CompSolid aCSolid; TopoDS_Builder aBuilder; - theType == GeomAPI_Shape::COMPSOLID ? aBuilder.MakeCompSolid(aCSolid) : aBuilder.MakeShell(aShell); + theType == + GeomAPI_Shape::COMPSOLID ? aBuilder.MakeCompSolid(aCSolid) : aBuilder.MakeShell(aShell); NCollection_Map& aShapesMap = anIter.ChangeValue(); for(TopExp_Explorer anExp(aShapesComp, aTA); anExp.More(); anExp.Next()) { const TopoDS_Shape& aShape = anExp.Current(); if(aShapesMap.Contains(aShape)) { - theType == GeomAPI_Shape::COMPSOLID ? aBuilder.Add(aCSolid, aShape) : aBuilder.Add(aShell, aShape); + theType == + GeomAPI_Shape::COMPSOLID ? aBuilder.Add(aCSolid, aShape) : aBuilder.Add(aShell, aShape); aShapesMap.Remove(aShape); } } std::shared_ptr aGeomShape(new GeomAPI_Shape); - TopoDS_Shape* aSh = theType == GeomAPI_Shape::COMPSOLID ? new TopoDS_Shape(aCSolid) : new TopoDS_Shape(aShell); + TopoDS_Shape* aSh = theType == GeomAPI_Shape::COMPSOLID ? new TopoDS_Shape(aCSolid) : + new TopoDS_Shape(aShell); aGeomShape->setImpl(aSh); theCombinedShapes.push_back(aGeomShape); } @@ -235,10 +244,12 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes(const std:: TopoDS_Compound aResultComp; TopoDS_Builder aBuilder; aBuilder.MakeCompound(aResultComp); - for(ListOfShape::const_iterator anIter = theCombinedShapes.cbegin(); anIter != theCombinedShapes.cend(); anIter++) { + for(ListOfShape::const_iterator anIter = theCombinedShapes.cbegin(); + anIter != theCombinedShapes.cend(); anIter++) { aBuilder.Add(aResultComp, (*anIter)->impl()); } - for(ListOfShape::const_iterator anIter = theFreeShapes.cbegin(); anIter != theFreeShapes.cend(); anIter++) { + for(ListOfShape::const_iterator anIter = theFreeShapes.cbegin(); + anIter != theFreeShapes.cend(); anIter++) { aBuilder.Add(aResultComp, (*anIter)->impl()); } aResult->setImpl(new TopoDS_Shape(aResultComp)); @@ -248,7 +259,8 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes(const std:: } //================================================================================================== -static void addSimpleShapeToList(const TopoDS_Shape& theShape, NCollection_List& theList) +static void addSimpleShapeToList(const TopoDS_Shape& theShape, + NCollection_List& theList) { if(theShape.IsNull()) { return; @@ -279,7 +291,8 @@ static TopoDS_Compound makeCompound(const NCollection_List theShap } //================================================================================================== -std::shared_ptr GeomAlgoAPI_ShapeTools::groupSharedTopology(const std::shared_ptr theCompound) +std::shared_ptr GeomAlgoAPI_ShapeTools::groupSharedTopology( + const std::shared_ptr theCompound) { GeomShapePtr aResult = theCompound; @@ -296,14 +309,18 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::groupSharedTopology(const NCollection_List aGroupedShapes; aGroupedShapes.Append(anUngroupedShapes.First()); anUngroupedShapes.RemoveFirst(); - for(NCollection_List::Iterator aGroupIt(aGroupedShapes); aGroupIt.More(); aGroupIt.Next()) { + for(NCollection_List::Iterator aGroupIt(aGroupedShapes); + aGroupIt.More(); aGroupIt.Next()) { const TopoDS_Shape& aGroupShape = aGroupIt.Value(); - for(NCollection_List::Iterator anUngroupedIt(anUngroupedShapes); anUngroupedIt.More(); anUngroupedIt.Next()) { + for(NCollection_List::Iterator anUngroupedIt(anUngroupedShapes); + anUngroupedIt.More(); anUngroupedIt.Next()) { const TopoDS_Shape& anUngroupedShape = anUngroupedIt.Value(); bool isFound = false; - for(TopExp_Explorer aGroupShapeExp(aGroupShape, TopAbs_VERTEX); aGroupShapeExp.More(); aGroupShapeExp.Next()) { + for(TopExp_Explorer aGroupShapeExp(aGroupShape, TopAbs_VERTEX); + aGroupShapeExp.More(); aGroupShapeExp.Next()) { const TopoDS_Shape& aVertex1 = aGroupShapeExp.Current(); - for(TopExp_Explorer anUngroupedShapeExp(anUngroupedShape, TopAbs_VERTEX); anUngroupedShapeExp.More(); anUngroupedShapeExp.Next()) { + for(TopExp_Explorer anUngroupedShapeExp(anUngroupedShape, TopAbs_VERTEX); + anUngroupedShapeExp.More(); anUngroupedShapeExp.Next()) { const TopoDS_Shape& aVertex2 = anUngroupedShapeExp.Current(); if(aVertex1.IsSame(aVertex2)) { aGroupedShapes.Append(anUngroupedShape); @@ -328,7 +345,8 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::groupSharedTopology(const BRep_Builder aBuilder; aBuilder.MakeCompound(aCompound); ListOfShape aCompSolids, aFreeSolids; - for(NCollection_Vector>::Iterator anIt(aGroups); anIt.More(); anIt.Next()) { + for(NCollection_Vector>::Iterator + anIt(aGroups); anIt.More(); anIt.Next()) { NCollection_List aGroup = anIt.Value(); GeomShapePtr aGeomShape(new GeomAPI_Shape()); if(aGroup.Size() == 1) { @@ -351,13 +369,15 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::groupSharedTopology(const } //================================================================================================== -std::list > GeomAlgoAPI_ShapeTools::getBoundingBox(const ListOfShape& theShapes, const double theEnlarge) +std::list > + GeomAlgoAPI_ShapeTools::getBoundingBox(const ListOfShape& theShapes, const double theEnlarge) { // Bounding box of all objects. Bnd_Box aBndBox; // Getting box. - for (ListOfShape::const_iterator anObjectsIt = theShapes.begin(); anObjectsIt != theShapes.end(); anObjectsIt++) { + for (ListOfShape::const_iterator + anObjectsIt = theShapes.begin(); anObjectsIt != theShapes.end(); anObjectsIt++) { const TopoDS_Shape& aShape = (*anObjectsIt)->impl(); BRepBndLib::Add(aShape, aBndBox); } @@ -385,7 +405,8 @@ std::list > GeomAlgoAPI_ShapeTools::getBoundingBox( } //================================================================================================== -std::shared_ptr GeomAlgoAPI_ShapeTools::faceToInfinitePlane(const std::shared_ptr theFace) +std::shared_ptr + GeomAlgoAPI_ShapeTools::faceToInfinitePlane(const std::shared_ptr theFace) { if (!theFace.get()) return std::shared_ptr(); @@ -407,8 +428,9 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::faceToInfinitePlane(const } //================================================================================================== -std::shared_ptr GeomAlgoAPI_ShapeTools::fitPlaneToBox(const std::shared_ptr thePlane, - const std::list >& thePoints) +std::shared_ptr GeomAlgoAPI_ShapeTools::fitPlaneToBox( + const std::shared_ptr thePlane, + const std::list >& thePoints) { std::shared_ptr aResultFace; @@ -441,7 +463,8 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::fitPlaneToBox(const std::s IntAna_Quadric aQuadric(aFacePln); Standard_Real UMin, UMax, VMin, VMax; UMin = UMax = VMin = VMax = 0; - for (std::list >::const_iterator aPointsIt = thePoints.begin(); aPointsIt != thePoints.end(); aPointsIt++) { + for (std::list >::const_iterator + aPointsIt = thePoints.begin(); aPointsIt != thePoints.end(); aPointsIt++) { const gp_Pnt& aPnt = (*aPointsIt)->impl(); gp_Lin aLin(aPnt, aFacePln.Axis().Direction()); IntAna_IntConicQuad anIntAna(aLin, aQuadric); @@ -544,8 +567,9 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::findPlane(const ListOfShape } //================================================================================================== -bool GeomAlgoAPI_ShapeTools::isSubShapeInsideShape(const std::shared_ptr theSubShape, - const std::shared_ptr theBaseShape) +bool GeomAlgoAPI_ShapeTools::isSubShapeInsideShape( + const std::shared_ptr theSubShape, + const std::shared_ptr theBaseShape) { if(!theSubShape.get() || !theBaseShape.get()) { return false; @@ -595,7 +619,9 @@ bool GeomAlgoAPI_ShapeTools::isSubShapeInsideShape(const std::shared_ptr t } //================================================================================================== -std::shared_ptr GeomAlgoAPI_ShapeTools::getFaceOuterWire(const std::shared_ptr theFace) +std::shared_ptr + GeomAlgoAPI_ShapeTools::getFaceOuterWire(const std::shared_ptr theFace) { GeomShapePtr anOuterWire; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h index cadedc031..49aaef252 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h @@ -30,40 +30,49 @@ public: /// \return the total volume of the solids of the current shape or 0.0 if it can be computed. GEOMALGOAPI_EXPORT static double volume(const std::shared_ptr theShape); - /// \return the centre of mass of the current face. The coordinates returned for the center of mass - /// are expressed in the absolute Cartesian coordinate system. (This function works only for surfaces). - GEOMALGOAPI_EXPORT static std::shared_ptr centreOfMass(const std::shared_ptr theShape); + /// \return the centre of mass of the current face. + /// The coordinates returned for the center of mass + /// are expressed in the absolute Cartesian coordinate system. + /// (This function works only for surfaces). + GEOMALGOAPI_EXPORT static std::shared_ptr + centreOfMass(const std::shared_ptr theShape); /// \brief Combines faces with common edges to shells, or solids to compsolids. /// \param[in] theCompound compound of shapes. /// \param[in] theType type of combine. /// \param[out] theCombinedShapes resulting shapes. /// \param[out] theFreeShapes shapes that does not have common subshapes. - GEOMALGOAPI_EXPORT static std::shared_ptr combineShapes(const std::shared_ptr theCompound, - const GeomAPI_Shape::ShapeType theType, - ListOfShape& theCombinedShapes, - ListOfShape& theFreeShapes); + GEOMALGOAPI_EXPORT static std::shared_ptr combineShapes( + const std::shared_ptr theCompound, + const GeomAPI_Shape::ShapeType theType, + ListOfShape& theCombinedShapes, + ListOfShape& theFreeShapes); /// \brief Groups shapes with shared topology to compounds. /// \param[in] theCompound compound of shapes. /// \return compound of compounds with shared topology. - GEOMALGOAPI_EXPORT static std::shared_ptr groupSharedTopology(const std::shared_ptr theCompound); + GEOMALGOAPI_EXPORT static std::shared_ptr + groupSharedTopology(const std::shared_ptr theCompound); /// \brief Calculates bounding box for theShapes /// \return list of eight points. /// \param[in] theShapes list of shapes. /// \param[in] theEnlarge enlarges bounding box size. - GEOMALGOAPI_EXPORT static std::list > getBoundingBox(const ListOfShape& theShapes, const double theEnlarge = 0.0); + GEOMALGOAPI_EXPORT static + std::list > getBoundingBox(const ListOfShape& theShapes, + const double theEnlarge = 0.0); /// \return infinite plane received from theFace plane. - GEOMALGOAPI_EXPORT static std::shared_ptr faceToInfinitePlane(const std::shared_ptr theFace); + GEOMALGOAPI_EXPORT static std::shared_ptr + faceToInfinitePlane(const std::shared_ptr theFace); /// \brief Enlarges or reduces plane to fit bounding box. /// \return plane that fits to bounding box. /// \param[in] thePlane base plane. /// \param[in] thePoints bounding box points (shoud be eight). - GEOMALGOAPI_EXPORT static std::shared_ptr fitPlaneToBox(const std::shared_ptr thePlane, - const std::list >& thePoints); + GEOMALGOAPI_EXPORT static std::shared_ptr fitPlaneToBox( + const std::shared_ptr thePlane, + const std::list >& thePoints); /// \brief Finds the start and end vertices of theShape. theShape can be of the following type:\n /// Vertex: theV1 and theV2 are the same and equal to theShape;\n @@ -79,9 +88,9 @@ public: /// \param[in] theWires base wires. /// \param[out] theFaces resulting faces. GEOMALGOAPI_EXPORT static void makeFacesWithHoles(const std::shared_ptr theOrigin, - const std::shared_ptr theDirection, - const ListOfShape& theWires, - ListOfShape& theFaces); + const std::shared_ptr theDirection, + const ListOfShape& theWires, + ListOfShape& theFaces); /// \brief Return a plane for list of shapes if they are all planar. /// \param[in] theShapes shapes to find plane. @@ -92,14 +101,16 @@ public: /// \param[in] theSubShape shape that should be inside. /// \param[in] theBaseShape base shape. /// \return true if edge inside the face. - GEOMALGOAPI_EXPORT static bool isSubShapeInsideShape(const std::shared_ptr theSubShape, - const std::shared_ptr theBaseShape); + GEOMALGOAPI_EXPORT static bool isSubShapeInsideShape( + const std::shared_ptr theSubShape, + const std::shared_ptr theBaseShape); /// \return true if theShape is valid. GEOMALGOAPI_EXPORT static bool isShapeValid(const std::shared_ptr theShape); /// \return outer wire for face. If theShape has different type returns empty pointer. - GEOMALGOAPI_EXPORT static std::shared_ptr getFaceOuterWire(const std::shared_ptr theFace); + GEOMALGOAPI_EXPORT static + std::shared_ptr getFaceOuterWire(const std::shared_ptr theFace); /// \return true if edge is parallel to face. GEOMALGOAPI_EXPORT static bool isParallel(const std::shared_ptr theEdge, @@ -110,13 +121,13 @@ public: /// \param[in] thePoints container of points to split /// \param[out] theShapes container of shapes after split GEOMALGOAPI_EXPORT static void splitShape(const std::shared_ptr& theBaseShape, - const std::list >& thePoints, - std::set >& theShapes); + const std::list >& thePoints, + std::set >& theShapes); GEOMALGOAPI_EXPORT static std::shared_ptr findShape( - const std::list >& thePoints, - const std::set >& theShapes); + const std::list >& thePoints, + const std::set >& theShapes); }; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp index 880273df2..2bd7775e3 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp @@ -147,7 +147,7 @@ void GeomAlgoAPI_SketchBuilder::createFaces(const std::shared_ptr& const std::shared_ptr& theDirX, const std::shared_ptr& theNorm, const std::shared_ptr& theWire, - std::list >& theResultFaces) + std::list >& theResultFaces) { std::shared_ptr aWire = std::dynamic_pointer_cast(theWire); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.h b/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.h index 99256bee6..7f3913144 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.h @@ -19,7 +19,8 @@ class GeomAlgoAPI_WireBuilder public: /// \brief Creates a wire from edges and wires. /// \param[in] theShapes list of shapes. Only edges and wires allowed. - /// The edges are not to be consecutive. But they are to be all connected geometrically or topologically. + /// The edges are not to be consecutive. + /// But they are to be all connected geometrically or topologically. /// \return wire created from theShapes. Empty in case of error or bad input. GEOMALGOAPI_EXPORT static std::shared_ptr wire(const ListOfShape& theShapes); };