Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-16 09:16:52

0001 // Created on: 1994-08-30
0002 // Created by: Jacques GOUSSARD
0003 // Copyright (c) 1994-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 _Draft_Modification_HeaderFile
0018 #define _Draft_Modification_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TopoDS_Face.hxx>
0024 #include <Draft_FaceInfo.hxx>
0025 #include <TopTools_ShapeMapHasher.hxx>
0026 #include <NCollection_IndexedDataMap.hxx>
0027 #include <TopoDS_Edge.hxx>
0028 #include <Draft_EdgeInfo.hxx>
0029 #include <TopoDS_Vertex.hxx>
0030 #include <Draft_VertexInfo.hxx>
0031 #include <TopoDS_Shape.hxx>
0032 #include <Draft_ErrorStatus.hxx>
0033 #include <NCollection_List.hxx>
0034 #include <BRepTools_Modification.hxx>
0035 #include <GeomAbs_Shape.hxx>
0036 #include <TopAbs_Orientation.hxx>
0037 class gp_Dir;
0038 class gp_Pln;
0039 class Geom_Surface;
0040 class TopLoc_Location;
0041 class TopoDS_Edge;
0042 class Geom_Curve;
0043 class TopoDS_Vertex;
0044 class gp_Pnt;
0045 class Geom2d_Curve;
0046 
0047 class Draft_Modification : public BRepTools_Modification
0048 {
0049 
0050 public:
0051   Standard_EXPORT Draft_Modification(const TopoDS_Shape& S);
0052 
0053   //! Resets on the same shape.
0054   Standard_EXPORT void Clear();
0055 
0056   //! Changes the basis shape and resets.
0057   Standard_EXPORT void Init(const TopoDS_Shape& S);
0058 
0059   //! Adds the face F and propagates the draft
0060   //! modification to its neighbour faces if they are
0061   //! tangent. If an error occurs, will return False and
0062   //! ProblematicShape will return the "bad" face.
0063   Standard_EXPORT bool Add(const TopoDS_Face& F,
0064                            const gp_Dir&      Direction,
0065                            const double       Angle,
0066                            const gp_Pln&      NeutralPlane,
0067                            const bool         Flag = true);
0068 
0069   //! Removes the face F and the neighbour faces if they
0070   //! are tangent. It will be necessary to call this
0071   //! method if the method Add returns false,
0072   //! to unset ProblematicFace.
0073   Standard_EXPORT void Remove(const TopoDS_Face& F);
0074 
0075   //! Performs the draft angle modification and sets the
0076   //! value returned by the method IsDone. If an error
0077   //! occurs, IsDone will return false, and an
0078   //! error status will be given by the method Error,
0079   //! and the shape on which the problem appeared will
0080   //! be given by ProblematicShape
0081   Standard_EXPORT void Perform();
0082 
0083   //! Returns True if Perform has been successfully
0084   //! called. Otherwise more information can be obtained
0085   //! using the methods Error() and ProblematicShape().
0086   Standard_EXPORT bool IsDone() const;
0087 
0088   Standard_EXPORT Draft_ErrorStatus Error() const;
0089 
0090   //! Returns the shape (Face, Edge or Vertex) on which
0091   //! an error occurred.
0092   Standard_EXPORT const TopoDS_Shape& ProblematicShape() const;
0093 
0094   //! Returns all the faces which have been added
0095   //! together with the face <F>.
0096   Standard_EXPORT const NCollection_List<TopoDS_Shape>& ConnectedFaces(const TopoDS_Face& F);
0097 
0098   //! Returns all the faces on which a modification has
0099   //! been given.
0100   Standard_EXPORT const NCollection_List<TopoDS_Shape>& ModifiedFaces();
0101 
0102   //! Returns true if the face <F> has been
0103   //! modified. In this case, <S> is the new geometric
0104   //! support of the face, <L> the new location, <Tol>
0105   //! the new tolerance.<RevWires> has to be set to
0106   //! true when the modification reverses the
0107   //! normal of the surface. (the wires have to be
0108   //! reversed). <RevFace> has to be set to
0109   //! true if the orientation of the modified
0110   //! face changes in the shells which contain it. Here
0111   //! it will be set to false.
0112   //!
0113   //! Otherwise, returns false, and <S>, <L>,
0114   //! <Tol> , <RevWires> ,<RevFace> are not significant.
0115   Standard_EXPORT bool NewSurface(const TopoDS_Face&         F,
0116                                   occ::handle<Geom_Surface>& S,
0117                                   TopLoc_Location&           L,
0118                                   double&                    Tol,
0119                                   bool&                      RevWires,
0120                                   bool&                      RevFace) override;
0121 
0122   //! Returns true if the edge <E> has been
0123   //! modified. In this case, <C> is the new geometric
0124   //! support of the edge, <L> the new location, <Tol>
0125   //! the new tolerance. Otherwise, returns
0126   //! false, and <C>, <L>, <Tol> are not
0127   //! significant.
0128   Standard_EXPORT bool NewCurve(const TopoDS_Edge&       E,
0129                                 occ::handle<Geom_Curve>& C,
0130                                 TopLoc_Location&         L,
0131                                 double&                  Tol) override;
0132 
0133   //! Returns true if the vertex <V> has been
0134   //! modified. In this case, <P> is the new geometric
0135   //! support of the vertex, <Tol> the new tolerance.
0136   //! Otherwise, returns false, and <P>, <Tol>
0137   //! are not significant.
0138   Standard_EXPORT bool NewPoint(const TopoDS_Vertex& V, gp_Pnt& P, double& Tol) override;
0139 
0140   //! Returns true if the edge <E> has a new
0141   //! curve on surface on the face <F>.In this case, <C>
0142   //! is the new geometric support of the edge, <L> the
0143   //! new location, <Tol> the new tolerance.
0144   //!
0145   //! Otherwise, returns false, and <C>, <L>,
0146   //! <Tol> are not significant.
0147   //!
0148   //! <NewE> is the new edge created from <E>. <NewF>
0149   //! is the new face created from <F>. They may be useful.
0150   Standard_EXPORT bool NewCurve2d(const TopoDS_Edge&         E,
0151                                   const TopoDS_Face&         F,
0152                                   const TopoDS_Edge&         NewE,
0153                                   const TopoDS_Face&         NewF,
0154                                   occ::handle<Geom2d_Curve>& C,
0155                                   double&                    Tol) override;
0156 
0157   //! Returns true if the Vertex <V> has a new
0158   //! parameter on the edge <E>. In this case, <P> is
0159   //! the parameter, <Tol> the new tolerance.
0160   //! Otherwise, returns false, and <P>, <Tol>
0161   //! are not significant.
0162   Standard_EXPORT bool NewParameter(const TopoDS_Vertex& V,
0163                                     const TopoDS_Edge&   E,
0164                                     double&              P,
0165                                     double&              Tol) override;
0166 
0167   //! Returns the continuity of <NewE> between <NewF1>
0168   //! and <NewF2>.
0169   //!
0170   //! <NewE> is the new edge created from <E>. <NewF1>
0171   //! (resp. <NewF2>) is the new face created from <F1>
0172   //! (resp. <F2>).
0173   Standard_EXPORT GeomAbs_Shape Continuity(const TopoDS_Edge& E,
0174                                            const TopoDS_Face& F1,
0175                                            const TopoDS_Face& F2,
0176                                            const TopoDS_Edge& NewE,
0177                                            const TopoDS_Face& NewF1,
0178                                            const TopoDS_Face& NewF2) override;
0179 
0180   DEFINE_STANDARD_RTTIEXT(Draft_Modification, BRepTools_Modification)
0181 
0182 private:
0183   Standard_EXPORT bool InternalAdd(const TopoDS_Face& F,
0184                                    const gp_Dir&      Direction,
0185                                    const double       Angle,
0186                                    const gp_Pln&      NeutralPlane,
0187                                    const bool         Flag = true);
0188 
0189   Standard_EXPORT bool Propagate();
0190 
0191   Standard_EXPORT occ::handle<Geom_Curve> NewCurve(const occ::handle<Geom_Curve>&   C,
0192                                                    const occ::handle<Geom_Surface>& S,
0193                                                    const TopAbs_Orientation         OriS,
0194                                                    const gp_Dir&                    Direction,
0195                                                    const double                     Angle,
0196                                                    const gp_Pln&                    NeutralPlane,
0197                                                    const bool                       Flag = true);
0198 
0199   Standard_EXPORT occ::handle<Geom_Surface> NewSurface(const occ::handle<Geom_Surface>& S,
0200                                                        const TopAbs_Orientation         OriS,
0201                                                        const gp_Dir&                    Direction,
0202                                                        const double                     Angle,
0203                                                        const gp_Pln& NeutralPlane);
0204 
0205   NCollection_IndexedDataMap<TopoDS_Face, Draft_FaceInfo, TopTools_ShapeMapHasher>     myFMap;
0206   NCollection_IndexedDataMap<TopoDS_Edge, Draft_EdgeInfo, TopTools_ShapeMapHasher>     myEMap;
0207   NCollection_IndexedDataMap<TopoDS_Vertex, Draft_VertexInfo, TopTools_ShapeMapHasher> myVMap;
0208   bool                                                                                 myComp;
0209   TopoDS_Shape                                                                         myShape;
0210   TopoDS_Shape                                                                         badShape;
0211   Draft_ErrorStatus                                                                    errStat;
0212   TopoDS_Face                                                                          curFace;
0213   NCollection_List<TopoDS_Shape>                                                       conneF;
0214   NCollection_IndexedDataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>
0215     myEFMap;
0216 };
0217 
0218 #endif // _Draft_Modification_HeaderFile