Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:57

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 
0043   DEFINE_STANDARD_ALLOC
0044 
0045   
0046   Standard_EXPORT ShapeUpgrade_ShapeDivide();
0047   
0048   //! Initialize by a Shape.
0049   Standard_EXPORT ShapeUpgrade_ShapeDivide(const TopoDS_Shape& S);
0050   
0051   //! Initialize by a Shape.
0052   Standard_EXPORT void Init (const TopoDS_Shape& S);
0053   
0054   Standard_EXPORT virtual ~ShapeUpgrade_ShapeDivide();
0055   
0056   //! Defines the spatial precision used for splitting
0057   Standard_EXPORT void SetPrecision (const Standard_Real Prec);
0058   
0059   //! Sets maximal allowed tolerance
0060   Standard_EXPORT void SetMaxTolerance (const Standard_Real maxtol);
0061   
0062   //! Sets minimal allowed tolerance
0063   Standard_EXPORT void SetMinTolerance (const Standard_Real mintol);
0064   
0065   //! Purpose sets mode for trimming (segment) surface by
0066   //! wire UV bounds.
0067   Standard_EXPORT void SetSurfaceSegmentMode (const Standard_Boolean Segment);
0068   
0069   //! Performs splitting and computes the resulting shape
0070   //! If newContext is True (default), the internal context
0071   //! will be cleared at start, else previous substitutions
0072   //! will be acting.
0073   Standard_EXPORT virtual Standard_Boolean Perform (const Standard_Boolean newContext = Standard_True);
0074   
0075   //! Gives the resulting Shape, or Null shape if not done.
0076   Standard_EXPORT TopoDS_Shape Result() const;
0077   
0078   //! Returns context with all the modifications made during
0079   //! last call(s) to Perform() recorded
0080   Standard_EXPORT Handle(ShapeBuild_ReShape) GetContext() const;
0081   
0082   //! Sets context with recorded modifications to be applied
0083   //! during next call(s) to Perform(shape,Standard_False)
0084   Standard_EXPORT void SetContext (const Handle(ShapeBuild_ReShape)& context);
0085   
0086   //! Sets message registrator
0087   Standard_EXPORT virtual void SetMsgRegistrator (const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg);
0088   
0089   //! Returns message registrator
0090   Standard_EXPORT Handle(ShapeExtend_BasicMsgRegistrator) MsgRegistrator() const;
0091   
0092   //! Sends a message to be attached to the shape.
0093   //! Calls corresponding message of message registrator.
0094   Standard_EXPORT void SendMsg (const TopoDS_Shape& shape, const Message_Msg& message, const Message_Gravity gravity = Message_Info) const;
0095   
0096   //! Queries the status of last call to Perform
0097   //! OK   : no splitting was done (or no call to Perform)
0098   //! DONE1: some edges were split
0099   //! DONE2: surface was split
0100   //! FAIL1: some errors occurred
0101   Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
0102   
0103   //! Sets the tool for splitting faces.
0104   Standard_EXPORT void SetSplitFaceTool (const Handle(ShapeUpgrade_FaceDivide)& splitFaceTool);
0105   
0106   //! Sets mode for splitting 3d curves from edges.
0107   //! 0 - only curve 3d from free edges.
0108   //! 1 - only curve 3d from shared edges.
0109   //! 2 -  all curve 3d.
0110   Standard_EXPORT void SetEdgeMode (const Standard_Integer aEdgeMode);
0111 
0112 
0113 
0114 
0115 protected:
0116 
0117   
0118   //! Returns the tool for splitting faces.
0119   Standard_EXPORT virtual Handle(ShapeUpgrade_FaceDivide) GetSplitFaceTool() const;
0120   
0121   Standard_EXPORT virtual Message_Msg GetFaceMsg() const;
0122   
0123   Standard_EXPORT virtual Message_Msg GetWireMsg() const;
0124   
0125   //! Returns a message decsribing modification of a shape.
0126   Standard_EXPORT virtual Message_Msg GetEdgeMsg() const;
0127 
0128 
0129   Handle(ShapeBuild_ReShape) myContext;
0130   Handle(ShapeExtend_BasicMsgRegistrator) myMsgReg;
0131   TopoDS_Shape myShape;
0132   TopoDS_Shape myResult;
0133   Standard_Real myPrecision;
0134   Standard_Real myMinTol;
0135   Standard_Real myMaxTol;
0136   Standard_Boolean mySegmentMode;
0137   Standard_Integer myStatus;
0138   Standard_Integer myEdgeMode;
0139 
0140 
0141 private:
0142 
0143 
0144 
0145   Handle(ShapeUpgrade_FaceDivide) mySplitFaceTool;
0146 
0147 
0148 };
0149 
0150 
0151 
0152 
0153 
0154 
0155 
0156 #endif // _ShapeUpgrade_ShapeDivide_HeaderFile