32bec2e51f8ffb7904a8eb6275c164fd105a9158
[occt.git] / src / Draft / Draft_Modification.hxx
1 // Created on: 1994-08-30
2 // Created by: Jacques GOUSSARD
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Draft_Modification_HeaderFile
18 #define _Draft_Modification_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Draft_IndexedDataMapOfFaceFaceInfo.hxx>
24 #include <Draft_IndexedDataMapOfEdgeEdgeInfo.hxx>
25 #include <Draft_IndexedDataMapOfVertexVertexInfo.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <TopoDS_Shape.hxx>
28 #include <Draft_ErrorStatus.hxx>
29 #include <TopoDS_Face.hxx>
30 #include <TopTools_ListOfShape.hxx>
31 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
32 #include <BRepTools_Modification.hxx>
33 #include <Standard_Real.hxx>
34 #include <GeomAbs_Shape.hxx>
35 #include <TopAbs_Orientation.hxx>
36 class StdFail_NotDone;
37 class Standard_NoSuchObject;
38 class Standard_ConstructionError;
39 class TopoDS_Shape;
40 class TopoDS_Face;
41 class gp_Dir;
42 class gp_Pln;
43 class Geom_Surface;
44 class TopLoc_Location;
45 class TopoDS_Edge;
46 class Geom_Curve;
47 class TopoDS_Vertex;
48 class gp_Pnt;
49 class Geom2d_Curve;
50
51
52 class Draft_Modification;
53 DEFINE_STANDARD_HANDLE(Draft_Modification, BRepTools_Modification)
54
55
56 class Draft_Modification : public BRepTools_Modification
57 {
58
59 public:
60
61   
62   Standard_EXPORT Draft_Modification(const TopoDS_Shape& S);
63   
64   //! Resets on the same shape.
65   Standard_EXPORT void Clear();
66   
67   //! Changes the basis shape and resets.
68   Standard_EXPORT void Init (const TopoDS_Shape& S);
69   
70   //! Adds  the  face  F    and propagates    the  draft
71   //! modification to  its  neighbour faces if they  are
72   //! tangent. If an error occurs, will return False and
73   //! ProblematicShape  will  return the "bad" face.
74   Standard_EXPORT Standard_Boolean Add (const TopoDS_Face& F, const gp_Dir& Direction, const Standard_Real Angle, const gp_Pln& NeutralPlane, const Standard_Boolean Flag = Standard_True);
75   
76   //! Removes the face F and the neighbour faces if they
77   //! are tangent.   It will be  necessary to  call this
78   //! method if  the  method Add returns Standard_False,
79   //! to unset ProblematicFace.
80   Standard_EXPORT void Remove (const TopoDS_Face& F);
81   
82   //! Performs the draft angle modification and sets the
83   //! value returned by the method  IsDone.  If an error
84   //! occurs, IsDone  will return Standard_False, and an
85   //! error status will  be  given by the  method Error,
86   //! and the  shape on which  the problem appeared will
87   //! be given by ProblematicShape
88   Standard_EXPORT void Perform();
89   
90   //! Returns  True  if   Perform has  been  successfully
91   //! called. Otherwise more information can be obtained
92   //! using the methods Error() and ProblematicShape().
93   Standard_EXPORT Standard_Boolean IsDone() const;
94   
95   Standard_EXPORT Draft_ErrorStatus Error() const;
96   
97   //! Returns the shape (Face,  Edge or Vertex) on which
98   //! an error occured.
99   Standard_EXPORT const TopoDS_Shape& ProblematicShape() const;
100   
101   //! Returns all  the  faces   which  have been   added
102   //! together with the face <F>.
103   Standard_EXPORT const TopTools_ListOfShape& ConnectedFaces (const TopoDS_Face& F);
104   
105   //! Returns all the faces  on which a modification has
106   //! been given.
107   Standard_EXPORT const TopTools_ListOfShape& ModifiedFaces();
108   
109   //! Returns Standard_True if   the face <F>  has  been
110   //! modified.  In this case,  <S> is the new geometric
111   //! support of the  face,  <L> the new  location,<Tol>
112   //! the   new tolerance.<RevWires>  has  to  be set to
113   //! Standard_True when   the modification reverses the
114   //! normal   of  the  surface.(the  wires   have to be
115   //! reversed).  <RevFace>    has    to  be   set    to
116   //! Standard_True  if  the orientation of the modified
117   //! face changes in  the shells which contain it. Here
118   //! it will be set to Standard_False.
119   //!
120   //! Otherwise, returns Standard_False, and <S>,   <L>,
121   //! <Tol> , <RevWires> ,<RevFace> are not  significant.
122   Standard_EXPORT Standard_Boolean NewSurface (const TopoDS_Face& F, Handle(Geom_Surface)& S, TopLoc_Location& L, Standard_Real& Tol, Standard_Boolean& RevWires, Standard_Boolean& RevFace) Standard_OVERRIDE;
123   
124   //! Returns Standard_True  if  the edge  <E> has  been
125   //! modified.  In this case,  <C> is the new geometric
126   //! support of the  edge, <L> the  new location, <Tol>
127   //! the         new    tolerance.   Otherwise, returns
128   //! Standard_False,    and  <C>,  <L>,   <Tol> are not
129   //! significant.
130   Standard_EXPORT Standard_Boolean NewCurve (const TopoDS_Edge& E, Handle(Geom_Curve)& C, TopLoc_Location& L, Standard_Real& Tol) Standard_OVERRIDE;
131   
132   //! Returns  Standard_True if the  vertex <V> has been
133   //! modified.  In this  case, <P> is the new geometric
134   //! support of the vertex,   <Tol> the new  tolerance.
135   //! Otherwise, returns Standard_False, and <P>,  <Tol>
136   //! are not significant.
137   Standard_EXPORT Standard_Boolean NewPoint (const TopoDS_Vertex& V, gp_Pnt& P, Standard_Real& Tol) Standard_OVERRIDE;
138   
139   //! Returns Standard_True if  the edge  <E> has a  new
140   //! curve on surface on the face <F>.In this case, <C>
141   //! is the new geometric support of  the edge, <L> the
142   //! new location, <Tol> the new tolerance.
143   //!
144   //! Otherwise, returns  Standard_False, and <C>,  <L>,
145   //! <Tol> are not significant.
146   //!
147   //! <NewE> is the new  edge created from  <E>.  <NewF>
148   //! is the new face created from <F>. They may be usefull.
149   Standard_EXPORT Standard_Boolean NewCurve2d (const TopoDS_Edge& E, const TopoDS_Face& F, const TopoDS_Edge& NewE, const TopoDS_Face& NewF, Handle(Geom2d_Curve)& C, Standard_Real& Tol) Standard_OVERRIDE;
150   
151   //! Returns Standard_True if the Vertex  <V> has a new
152   //! parameter on the  edge <E>. In  this case,  <P> is
153   //! the parameter,    <Tol>  the     new    tolerance.
154   //! Otherwise, returns Standard_False, and <P>,  <Tol>
155   //! are not significant.
156   Standard_EXPORT Standard_Boolean NewParameter (const TopoDS_Vertex& V, const TopoDS_Edge& E, Standard_Real& P, Standard_Real& Tol) Standard_OVERRIDE;
157   
158   //! Returns the  continuity of  <NewE> between <NewF1>
159   //! and <NewF2>.
160   //!
161   //! <NewE> is the new  edge created from <E>.  <NewF1>
162   //! (resp. <NewF2>) is the new  face created from <F1>
163   //! (resp. <F2>).
164   Standard_EXPORT GeomAbs_Shape Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, const TopoDS_Edge& NewE, const TopoDS_Face& NewF1, const TopoDS_Face& NewF2) Standard_OVERRIDE;
165
166
167
168
169   DEFINE_STANDARD_RTTIEXT(Draft_Modification,BRepTools_Modification)
170
171 protected:
172
173
174
175
176 private:
177
178   
179   Standard_EXPORT Standard_Boolean InternalAdd (const TopoDS_Face& F, const gp_Dir& Direction, const Standard_Real Angle, const gp_Pln& NeutralPlane, const Standard_Boolean Flag = Standard_True);
180   
181   Standard_EXPORT Standard_Boolean Propagate();
182   
183   Standard_EXPORT Handle(Geom_Curve) NewCurve (const Handle(Geom_Curve)& C, const Handle(Geom_Surface)& S, const TopAbs_Orientation OriS, const gp_Dir& Direction, const Standard_Real Angle, const gp_Pln& NeutralPlane, const Standard_Boolean Flag = Standard_True);
184   
185   Standard_EXPORT Handle(Geom_Surface) NewSurface (const Handle(Geom_Surface)& S, const TopAbs_Orientation OriS, const gp_Dir& Direction, const Standard_Real Angle, const gp_Pln& NeutralPlane);
186
187   Draft_IndexedDataMapOfFaceFaceInfo myFMap;
188   Draft_IndexedDataMapOfEdgeEdgeInfo myEMap;
189   Draft_IndexedDataMapOfVertexVertexInfo myVMap;
190   Standard_Boolean myComp;
191   TopoDS_Shape myShape;
192   TopoDS_Shape badShape;
193   Draft_ErrorStatus errStat;
194   TopoDS_Face curFace;
195   TopTools_ListOfShape conneF;
196   TopTools_IndexedDataMapOfShapeListOfShape myEFMap;
197
198
199 };
200
201
202
203
204
205
206
207 #endif // _Draft_Modification_HeaderFile