Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1999-04-15
0002 // Created by: Roman LYGIN
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_WireDivide_HeaderFile
0018 #define _ShapeUpgrade_WireDivide_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TopoDS_Face.hxx>
0024 #include <TopoDS_Wire.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <ShapeUpgrade_Tool.hxx>
0027 #include <ShapeExtend_Status.hxx>
0028 class ShapeUpgrade_SplitCurve3d;
0029 class ShapeUpgrade_SplitCurve2d;
0030 class ShapeUpgrade_EdgeDivide;
0031 class ShapeAnalysis_TransferParameters;
0032 class ShapeUpgrade_FixSmallCurves;
0033 class Geom_Surface;
0034 class TopoDS_Edge;
0035 class TopLoc_Location;
0036 
0037 // resolve name collisions with X11 headers
0038 #ifdef Status
0039   #undef Status
0040 #endif
0041 
0042 //! Divides edges in the wire lying on the face or free wires or
0043 //! free edges with a criterion.
0044 //! Splits 3D curve and pcurve(s) of the edge on the face.
0045 //! Other pcurves which may be associated with the edge are simply
0046 //! copied.
0047 //! If 3D curve is split then pcurve on the face is split as
0048 //! well, and vice-versa.
0049 //! Input shape is not modified.
0050 //! The modifications made are recorded in external context
0051 //! (ShapeBuild_ReShape). This tool is applied to all edges
0052 //! before splitting them in order to keep sharing.
0053 class ShapeUpgrade_WireDivide : public ShapeUpgrade_Tool
0054 {
0055 
0056 public:
0057   //! Empty constructor
0058   Standard_EXPORT ShapeUpgrade_WireDivide();
0059 
0060   //! Initializes by wire and face
0061   Standard_EXPORT void Init(const TopoDS_Wire& W, const TopoDS_Face& F);
0062 
0063   //! Initializes by wire and surface
0064   Standard_EXPORT void Init(const TopoDS_Wire& W, const occ::handle<Geom_Surface>& S);
0065 
0066   //! Loads working wire
0067   Standard_EXPORT void Load(const TopoDS_Wire& W);
0068 
0069   //! Creates wire of one edge and calls Load for wire
0070   Standard_EXPORT void Load(const TopoDS_Edge& E);
0071 
0072   //! Sets supporting surface by face
0073   Standard_EXPORT void SetFace(const TopoDS_Face& F);
0074 
0075   //! Sets supporting surface
0076   Standard_EXPORT void SetSurface(const occ::handle<Geom_Surface>& S);
0077 
0078   //! Sets supporting surface with location
0079   Standard_EXPORT void SetSurface(const occ::handle<Geom_Surface>& S, const TopLoc_Location& L);
0080 
0081   //! Computes the resulting wire by splitting all the edges
0082   //! according to splitting criteria.
0083   //! All the modifications made are recorded in context
0084   //! (ShapeBuild_ReShape). This tool is applied to all edges
0085   //! before splitting them in order to keep sharings.
0086   //! If no supporting face or surface is defined, only 3d
0087   //! splitting criteria are used.
0088   Standard_EXPORT virtual void Perform();
0089 
0090   //! Gives the resulting Wire (equal to initial one if not done
0091   //! or Null if not loaded)
0092   Standard_EXPORT const TopoDS_Wire& Wire() const;
0093 
0094   //! Queries status of last call to Perform()
0095   //! OK - no edges were split, wire left untouched
0096   //! DONE1 - some edges were split
0097   //! FAIL1 - some edges have no 3d curve (skipped)
0098   //! FAIL2 - some edges have no pcurve (skipped)
0099   Standard_EXPORT bool Status(const ShapeExtend_Status status) const;
0100 
0101   //! Sets the tool for splitting 3D curves.
0102   Standard_EXPORT void SetSplitCurve3dTool(
0103     const occ::handle<ShapeUpgrade_SplitCurve3d>& splitCurve3dTool);
0104 
0105   //! Sets the tool for splitting pcurves.
0106   Standard_EXPORT void SetSplitCurve2dTool(
0107     const occ::handle<ShapeUpgrade_SplitCurve2d>& splitCurve2dTool);
0108 
0109   //! Sets the tool for Transfer parameters between curves and pcurves.
0110   Standard_EXPORT void SetTransferParamTool(
0111     const occ::handle<ShapeAnalysis_TransferParameters>& TransferParam);
0112 
0113   //! Sets tool for splitting edge
0114   Standard_EXPORT void SetEdgeDivideTool(
0115     const occ::handle<ShapeUpgrade_EdgeDivide>& edgeDivideTool);
0116 
0117   //! returns tool for splitting edges
0118   Standard_EXPORT virtual occ::handle<ShapeUpgrade_EdgeDivide> GetEdgeDivideTool() const;
0119 
0120   //! Returns the tool for Transfer of parameters.
0121   Standard_EXPORT virtual occ::handle<ShapeAnalysis_TransferParameters> GetTransferParamTool();
0122 
0123   //! Sets mode for splitting 3d curves from edges.
0124   //! 0 - only curve 3d from free edges.
0125   //! 1 - only curve 3d from shared edges.
0126   //! 2 - all curve 3d.
0127   Standard_EXPORT void SetEdgeMode(const int EdgeMode);
0128 
0129   //! Sets tool for fixing small curves with specified min tolerance;
0130   Standard_EXPORT void SetFixSmallCurveTool(
0131     const occ::handle<ShapeUpgrade_FixSmallCurves>& FixSmallCurvesTool);
0132 
0133   //! Returns tool for fixing small curves
0134   Standard_EXPORT occ::handle<ShapeUpgrade_FixSmallCurves> GetFixSmallCurveTool() const;
0135 
0136   DEFINE_STANDARD_RTTIEXT(ShapeUpgrade_WireDivide, ShapeUpgrade_Tool)
0137 
0138 protected:
0139   //! Returns the tool for splitting 3D curves.
0140   Standard_EXPORT virtual occ::handle<ShapeUpgrade_SplitCurve3d> GetSplitCurve3dTool() const;
0141 
0142   //! Returns the tool for splitting pcurves.
0143   Standard_EXPORT virtual occ::handle<ShapeUpgrade_SplitCurve2d> GetSplitCurve2dTool() const;
0144 
0145   TopoDS_Face myFace;
0146   TopoDS_Wire myWire;
0147   int         myStatus;
0148   int         myEdgeMode;
0149 
0150 private:
0151   occ::handle<ShapeUpgrade_SplitCurve3d>        mySplitCurve3dTool;
0152   occ::handle<ShapeUpgrade_SplitCurve2d>        mySplitCurve2dTool;
0153   occ::handle<ShapeUpgrade_EdgeDivide>          myEdgeDivide;
0154   occ::handle<ShapeAnalysis_TransferParameters> myTransferParamTool;
0155   occ::handle<ShapeUpgrade_FixSmallCurves>      myFixSmallCurveTool;
0156 };
0157 
0158 #endif // _ShapeUpgrade_WireDivide_HeaderFile