0027282: [Regression to 6.9.1] smesh/bugs_00/A6: Cut produces an empty shape
[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;
eee615ad 125
126 //! Returns the vertex of range Index on the line.
127 virtual IntPatch_Point& ChangeVertex (const Standard_Integer Index) Standard_OVERRIDE;
42cf5bc1 128
eee615ad 129 //! Removes single vertex from the line
130 virtual void RemoveVertex (const Standard_Integer theIndex) Standard_OVERRIDE;
131
42cf5bc1 132 Standard_Boolean HasPolygon() const;
133
134 //! Returns the number of intersection points.
77dbd1f1 135 virtual Standard_Integer NbPnts() const Standard_OVERRIDE;
42cf5bc1 136
137 //! Returns the intersection point of range Index.
77dbd1f1 138 virtual const IntSurf_PntOn2S& Point (const Standard_Integer Index) const Standard_OVERRIDE;
42cf5bc1 139
140 //! Set the Point of index <Index> in the LineOn2S
141 Standard_EXPORT void SetPoint (const Standard_Integer Index, const IntPatch_Point& Pnt);
142
143 //! Set the parameters of all the vertex on the line.
144 //! if a vertex is already in the line,
145 //! its parameter is modified
146 //! else a new point in the line is inserted.
147 Standard_EXPORT void ComputeVertexParameters (const Standard_Real Tol);
148
77dbd1f1 149 //! Returns set of intersection points
d677b214 150 Standard_EXPORT virtual Handle(IntSurf_LineOn2S) Curve() const Standard_OVERRIDE;
77dbd1f1 151
152 //! Removes vertices from the line (i.e. cleans svtx member)
d677b214 153 virtual void ClearVertexes() Standard_OVERRIDE
77dbd1f1 154 {
155 svtx.Clear();
156 }
157
158 void SetCurve(const Handle(IntSurf_LineOn2S)& theNewCurve)
159 {
160 curv = theNewCurve;
161 }
162
163 //! if (theMode == 0) then prints the information about WLine
164 //! if (theMode == 1) then prints the list of 3d-points
165 //! if (theMode == 2) then prints the list of 2d-points on the 1st surface
166 //! Otherwise, prints list of 2d-points on the 2nd surface
167 Standard_EXPORT void Dump(const Standard_Integer theMode) const;
42cf5bc1 168
92efcf78 169 DEFINE_STANDARD_RTTIEXT(IntPatch_RLine,IntPatch_PointLine)
42cf5bc1 170
171protected:
172
173
174
175
176private:
177
178
179 Handle(Adaptor2d_HCurve2d) theArcOnS1;
180 Handle(Adaptor2d_HCurve2d) theArcOnS2;
181 Standard_Boolean onS1;
182 Standard_Boolean onS2;
183 Standard_Real ParamInf1;
184 Standard_Real ParamSup1;
185 Standard_Real ParamInf2;
186 Standard_Real ParamSup2;
187 Handle(IntSurf_LineOn2S) curv;
188 Standard_Boolean fipt;
189 Standard_Boolean lapt;
190 Standard_Integer indf;
191 Standard_Integer indl;
192 IntPatch_SequenceOfPoint svtx;
193
194
195};
196
197
198#include <IntPatch_RLine.lxx>
199
200
201
202
203
204#endif // _IntPatch_RLine_HeaderFile