0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / ShapeFix / ShapeFix_Shell.hxx
1 // Created on: 1998-08-12
2 // Created by: Galina KULIKOVA
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _ShapeFix_Shell_HeaderFile
18 #define _ShapeFix_Shell_HeaderFile
19
20 #include <Standard.hxx>
21
22 #include <Message_ProgressIndicator.hxx>
23 #include <TopoDS_Shell.hxx>
24 #include <TopoDS_Compound.hxx>
25 #include <ShapeFix_Root.hxx>
26 #include <ShapeExtend_Status.hxx>
27
28 class ShapeFix_Face;
29 class ShapeExtend_BasicMsgRegistrator;
30
31 // resolve name collisions with X11 headers
32 #ifdef Status
33   #undef Status
34 #endif
35
36 class ShapeFix_Shell;
37 DEFINE_STANDARD_HANDLE(ShapeFix_Shell, ShapeFix_Root)
38
39 //! Fixing orientation of faces in shell
40 class ShapeFix_Shell : public ShapeFix_Root
41 {
42
43 public:
44
45   
46   //! Empty constructor
47   Standard_EXPORT ShapeFix_Shell();
48   
49   //! Initializes by shell.
50   Standard_EXPORT ShapeFix_Shell(const TopoDS_Shell& shape);
51   
52   //! Initializes by shell.
53   Standard_EXPORT void Init (const TopoDS_Shell& shell);
54   
55   //! Iterates on subshapes and performs fixes
56   //! (for each face calls ShapeFix_Face::Perform and
57   //! then calls FixFaceOrientation). The passed progress
58   //! indicator allows user to consult the current progress
59   //! stage and abort algorithm if needed.
60   Standard_EXPORT Standard_Boolean Perform (const Handle(Message_ProgressIndicator)& theProgress = 0);
61   
62   //! Fixes orientation of faces in shell.
63   //! Changes orientation of face in the shell, if it is oriented opposite
64   //! to neigbouring faces. If it is not possible to orient all faces in the
65   //! shell (like in case of mebious band), this method orients only subset
66   //! of faces. Other faces are stored in Error compound.
67   //! Modes :
68   //! isAccountMultiConex - mode for account cases of multiconnexity.
69   //! If this mode is equal to Standard_True, separate shells will be created
70   //! in the cases of multiconnexity. If this mode is equal to Standard_False,
71   //! one shell will be created without account of multiconnexity.By defautt - Standard_True;
72   //! NonManifold - mode for creation of non-manifold shells.
73   //! If this mode is equal to Standard_True one non-manifold will be created from shell
74   //! contains multishared edges. Else if this mode is equal to Standard_False only
75   //! manifold shells will be created. By default - Standard_False.
76   Standard_EXPORT Standard_Boolean FixFaceOrientation (
77       const TopoDS_Shell& shell,
78       const Standard_Boolean isAccountMultiConex = Standard_True,
79       const Standard_Boolean NonManifold = Standard_False);
80   
81   //! Returns fixed shell (or subset of oriented faces).
82   Standard_EXPORT TopoDS_Shell Shell();
83   
84   //! In case of multiconnexity returns compound of fixed shells
85   //! else returns one shell..
86   Standard_EXPORT TopoDS_Shape Shape();
87   
88   //! Returns Number of obtainrd shells;
89   Standard_EXPORT Standard_Integer NbShells() const;
90   
91   //! Returns not oriented subset of faces.
92   Standard_EXPORT TopoDS_Compound ErrorFaces() const;
93   
94   //! Returns the status of the last Fix.
95   Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
96   
97   //! Returns tool for fixing faces.
98     Handle(ShapeFix_Face) FixFaceTool();
99   
100   //! Sets message registrator
101   Standard_EXPORT virtual void SetMsgRegistrator (const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg) Standard_OVERRIDE;
102   
103   //! Sets basic precision value (also to FixWireTool)
104   Standard_EXPORT virtual void SetPrecision (const Standard_Real preci) Standard_OVERRIDE;
105   
106   //! Sets minimal allowed tolerance (also to FixWireTool)
107   Standard_EXPORT virtual void SetMinTolerance (const Standard_Real mintol) Standard_OVERRIDE;
108   
109   //! Sets maximal allowed tolerance (also to FixWireTool)
110   Standard_EXPORT virtual void SetMaxTolerance (const Standard_Real maxtol) Standard_OVERRIDE;
111   
112   //! Returns (modifiable) the mode for applying fixes of
113   //! ShapeFix_Face, by default True.
114     Standard_Integer& FixFaceMode();
115   
116   //! Returns (modifiable) the mode for applying
117   //! FixFaceOrientation, by default True.
118     Standard_Integer& FixOrientationMode();
119
120   //! Sets NonManifold flag
121   Standard_EXPORT virtual void SetNonManifoldFlag(const Standard_Boolean isNonManifold);
122
123
124   DEFINE_STANDARD_RTTIEXT(ShapeFix_Shell,ShapeFix_Root)
125
126 protected:
127
128
129   TopoDS_Shell myShell;
130   TopoDS_Compound myErrFaces;
131   Standard_Integer myStatus;
132   Handle(ShapeFix_Face) myFixFace;
133   Standard_Integer myFixFaceMode;
134   Standard_Integer myFixOrientationMode;
135   Standard_Integer myNbShells;
136   Standard_Boolean myNonManifold;
137
138 private:
139
140
141
142
143 };
144
145
146 #include <ShapeFix_Shell.lxx>
147
148
149
150
151
152 #endif // _ShapeFix_Shell_HeaderFile