From b0b47e7abb9155176661ca459f6a62b5c39c3325 Mon Sep 17 00:00:00 2001 From: mzernova Date: Thu, 16 Jan 2025 16:28:51 +0000 Subject: [PATCH] Formatting --- src/RWMesh/RWMesh_EdgeIterator.cxx | 25 ++++---- src/RWMesh/RWMesh_EdgeIterator.hxx | 39 ++++++------ src/RWMesh/RWMesh_FaceIterator.cxx | 64 ++++++++++---------- src/RWMesh/RWMesh_FaceIterator.hxx | 69 +++++++++++---------- src/RWMesh/RWMesh_ShapeIterator.cxx | 89 ++++++++++++++-------------- src/RWMesh/RWMesh_ShapeIterator.hxx | 64 ++++++++++---------- src/RWMesh/RWMesh_VertexIterator.cxx | 20 +++---- src/RWMesh/RWMesh_VertexIterator.hxx | 36 ++++------- 8 files changed, 191 insertions(+), 215 deletions(-) diff --git a/src/RWMesh/RWMesh_EdgeIterator.cxx b/src/RWMesh/RWMesh_EdgeIterator.cxx index 0dcc5f6a0a..bdcbe8ce81 100644 --- a/src/RWMesh/RWMesh_EdgeIterator.cxx +++ b/src/RWMesh/RWMesh_EdgeIterator.cxx @@ -23,11 +23,11 @@ // function : RWMesh_EdgeIterator // purpose : // ======================================================================= -RWMesh_EdgeIterator::RWMesh_EdgeIterator (const TDF_Label& theLabel, - const TopLoc_Location& theLocation, - const Standard_Boolean theToMapColors, - const XCAFPrs_Style& theStyle) -: RWMesh_ShapeIterator (theLabel, theLocation, TopAbs_EDGE, theToMapColors, theStyle) +RWMesh_EdgeIterator::RWMesh_EdgeIterator(const TDF_Label& theLabel, + const TopLoc_Location& theLocation, + const Standard_Boolean theToMapColors, + const XCAFPrs_Style& theStyle) + : RWMesh_ShapeIterator(theLabel, theLocation, TopAbs_EDGE, theToMapColors, theStyle) { Next(); } @@ -36,9 +36,9 @@ RWMesh_EdgeIterator::RWMesh_EdgeIterator (const TDF_Label& theLabel, // function : RWMesh_EdgeIterator // purpose : // ======================================================================= -RWMesh_EdgeIterator::RWMesh_EdgeIterator (const TopoDS_Shape& theShape, - const XCAFPrs_Style& theStyle) -: RWMesh_ShapeIterator (theShape, TopAbs_EDGE, theStyle) +RWMesh_EdgeIterator::RWMesh_EdgeIterator(const TopoDS_Shape& theShape, + const XCAFPrs_Style& theStyle) + : RWMesh_ShapeIterator(theShape, TopAbs_EDGE, theStyle) { Next(); } @@ -51,11 +51,10 @@ void RWMesh_EdgeIterator::Next() { for (; myIter.More(); myIter.Next()) { - myEdge = TopoDS::Edge (myIter.Current()); - myPolygon3D = BRep_Tool::Polygon3D (myEdge, myLocation); - myTrsf = myLocation.Transformation(); - if (myPolygon3D.IsNull() - || myPolygon3D->NbNodes() == 0) + myEdge = TopoDS::Edge(myIter.Current()); + myPolygon3D = BRep_Tool::Polygon3D(myEdge, myLocation); + myTrsf = myLocation.Transformation(); + if (myPolygon3D.IsNull() || myPolygon3D->NbNodes() == 0) { resetEdge(); continue; diff --git a/src/RWMesh/RWMesh_EdgeIterator.hxx b/src/RWMesh/RWMesh_EdgeIterator.hxx index 596262c54d..b71c012866 100644 --- a/src/RWMesh/RWMesh_EdgeIterator.hxx +++ b/src/RWMesh/RWMesh_EdgeIterator.hxx @@ -14,14 +14,14 @@ #ifndef _RWMesh_EdgeIterator_HeaderFile #define _RWMesh_EdgeIterator_HeaderFile -#include #include #include +#include #include -#include #include +#include #include -#include +#include #include @@ -34,22 +34,21 @@ class TDF_Label; class RWMesh_EdgeIterator : public RWMesh_ShapeIterator { public: - //! Main constructor. //! @param[in] theLabel The label of the shape. //! @param[in] theLocation The location of the shape. //! @param[in] theToMapColors Flag to indicate if colors should be mapped. //! @param[in] theStyle The style of the shape. - Standard_EXPORT RWMesh_EdgeIterator (const TDF_Label& theLabel, - const TopLoc_Location& theLocation, - const Standard_Boolean theToMapColors = false, - const XCAFPrs_Style& theStyle = XCAFPrs_Style()); + Standard_EXPORT RWMesh_EdgeIterator(const TDF_Label& theLabel, + const TopLoc_Location& theLocation, + const Standard_Boolean theToMapColors = false, + const XCAFPrs_Style& theStyle = XCAFPrs_Style()); //! Auxiliary constructor. //! @param[in] theShape The shape to iterate. //! @param[in] theStyle The style of the shape. - Standard_EXPORT RWMesh_EdgeIterator (const TopoDS_Shape& theShape, - const XCAFPrs_Style& theStyle = XCAFPrs_Style()); + Standard_EXPORT RWMesh_EdgeIterator(const TopoDS_Shape& theShape, + const XCAFPrs_Style& theStyle = XCAFPrs_Style()); //! Return true if iterator points to the valid triangulation. bool More() const Standard_OVERRIDE { return !myPolygon3D.IsNull(); } @@ -73,7 +72,6 @@ public: } public: - //! Lower element index in current triangulation. Standard_Integer ElemLower() const Standard_OVERRIDE { return 1; } @@ -81,9 +79,11 @@ public: Standard_Integer ElemUpper() const Standard_OVERRIDE { return myPolygon3D->NbNodes(); } public: - //! Return number of nodes for the current edge. - Standard_Integer NbNodes() const Standard_OVERRIDE { return !myPolygon3D.IsNull() ? myPolygon3D->NbNodes() : 0; } + Standard_Integer NbNodes() const Standard_OVERRIDE + { + return !myPolygon3D.IsNull() ? myPolygon3D->NbNodes() : 0; + } //! Lower node index in current triangulation. Standard_Integer NodeLower() const Standard_OVERRIDE { return 1; } @@ -92,12 +92,13 @@ public: Standard_Integer NodeUpper() const Standard_OVERRIDE { return myPolygon3D->NbNodes(); } public: - //! Return the node with specified index with applied transformation. - gp_Pnt node (const Standard_Integer theNode) const Standard_OVERRIDE { return myPolygon3D->Nodes().Value (theNode); } + gp_Pnt node(const Standard_Integer theNode) const Standard_OVERRIDE + { + return myPolygon3D->Nodes().Value(theNode); + } private: - //! Reset information for current edge. void resetEdge() { @@ -110,10 +111,8 @@ private: void initEdge(); private: - - TopoDS_Edge myEdge; //!< current edge - Handle(Poly_Polygon3D) myPolygon3D; //!< geometry of current edge - + TopoDS_Edge myEdge; //!< current edge + Handle(Poly_Polygon3D) myPolygon3D; //!< geometry of current edge }; #endif // _RWMesh_EdgeIterator_HeaderFile diff --git a/src/RWMesh/RWMesh_FaceIterator.cxx b/src/RWMesh/RWMesh_FaceIterator.cxx index 36087407c6..2cdc3c923d 100644 --- a/src/RWMesh/RWMesh_FaceIterator.cxx +++ b/src/RWMesh/RWMesh_FaceIterator.cxx @@ -24,15 +24,15 @@ // function : RWMesh_FaceIterator // purpose : // ======================================================================= -RWMesh_FaceIterator::RWMesh_FaceIterator (const TDF_Label& theLabel, - const TopLoc_Location& theLocation, - const Standard_Boolean theToMapColors, - const XCAFPrs_Style& theStyle) -: RWMesh_ShapeIterator (theLabel, theLocation, TopAbs_FACE, theToMapColors, theStyle), - mySLTool (1, 1e-12), - myHasNormals (false), - myIsMirrored (false) -{ +RWMesh_FaceIterator::RWMesh_FaceIterator(const TDF_Label& theLabel, + const TopLoc_Location& theLocation, + const Standard_Boolean theToMapColors, + const XCAFPrs_Style& theStyle) + : RWMesh_ShapeIterator(theLabel, theLocation, TopAbs_FACE, theToMapColors, theStyle), + mySLTool(1, 1e-12), + myHasNormals(false), + myIsMirrored(false) +{ Next(); } @@ -40,13 +40,13 @@ RWMesh_FaceIterator::RWMesh_FaceIterator (const TDF_Label& theLabel, // function : RWMesh_FaceIterator // purpose : // ======================================================================= -RWMesh_FaceIterator::RWMesh_FaceIterator (const TopoDS_Shape& theShape, - const XCAFPrs_Style& theStyle) -: RWMesh_ShapeIterator (theShape, TopAbs_FACE, theStyle), - mySLTool (1, 1e-12), - myHasNormals (false), - myIsMirrored (false) -{ +RWMesh_FaceIterator::RWMesh_FaceIterator(const TopoDS_Shape& theShape, + const XCAFPrs_Style& theStyle) + : RWMesh_ShapeIterator(theShape, TopAbs_FACE, theStyle), + mySLTool(1, 1e-12), + myHasNormals(false), + myIsMirrored(false) +{ Next(); } @@ -54,23 +54,22 @@ RWMesh_FaceIterator::RWMesh_FaceIterator (const TopoDS_Shape& theShape, // function : normal // purpose : // ======================================================================= -gp_Dir RWMesh_FaceIterator::normal (Standard_Integer theNode) const +gp_Dir RWMesh_FaceIterator::normal(Standard_Integer theNode) const { - gp_Dir aNormal (gp::DZ()); + gp_Dir aNormal(gp::DZ()); if (myPolyTriang->HasNormals()) { Graphic3d_Vec3 aNormVec3; - myPolyTriang->Normal (theNode, aNormVec3); + myPolyTriang->Normal(theNode, aNormVec3); if (aNormVec3.Modulus() != 0.0f) { - aNormal.SetCoord (aNormVec3.x(), aNormVec3.y(), aNormVec3.z()); + aNormal.SetCoord(aNormVec3.x(), aNormVec3.y(), aNormVec3.z()); } } - else if (myHasNormals - && myPolyTriang->HasUVNodes()) + else if (myHasNormals && myPolyTriang->HasUVNodes()) { - const gp_XY anUV = myPolyTriang->UVNode (theNode).XY(); - mySLTool.SetParameters (anUV.X(), anUV.Y()); + const gp_XY anUV = myPolyTriang->UVNode(theNode).XY(); + mySLTool.SetParameters(anUV.X(), anUV.Y()); if (mySLTool.IsNormalDefined()) { aNormal = mySLTool.Normal(); @@ -87,11 +86,10 @@ void RWMesh_FaceIterator::Next() { for (; myIter.More(); myIter.Next()) { - myFace = TopoDS::Face (myIter.Current()); - myPolyTriang = BRep_Tool::Triangulation (myFace, myLocation); + myFace = TopoDS::Face(myIter.Current()); + myPolyTriang = BRep_Tool::Triangulation(myFace, myLocation); myTrsf = myLocation.Transformation(); - if (myPolyTriang.IsNull() - || myPolyTriang->NbTriangles() == 0) + if (myPolyTriang.IsNull() || myPolyTriang->NbTriangles() == 0) { resetFace(); continue; @@ -119,13 +117,13 @@ void RWMesh_FaceIterator::initFace() } if (myPolyTriang->HasUVNodes() && !myHasNormals) { - TopoDS_Face aFaceFwd = TopoDS::Face (myFace.Oriented (TopAbs_FORWARD)); - aFaceFwd.Location (TopLoc_Location()); + TopoDS_Face aFaceFwd = TopoDS::Face(myFace.Oriented(TopAbs_FORWARD)); + aFaceFwd.Location(TopLoc_Location()); TopLoc_Location aLoc; - if (!BRep_Tool::Surface (aFaceFwd, aLoc).IsNull()) + if (!BRep_Tool::Surface(aFaceFwd, aLoc).IsNull()) { - myFaceAdaptor.Initialize (aFaceFwd, false); - mySLTool.SetSurface (myFaceAdaptor); + myFaceAdaptor.Initialize(aFaceFwd, false); + mySLTool.SetSurface(myFaceAdaptor); myHasNormals = true; } } diff --git a/src/RWMesh/RWMesh_FaceIterator.hxx b/src/RWMesh/RWMesh_FaceIterator.hxx index ca8213f346..d68b7bb54f 100644 --- a/src/RWMesh/RWMesh_FaceIterator.hxx +++ b/src/RWMesh/RWMesh_FaceIterator.hxx @@ -32,22 +32,21 @@ class TDF_Label; class RWMesh_FaceIterator : public RWMesh_ShapeIterator { public: - //! Main constructor. //! @param[in] theLabel Label containing the face data //! @param[in] theLocation Location of the face //! @param[in] theToMapColors Flag to indicate if colors should be mapped //! @param[in] theStyle Style information for the face - Standard_EXPORT RWMesh_FaceIterator (const TDF_Label& theLabel, - const TopLoc_Location& theLocation, - const Standard_Boolean theToMapColors = false, - const XCAFPrs_Style& theStyle = XCAFPrs_Style()); + Standard_EXPORT RWMesh_FaceIterator(const TDF_Label& theLabel, + const TopLoc_Location& theLocation, + const Standard_Boolean theToMapColors = false, + const XCAFPrs_Style& theStyle = XCAFPrs_Style()); //! Auxiliary constructor. //! @param[in] theShape Shape containing the face data //! @param[in] theStyle Style information for the face - Standard_EXPORT RWMesh_FaceIterator (const TopoDS_Shape& theShape, - const XCAFPrs_Style& theStyle = XCAFPrs_Style()); + Standard_EXPORT RWMesh_FaceIterator(const TopoDS_Shape& theShape, + const XCAFPrs_Style& theStyle = XCAFPrs_Style()); //! Return true if iterator points to the valid triangulation. bool More() const Standard_OVERRIDE { return !myPolyTriang.IsNull(); } @@ -71,11 +70,10 @@ public: bool IsEmpty() const Standard_OVERRIDE { return myPolyTriang.IsNull() - || (myPolyTriang->NbNodes() < 1 && myPolyTriang->NbTriangles() < 1); + || (myPolyTriang->NbNodes() < 1 && myPolyTriang->NbTriangles() < 1); } public: - //! Return face material. const XCAFPrs_Style& FaceStyle() const { return myStyle; } @@ -86,7 +84,6 @@ public: const Quantity_ColorRGBA& FaceColor() const { return myColor; } public: - //! Return number of elements of specific type for the current face. Standard_Integer NbTriangles() const { return myPolyTriang->NbTriangles(); } @@ -97,31 +94,31 @@ public: Standard_Integer ElemUpper() const Standard_OVERRIDE { return myPolyTriang->NbTriangles(); } //! Return triangle with specified index with applied Face orientation. - Poly_Triangle TriangleOriented (Standard_Integer theElemIndex) const + Poly_Triangle TriangleOriented(Standard_Integer theElemIndex) const { - Poly_Triangle aTri = triangle (theElemIndex); + Poly_Triangle aTri = triangle(theElemIndex); if ((myFace.Orientation() == TopAbs_REVERSED) ^ myIsMirrored) { - return Poly_Triangle (aTri.Value (1), aTri.Value (3), aTri.Value (2)); + return Poly_Triangle(aTri.Value(1), aTri.Value(3), aTri.Value(2)); } return aTri; } public: - //! Return true if triangulation has defined normals. bool HasNormals() const { return myHasNormals; } //! Return true if triangulation has defined normals. bool HasTexCoords() const { return !myPolyTriang.IsNull() && myPolyTriang->HasUVNodes(); } - //! Return normal at specified node index with face transformation applied and face orientation applied. - gp_Dir NormalTransformed (Standard_Integer theNode) const + //! Return normal at specified node index with face transformation applied and face orientation + //! applied. + gp_Dir NormalTransformed(Standard_Integer theNode) const { - gp_Dir aNorm = normal (theNode); + gp_Dir aNorm = normal(theNode); if (myTrsf.Form() != gp_Identity) { - aNorm.Transform (myTrsf); + aNorm.Transform(myTrsf); } if (myFace.Orientation() == TopAbs_REVERSED) { @@ -133,9 +130,7 @@ public: //! Return number of nodes for the current face. Standard_Integer NbNodes() const Standard_OVERRIDE { - return !myPolyTriang.IsNull() - ? myPolyTriang->NbNodes() - : 0; + return !myPolyTriang.IsNull() ? myPolyTriang->NbNodes() : 0; } //! Lower node index in current triangulation. @@ -145,24 +140,28 @@ public: Standard_Integer NodeUpper() const Standard_OVERRIDE { return myPolyTriang->NbNodes(); } //! Return texture coordinates for the node. - gp_Pnt2d NodeTexCoord (const Standard_Integer theNode) const + gp_Pnt2d NodeTexCoord(const Standard_Integer theNode) const { - return myPolyTriang->HasUVNodes() ? myPolyTriang->UVNode (theNode) : gp_Pnt2d(); + return myPolyTriang->HasUVNodes() ? myPolyTriang->UVNode(theNode) : gp_Pnt2d(); } public: - //! Return the node with specified index with applied transformation. - gp_Pnt node (const Standard_Integer theNode) const Standard_OVERRIDE { return myPolyTriang->Node (theNode); } + gp_Pnt node(const Standard_Integer theNode) const Standard_OVERRIDE + { + return myPolyTriang->Node(theNode); + } //! Return normal at specified node index without face transformation applied. - Standard_EXPORT gp_Dir normal (Standard_Integer theNode) const; + Standard_EXPORT gp_Dir normal(Standard_Integer theNode) const; //! Return triangle with specified index. - Poly_Triangle triangle (Standard_Integer theElemIndex) const { return myPolyTriang->Triangle (theElemIndex); } + Poly_Triangle triangle(Standard_Integer theElemIndex) const + { + return myPolyTriang->Triangle(theElemIndex); + } private: - //! Reset information for current face. void resetFace() { @@ -176,14 +175,12 @@ private: void initFace(); private: - - TopoDS_Face myFace; //!< current face - Handle(Poly_Triangulation) myPolyTriang; //!< triangulation of current face - mutable BRepLProp_SLProps mySLTool; //!< auxiliary tool for fetching normals from surface - BRepAdaptor_Surface myFaceAdaptor; //!< surface adaptor for fetching normals from surface - Standard_Boolean myHasNormals; //!< flag indicating that current face has normals - Standard_Boolean myIsMirrored; //!< flag indicating that face triangles should be mirrored - + TopoDS_Face myFace; //!< current face + Handle(Poly_Triangulation) myPolyTriang; //!< triangulation of current face + mutable BRepLProp_SLProps mySLTool; //!< auxiliary tool for fetching normals from surface + BRepAdaptor_Surface myFaceAdaptor; //!< surface adaptor for fetching normals from surface + Standard_Boolean myHasNormals; //!< flag indicating that current face has normals + Standard_Boolean myIsMirrored; //!< flag indicating that face triangles should be mirrored }; #endif // _RWMesh_FaceIterator_HeaderFile diff --git a/src/RWMesh/RWMesh_ShapeIterator.cxx b/src/RWMesh/RWMesh_ShapeIterator.cxx index 8cf0de8227..63c3fccaf3 100644 --- a/src/RWMesh/RWMesh_ShapeIterator.cxx +++ b/src/RWMesh/RWMesh_ShapeIterator.cxx @@ -22,30 +22,29 @@ // function : RWMesh_ShapeIterator // purpose : // ======================================================================= -RWMesh_ShapeIterator::RWMesh_ShapeIterator (const TDF_Label& theLabel, - const TopLoc_Location& theLocation, - const TopAbs_ShapeEnum theShapeType, - const Standard_Boolean theToMapColors, - const XCAFPrs_Style& theStyle) -: myDefStyle (theStyle), - myToMapColors (theToMapColors), - myShapeType (theShapeType), - myHasColor (false) +RWMesh_ShapeIterator::RWMesh_ShapeIterator(const TDF_Label& theLabel, + const TopLoc_Location& theLocation, + const TopAbs_ShapeEnum theShapeType, + const Standard_Boolean theToMapColors, + const XCAFPrs_Style& theStyle) + : myDefStyle(theStyle), + myToMapColors(theToMapColors), + myShapeType(theShapeType), + myHasColor(false) { TopoDS_Shape aShape; - if (!XCAFDoc_ShapeTool::GetShape (theLabel, aShape) - || aShape.IsNull()) + if (!XCAFDoc_ShapeTool::GetShape(theLabel, aShape) || aShape.IsNull()) { return; } - aShape.Location (theLocation, false); - myIter.Init (aShape, myShapeType); + aShape.Location(theLocation, false); + myIter.Init(aShape, myShapeType); if (theToMapColors) { - dispatchStyles (theLabel, theLocation, theStyle); - myStyles.Bind (aShape, theStyle); + dispatchStyles(theLabel, theLocation, theStyle); + myStyles.Bind(aShape, theStyle); } } @@ -53,43 +52,43 @@ RWMesh_ShapeIterator::RWMesh_ShapeIterator (const TDF_Label& theLabel, // function : RWMesh_ShapeIterator // purpose : // ======================================================================= -RWMesh_ShapeIterator::RWMesh_ShapeIterator (const TopoDS_Shape& theShape, - const TopAbs_ShapeEnum theShapeType, - const XCAFPrs_Style& theStyle) -: myDefStyle (theStyle), - myToMapColors (true), - myShapeType (theShapeType), - myHasColor (false) +RWMesh_ShapeIterator::RWMesh_ShapeIterator(const TopoDS_Shape& theShape, + const TopAbs_ShapeEnum theShapeType, + const XCAFPrs_Style& theStyle) + : myDefStyle(theStyle), + myToMapColors(true), + myShapeType(theShapeType), + myHasColor(false) { if (theShape.IsNull()) { return; } - myIter.Init (theShape, myShapeType); + myIter.Init(theShape, myShapeType); } // ======================================================================= // function : dispatchStyles // purpose : // ======================================================================= -void RWMesh_ShapeIterator::dispatchStyles (const TDF_Label& theLabel, +void RWMesh_ShapeIterator::dispatchStyles(const TDF_Label& theLabel, const TopLoc_Location& theLocation, const XCAFPrs_Style& theStyle) { - TopLoc_Location aDummyLoc; + TopLoc_Location aDummyLoc; XCAFPrs_IndexedDataMapOfShapeStyle aStyles; - XCAFPrs::CollectStyleSettings (theLabel, aDummyLoc, aStyles); + XCAFPrs::CollectStyleSettings(theLabel, aDummyLoc, aStyles); Standard_Integer aNbTypes[TopAbs_SHAPE] = {}; for (Standard_Integer aTypeIter = myShapeType; aTypeIter >= TopAbs_COMPOUND; --aTypeIter) { - if (aTypeIter != myShapeType - && aNbTypes[aTypeIter] == 0) + if (aTypeIter != myShapeType && aNbTypes[aTypeIter] == 0) { continue; } - for (XCAFPrs_IndexedDataMapOfShapeStyle::Iterator aStyleIter (aStyles); aStyleIter.More(); aStyleIter.Next()) + for (XCAFPrs_IndexedDataMapOfShapeStyle::Iterator aStyleIter(aStyles); aStyleIter.More(); + aStyleIter.Next()) { const TopoDS_Shape& aKeyShape = aStyleIter.Key(); const TopAbs_ShapeEnum aKeyShapeType = aKeyShape.ShapeType(); @@ -103,34 +102,32 @@ void RWMesh_ShapeIterator::dispatchStyles (const TDF_Label& theLabel, } XCAFPrs_Style aCafStyle = aStyleIter.Value(); - if (!aCafStyle.IsSetColorCurv() - && theStyle.IsSetColorCurv()) + if (!aCafStyle.IsSetColorCurv() && theStyle.IsSetColorCurv()) { - aCafStyle.SetColorCurv (theStyle.GetColorCurv()); + aCafStyle.SetColorCurv(theStyle.GetColorCurv()); } - if (!aCafStyle.IsSetColorSurf() - && theStyle.IsSetColorSurf()) + if (!aCafStyle.IsSetColorSurf() && theStyle.IsSetColorSurf()) { - aCafStyle.SetColorSurf (theStyle.GetColorSurfRGBA()); + aCafStyle.SetColorSurf(theStyle.GetColorSurfRGBA()); } - if (aCafStyle.Material().IsNull() - && !theStyle.Material().IsNull()) + if (aCafStyle.Material().IsNull() && !theStyle.Material().IsNull()) { - aCafStyle.SetMaterial (theStyle.Material()); + aCafStyle.SetMaterial(theStyle.Material()); } - TopoDS_Shape aKeyShapeLocated = aKeyShape.Located (theLocation); + TopoDS_Shape aKeyShapeLocated = aKeyShape.Located(theLocation); if (aKeyShapeType == myShapeType) { - myStyles.Bind (aKeyShapeLocated, aCafStyle); + myStyles.Bind(aKeyShapeLocated, aCafStyle); } else { - for (TopExp_Explorer aShapeIter (aKeyShapeLocated, myShapeType); aShapeIter.More(); aShapeIter.Next()) + for (TopExp_Explorer aShapeIter(aKeyShapeLocated, myShapeType); aShapeIter.More(); + aShapeIter.Next()) { - if (!myStyles.IsBound (aShapeIter.Current())) + if (!myStyles.IsBound(aShapeIter.Current())) { - myStyles.Bind (aShapeIter.Current(), aCafStyle); + myStyles.Bind(aShapeIter.Current(), aCafStyle); } } } @@ -149,18 +146,18 @@ void RWMesh_ShapeIterator::initShape() { return; } - if (!myStyles.Find (Shape(), myStyle)) + if (!myStyles.Find(Shape(), myStyle)) { myStyle = myDefStyle; } if (!myStyle.Material().IsNull()) { myHasColor = true; - myColor = myStyle.Material()->BaseColor(); + myColor = myStyle.Material()->BaseColor(); } else if (myStyle.IsSetColorSurf()) { myHasColor = true; - myColor = myStyle.GetColorSurfRGBA(); + myColor = myStyle.GetColorSurfRGBA(); } } \ No newline at end of file diff --git a/src/RWMesh/RWMesh_ShapeIterator.hxx b/src/RWMesh/RWMesh_ShapeIterator.hxx index e7fe6b2af7..6efdfa915c 100644 --- a/src/RWMesh/RWMesh_ShapeIterator.hxx +++ b/src/RWMesh/RWMesh_ShapeIterator.hxx @@ -15,13 +15,13 @@ #define _RWMesh_ShapeIterator_HeaderFile #include -#include #include #include #include #include -#include #include +#include +#include #include @@ -34,7 +34,6 @@ class TDF_Label; class RWMesh_ShapeIterator { public: - //! Return explored shape. const TopoDS_Shape& ExploredShape() const { return myIter.ExploredShape(); } @@ -75,61 +74,58 @@ public: Standard_EXPORT virtual Standard_Integer NodeUpper() const = 0; //! Return the node with specified index with applied transformation. - gp_Pnt NodeTransformed (const Standard_Integer theNode) const + gp_Pnt NodeTransformed(const Standard_Integer theNode) const { - gp_Pnt aNode = node (theNode); - aNode.Transform (myTrsf); + gp_Pnt aNode = node(theNode); + aNode.Transform(myTrsf); return aNode; } protected: - //! Return the node with specified index with applied transformation. - virtual gp_Pnt node (const Standard_Integer theNode) const = 0; + virtual gp_Pnt node(const Standard_Integer theNode) const = 0; //! Main constructor. - RWMesh_ShapeIterator (const TDF_Label& theLabel, - const TopLoc_Location& theLocation, - const TopAbs_ShapeEnum theShapeType, - const Standard_Boolean theToMapColors = false, - const XCAFPrs_Style& theStyle = XCAFPrs_Style()); + RWMesh_ShapeIterator(const TDF_Label& theLabel, + const TopLoc_Location& theLocation, + const TopAbs_ShapeEnum theShapeType, + const Standard_Boolean theToMapColors = false, + const XCAFPrs_Style& theStyle = XCAFPrs_Style()); //! Auxiliary constructor. - RWMesh_ShapeIterator (const TopoDS_Shape& theShape, - const TopAbs_ShapeEnum theShapeType, - const XCAFPrs_Style& theStyle = XCAFPrs_Style()); + RWMesh_ShapeIterator(const TopoDS_Shape& theShape, + const TopAbs_ShapeEnum theShapeType, + const XCAFPrs_Style& theStyle = XCAFPrs_Style()); //! Dispatch shape styles. - void dispatchStyles (const TDF_Label& theLabel, - const TopLoc_Location& theLocation, - const XCAFPrs_Style& theStyle); + void dispatchStyles(const TDF_Label& theLabel, + const TopLoc_Location& theLocation, + const XCAFPrs_Style& theStyle); //! Reset information for current shape. void resetShape() { myHasColor = false; - myColor = Quantity_ColorRGBA(); - myStyle = XCAFPrs_Style(); + myColor = Quantity_ColorRGBA(); + myStyle = XCAFPrs_Style(); } //! Initialize shape properties. void initShape(); protected: - NCollection_DataMap - myStyles; //!< Shape -> Style map - XCAFPrs_Style myDefStyle; //!< default style for shapes without dedicated style - Standard_Boolean myToMapColors; //!< flag to dispatch styles - - TopExp_Explorer myIter; //!< shape explorer - TopLoc_Location myLocation; //!< current shape location - gp_Trsf myTrsf; //!< current shape transformation - XCAFPrs_Style myStyle; //!< current shape style - Quantity_ColorRGBA myColor; //!< current shape color - TopAbs_ShapeEnum myShapeType; //!< type of shape - Standard_Boolean myHasColor; //!< flag indicating that current shape has assigned color - + myStyles; //!< Shape -> Style map + XCAFPrs_Style myDefStyle; //!< default style for shapes without dedicated style + Standard_Boolean myToMapColors; //!< flag to dispatch styles + + TopExp_Explorer myIter; //!< shape explorer + TopLoc_Location myLocation; //!< current shape location + gp_Trsf myTrsf; //!< current shape transformation + XCAFPrs_Style myStyle; //!< current shape style + Quantity_ColorRGBA myColor; //!< current shape color + TopAbs_ShapeEnum myShapeType; //!< type of shape + Standard_Boolean myHasColor; //!< flag indicating that current shape has assigned color }; #endif // _RWMesh_ShapeIterator_HeaderFile diff --git a/src/RWMesh/RWMesh_VertexIterator.cxx b/src/RWMesh/RWMesh_VertexIterator.cxx index 3a5e06abe0..ce9d3deb47 100644 --- a/src/RWMesh/RWMesh_VertexIterator.cxx +++ b/src/RWMesh/RWMesh_VertexIterator.cxx @@ -23,11 +23,11 @@ // function : RWMesh_VertexIterator // purpose : // ======================================================================= -RWMesh_VertexIterator::RWMesh_VertexIterator (const TDF_Label& theLabel, - const TopLoc_Location& theLocation, - const Standard_Boolean theToMapColors, - const XCAFPrs_Style& theStyle) -: RWMesh_ShapeIterator (theLabel, theLocation, TopAbs_VERTEX, theToMapColors, theStyle) +RWMesh_VertexIterator::RWMesh_VertexIterator(const TDF_Label& theLabel, + const TopLoc_Location& theLocation, + const Standard_Boolean theToMapColors, + const XCAFPrs_Style& theStyle) + : RWMesh_ShapeIterator(theLabel, theLocation, TopAbs_VERTEX, theToMapColors, theStyle) { Next(); } @@ -36,9 +36,9 @@ RWMesh_VertexIterator::RWMesh_VertexIterator (const TDF_Label& theLabel, // function : RWMesh_VertexIterator // purpose : // ======================================================================= -RWMesh_VertexIterator::RWMesh_VertexIterator (const TopoDS_Shape& theShape, - const XCAFPrs_Style& theStyle) -: RWMesh_ShapeIterator (theShape, TopAbs_VERTEX, theStyle) +RWMesh_VertexIterator::RWMesh_VertexIterator(const TopoDS_Shape& theShape, + const XCAFPrs_Style& theStyle) + : RWMesh_ShapeIterator(theShape, TopAbs_VERTEX, theStyle) { Next(); } @@ -51,8 +51,8 @@ void RWMesh_VertexIterator::Next() { for (; myIter.More(); myIter.Next()) { - myVertex = TopoDS::Vertex (myIter.Current()); - myPoint = BRep_Tool::Pnt (myVertex); + myVertex = TopoDS::Vertex(myIter.Current()); + myPoint = BRep_Tool::Pnt(myVertex); myTrsf = myLocation.Transformation(); if (myVertex.IsNull()) { diff --git a/src/RWMesh/RWMesh_VertexIterator.hxx b/src/RWMesh/RWMesh_VertexIterator.hxx index 32134389d7..c57945a300 100644 --- a/src/RWMesh/RWMesh_VertexIterator.hxx +++ b/src/RWMesh/RWMesh_VertexIterator.hxx @@ -14,14 +14,14 @@ #ifndef _RWMesh_VertexIterator_HeaderFile #define _RWMesh_VertexIterator_HeaderFile -#include #include #include +#include #include -#include #include +#include #include -#include +#include #include @@ -34,22 +34,21 @@ class TDF_Label; class RWMesh_VertexIterator : public RWMesh_ShapeIterator { public: - //! Main constructor. //! @param[in] theLabel The label of the shape. //! @param[in] theLocation The location of the shape. //! @param[in] theToMapColors Flag to indicate if colors should be mapped. //! @param[in] theStyle The style of the shape. - Standard_EXPORT RWMesh_VertexIterator (const TDF_Label& theLabel, - const TopLoc_Location& theLocation, - const Standard_Boolean theToMapColors = false, - const XCAFPrs_Style& theStyle = XCAFPrs_Style()); + Standard_EXPORT RWMesh_VertexIterator(const TDF_Label& theLabel, + const TopLoc_Location& theLocation, + const Standard_Boolean theToMapColors = false, + const XCAFPrs_Style& theStyle = XCAFPrs_Style()); //! Auxiliary constructor. //! @param[in] theShape The shape to iterate. //! @param[in] theStyle The style of the shape. - Standard_EXPORT RWMesh_VertexIterator (const TopoDS_Shape& theShape, - const XCAFPrs_Style& theStyle = XCAFPrs_Style()); + Standard_EXPORT RWMesh_VertexIterator(const TopoDS_Shape& theShape, + const XCAFPrs_Style& theStyle = XCAFPrs_Style()); //! Return true if iterator points to the valid triangulation. bool More() const Standard_OVERRIDE { return !myVertex.IsNull(); } @@ -67,13 +66,9 @@ public: const gp_Pnt& Point() const { return myPoint; } //! Return true if geometry data is defined. - bool IsEmpty() const Standard_OVERRIDE - { - return myVertex.IsNull(); - } + bool IsEmpty() const Standard_OVERRIDE { return myVertex.IsNull(); } public: - //! Lower element index in current triangulation. Standard_Integer ElemLower() const Standard_OVERRIDE { return 1; } @@ -81,7 +76,6 @@ public: Standard_Integer ElemUpper() const Standard_OVERRIDE { return 1; } public: - //! Return number of nodes for the current edge. Standard_Integer NbNodes() const Standard_OVERRIDE { return 1; } @@ -92,12 +86,10 @@ public: Standard_Integer NodeUpper() const Standard_OVERRIDE { return 1; } public: - //! Return the node with specified index with applied transformation. - gp_Pnt node (const Standard_Integer /*theNode*/) const Standard_OVERRIDE { return myPoint; } + gp_Pnt node(const Standard_Integer /*theNode*/) const Standard_OVERRIDE { return myPoint; } private: - //! Reset information for current vertex. void resetVertex() { @@ -109,10 +101,8 @@ private: void initVertex(); private: - - TopoDS_Vertex myVertex; //!< current vertex - gp_Pnt myPoint; //!< geometry of current vertex - + TopoDS_Vertex myVertex; //!< current vertex + gp_Pnt myPoint; //!< geometry of current vertex }; #endif // _RWMesh_VertexIterator_HeaderFile