|
|
|||
File indexing completed on 2026-05-18 08:30:27
0001 // Created on: 1998-06-17 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_Edge_HeaderFile 0018 #define _ShapeFix_Edge_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_Type.hxx> 0022 0023 #include <Standard_Integer.hxx> 0024 #include <Standard_Transient.hxx> 0025 #include <ShapeExtend_Status.hxx> 0026 class ShapeConstruct_ProjectCurveOnSurface; 0027 class TopoDS_Edge; 0028 class TopoDS_Face; 0029 class Geom_Surface; 0030 class TopLoc_Location; 0031 class ShapeAnalysis_Surface; 0032 class ShapeBuild_ReShape; 0033 0034 // resolve name collisions with X11 headers 0035 #ifdef Status 0036 #undef Status 0037 #endif 0038 0039 class ShapeFix_Edge; 0040 DEFINE_STANDARD_HANDLE(ShapeFix_Edge, Standard_Transient) 0041 0042 //! Fixing invalid edge. 0043 //! Geometrical and/or topological inconsistency: 0044 //! - no 3d curve or pcurve, 0045 //! - mismatching orientation of 3d curve and pcurve, 0046 //! - incorrect SameParameter flag (curve deviation is greater than 0047 //! edge tolerance), 0048 //! - not adjacent curves (3d or pcurve) to the vertices. 0049 class ShapeFix_Edge : public Standard_Transient 0050 { 0051 0052 public: 0053 //! Empty constructor 0054 Standard_EXPORT ShapeFix_Edge(); 0055 0056 //! Returns the projector used for recomputing missing pcurves 0057 //! Can be used for adjusting parameters of projector 0058 Standard_EXPORT Handle(ShapeConstruct_ProjectCurveOnSurface) Projector(); 0059 0060 Standard_EXPORT Standard_Boolean FixRemovePCurve(const TopoDS_Edge& edge, 0061 const TopoDS_Face& face); 0062 0063 //! Removes the pcurve(s) of the edge if it does not match the 0064 //! vertices 0065 //! Check is done 0066 //! Use : It is to be called when pcurve of an edge can be wrong 0067 //! (e.g., after import from IGES) 0068 //! Returns: True, if does not match, removed (status DONE) 0069 //! False, (status OK) if matches or (status FAIL) if no pcurve, 0070 //! nothing done 0071 Standard_EXPORT Standard_Boolean FixRemovePCurve(const TopoDS_Edge& edge, 0072 const Handle(Geom_Surface)& surface, 0073 const TopLoc_Location& location); 0074 0075 //! Removes 3d curve of the edge if it does not match the vertices 0076 //! Returns: True, if does not match, removed (status DONE) 0077 //! False, (status OK) if matches or (status FAIL) if no 3d curve, 0078 //! nothing done 0079 Standard_EXPORT Standard_Boolean FixRemoveCurve3d(const TopoDS_Edge& edge); 0080 0081 //! See method below for information 0082 Standard_EXPORT Standard_Boolean FixAddPCurve(const TopoDS_Edge& edge, 0083 const TopoDS_Face& face, 0084 const Standard_Boolean isSeam, 0085 const Standard_Real prec = 0.0); 0086 0087 //! See method below for information 0088 Standard_EXPORT Standard_Boolean FixAddPCurve(const TopoDS_Edge& edge, 0089 const Handle(Geom_Surface)& surface, 0090 const TopLoc_Location& location, 0091 const Standard_Boolean isSeam, 0092 const Standard_Real prec = 0.0); 0093 0094 //! See method below for information 0095 Standard_EXPORT Standard_Boolean FixAddPCurve(const TopoDS_Edge& edge, 0096 const TopoDS_Face& face, 0097 const Standard_Boolean isSeam, 0098 const Handle(ShapeAnalysis_Surface)& surfana, 0099 const Standard_Real prec = 0.0); 0100 0101 //! Adds pcurve(s) of the edge if missing (by projecting 3d curve) 0102 //! Parameter isSeam indicates if the edge is a seam. 0103 //! The parameter <prec> defines the precision for calculations. 0104 //! If it is 0 (default), the tolerance of the edge is taken. 0105 //! Remark : This method is rather for internal use since it accepts parameter 0106 //! <surfana> for optimization of computations 0107 //! Use : It is to be called after FixRemovePCurve (if removed) or in any 0108 //! case when edge can have no pcurve 0109 //! Returns: True if pcurve was added, else False 0110 //! Status : 0111 //! OK : Pcurve exists 0112 //! FAIL1: No 3d curve 0113 //! FAIL2: fail during projecting 0114 //! DONE1: Pcurve was added 0115 //! DONE2: specific case of pcurve going through degenerated point on 0116 //! sphere encountered during projection (see class 0117 //! ShapeConstruct_ProjectCurveOnSurface for more info) 0118 Standard_EXPORT Standard_Boolean FixAddPCurve(const TopoDS_Edge& edge, 0119 const Handle(Geom_Surface)& surface, 0120 const TopLoc_Location& location, 0121 const Standard_Boolean isSeam, 0122 const Handle(ShapeAnalysis_Surface)& surfana, 0123 const Standard_Real prec = 0.0); 0124 0125 //! Tries to build 3d curve of the edge if missing 0126 //! Use : It is to be called after FixRemoveCurve3d (if removed) or in any 0127 //! case when edge can have no 3d curve 0128 //! Returns: True if 3d curve was added, else False 0129 //! Status : 0130 //! OK : 3d curve exists 0131 //! FAIL1: BRepLib::BuildCurve3d() has failed 0132 //! DONE1: 3d curve was added 0133 Standard_EXPORT Standard_Boolean FixAddCurve3d(const TopoDS_Edge& edge); 0134 0135 Standard_EXPORT Standard_Boolean FixVertexTolerance(const TopoDS_Edge& edge, 0136 const TopoDS_Face& face); 0137 0138 //! Increases the tolerances of the edge vertices to comprise 0139 //! the ends of 3d curve and pcurve on the given face 0140 //! (first method) or all pcurves stored in an edge (second one) 0141 //! Returns: True, if tolerances have been increased, otherwise False 0142 //! Status: 0143 //! OK : the original tolerances have not been changed 0144 //! DONE1: the tolerance of first vertex has been increased 0145 //! DONE2: the tolerance of last vertex has been increased 0146 Standard_EXPORT Standard_Boolean FixVertexTolerance(const TopoDS_Edge& edge); 0147 0148 Standard_EXPORT Standard_Boolean FixReversed2d(const TopoDS_Edge& edge, const TopoDS_Face& face); 0149 0150 //! Fixes edge if pcurve is directed opposite to 3d curve 0151 //! Check is done by call to the function 0152 //! ShapeAnalysis_Edge::CheckCurve3dWithPCurve() 0153 //! Warning: For seam edge this method will check and fix the pcurve in only 0154 //! one direction. Hence, it should be called twice for seam edge: 0155 //! once with edge orientation FORWARD and once with REVERSED. 0156 //! Returns: False if nothing done, True if reversed (status DONE) 0157 //! Status: OK - pcurve OK, nothing done 0158 //! FAIL1 - no pcurve 0159 //! FAIL2 - no 3d curve 0160 //! DONE1 - pcurve was reversed 0161 Standard_EXPORT Standard_Boolean FixReversed2d(const TopoDS_Edge& edge, 0162 const Handle(Geom_Surface)& surface, 0163 const TopLoc_Location& location); 0164 0165 //! Tries to make edge SameParameter and sets corresponding 0166 //! tolerance and SameParameter flag. 0167 //! First, it makes edge same range if SameRange flag is not set. 0168 //! 0169 //! If flag SameParameter is set, this method calls the 0170 //! function ShapeAnalysis_Edge::CheckSameParameter() that 0171 //! calculates the maximal deviation of pcurves of the edge from 0172 //! its 3d curve. If deviation > tolerance, the tolerance of edge 0173 //! is increased to a value of deviation. If deviation < tolerance 0174 //! nothing happens. 0175 //! 0176 //! If flag SameParameter is not set, this method chooses the best 0177 //! variant (one that has minimal tolerance), either 0178 //! a. only after computing deviation (as above) or 0179 //! b. after calling standard procedure BRepLib::SameParameter 0180 //! and computing deviation (as above). If <tolerance> > 0, it is 0181 //! used as parameter for BRepLib::SameParameter, otherwise, 0182 //! tolerance of the edge is used. 0183 //! 0184 //! Use : Is to be called after all pcurves and 3d curve of the edge are 0185 //! correctly computed 0186 //! Remark : SameParameter flag is always set to True after this method 0187 //! Returns: True, if something done, else False 0188 //! Status : OK - edge was initially SameParameter, nothing is done 0189 //! FAIL1 - computation of deviation of pcurves from 3d curve has failed 0190 //! FAIL2 - BRepLib::SameParameter() has failed 0191 //! DONE1 - tolerance of the edge was increased 0192 //! DONE2 - flag SameParameter was set to True (only if 0193 //! BRepLib::SameParameter() did not set it) 0194 //! DONE3 - edge was modified by BRepLib::SameParameter() to SameParameter 0195 //! DONE4 - not used anymore 0196 //! DONE5 - if the edge resulting from BRepLib has been chosen, i.e. variant b. above 0197 //! (only for edges with not set SameParameter) 0198 Standard_EXPORT Standard_Boolean FixSameParameter(const TopoDS_Edge& edge, 0199 const Standard_Real tolerance = 0.0); 0200 0201 //! Tries to make edge SameParameter and sets corresponding 0202 //! tolerance and SameParameter flag. 0203 //! First, it makes edge same range if SameRange flag is not set. 0204 //! 0205 //! If flag SameParameter is set, this method calls the 0206 //! function ShapeAnalysis_Edge::CheckSameParameter() that 0207 //! calculates the maximal deviation of pcurves of the edge from 0208 //! its 3d curve. If deviation > tolerance, the tolerance of edge 0209 //! is increased to a value of deviation. If deviation < tolerance 0210 //! nothing happens. 0211 //! 0212 //! If flag SameParameter is not set, this method chooses the best 0213 //! variant (one that has minimal tolerance), either 0214 //! a. only after computing deviation (as above) or 0215 //! b. after calling standard procedure BRepLib::SameParameter 0216 //! and computing deviation (as above). If <tolerance> > 0, it is 0217 //! used as parameter for BRepLib::SameParameter, otherwise, 0218 //! tolerance of the edge is used. 0219 //! 0220 //! Use : Is to be called after all pcurves and 3d curve of the edge are 0221 //! correctly computed 0222 //! Remark : SameParameter flag is always set to True after this method 0223 //! Returns: True, if something done, else False 0224 //! Status : OK - edge was initially SameParameter, nothing is done 0225 //! FAIL1 - computation of deviation of pcurves from 3d curve has failed 0226 //! FAIL2 - BRepLib::SameParameter() has failed 0227 //! DONE1 - tolerance of the edge was increased 0228 //! DONE2 - flag SameParameter was set to True (only if 0229 //! BRepLib::SameParameter() did not set it) 0230 //! DONE3 - edge was modified by BRepLib::SameParameter() to SameParameter 0231 //! DONE4 - not used anymore 0232 //! DONE5 - if the edge resulting from BRepLib has been chosen, i.e. variant b. above 0233 //! (only for edges with not set SameParameter) 0234 Standard_EXPORT Standard_Boolean FixSameParameter(const TopoDS_Edge& edge, 0235 const TopoDS_Face& face, 0236 const Standard_Real tolerance = 0.0); 0237 0238 //! Returns the status (in the form of True/False) of last Fix 0239 Standard_EXPORT Standard_Boolean Status(const ShapeExtend_Status status) const; 0240 0241 //! Sets context 0242 Standard_EXPORT void SetContext(const Handle(ShapeBuild_ReShape)& context); 0243 0244 //! Returns context 0245 Standard_EXPORT Handle(ShapeBuild_ReShape) Context() const; 0246 0247 DEFINE_STANDARD_RTTIEXT(ShapeFix_Edge, Standard_Transient) 0248 0249 protected: 0250 Handle(ShapeBuild_ReShape) myContext; 0251 Standard_Integer myStatus; 0252 Handle(ShapeConstruct_ProjectCurveOnSurface) myProjector; 0253 0254 private: 0255 }; 0256 0257 #endif // _ShapeFix_Edge_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|