Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:17:43

0001 // Created on: 1999-08-09
0002 // Created by: Galina KULIKOVA
0003 // Copyright (c) 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_Root_HeaderFile
0018 #define _ShapeFix_Root_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TopoDS_Shape.hxx>
0024 #include <Standard_Transient.hxx>
0025 #include <Message_Gravity.hxx>
0026 #include <Standard_Integer.hxx>
0027 
0028 #include <ShapeExtend_BasicMsgRegistrator.hxx>
0029 
0030 class ShapeBuild_ReShape;
0031 class ShapeExtend_BasicMsgRegistrator;
0032 class Message_Msg;
0033 
0034 //! Root class for fixing operations
0035 //! Provides context for recording changes (optional),
0036 //! basic precision value and limit (minimal and
0037 //! maximal) values for tolerances,
0038 //! and message registrator
0039 class ShapeFix_Root : public Standard_Transient
0040 {
0041 
0042 public:
0043   //! Empty Constructor (no context is created)
0044   Standard_EXPORT ShapeFix_Root();
0045 
0046   //! Copy all fields from another Root object
0047   Standard_EXPORT virtual void Set(const occ::handle<ShapeFix_Root>& Root);
0048 
0049   //! Sets context
0050   Standard_EXPORT virtual void SetContext(const occ::handle<ShapeBuild_ReShape>& context);
0051 
0052   //! Returns context
0053   occ::handle<ShapeBuild_ReShape> Context() const;
0054 
0055   //! Sets message registrator
0056   Standard_EXPORT virtual void SetMsgRegistrator(
0057     const occ::handle<ShapeExtend_BasicMsgRegistrator>& msgreg);
0058 
0059   //! Returns message registrator
0060   occ::handle<ShapeExtend_BasicMsgRegistrator> MsgRegistrator() const;
0061 
0062   //! Sets basic precision value
0063   Standard_EXPORT virtual void SetPrecision(const double preci);
0064 
0065   //! Returns basic precision value
0066   double Precision() const;
0067 
0068   //! Sets minimal allowed tolerance
0069   Standard_EXPORT virtual void SetMinTolerance(const double mintol);
0070 
0071   //! Returns minimal allowed tolerance
0072   double MinTolerance() const;
0073 
0074   //! Sets maximal allowed tolerance
0075   Standard_EXPORT virtual void SetMaxTolerance(const double maxtol);
0076 
0077   //! Returns maximal allowed tolerance
0078   double MaxTolerance() const;
0079 
0080   //! Returns tolerance limited by [myMinTol,myMaxTol]
0081   double LimitTolerance(const double toler) const;
0082 
0083   //! Sends a message to be attached to the shape.
0084   //! Calls corresponding message of message registrator.
0085   Standard_EXPORT void SendMsg(const TopoDS_Shape&   shape,
0086                                const Message_Msg&    message,
0087                                const Message_Gravity gravity = Message_Info) const;
0088 
0089   //! Sends a message to be attached to myShape.
0090   //! Calls previous method.
0091   void SendMsg(const Message_Msg& message, const Message_Gravity gravity = Message_Info) const;
0092 
0093   //! Sends a warning to be attached to the shape.
0094   //! Calls SendMsg with gravity set to Message_Warning.
0095   void SendWarning(const TopoDS_Shape& shape, const Message_Msg& message) const;
0096 
0097   //! Calls previous method for myShape.
0098   void SendWarning(const Message_Msg& message) const;
0099 
0100   //! Sends a fail to be attached to the shape.
0101   //! Calls SendMsg with gravity set to Message_Fail.
0102   void SendFail(const TopoDS_Shape& shape, const Message_Msg& message) const;
0103 
0104   //! Calls previous method for myShape.
0105   void SendFail(const Message_Msg& message) const;
0106 
0107   DEFINE_STANDARD_RTTIEXT(ShapeFix_Root, Standard_Transient)
0108 
0109 protected:
0110   //! Auxiliary method for work with three-position
0111   //! (on/off/default) flags (modes) in ShapeFix.
0112   static bool NeedFix(const int flag, const bool def = true);
0113 
0114   TopoDS_Shape myShape;
0115 
0116 private:
0117   occ::handle<ShapeBuild_ReShape>              myContext;
0118   occ::handle<ShapeExtend_BasicMsgRegistrator> myMsgReg;
0119   double                                       myPrecision;
0120   double                                       myMinTol;
0121   double                                       myMaxTol;
0122 };
0123 
0124 #include <ShapeFix_Root.lxx>
0125 
0126 #endif // _ShapeFix_Root_HeaderFile