60d50a9df39cdeeda96bd6fc6a0c17a3f90979cb
[occt.git] / src / IntPatch / IntPatch_WLine.hxx
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.
66     void AddVertex (const IntPatch_Point& Pnt);
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.
82     Standard_Integer NbPnts() const Standard_OVERRIDE;
83   
84   //! Returns the intersection point of range Index.
85     const IntSurf_PntOn2S& Point (const Standard_Integer Index) const Standard_OVERRIDE;
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   
111     Standard_Integer NbVertex() const;
112   
113   //! Returns the vertex of range Index on the line.
114     const IntPatch_Point& Vertex (const Standard_Integer Index) const;
115   
116   //! Set the parameters of all the vertex on the line.
117   //! if a vertex is already in the line,
118   //! its parameter is modified
119   //! else a new point in the line is inserted.
120   Standard_EXPORT void ComputeVertexParameters (const Standard_Real Tol, const Standard_Boolean hasBeenAdded = Standard_False);
121   
122   Standard_EXPORT Handle(IntSurf_LineOn2S) Curve() const;
123   
124   Standard_EXPORT Standard_Boolean IsOutSurf1Box (const gp_Pnt2d& P1);
125   
126   Standard_EXPORT Standard_Boolean IsOutSurf2Box (const gp_Pnt2d& P1);
127   
128   Standard_EXPORT Standard_Boolean IsOutBox (const gp_Pnt& P);
129   
130   Standard_EXPORT void SetPeriod (const Standard_Real pu1, const Standard_Real pv1, const Standard_Real pu2, const Standard_Real pv2);
131   
132   Standard_EXPORT Standard_Real U1Period() const;
133   
134   Standard_EXPORT Standard_Real V1Period() const;
135   
136   Standard_EXPORT Standard_Real U2Period() const;
137   
138   Standard_EXPORT Standard_Real V2Period() const;
139   
140   Standard_EXPORT void SetArcOnS1 (const Handle(Adaptor2d_HCurve2d)& A);
141   
142   Standard_EXPORT Standard_Boolean HasArcOnS1() const;
143   
144   Standard_EXPORT const Handle(Adaptor2d_HCurve2d)& GetArcOnS1() const;
145   
146   Standard_EXPORT void SetArcOnS2 (const Handle(Adaptor2d_HCurve2d)& A);
147   
148   Standard_EXPORT Standard_Boolean HasArcOnS2() const;
149   
150   Standard_EXPORT const Handle(Adaptor2d_HCurve2d)& GetArcOnS2() const;
151   
152   Standard_EXPORT void ClearVertexes();
153   
154   Standard_EXPORT void RemoveVertex (const Standard_Integer theIndex);
155   
156   Standard_EXPORT void InsertVertexBefore (const Standard_Integer theIndex, const IntPatch_Point& thePnt);
157   
158   //! if (theMode == 0) then prints the information about WLine
159   //! if (theMode == 1) then prints the list of 3d-points
160   //! if (theMode == 2) then prints the list of 2d-points on the 1st surface
161   //! Otherwise,             prints list of 2d-points on the 2nd surface
162   Standard_EXPORT void Dump(const Standard_Integer theMode) const;
163
164
165
166
167   DEFINE_STANDARD_RTTIEXT(IntPatch_WLine,IntPatch_PointLine)
168
169 protected:
170
171
172
173
174 private:
175
176
177   Handle(IntSurf_LineOn2S) curv;
178   Standard_Boolean fipt;
179   Standard_Boolean lapt;
180   Standard_Integer indf;
181   Standard_Integer indl;
182   IntPatch_SequenceOfPoint svtx;
183   Bnd_Box2d Buv1;
184   Bnd_Box2d Buv2;
185   Bnd_Box Bxyz;
186   Standard_Real u1period;
187   Standard_Real v1period;
188   Standard_Real u2period;
189   Standard_Real v2period;
190   Standard_Boolean hasArcOnS1;
191   Handle(Adaptor2d_HCurve2d) theArcOnS1;
192   Standard_Boolean hasArcOnS2;
193   Handle(Adaptor2d_HCurve2d) theArcOnS2;
194
195
196 };
197
198
199 #include <IntPatch_WLine.lxx>
200
201
202
203
204
205 #endif // _IntPatch_WLine_HeaderFile