0027179: The algorithm of sharing edges in Boolean operation should be improved
[occt.git] / src / IntPatch / IntPatch_RLine.hxx
CommitLineData
42cf5bc1 1// Created on: 1992-04-06
2// Created by: Jacques GOUSSARD
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 _IntPatch_RLine_HeaderFile
18#define _IntPatch_RLine_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
23#include <Standard_Boolean.hxx>
24#include <Standard_Real.hxx>
25#include <Standard_Integer.hxx>
26#include <IntPatch_SequenceOfPoint.hxx>
27#include <IntPatch_PointLine.hxx>
28#include <IntSurf_TypeTrans.hxx>
29#include <IntSurf_Situation.hxx>
30class Adaptor2d_HCurve2d;
31class IntSurf_LineOn2S;
32class Standard_DomainError;
33class Standard_OutOfRange;
34class IntPatch_Point;
35class IntSurf_PntOn2S;
36
37
38class IntPatch_RLine;
39DEFINE_STANDARD_HANDLE(IntPatch_RLine, IntPatch_PointLine)
40
41//! Implementation of an intersection line described by a
42//! restriction line on one of the surfaces.
43class IntPatch_RLine : public IntPatch_PointLine
44{
45
46public:
47
48
49 //! Creates a restriction as an intersection line
50 //! when the transitions are In or Out.
51 Standard_EXPORT IntPatch_RLine(const Standard_Boolean Tang, const IntSurf_TypeTrans Trans1, const IntSurf_TypeTrans Trans2);
52
53 //! Creates a restriction as an intersection line
54 //! when the transitions are Touch.
55 Standard_EXPORT IntPatch_RLine(const Standard_Boolean Tang, const IntSurf_Situation Situ1, const IntSurf_Situation Situ2);
56
57 //! Creates a restriction as an intersection line
58 //! when the transitions are Undecided.
59 Standard_EXPORT IntPatch_RLine(const Standard_Boolean Tang);
60
61 //! To add a vertex in the list.
d677b214 62 virtual void AddVertex (const IntPatch_Point& Pnt) Standard_OVERRIDE;
42cf5bc1 63
64 //! Replaces the element of range Index in the list
65 //! of points.
66 void Replace (const Standard_Integer Index, const IntPatch_Point& Pnt);
67
68 void SetFirstPoint (const Standard_Integer IndFirst);
69
70 void SetLastPoint (const Standard_Integer IndLast);
71
72 void Add (const Handle(IntSurf_LineOn2S)& L);
73
74 //! Returns True if the intersection is on the domain of the
75 //! first patch.
76 //! Returns False if the intersection is on the domain of
77 //! the second patch.
78 Standard_Boolean IsArcOnS1() const;
79
80 //! Returns True if the intersection is on the domain of the
81 //! first patch.
82 //! Returns False if the intersection is on the domain of
83 //! the second patch.
84 Standard_Boolean IsArcOnS2() const;
85
86 Standard_EXPORT void SetArcOnS1 (const Handle(Adaptor2d_HCurve2d)& A);
87
88 Standard_EXPORT void SetArcOnS2 (const Handle(Adaptor2d_HCurve2d)& A);
89
90 Standard_EXPORT void SetParamOnS1 (const Standard_Real p1, const Standard_Real p2);
91
92 Standard_EXPORT void SetParamOnS2 (Standard_Real& p1, Standard_Real& p2);
93
94 //! Returns the concerned arc.
95 const Handle(Adaptor2d_HCurve2d)& ArcOnS1() const;
96
97 //! Returns the concerned arc.
98 const Handle(Adaptor2d_HCurve2d)& ArcOnS2() const;
99
100 Standard_EXPORT void ParamOnS1 (Standard_Real& p1, Standard_Real& p2) const;
101
102 Standard_EXPORT void ParamOnS2 (Standard_Real& p1, Standard_Real& p2) const;
103
104 //! Returns True if the line has a known First point.
105 //! This point is given by the method FirstPoint().
106 Standard_Boolean HasFirstPoint() const;
107
108 //! Returns True if the line has a known Last point.
109 //! This point is given by the method LastPoint().
110 Standard_Boolean HasLastPoint() const;
111
112 //! Returns the IntPoint corresponding to the FirstPoint.
113 //! An exception is raised when HasFirstPoint returns False.
114 const IntPatch_Point& FirstPoint() const;
115
116 //! Returns the IntPoint corresponding to the LastPoint.
117 //! An exception is raised when HasLastPoint returns False.
118 const IntPatch_Point& LastPoint() const;
119
77dbd1f1 120 //! Returns number of vertices (IntPatch_Point) of the line
d677b214 121 virtual Standard_Integer NbVertex() const Standard_OVERRIDE;
42cf5bc1 122
123 //! Returns the vertex of range Index on the line.
d677b214 124 virtual const IntPatch_Point& Vertex (const Standard_Integer Index) const Standard_OVERRIDE;
42cf5bc1 125
126 Standard_Boolean HasPolygon() const;
127
128 //! Returns the number of intersection points.
77dbd1f1 129 virtual Standard_Integer NbPnts() const Standard_OVERRIDE;
42cf5bc1 130
131 //! Returns the intersection point of range Index.
77dbd1f1 132 virtual const IntSurf_PntOn2S& Point (const Standard_Integer Index) const Standard_OVERRIDE;
42cf5bc1 133
134 //! Set the Point of index <Index> in the LineOn2S
135 Standard_EXPORT void SetPoint (const Standard_Integer Index, const IntPatch_Point& Pnt);
136
137 //! Set the parameters of all the vertex on the line.
138 //! if a vertex is already in the line,
139 //! its parameter is modified
140 //! else a new point in the line is inserted.
141 Standard_EXPORT void ComputeVertexParameters (const Standard_Real Tol);
142
77dbd1f1 143 //! Returns set of intersection points
d677b214 144 Standard_EXPORT virtual Handle(IntSurf_LineOn2S) Curve() const Standard_OVERRIDE;
77dbd1f1 145
146 //! Removes vertices from the line (i.e. cleans svtx member)
d677b214 147 virtual void ClearVertexes() Standard_OVERRIDE
77dbd1f1 148 {
149 svtx.Clear();
150 }
151
152 void SetCurve(const Handle(IntSurf_LineOn2S)& theNewCurve)
153 {
154 curv = theNewCurve;
155 }
156
157 //! if (theMode == 0) then prints the information about WLine
158 //! if (theMode == 1) then prints the list of 3d-points
159 //! if (theMode == 2) then prints the list of 2d-points on the 1st surface
160 //! Otherwise, prints list of 2d-points on the 2nd surface
161 Standard_EXPORT void Dump(const Standard_Integer theMode) const;
42cf5bc1 162
92efcf78 163 DEFINE_STANDARD_RTTIEXT(IntPatch_RLine,IntPatch_PointLine)
42cf5bc1 164
165protected:
166
167
168
169
170private:
171
172
173 Handle(Adaptor2d_HCurve2d) theArcOnS1;
174 Handle(Adaptor2d_HCurve2d) theArcOnS2;
175 Standard_Boolean onS1;
176 Standard_Boolean onS2;
177 Standard_Real ParamInf1;
178 Standard_Real ParamSup1;
179 Standard_Real ParamInf2;
180 Standard_Real ParamSup2;
181 Handle(IntSurf_LineOn2S) curv;
182 Standard_Boolean fipt;
183 Standard_Boolean lapt;
184 Standard_Integer indf;
185 Standard_Integer indl;
186 IntPatch_SequenceOfPoint svtx;
187
188
189};
190
191
192#include <IntPatch_RLine.lxx>
193
194
195
196
197
198#endif // _IntPatch_RLine_HeaderFile