Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-12-01 10:17:15

0001 // Created on: 1998-08-12
0002 // Created by: DATA EXCHANGE TEAM
0003 // Copyright (c) 1998-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _ShapeFix_Shape_HeaderFile
0018 #define _ShapeFix_Shape_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TopoDS_Shape.hxx>
0024 #include <TopTools_ShapeMapHasher.hxx>
0025 #include <NCollection_Map.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <ShapeFix_Root.hxx>
0028 #include <ShapeExtend_Status.hxx>
0029 #include <Message_ProgressRange.hxx>
0030 
0031 class ShapeFix_Solid;
0032 class ShapeFix_Shell;
0033 class ShapeFix_Face;
0034 class ShapeFix_Wire;
0035 class ShapeFix_Edge;
0036 class ShapeExtend_BasicMsgRegistrator;
0037 
0038 // resolve name collisions with X11 headers
0039 #ifdef Status
0040   #undef Status
0041 #endif
0042 
0043 //! Fixing shape in general
0044 class ShapeFix_Shape : public ShapeFix_Root
0045 {
0046 
0047 public:
0048   //! Empty Constructor
0049   Standard_EXPORT ShapeFix_Shape();
0050 
0051   //! Initislises by shape.
0052   Standard_EXPORT ShapeFix_Shape(const TopoDS_Shape& shape);
0053 
0054   //! Initislises by shape.
0055   Standard_EXPORT void Init(const TopoDS_Shape& shape);
0056 
0057   //! Iterates on sub- shape and performs fixes
0058   Standard_EXPORT bool Perform(const Message_ProgressRange& theProgress = Message_ProgressRange());
0059 
0060   //! Returns resulting shape
0061   Standard_EXPORT TopoDS_Shape Shape() const;
0062 
0063   //! Returns tool for fixing solids.
0064   occ::handle<ShapeFix_Solid> FixSolidTool() const;
0065 
0066   //! Returns tool for fixing shells.
0067   occ::handle<ShapeFix_Shell> FixShellTool() const;
0068 
0069   //! Returns tool for fixing faces.
0070   occ::handle<ShapeFix_Face> FixFaceTool() const;
0071 
0072   //! Returns tool for fixing wires.
0073   occ::handle<ShapeFix_Wire> FixWireTool() const;
0074 
0075   //! Returns tool for fixing edges.
0076   occ::handle<ShapeFix_Edge> FixEdgeTool() const;
0077 
0078   //! Returns the status of the last Fix.
0079   //! This can be a combination of the following flags:
0080   //! ShapeExtend_DONE1: some free edges were fixed
0081   //! ShapeExtend_DONE2: some free wires were fixed
0082   //! ShapeExtend_DONE3: some free faces were fixed
0083   //! ShapeExtend_DONE4: some free shells were fixed
0084   //! ShapeExtend_DONE5: some free solids were fixed
0085   //! ShapeExtend_DONE6: shapes in compound(s) were fixed
0086   Standard_EXPORT bool Status(const ShapeExtend_Status status) const;
0087 
0088   //! Sets message registrator
0089   Standard_EXPORT void SetMsgRegistrator(
0090     const occ::handle<ShapeExtend_BasicMsgRegistrator>& msgreg) override;
0091 
0092   //! Sets basic precision value (also to FixSolidTool)
0093   Standard_EXPORT void SetPrecision(const double preci) override;
0094 
0095   //! Sets minimal allowed tolerance (also to FixSolidTool)
0096   Standard_EXPORT void SetMinTolerance(const double mintol) override;
0097 
0098   //! Sets maximal allowed tolerance (also to FixSolidTool)
0099   Standard_EXPORT void SetMaxTolerance(const double maxtol) override;
0100 
0101   //! Returns (modifiable) the mode for applying fixes of
0102   //! ShapeFix_Solid, by default True.
0103   int& FixSolidMode();
0104 
0105   //! Returns (modifiable) the mode for applying fixes of
0106   //! ShapeFix_Shell, by default True.
0107   int& FixFreeShellMode();
0108 
0109   //! Returns (modifiable) the mode for applying fixes of
0110   //! ShapeFix_Face, by default True.
0111   int& FixFreeFaceMode();
0112 
0113   //! Returns (modifiable) the mode for applying fixes of
0114   //! ShapeFix_Wire, by default True.
0115   int& FixFreeWireMode();
0116 
0117   //! Returns (modifiable) the mode for applying
0118   //! ShapeFix::SameParameter after all fixes, by default True.
0119   int& FixSameParameterMode();
0120 
0121   //! Returns (modifiable) the mode for applying
0122   //! ShapeFix::FixVertexPosition before all fixes, by default False.
0123   int& FixVertexPositionMode();
0124 
0125   //! Returns (modifiable) the mode for fixing tolerances of vertices on whole shape
0126   //! after performing all fixes
0127   int& FixVertexTolMode();
0128 
0129   DEFINE_STANDARD_RTTIEXT(ShapeFix_Shape, ShapeFix_Root)
0130 
0131 protected:
0132   //! Fixes same parameterization problem on the passed shape
0133   //! by updating tolerances of the corresponding topological
0134   //! entities.
0135   Standard_EXPORT void SameParameter(
0136     const TopoDS_Shape&          shape,
0137     const bool                   enforce,
0138     const Message_ProgressRange& theProgress = Message_ProgressRange());
0139 
0140   TopoDS_Shape                                           myResult;
0141   occ::handle<ShapeFix_Solid>                            myFixSolid;
0142   NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> myMapFixingShape;
0143   int                                                    myFixSolidMode;
0144   int                                                    myFixShellMode;
0145   int                                                    myFixFaceMode;
0146   int                                                    myFixWireMode;
0147   int                                                    myFixSameParameterMode;
0148   int                                                    myFixVertexPositionMode;
0149   int                                                    myFixVertexTolMode;
0150   int                                                    myStatus;
0151 };
0152 
0153 #include <ShapeFix_Shape.lxx>
0154 
0155 #endif // _ShapeFix_Shape_HeaderFile