Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1996-10-02
0002 // Created by: Jacques GOUSSARD
0003 // Copyright (c) 1996-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 _LocOpe_SplitDrafts_HeaderFile
0018 #define _LocOpe_SplitDrafts_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 #include <TopoDS_Shape.hxx>
0024 #include <NCollection_List.hxx>
0025 #include <TopTools_ShapeMapHasher.hxx>
0026 #include <NCollection_DataMap.hxx>
0027 
0028 class TopoDS_Face;
0029 class TopoDS_Wire;
0030 class gp_Dir;
0031 class gp_Pln;
0032 
0033 //! This class provides a tool to realize the
0034 //! following operations on a shape:
0035 //! - split a face of the shape with a wire,
0036 //! - put draft angle on both side of the wire.
0037 //! For each side, the draft angle may be different.
0038 class LocOpe_SplitDrafts
0039 {
0040 public:
0041   DEFINE_STANDARD_ALLOC
0042 
0043   //! Empty constructor.
0044   LocOpe_SplitDrafts() = default;
0045 
0046   //! Creates the algorithm on the shape <S>.
0047   LocOpe_SplitDrafts(const TopoDS_Shape& S)
0048       : myShape(S)
0049   {
0050   }
0051 
0052   //! Initializes the algorithm with the shape <S>.
0053   Standard_EXPORT void Init(const TopoDS_Shape& S);
0054 
0055   //! Splits the face <F> of the former given shape with
0056   //! the wire <W>. The wire is assumed to lie on the
0057   //! face. Puts a draft angle on both parts of the
0058   //! wire. <Extractg>, <Nplg>, <Angleg> define the
0059   //! arguments for the left part of the wire.
0060   //! <Extractd>, <Npld>, <Angled> define the arguments
0061   //! for the right part of the wire. The draft angle is
0062   //! measured with the direction <Extract>. <Npl>
0063   //! defines the neutral plane (points belonging to the
0064   //! neutral plane are not modified). <Angle> is the
0065   //! value of the draft angle. If <ModifyLeft> is set
0066   //! to <false>, no draft angle is applied to
0067   //! the left part of the wire. If <ModifyRight> is set
0068   //! to <false>,no draft angle is applied to
0069   //! the right part of the wire.
0070   Standard_EXPORT void Perform(const TopoDS_Face& F,
0071                                const TopoDS_Wire& W,
0072                                const gp_Dir&      Extractg,
0073                                const gp_Pln&      NPlg,
0074                                const double       Angleg,
0075                                const gp_Dir&      Extractd,
0076                                const gp_Pln&      NPld,
0077                                const double       Angled,
0078                                const bool         ModifyLeft  = true,
0079                                const bool         ModifyRight = true);
0080 
0081   //! Splits the face <F> of the former given shape with
0082   //! the wire <W>. The wire is assumed to lie on the
0083   //! face. Puts a draft angle on the left part of the
0084   //! wire. The draft angle is measured with the
0085   //! direction <Extract>. <Npl> defines the neutral
0086   //! plane (points belonging to the neutral plane are
0087   //! not modified). <Angle> is the value of the draft
0088   //! angle.
0089   Standard_EXPORT void Perform(const TopoDS_Face& F,
0090                                const TopoDS_Wire& W,
0091                                const gp_Dir&      Extract,
0092                                const gp_Pln&      NPl,
0093                                const double       Angle);
0094 
0095   //! Returns <true> if the modification has been successfully performed.
0096   bool IsDone() const { return !myResult.IsNull(); }
0097 
0098   const TopoDS_Shape& OriginalShape() const { return myShape; }
0099 
0100   //! Returns the modified shape.
0101   Standard_EXPORT const TopoDS_Shape& Shape() const;
0102 
0103   //! Manages the descendant shapes.
0104   Standard_EXPORT const NCollection_List<TopoDS_Shape>& ShapesFromShape(
0105     const TopoDS_Shape& S) const;
0106 
0107 private:
0108   TopoDS_Shape myShape;
0109   TopoDS_Shape myResult;
0110   NCollection_DataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher> myMap;
0111 };
0112 
0113 #endif // _LocOpe_SplitDrafts_HeaderFile