|
||||
File indexing completed on 2025-01-18 10:04:56
0001 // Created on: 1998-06-03 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_Face_HeaderFile 0018 #define _ShapeFix_Face_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_Type.hxx> 0022 0023 #include <TopoDS_Face.hxx> 0024 #include <TopoDS_Shape.hxx> 0025 #include <Standard_Integer.hxx> 0026 #include <ShapeFix_Root.hxx> 0027 #include <TopTools_DataMapOfShapeListOfShape.hxx> 0028 #include <TopTools_SequenceOfShape.hxx> 0029 #include <ShapeFix_DataMapOfShapeBox2d.hxx> 0030 #include <ShapeExtend_Status.hxx> 0031 class ShapeAnalysis_Surface; 0032 class ShapeFix_Wire; 0033 class Geom_Surface; 0034 class ShapeExtend_BasicMsgRegistrator; 0035 class TopoDS_Wire; 0036 class ShapeExtend_WireData; 0037 class TopoDS_Vertex; 0038 0039 // resolve name collisions with X11 headers 0040 #ifdef Status 0041 #undef Status 0042 #endif 0043 0044 class ShapeFix_Face; 0045 DEFINE_STANDARD_HANDLE(ShapeFix_Face, ShapeFix_Root) 0046 0047 //! This operator allows to perform various fixes on face 0048 //! and its wires: fixes provided by ShapeFix_Wire, 0049 //! fixing orientation of wires, addition of natural bounds, 0050 //! fixing of missing seam edge, 0051 //! and detection and removal of null-area wires 0052 class ShapeFix_Face : public ShapeFix_Root 0053 { 0054 0055 public: 0056 0057 0058 //! Creates an empty tool 0059 Standard_EXPORT ShapeFix_Face(); 0060 0061 //! Creates a tool and loads a face 0062 Standard_EXPORT ShapeFix_Face(const TopoDS_Face& face); 0063 0064 //! Sets all modes to default 0065 Standard_EXPORT virtual void ClearModes(); 0066 0067 //! Loads a whole face already created, with its wires, sense and 0068 //! location 0069 Standard_EXPORT void Init (const TopoDS_Face& face); 0070 0071 //! Starts the creation of the face 0072 //! By default it will be FORWARD, or REVERSED if <fwd> is False 0073 Standard_EXPORT void Init (const Handle(Geom_Surface)& surf, const Standard_Real preci, const Standard_Boolean fwd = Standard_True); 0074 0075 //! Starts the creation of the face 0076 //! By default it will be FORWARD, or REVERSED if <fwd> is False 0077 Standard_EXPORT void Init (const Handle(ShapeAnalysis_Surface)& surf, const Standard_Real preci, const Standard_Boolean fwd = Standard_True); 0078 0079 //! Sets message registrator 0080 Standard_EXPORT virtual void SetMsgRegistrator (const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg) Standard_OVERRIDE; 0081 0082 //! Sets basic precision value (also to FixWireTool) 0083 Standard_EXPORT virtual void SetPrecision (const Standard_Real preci) Standard_OVERRIDE; 0084 0085 //! Sets minimal allowed tolerance (also to FixWireTool) 0086 Standard_EXPORT virtual void SetMinTolerance (const Standard_Real mintol) Standard_OVERRIDE; 0087 0088 //! Sets maximal allowed tolerance (also to FixWireTool) 0089 Standard_EXPORT virtual void SetMaxTolerance (const Standard_Real maxtol) Standard_OVERRIDE; 0090 0091 //! Returns (modifiable) the mode for applying fixes of 0092 //! ShapeFix_Wire, by default True. 0093 Standard_Integer& FixWireMode(); 0094 0095 //! Returns (modifiable) the fix orientation mode, by default 0096 //! True. If True, wires oriented to border limited square. 0097 Standard_Integer& FixOrientationMode(); 0098 0099 //! Returns (modifiable) the add natural bound mode. 0100 //! If true, natural boundary is added on faces that miss them. 0101 //! Default is False for faces with single wire (they are 0102 //! handled by FixOrientation in that case) and True for others. 0103 Standard_Integer& FixAddNaturalBoundMode(); 0104 0105 //! Returns (modifiable) the fix missing seam mode, by default 0106 //! True. If True, tries to insert seam is missed. 0107 Standard_Integer& FixMissingSeamMode(); 0108 0109 //! Returns (modifiable) the fix small area wire mode, by default 0110 //! False. If True, drops small wires. 0111 Standard_Integer& FixSmallAreaWireMode(); 0112 0113 //! Returns (modifiable) the remove face with small area, by default 0114 //! False. If True, drops faces with small outer wires. 0115 Standard_Integer& RemoveSmallAreaFaceMode(); 0116 0117 //! Returns (modifiable) the fix intersecting wires mode 0118 //! by default True. 0119 Standard_Integer& FixIntersectingWiresMode(); 0120 0121 //! Returns (modifiable) the fix loop wires mode 0122 //! by default True. 0123 Standard_Integer& FixLoopWiresMode(); 0124 0125 //! Returns (modifiable) the fix split face mode 0126 //! by default True. 0127 Standard_Integer& FixSplitFaceMode(); 0128 0129 //! Returns (modifiable) the auto-correct precision mode 0130 //! by default False. 0131 Standard_Integer& AutoCorrectPrecisionMode(); 0132 0133 //! Returns (modifiable) the activation flag for periodic 0134 //! degenerated fix. False by default. 0135 Standard_Integer& FixPeriodicDegeneratedMode(); 0136 0137 //! Returns a face which corresponds to the current state 0138 //! Warning: The finally produced face may be another one ... but with the 0139 //! same support 0140 TopoDS_Face Face() const; 0141 0142 //! Returns resulting shape (Face or Shell if split) 0143 //! To be used instead of Face() if FixMissingSeam involved 0144 TopoDS_Shape Result() const; 0145 0146 //! Add a wire to current face using BRep_Builder. 0147 //! Wire is added without taking into account orientation of face 0148 //! (as if face were FORWARD). 0149 Standard_EXPORT void Add (const TopoDS_Wire& wire); 0150 0151 //! Performs all the fixes, depending on modes 0152 //! Function Status returns the status of last call to Perform() 0153 //! ShapeExtend_OK : face was OK, nothing done 0154 //! ShapeExtend_DONE1: some wires are fixed 0155 //! ShapeExtend_DONE2: orientation of wires fixed 0156 //! ShapeExtend_DONE3: missing seam added 0157 //! ShapeExtend_DONE4: small area wire removed 0158 //! ShapeExtend_DONE5: natural bounds added 0159 //! ShapeExtend_FAIL1: some fails during fixing wires 0160 //! ShapeExtend_FAIL2: cannot fix orientation of wires 0161 //! ShapeExtend_FAIL3: cannot add missing seam 0162 //! ShapeExtend_FAIL4: cannot remove small area wire 0163 Standard_EXPORT Standard_Boolean Perform(); 0164 0165 //! Fixes orientation of wires on the face 0166 //! It tries to make all wires lie outside all others (according 0167 //! to orientation) by reversing orientation of some of them. 0168 //! If face lying on sphere or torus has single wire and 0169 //! AddNaturalBoundMode is True, that wire is not reversed in 0170 //! any case (supposing that natural bound will be added). 0171 //! Returns True if wires were reversed 0172 Standard_EXPORT Standard_Boolean FixOrientation(); 0173 0174 //! Fixes orientation of wires on the face 0175 //! It tries to make all wires lie outside all others (according 0176 //! to orientation) by reversing orientation of some of them. 0177 //! If face lying on sphere or torus has single wire and 0178 //! AddNaturalBoundMode is True, that wire is not reversed in 0179 //! any case (supposing that natural bound will be added). 0180 //! Returns True if wires were reversed 0181 //! OutWires return information about out wires + list of 0182 //! internal wires for each (for performing split face). 0183 Standard_EXPORT Standard_Boolean FixOrientation (TopTools_DataMapOfShapeListOfShape& MapWires); 0184 0185 //! Adds natural boundary on face if it is missing. 0186 //! Two cases are supported: 0187 //! - face has no wires 0188 //! - face lies on geometrically double-closed surface 0189 //! (sphere or torus) and none of wires is left-oriented 0190 //! Returns True if natural boundary was added 0191 Standard_EXPORT Standard_Boolean FixAddNaturalBound(); 0192 0193 //! Detects and fixes the special case when face on a closed 0194 //! surface is given by two wires closed in 3d but with gap in 2d. 0195 //! In that case it creates a new wire from the two, and adds a 0196 //! missing seam edge 0197 //! Returns True if missing seam was added 0198 Standard_EXPORT Standard_Boolean FixMissingSeam(); 0199 0200 //! Detects wires with small area (that is less than 0201 //! 100*Precision::PConfusion(). Removes these wires if they are internal. 0202 //! Returns : True if at least one small wire removed, 0203 //! False if does nothing. 0204 Standard_EXPORT Standard_Boolean FixSmallAreaWire (const Standard_Boolean theIsRemoveSmallFace); 0205 0206 //! Detects if wire has a loop and fixes this situation by splitting on the few parts. 0207 //! if wire has a loops and it was split Status was set to value ShapeExtend_DONE6. 0208 Standard_EXPORT Standard_Boolean FixLoopWire (TopTools_SequenceOfShape& aResWires); 0209 0210 //! Detects and fixes the special case when face has more than one wire 0211 //! and this wires have intersection point 0212 Standard_EXPORT Standard_Boolean FixIntersectingWires(); 0213 0214 //! If wire contains two coincidence edges it must be removed 0215 //! Queries on status after Perform() 0216 Standard_EXPORT Standard_Boolean FixWiresTwoCoincEdges(); 0217 0218 //! Split face if there are more than one out wire 0219 //! using inrormation after FixOrientation() 0220 Standard_EXPORT Standard_Boolean FixSplitFace (const TopTools_DataMapOfShapeListOfShape& MapWires); 0221 0222 //! Fixes topology for a specific case when face is composed 0223 //! by a single wire belting a periodic surface. In that case 0224 //! a degenerated edge is reconstructed in the degenerated pole 0225 //! of the surface. Initial wire gets consistent orientation. 0226 //! Must be used in couple and before FixMissingSeam routine 0227 Standard_EXPORT Standard_Boolean FixPeriodicDegenerated(); 0228 0229 //! Returns the status of last call to Perform() 0230 //! ShapeExtend_OK : face was OK, nothing done 0231 //! ShapeExtend_DONE1: some wires are fixed 0232 //! ShapeExtend_DONE2: orientation of wires fixed 0233 //! ShapeExtend_DONE3: missing seam added 0234 //! ShapeExtend_DONE4: small area wire removed 0235 //! ShapeExtend_DONE5: natural bounds added 0236 //! ShapeExtend_DONE8: face may be splited 0237 //! ShapeExtend_FAIL1: some fails during fixing wires 0238 //! ShapeExtend_FAIL2: cannot fix orientation of wires 0239 //! ShapeExtend_FAIL3: cannot add missing seam 0240 //! ShapeExtend_FAIL4: cannot remove small area wire 0241 Standard_Boolean Status (const ShapeExtend_Status status) const; 0242 0243 //! Returns tool for fixing wires. 0244 Handle(ShapeFix_Wire) FixWireTool(); 0245 0246 0247 0248 0249 DEFINE_STANDARD_RTTIEXT(ShapeFix_Face,ShapeFix_Root) 0250 0251 protected: 0252 0253 0254 Handle(ShapeAnalysis_Surface) mySurf; 0255 TopoDS_Face myFace; 0256 TopoDS_Shape myResult; 0257 Handle(ShapeFix_Wire) myFixWire; 0258 Standard_Boolean myFwd; 0259 Standard_Integer myStatus; 0260 0261 0262 private: 0263 0264 //! Returns True if the face needs to add natural bound and corresponded option of shape healing is ON 0265 Standard_Boolean isNeedAddNaturalBound(const TopTools_SequenceOfShape& theOrientedWires); 0266 0267 Standard_EXPORT Standard_Boolean SplitEdge (const Handle(ShapeExtend_WireData)& sewd, const Standard_Integer num, const Standard_Real param, const TopoDS_Vertex& vert, const Standard_Real preci, ShapeFix_DataMapOfShapeBox2d& boxes); 0268 0269 Standard_EXPORT Standard_Boolean SplitEdge (const Handle(ShapeExtend_WireData)& sewd, const Standard_Integer num, const Standard_Real param1, const Standard_Real param2, const TopoDS_Vertex& vert, const Standard_Real preci, ShapeFix_DataMapOfShapeBox2d& boxes); 0270 0271 Standard_Integer myFixWireMode; 0272 Standard_Integer myFixOrientationMode; 0273 Standard_Integer myFixAddNaturalBoundMode; 0274 Standard_Integer myFixMissingSeamMode; 0275 Standard_Integer myFixSmallAreaWireMode; 0276 Standard_Integer myRemoveSmallAreaFaceMode; 0277 Standard_Integer myFixLoopWiresMode; 0278 Standard_Integer myFixIntersectingWiresMode; 0279 Standard_Integer myFixSplitFaceMode; 0280 Standard_Integer myAutoCorrectPrecisionMode; 0281 Standard_Integer myFixPeriodicDegenerated; 0282 0283 0284 }; 0285 0286 0287 #include <ShapeFix_Face.lxx> 0288 0289 0290 0291 0292 0293 #endif // _ShapeFix_Face_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |