1ef01f8466a91e6e74ae904d42e53275ca2ee737
[occt.git] / src / BRepAlgo / BRepAlgo_NormalProjection.hxx
1 // Created on: 1997-10-13
2 // Created by: Roman BORISOV
3 // Copyright (c) 1997-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 _BRepAlgo_NormalProjection_HeaderFile
18 #define _BRepAlgo_NormalProjection_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <TopoDS_Shape.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <Standard_Real.hxx>
27 #include <GeomAbs_Shape.hxx>
28 #include <Standard_Integer.hxx>
29 #include <TopTools_DataMapOfShapeShape.hxx>
30 #include <TopTools_DataMapOfShapeListOfShape.hxx>
31 #include <TopTools_ListOfShape.hxx>
32 class Standard_ConstructionError;
33 class Standard_NoSuchObject;
34 class StdFail_NotDone;
35 class TopoDS_Shape;
36 class TopoDS_Edge;
37 class Adaptor3d_Curve;
38
39
40 //! This class makes the projection  of a wire on a
41 //! shape.
42 class BRepAlgo_NormalProjection 
43 {
44 public:
45
46   DEFINE_STANDARD_ALLOC
47
48   
49   Standard_EXPORT BRepAlgo_NormalProjection();
50   
51   Standard_EXPORT BRepAlgo_NormalProjection(const TopoDS_Shape& S);
52   
53   Standard_EXPORT void Init (const TopoDS_Shape& S);
54   
55   //! Add an edge or a wire to the list of shape to project
56   Standard_EXPORT void Add (const TopoDS_Shape& ToProj);
57   
58   //! Set the parameters  used  for computation
59   //! Tol3d is the requiered  tolerance between the  3d projected
60   //! curve  and its 2d representation
61   //! InternalContinuity  is the order of constraints
62   //! used for  approximation.
63   //! MaxDeg and MaxSeg are the maximum degree and the maximum
64   //! number of segment for BSpline resulting of an approximation.
65   Standard_EXPORT void SetParams (const Standard_Real Tol3D, const Standard_Real Tol2D, const GeomAbs_Shape InternalContinuity, const Standard_Integer MaxDegree, const Standard_Integer MaxSeg);
66   
67   //! Set the parameters  used  for computation
68   //! in their default values
69   Standard_EXPORT void SetDefaultParams();
70   
71   //! Sets the maximum distance between target shape and
72   //! shape to project. If this condition is not satisfied then
73   //! corresponding part of solution is discarded.
74   //! if MaxDist < 0 then this method does not affect the algorithm
75   Standard_EXPORT void SetMaxDistance (const Standard_Real MaxDist);
76   
77   //! if  With3d = Standard_False the 3dcurve is not computed
78   //! the  initial 3dcurve is kept  to  build the  resulting edges.
79   Standard_EXPORT void Compute3d (const Standard_Boolean With3d = Standard_True);
80   
81   //! Manage  limitation  of  projected  edges.
82   Standard_EXPORT void SetLimit (const Standard_Boolean FaceBoundaries = Standard_True);
83   
84   //! Builds the result as a  compound.
85   Standard_EXPORT void Build();
86   
87   Standard_EXPORT Standard_Boolean IsDone() const;
88   
89   //! returns the result
90   Standard_EXPORT const TopoDS_Shape& Projection() const;
91   
92   //! For a resulting edge, returns the corresponding initial edge.
93   Standard_EXPORT const TopoDS_Shape& Ancestor (const TopoDS_Edge& E) const;
94   
95   //! For a projected edge, returns the corresponding initial face.
96   Standard_EXPORT const TopoDS_Shape& Couple (const TopoDS_Edge& E) const;
97   
98   //! Returns the  list   of shapes generated   from the
99   //! shape <S>.
100   Standard_EXPORT const TopTools_ListOfShape& Generated (const TopoDS_Shape& S);
101   
102   Standard_EXPORT Standard_Boolean IsElementary (const Adaptor3d_Curve& C) const;
103   
104   //! build the result as a list of wire if possible in --
105   //! a first returns a wire only if there is only a wire.
106   Standard_EXPORT Standard_Boolean BuildWire (TopTools_ListOfShape& Liste) const;
107
108
109
110
111 protected:
112
113
114
115
116
117 private:
118
119
120
121   TopoDS_Shape myShape;
122   Standard_Boolean myIsDone;
123   Standard_Real myTol3d;
124   Standard_Real myTol2d;
125   Standard_Real myMaxDist;
126   Standard_Boolean myWith3d;
127   GeomAbs_Shape myContinuity;
128   Standard_Integer myMaxDegree;
129   Standard_Integer myMaxSeg;
130   Standard_Boolean myFaceBounds;
131   TopoDS_Shape myToProj;
132   TopTools_DataMapOfShapeShape myAncestorMap;
133   TopTools_DataMapOfShapeShape myCorresp;
134   TopTools_DataMapOfShapeListOfShape myDescendants;
135   TopoDS_Shape myRes;
136
137
138 };
139
140
141
142
143
144
145
146 #endif // _BRepAlgo_NormalProjection_HeaderFile