42cf5bc1 |
1 | // Created on: 1991-05-27 |
2 | // Created by: Isabelle GRIGNON |
3 | // Copyright (c) 1991-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 _IntPatch_WLine_HeaderFile |
18 | #define _IntPatch_WLine_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Boolean.hxx> |
24 | #include <Standard_Integer.hxx> |
25 | #include <IntPatch_SequenceOfPoint.hxx> |
26 | #include <Bnd_Box2d.hxx> |
27 | #include <Bnd_Box.hxx> |
28 | #include <Standard_Real.hxx> |
29 | #include <IntPatch_PointLine.hxx> |
30 | #include <IntSurf_TypeTrans.hxx> |
31 | #include <IntSurf_Situation.hxx> |
32 | class IntSurf_LineOn2S; |
33 | class Adaptor2d_HCurve2d; |
34 | class Standard_OutOfRange; |
35 | class Standard_DomainError; |
36 | class IntPatch_Point; |
37 | class IntSurf_PntOn2S; |
38 | class gp_Pnt2d; |
39 | class gp_Pnt; |
40 | |
41 | |
42 | class IntPatch_WLine; |
43 | DEFINE_STANDARD_HANDLE(IntPatch_WLine, IntPatch_PointLine) |
44 | |
45 | //! Definition of set of points as a result of the intersection |
46 | //! between 2 parametrised patches. |
47 | class IntPatch_WLine : public IntPatch_PointLine |
48 | { |
49 | |
50 | public: |
51 | |
52 | |
53 | //! Creates a WLine as an intersection when the |
54 | //! transitions are In or Out. |
55 | Standard_EXPORT IntPatch_WLine(const Handle(IntSurf_LineOn2S)& Line, const Standard_Boolean Tang, const IntSurf_TypeTrans Trans1, const IntSurf_TypeTrans Trans2); |
56 | |
57 | //! Creates a WLine as an intersection when the |
58 | //! transitions are Touch. |
59 | Standard_EXPORT IntPatch_WLine(const Handle(IntSurf_LineOn2S)& Line, const Standard_Boolean Tang, const IntSurf_Situation Situ1, const IntSurf_Situation Situ2); |
60 | |
61 | //! Creates a WLine as an intersection when the |
62 | //! transitions are Undecided. |
63 | Standard_EXPORT IntPatch_WLine(const Handle(IntSurf_LineOn2S)& Line, const Standard_Boolean Tang); |
64 | |
65 | //! Adds a vertex in the list. |
d677b214 |
66 | virtual void AddVertex (const IntPatch_Point& Pnt) Standard_OVERRIDE; |
42cf5bc1 |
67 | |
68 | //! Set the Point of index <Index> in the LineOn2S |
69 | Standard_EXPORT void SetPoint (const Standard_Integer Index, const IntPatch_Point& Pnt); |
70 | |
71 | //! Replaces the element of range Index in the list |
72 | //! of points. |
73 | //! The exception OutOfRange is raised when |
74 | //! Index <= 0 or Index > NbVertex. |
75 | void Replace (const Standard_Integer Index, const IntPatch_Point& Pnt); |
76 | |
77 | void SetFirstPoint (const Standard_Integer IndFirst); |
78 | |
79 | void SetLastPoint (const Standard_Integer IndLast); |
80 | |
81 | //! Returns the number of intersection points. |
77dbd1f1 |
82 | virtual Standard_Integer NbPnts() const Standard_OVERRIDE; |
42cf5bc1 |
83 | |
84 | //! Returns the intersection point of range Index. |
77dbd1f1 |
85 | virtual const IntSurf_PntOn2S& Point (const Standard_Integer Index) const Standard_OVERRIDE; |
42cf5bc1 |
86 | |
87 | //! Returns True if the line has a known First point. |
88 | //! This point is given by the method FirstPoint(). |
89 | Standard_Boolean HasFirstPoint() const; |
90 | |
91 | //! Returns True if the line has a known Last point. |
92 | //! This point is given by the method LastPoint(). |
93 | Standard_Boolean HasLastPoint() const; |
94 | |
95 | //! Returns the Point corresponding to the FirstPoint. |
96 | const IntPatch_Point& FirstPoint() const; |
97 | |
98 | //! Returns the Point corresponding to the LastPoint. |
99 | const IntPatch_Point& LastPoint() const; |
100 | |
101 | //! Returns the Point corresponding to the FirstPoint. |
102 | //! Indfirst is the index of the first in the list |
103 | //! of vertices. |
104 | const IntPatch_Point& FirstPoint (Standard_Integer& Indfirst) const; |
105 | |
106 | //! Returns the Point corresponding to the LastPoint. |
107 | //! Indlast is the index of the last in the list |
108 | //! of vertices. |
109 | const IntPatch_Point& LastPoint (Standard_Integer& Indlast) const; |
110 | |
77dbd1f1 |
111 | //! Returns number of vertices (IntPatch_Point) of the line |
d677b214 |
112 | virtual Standard_Integer NbVertex() const Standard_OVERRIDE; |
42cf5bc1 |
113 | |
114 | //! Returns the vertex of range Index on the line. |
d677b214 |
115 | virtual const IntPatch_Point& Vertex (const Standard_Integer Index) const Standard_OVERRIDE; |
42cf5bc1 |
116 | |
117 | //! Set the parameters of all the vertex on the line. |
118 | //! if a vertex is already in the line, |
119 | //! its parameter is modified |
120 | //! else a new point in the line is inserted. |
121 | Standard_EXPORT void ComputeVertexParameters (const Standard_Real Tol, const Standard_Boolean hasBeenAdded = Standard_False); |
122 | |
77dbd1f1 |
123 | //! Returns set of intersection points |
d677b214 |
124 | Standard_EXPORT virtual Handle(IntSurf_LineOn2S) Curve() const Standard_OVERRIDE; |
42cf5bc1 |
125 | |
126 | Standard_EXPORT Standard_Boolean IsOutSurf1Box (const gp_Pnt2d& P1); |
127 | |
128 | Standard_EXPORT Standard_Boolean IsOutSurf2Box (const gp_Pnt2d& P1); |
129 | |
130 | Standard_EXPORT Standard_Boolean IsOutBox (const gp_Pnt& P); |
131 | |
132 | Standard_EXPORT void SetPeriod (const Standard_Real pu1, const Standard_Real pv1, const Standard_Real pu2, const Standard_Real pv2); |
133 | |
134 | Standard_EXPORT Standard_Real U1Period() const; |
135 | |
136 | Standard_EXPORT Standard_Real V1Period() const; |
137 | |
138 | Standard_EXPORT Standard_Real U2Period() const; |
139 | |
140 | Standard_EXPORT Standard_Real V2Period() const; |
141 | |
142 | Standard_EXPORT void SetArcOnS1 (const Handle(Adaptor2d_HCurve2d)& A); |
143 | |
144 | Standard_EXPORT Standard_Boolean HasArcOnS1() const; |
145 | |
146 | Standard_EXPORT const Handle(Adaptor2d_HCurve2d)& GetArcOnS1() const; |
147 | |
148 | Standard_EXPORT void SetArcOnS2 (const Handle(Adaptor2d_HCurve2d)& A); |
149 | |
150 | Standard_EXPORT Standard_Boolean HasArcOnS2() const; |
151 | |
152 | Standard_EXPORT const Handle(Adaptor2d_HCurve2d)& GetArcOnS2() const; |
153 | |
77dbd1f1 |
154 | //! Removes vertices from the line (i.e. cleans svtx member) |
d677b214 |
155 | virtual void ClearVertexes() Standard_OVERRIDE; |
42cf5bc1 |
156 | |
157 | Standard_EXPORT void RemoveVertex (const Standard_Integer theIndex); |
158 | |
159 | Standard_EXPORT void InsertVertexBefore (const Standard_Integer theIndex, const IntPatch_Point& thePnt); |
160 | |
eb75e31c |
161 | //! if (theMode == 0) then prints the information about WLine |
162 | //! if (theMode == 1) then prints the list of 3d-points |
163 | //! if (theMode == 2) then prints the list of 2d-points on the 1st surface |
164 | //! Otherwise, prints list of 2d-points on the 2nd surface |
165 | Standard_EXPORT void Dump(const Standard_Integer theMode) const; |
42cf5bc1 |
166 | |
716037dd |
167 | //! Allows or forbides purging of existing WLine |
168 | void EnablePurging(const Standard_Boolean theIsEnabled) |
169 | { |
170 | myIsPurgerAllowed = theIsEnabled; |
171 | } |
42cf5bc1 |
172 | |
716037dd |
173 | //! Returns TRUE if purging is allowed or forbiden for existing WLine |
174 | Standard_Boolean IsPurgingAllowed() |
175 | { |
176 | return myIsPurgerAllowed; |
177 | } |
42cf5bc1 |
178 | |
179 | |
92efcf78 |
180 | DEFINE_STANDARD_RTTIEXT(IntPatch_WLine,IntPatch_PointLine) |
42cf5bc1 |
181 | |
182 | protected: |
183 | |
184 | |
185 | |
186 | |
187 | private: |
188 | |
189 | |
190 | Handle(IntSurf_LineOn2S) curv; |
191 | Standard_Boolean fipt; |
192 | Standard_Boolean lapt; |
193 | Standard_Integer indf; |
194 | Standard_Integer indl; |
195 | IntPatch_SequenceOfPoint svtx; |
196 | Bnd_Box2d Buv1; |
197 | Bnd_Box2d Buv2; |
198 | Bnd_Box Bxyz; |
199 | Standard_Real u1period; |
200 | Standard_Real v1period; |
201 | Standard_Real u2period; |
202 | Standard_Real v2period; |
203 | Standard_Boolean hasArcOnS1; |
204 | Handle(Adaptor2d_HCurve2d) theArcOnS1; |
205 | Standard_Boolean hasArcOnS2; |
206 | Handle(Adaptor2d_HCurve2d) theArcOnS2; |
716037dd |
207 | Standard_Boolean myIsPurgerAllowed; |
42cf5bc1 |
208 | |
209 | |
210 | }; |
211 | |
212 | |
213 | #include <IntPatch_WLine.lxx> |
214 | |
215 | |
216 | |
217 | |
218 | |
219 | #endif // _IntPatch_WLine_HeaderFile |