42cf5bc1 |
1 | // Created on: 1992-04-27 |
2 | // Created by: Laurent BUCHARD |
3 | // Copyright (c) 1992-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 _IntRes2d_Intersection_HeaderFile |
18 | #define _IntRes2d_Intersection_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Boolean.hxx> |
25 | #include <IntRes2d_SequenceOfIntersectionPoint.hxx> |
26 | #include <IntRes2d_SequenceOfIntersectionSegment.hxx> |
27 | #include <Standard_Integer.hxx> |
28 | #include <Standard_Real.hxx> |
29 | class StdFail_NotDone; |
30 | class Standard_OutOfRange; |
31 | class IntRes2d_IntersectionPoint; |
32 | class IntRes2d_IntersectionSegment; |
33 | |
34 | |
35 | //! Defines the root class of all the Intersections |
36 | //! between two 2D-Curves, and provides all the methods |
37 | //! about the results of the Intersections Algorithms. |
38 | class IntRes2d_Intersection |
39 | { |
40 | public: |
41 | |
42 | DEFINE_STANDARD_ALLOC |
43 | |
44 | |
45 | //! returns TRUE when the computation was successful. |
46 | Standard_Boolean IsDone() const; |
47 | |
48 | //! Returns TRUE if there is no intersection between the |
49 | //! given arguments. |
50 | //! The exception NotDone is raised if IsDone returns FALSE. |
51 | Standard_Boolean IsEmpty() const; |
52 | |
53 | //! This function returns the number of intersection |
54 | //! points between the 2 curves. |
55 | //! The exception NotDone is raised if IsDone returns FALSE. |
56 | Standard_Integer NbPoints() const; |
57 | |
58 | //! This function returns the intersection point |
59 | //! of range N; |
60 | //! The exception NotDone is raised if IsDone returns FALSE. |
61 | //! The exception OutOfRange is raised if (N <= 0) |
62 | //! or (N > NbPoints). |
63 | const IntRes2d_IntersectionPoint& Point (const Standard_Integer N) const; |
64 | |
65 | //! This function returns the number of intersection |
66 | //! segments between the two curves. |
67 | //! The exception NotDone is raised if IsDone returns FALSE. |
68 | Standard_Integer NbSegments() const; |
69 | |
70 | //! This function returns the intersection segment |
71 | //! of range N; |
72 | //! The exception NotDone is raised if IsDone returns FALSE. |
73 | //! The exception OutOfRange is raised if (N <= 0) |
74 | //! or (N > NbPoints). |
75 | const IntRes2d_IntersectionSegment& Segment (const Standard_Integer N) const; |
76 | |
77 | void SetReversedParameters (const Standard_Boolean Reverseflag); |
78 | |
79 | |
80 | |
81 | |
82 | protected: |
83 | |
84 | |
85 | //! Empty constructor. |
86 | IntRes2d_Intersection(); |
87 | |
88 | IntRes2d_Intersection(const IntRes2d_Intersection& Other); |
6928e351 |
89 | |
158f2931 |
90 | //! Assignment |
91 | IntRes2d_Intersection& operator= (const IntRes2d_Intersection& theOther) |
92 | { |
93 | done = theOther.done; |
94 | reverse = theOther.reverse; |
95 | lpnt = theOther.lpnt; |
96 | lseg = theOther.lseg; |
97 | return *this; |
98 | } |
99 | |
6928e351 |
100 | //! Destructor is protected, for safe inheritance |
101 | ~IntRes2d_Intersection () {} |
42cf5bc1 |
102 | |
103 | Standard_EXPORT void SetValues (const IntRes2d_Intersection& Inter); |
104 | |
105 | Standard_EXPORT void Append (const IntRes2d_Intersection& Inter, const Standard_Real FirstParam1, const Standard_Real LastParam1, const Standard_Real FirstParam2, const Standard_Real LastParam2); |
106 | |
107 | void Append (const IntRes2d_IntersectionSegment& Seg); |
108 | |
109 | void Append (const IntRes2d_IntersectionPoint& Pnt); |
110 | |
111 | Standard_EXPORT void Insert (const IntRes2d_IntersectionPoint& Pnt); |
112 | |
113 | void ResetFields(); |
114 | |
115 | Standard_Boolean ReversedParameters() const; |
116 | |
158f2931 |
117 | protected: |
42cf5bc1 |
118 | |
42cf5bc1 |
119 | IntRes2d_SequenceOfIntersectionPoint lpnt; |
120 | IntRes2d_SequenceOfIntersectionSegment lseg; |
158f2931 |
121 | Standard_Boolean done; |
122 | Standard_Boolean reverse; |
42cf5bc1 |
123 | |
124 | }; |
125 | |
126 | |
127 | #include <IntRes2d_Intersection.lxx> |
128 | |
129 | |
130 | |
131 | |
132 | |
133 | #endif // _IntRes2d_Intersection_HeaderFile |