From f7cba33d14895ec5bfdb7cd4515f0a23294dfc81 Mon Sep 17 00:00:00 2001 From: kovacsv Date: Sun, 16 Jul 2023 08:13:40 +0200 Subject: [PATCH] Replace tabs with spaces. --- occt-import-js/src/importer-brep.cpp | 228 +++++++++++++------------- occt-import-js/src/importer-brep.hpp | 8 +- occt-import-js/src/importer-utils.hpp | 22 +-- 3 files changed, 129 insertions(+), 129 deletions(-) diff --git a/occt-import-js/src/importer-brep.cpp b/occt-import-js/src/importer-brep.cpp index 538f2fc..b7c4158 100644 --- a/occt-import-js/src/importer-brep.cpp +++ b/occt-import-js/src/importer-brep.cpp @@ -10,149 +10,149 @@ class BrepShapeMesh : public Mesh { public: - BrepShapeMesh (const TopoDS_Shape& shape) : - Mesh (), - shape (shape) - { - - } - - virtual std::string GetName () const override - { - return std::string (); - } - - virtual bool GetColor (Color&) const override - { - return false; - } - - virtual void EnumerateFaces (const std::function& onFace) const override - { - for (TopExp_Explorer ex (shape, TopAbs_FACE); ex.More (); ex.Next ()) { - const TopoDS_Face& face = TopoDS::Face (ex.Current ()); - OcctFace outputFace (face); - onFace (outputFace); - } - } + BrepShapeMesh (const TopoDS_Shape& shape) : + Mesh (), + shape (shape) + { + + } + + virtual std::string GetName () const override + { + return std::string (); + } + + virtual bool GetColor (Color&) const override + { + return false; + } + + virtual void EnumerateFaces (const std::function& onFace) const override + { + for (TopExp_Explorer ex (shape, TopAbs_FACE); ex.More (); ex.Next ()) { + const TopoDS_Face& face = TopoDS::Face (ex.Current ()); + OcctFace outputFace (face); + onFace (outputFace); + } + } private: - const TopoDS_Shape& shape; + const TopoDS_Shape& shape; }; class BrepStandaloneFacesMesh : public Mesh { public: - BrepStandaloneFacesMesh (const TopoDS_Shape& shape) : - Mesh (), - shape (shape) - { - - } - - bool HasFaces () const - { - TopExp_Explorer ex (shape, TopAbs_FACE, TopAbs_SHELL); - return ex.More (); - } - - virtual std::string GetName () const override - { - return std::string (); - } - - virtual bool GetColor (Color&) const override - { - return false; - } - - virtual void EnumerateFaces (const std::function& onFace) const override - { - for (TopExp_Explorer ex (shape, TopAbs_FACE, TopAbs_SHELL); ex.More (); ex.Next ()) { - const TopoDS_Face& face = TopoDS::Face (ex.Current ()); - OcctFace outputFace (face); - onFace (outputFace); - } - } + BrepStandaloneFacesMesh (const TopoDS_Shape& shape) : + Mesh (), + shape (shape) + { + + } + + bool HasFaces () const + { + TopExp_Explorer ex (shape, TopAbs_FACE, TopAbs_SHELL); + return ex.More (); + } + + virtual std::string GetName () const override + { + return std::string (); + } + + virtual bool GetColor (Color&) const override + { + return false; + } + + virtual void EnumerateFaces (const std::function& onFace) const override + { + for (TopExp_Explorer ex (shape, TopAbs_FACE, TopAbs_SHELL); ex.More (); ex.Next ()) { + const TopoDS_Face& face = TopoDS::Face (ex.Current ()); + OcctFace outputFace (face); + onFace (outputFace); + } + } private: - const TopoDS_Shape& shape; + const TopoDS_Shape& shape; }; class BrepNode : public Node { public: - BrepNode (const TopoDS_Shape& shape) : - shape (shape) - { - - } - - virtual std::string GetName () const override - { - return std::string (); - } - - virtual std::vector GetChildren () const override - { - return {}; - } - - virtual bool IsMeshNode () const override - { - return true; - } - - virtual void EnumerateMeshes (const std::function& onMesh) const override - { - // Enumerate solids - for (TopExp_Explorer ex (shape, TopAbs_SOLID); ex.More (); ex.Next ()) { - const TopoDS_Shape& currentShape = ex.Current (); - BrepShapeMesh outputShapeMesh (currentShape); - onMesh (outputShapeMesh); - } - - // Enumerate shells that are not part of a solid - for (TopExp_Explorer ex (shape, TopAbs_SHELL, TopAbs_SOLID); ex.More (); ex.Next ()) { - const TopoDS_Shape& currentShape = ex.Current (); - BrepShapeMesh outputShapeMesh (currentShape); - onMesh (outputShapeMesh); - } - - // Create a mesh from faces that are not part of a shell - BrepStandaloneFacesMesh standaloneFacesMesh (shape); - if (standaloneFacesMesh.HasFaces ()) { - onMesh (standaloneFacesMesh); - } - } + BrepNode (const TopoDS_Shape& shape) : + shape (shape) + { + + } + + virtual std::string GetName () const override + { + return std::string (); + } + + virtual std::vector GetChildren () const override + { + return {}; + } + + virtual bool IsMeshNode () const override + { + return true; + } + + virtual void EnumerateMeshes (const std::function& onMesh) const override + { + // Enumerate solids + for (TopExp_Explorer ex (shape, TopAbs_SOLID); ex.More (); ex.Next ()) { + const TopoDS_Shape& currentShape = ex.Current (); + BrepShapeMesh outputShapeMesh (currentShape); + onMesh (outputShapeMesh); + } + + // Enumerate shells that are not part of a solid + for (TopExp_Explorer ex (shape, TopAbs_SHELL, TopAbs_SOLID); ex.More (); ex.Next ()) { + const TopoDS_Shape& currentShape = ex.Current (); + BrepShapeMesh outputShapeMesh (currentShape); + onMesh (outputShapeMesh); + } + + // Create a mesh from faces that are not part of a shell + BrepStandaloneFacesMesh standaloneFacesMesh (shape); + if (standaloneFacesMesh.HasFaces ()) { + onMesh (standaloneFacesMesh); + } + } private: - const TopoDS_Shape& shape; + const TopoDS_Shape& shape; }; ImporterBrep::ImporterBrep () : - Importer (), - shape () + Importer (), + shape () { } Importer::Result ImporterBrep::LoadFile (const std::vector& fileContent, const ImportParams& params) { - VectorBuffer inputBuffer (fileContent); - std::istream inputStream (&inputBuffer); + VectorBuffer inputBuffer (fileContent); + std::istream inputStream (&inputBuffer); - BRep_Builder builder; - BRepTools::Read (shape, inputStream, builder); - if (shape.IsNull ()) { - return Importer::Result::ImportFailed; - } + BRep_Builder builder; + BRepTools::Read (shape, inputStream, builder); + if (shape.IsNull ()) { + return Importer::Result::ImportFailed; + } - TriangulateShape (shape, params); - return Importer::Result::Success; + TriangulateShape (shape, params); + return Importer::Result::Success; } NodePtr ImporterBrep::GetRootNode () const { - return std::make_shared (shape); + return std::make_shared (shape); } diff --git a/occt-import-js/src/importer-brep.hpp b/occt-import-js/src/importer-brep.hpp index 82d5edd..56f2472 100644 --- a/occt-import-js/src/importer-brep.hpp +++ b/occt-import-js/src/importer-brep.hpp @@ -7,11 +7,11 @@ class ImporterBrep : public Importer { public: - ImporterBrep (); + ImporterBrep (); - virtual Result LoadFile (const std::vector& fileContent, const ImportParams& params) override; - virtual NodePtr GetRootNode () const override; + virtual Result LoadFile (const std::vector& fileContent, const ImportParams& params) override; + virtual NodePtr GetRootNode () const override; private: - TopoDS_Shape shape; + TopoDS_Shape shape; }; diff --git a/occt-import-js/src/importer-utils.hpp b/occt-import-js/src/importer-utils.hpp index 2ac5773..4b5df5b 100644 --- a/occt-import-js/src/importer-utils.hpp +++ b/occt-import-js/src/importer-utils.hpp @@ -13,27 +13,27 @@ class VectorBuffer : public std::streambuf { public: - VectorBuffer (const std::vector& v); + VectorBuffer (const std::vector& v); }; class OcctFace : public Face { public: - OcctFace (const TopoDS_Face& face); + OcctFace (const TopoDS_Face& face); - virtual bool HasNormals () const override; - virtual bool GetColor (Color& color) const override; + virtual bool HasNormals () const override; + virtual bool GetColor (Color& color) const override; - virtual void EnumerateVertices (const std::function& onVertex) const override; - virtual void EnumerateNormals (const std::function& onNormal) const override; - virtual void EnumerateTriangles (const std::function& onTriangle) const override; + virtual void EnumerateVertices (const std::function& onVertex) const override; + virtual void EnumerateNormals (const std::function& onNormal) const override; + virtual void EnumerateTriangles (const std::function& onTriangle) const override; protected: - bool HasTriangulation () const; + bool HasTriangulation () const; - const TopoDS_Face& face; - Handle (Poly_Triangulation) triangulation; - TopLoc_Location location; + const TopoDS_Face& face; + Handle (Poly_Triangulation) triangulation; + TopLoc_Location location; }; bool TriangulateShape (TopoDS_Shape& shape, const ImportParams& params);