0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / IntCurvesFace / IntCurvesFace_ShapeIntersector.hxx
1 // Created on: 1998-01-27
2 // Created by: Laurent BUCHARD
3 // Copyright (c) 1998-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 _IntCurvesFace_ShapeIntersector_HeaderFile
18 #define _IntCurvesFace_ShapeIntersector_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Integer.hxx>
26 #include <Standard_Address.hxx>
27 #include <BRepTopAdaptor_SeqOfPtr.hxx>
28 #include <TColStd_SequenceOfInteger.hxx>
29 #include <TColStd_SequenceOfReal.hxx>
30 #include <Standard_Real.hxx>
31 #include <IntCurveSurface_TransitionOnCurve.hxx>
32 #include <TopAbs_State.hxx>
33 class TopoDS_Shape;
34 class gp_Lin;
35 class Adaptor3d_HCurve;
36 class gp_Pnt;
37 class TopoDS_Face;
38
39
40
41 class IntCurvesFace_ShapeIntersector 
42 {
43 public:
44
45   DEFINE_STANDARD_ALLOC
46
47   
48   Standard_EXPORT IntCurvesFace_ShapeIntersector();
49   
50   Standard_EXPORT void Load (const TopoDS_Shape& Sh, const Standard_Real Tol);
51   
52   //! Perform the intersection between the
53   //! segment L and the loaded shape.
54   //!
55   //! PInf is the smallest parameter on the line
56   //! PSup is the highest  parammter on the line
57   //!
58   //! For an infinite line PInf and PSup can be
59   //! +/- RealLast.
60   Standard_EXPORT void Perform (const gp_Lin& L, const Standard_Real PInf, const Standard_Real PSup);
61   
62   //! Perform the intersection between the
63   //! segment L and the loaded shape.
64   //!
65   //! PInf is the smallest parameter on the line
66   //! PSup is the highest  parammter on the line
67   //!
68   //! For an infinite line PInf and PSup can be
69   //! +/- RealLast.
70   Standard_EXPORT void PerformNearest (const gp_Lin& L, const Standard_Real PInf, const Standard_Real PSup);
71   
72   //! same method for a HCurve from Adaptor3d.
73   //! PInf an PSup can also be - and + INF.
74   Standard_EXPORT void Perform (const Handle(Adaptor3d_HCurve)& HCu, const Standard_Real PInf, const Standard_Real PSup);
75   
76   //! True is returned when the intersection have been computed.
77     Standard_Boolean IsDone() const;
78   
79     Standard_Integer NbPnt() const;
80   
81   //! Returns the U parameter of the ith intersection point
82   //! on the surface.
83     Standard_Real UParameter (const Standard_Integer I) const;
84   
85   //! Returns the V parameter of the ith intersection point
86   //! on the surface.
87     Standard_Real VParameter (const Standard_Integer I) const;
88   
89   //! Returns the parameter of the ith intersection point
90   //! on the line.
91     Standard_Real WParameter (const Standard_Integer I) const;
92   
93   //! Returns the geometric point of the ith intersection
94   //! between the line and the surface.
95     const gp_Pnt& Pnt (const Standard_Integer I) const;
96   
97   //! Returns the ith transition of the line on the surface.
98     IntCurveSurface_TransitionOnCurve Transition (const Standard_Integer I) const;
99   
100   //! Returns the ith state of the point on the face.
101   //! The values can be either TopAbs_IN
102   //! ( the point is in the face)
103   //! or TopAbs_ON
104   //! ( the point is on a boudary of the face).
105     TopAbs_State State (const Standard_Integer I) const;
106   
107   //! Returns the significant face used to determine
108   //! the intersection.
109     const TopoDS_Face& Face (const Standard_Integer I) const;
110   
111   //! Internal method. Sort the result on the Curve
112   //! parameter.
113   Standard_EXPORT void SortResult();
114   
115   Standard_EXPORT void Destroy();
116 ~IntCurvesFace_ShapeIntersector()
117 {
118   Destroy();
119 }
120
121
122
123
124 protected:
125
126
127
128
129
130 private:
131
132
133
134   Standard_Boolean done;
135   Standard_Integer nbfaces;
136   Standard_Address PtrJetons;
137   Standard_Address PtrJetonsIndex;
138   BRepTopAdaptor_SeqOfPtr PtrIntersector;
139   TColStd_SequenceOfInteger IndexPt;
140   TColStd_SequenceOfInteger IndexFace;
141   TColStd_SequenceOfInteger IndexIntPnt;
142   TColStd_SequenceOfReal IndexPar;
143
144
145 };
146
147
148 #include <IntCurvesFace_ShapeIntersector.lxx>
149
150
151
152
153
154 #endif // _IntCurvesFace_ShapeIntersector_HeaderFile