Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:21:45

0001 // Created on: 1999-04-26
0002 // Created by: Pavel DURANDIN
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 _ShapeUpgrade_ShapeDivide_HeaderFile
0018 #define _ShapeUpgrade_ShapeDivide_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TopoDS_Shape.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <Message_Gravity.hxx>
0027 #include <ShapeExtend_Status.hxx>
0028 class ShapeUpgrade_FaceDivide;
0029 class ShapeBuild_ReShape;
0030 class ShapeExtend_BasicMsgRegistrator;
0031 class Message_Msg;
0032 
0033 // resolve name collisions with X11 headers
0034 #ifdef Status
0035   #undef Status
0036 #endif
0037 
0038 //! Divides a all faces in shell with given criteria Shell.
0039 class ShapeUpgrade_ShapeDivide
0040 {
0041 public:
0042   DEFINE_STANDARD_ALLOC
0043 
0044   Standard_EXPORT ShapeUpgrade_ShapeDivide();
0045 
0046   //! Initialize by a Shape.
0047   Standard_EXPORT ShapeUpgrade_ShapeDivide(const TopoDS_Shape& S);
0048 
0049   //! Initialize by a Shape.
0050   Standard_EXPORT void Init(const TopoDS_Shape& S);
0051 
0052   Standard_EXPORT virtual ~ShapeUpgrade_ShapeDivide();
0053 
0054   //! Defines the spatial precision used for splitting
0055   Standard_EXPORT void SetPrecision(const double Prec);
0056 
0057   //! Sets maximal allowed tolerance
0058   Standard_EXPORT void SetMaxTolerance(const double maxtol);
0059 
0060   //! Sets minimal allowed tolerance
0061   Standard_EXPORT void SetMinTolerance(const double mintol);
0062 
0063   //! Purpose sets mode for trimming (segment) surface by
0064   //! wire UV bounds.
0065   Standard_EXPORT void SetSurfaceSegmentMode(const bool Segment);
0066 
0067   //! Performs splitting and computes the resulting shape
0068   //! If newContext is True (default), the internal context
0069   //! will be cleared at start, else previous substitutions
0070   //! will be acting.
0071   Standard_EXPORT virtual bool Perform(const bool newContext = true);
0072 
0073   //! Gives the resulting Shape, or Null shape if not done.
0074   Standard_EXPORT TopoDS_Shape Result() const;
0075 
0076   //! Returns context with all the modifications made during
0077   //! last call(s) to Perform() recorded
0078   Standard_EXPORT occ::handle<ShapeBuild_ReShape> GetContext() const;
0079 
0080   //! Sets context with recorded modifications to be applied
0081   //! during next call(s) to Perform(shape,false)
0082   Standard_EXPORT void SetContext(const occ::handle<ShapeBuild_ReShape>& context);
0083 
0084   //! Sets message registrator
0085   Standard_EXPORT virtual void SetMsgRegistrator(
0086     const occ::handle<ShapeExtend_BasicMsgRegistrator>& msgreg);
0087 
0088   //! Returns message registrator
0089   Standard_EXPORT occ::handle<ShapeExtend_BasicMsgRegistrator> MsgRegistrator() const;
0090 
0091   //! Sends a message to be attached to the shape.
0092   //! Calls corresponding message of message registrator.
0093   Standard_EXPORT void SendMsg(const TopoDS_Shape&   shape,
0094                                const Message_Msg&    message,
0095                                const Message_Gravity gravity = Message_Info) const;
0096 
0097   //! Queries the status of last call to Perform
0098   //! OK   : no splitting was done (or no call to Perform)
0099   //! DONE1: some edges were split
0100   //! DONE2: surface was split
0101   //! FAIL1: some errors occurred
0102   Standard_EXPORT bool Status(const ShapeExtend_Status status) const;
0103 
0104   //! Sets the tool for splitting faces.
0105   Standard_EXPORT void SetSplitFaceTool(const occ::handle<ShapeUpgrade_FaceDivide>& splitFaceTool);
0106 
0107   //! Sets mode for splitting 3d curves from edges.
0108   //! 0 - only curve 3d from free edges.
0109   //! 1 - only curve 3d from shared edges.
0110   //! 2 -  all curve 3d.
0111   Standard_EXPORT void SetEdgeMode(const int aEdgeMode);
0112 
0113 protected:
0114   //! Returns the tool for splitting faces.
0115   Standard_EXPORT virtual occ::handle<ShapeUpgrade_FaceDivide> GetSplitFaceTool() const;
0116 
0117   Standard_EXPORT virtual Message_Msg GetFaceMsg() const;
0118 
0119   Standard_EXPORT virtual Message_Msg GetWireMsg() const;
0120 
0121   //! Returns a message describing modification of a shape.
0122   Standard_EXPORT virtual Message_Msg GetEdgeMsg() const;
0123 
0124   occ::handle<ShapeBuild_ReShape>              myContext;
0125   occ::handle<ShapeExtend_BasicMsgRegistrator> myMsgReg;
0126   TopoDS_Shape                                 myShape;
0127   TopoDS_Shape                                 myResult;
0128   double                                       myPrecision;
0129   double                                       myMinTol;
0130   double                                       myMaxTol;
0131   bool                                         mySegmentMode;
0132   int                                          myStatus;
0133   int                                          myEdgeMode;
0134 
0135 private:
0136   occ::handle<ShapeUpgrade_FaceDivide> mySplitFaceTool;
0137 };
0138 
0139 #endif // _ShapeUpgrade_ShapeDivide_HeaderFile