0029807: [Regression to 7.0.0] Impossible to cut cone from prism
[occt.git] / src / IntPatch / IntPatch_TheIWLineOfTheIWalking.hxx
1 // Created on: 1992-05-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_TheIWLineOfTheIWalking_HeaderFile
18 #define _IntPatch_TheIWLineOfTheIWalking_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <IntSurf_SequenceOfCouple.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Integer.hxx>
26 #include <IntSurf_PathPoint.hxx>
27 #include <gp_Vec.hxx>
28 #include <Standard_Transient.hxx>
29 #include <IntSurf_Allocator.hxx>
30 class IntSurf_LineOn2S;
31 class Standard_OutOfRange;
32 class Standard_DomainError;
33 class IntSurf_PathPoint;
34 class IntSurf_PntOn2S;
35 class gp_Vec;
36
37
38 class IntPatch_TheIWLineOfTheIWalking;
39 DEFINE_STANDARD_HANDLE(IntPatch_TheIWLineOfTheIWalking, Standard_Transient)
40
41
42 class IntPatch_TheIWLineOfTheIWalking : public Standard_Transient
43 {
44
45 public:
46
47   
48   Standard_EXPORT IntPatch_TheIWLineOfTheIWalking(const IntSurf_Allocator& theAllocator = 0);
49   
50   //! reverse the points in the line. Hasfirst, HasLast are kept.
51   Standard_EXPORT void Reverse();
52   
53   //! Cut the line at the point of rank Index.
54     void Cut (const Standard_Integer Index);
55   
56   //! Add a point in the line.
57     void AddPoint (const IntSurf_PntOn2S& P);
58   
59     void AddStatusFirst (const Standard_Boolean Closed, const Standard_Boolean HasFirst);
60   
61     void AddStatusFirst (const Standard_Boolean Closed, const Standard_Boolean HasLast, const Standard_Integer Index, const IntSurf_PathPoint& P);
62   
63     void AddStatusFirstLast (const Standard_Boolean Closed, const Standard_Boolean HasFirst, const Standard_Boolean HasLast);
64   
65     void AddStatusLast (const Standard_Boolean HasLast);
66   
67     void AddStatusLast (const Standard_Boolean HasLast, const Standard_Integer Index, const IntSurf_PathPoint& P);
68   
69   //! associer a l 'indice du point sur la ligne l'indice du point
70   //! passant dans l'iterateur de depart
71     void AddIndexPassing (const Standard_Integer Index);
72   
73     void SetTangentVector (const gp_Vec& V, const Standard_Integer Index);
74   
75     void SetTangencyAtBegining (const Standard_Boolean IsTangent);
76   
77     void SetTangencyAtEnd (const Standard_Boolean IsTangent);
78   
79   //! Returns the number of points of the line (including first
80   //! point and end point : see HasLastPoint and HasFirstPoint).
81     Standard_Integer NbPoints() const;
82   
83   //! Returns the point of range Index.
84   //! If index <= 0 or Index > NbPoints, an exception is raised.
85     const IntSurf_PntOn2S& Value (const Standard_Integer Index) const;
86   
87   //! Returns the LineOn2S contained in the walking line.
88     const Handle(IntSurf_LineOn2S)& Line() const;
89   
90   //! Returns True if the line is closed.
91     Standard_Boolean IsClosed() const;
92   
93   //! Returns True if the first point of the line is a
94   //! marching point . when is HasFirstPoint==False ,the line
95   //! begins on the natural bound of the surface.the line can be
96   //! too long
97     Standard_Boolean HasFirstPoint() const;
98   
99   //! Returns True if the end point of the line is a
100   //! marching point (Point from IntWS).
101   //! when is HasFirstPoint==False ,the line ends
102   //! on the natural bound of the surface.the line can be
103   //! too long.
104     Standard_Boolean HasLastPoint() const;
105   
106   //! Returns the first point of the line when it is a
107   //! marching point.
108   //! An exception is raised if HasFirstPoint returns False.
109     const IntSurf_PathPoint& FirstPoint() const;
110   
111   //! Returns the Index of first point of the line when it is a
112   //! marching point.This index is the index in the
113   //! PointStartIterator.
114   //! An exception is raised if HasFirstPoint returns False.
115     Standard_Integer FirstPointIndex() const;
116   
117   //! Returns the last point of the line when it is a
118   //! marching point.
119   //! An exception is raised if HasLastPoint returns False.
120     const IntSurf_PathPoint& LastPoint() const;
121   
122   //! Returns the index of last point of the line when it is a
123   //! marching point.This index is the index in the
124   //! PointStartIterator.
125   //! An exception is raised if HasLastPoint returns False.
126     Standard_Integer LastPointIndex() const;
127   
128   //! returns the number of points belonging to Pnts1 which are
129   //! passing point.
130     Standard_Integer NbPassingPoint() const;
131   
132   //! returns the index of the point belonging to the line which
133   //! is associated to the passing point belonging to Pnts1
134   //! an exception is raised if Index > NbPassingPoint()
135     void PassingPoint (const Standard_Integer Index, Standard_Integer& IndexLine, Standard_Integer& IndexPnts) const;
136   
137     const gp_Vec& TangentVector (Standard_Integer& Index) const;
138   
139     Standard_Boolean IsTangentAtBegining() const;
140   
141     Standard_Boolean IsTangentAtEnd() const;
142
143
144
145
146   DEFINE_STANDARD_RTTI_INLINE(IntPatch_TheIWLineOfTheIWalking,Standard_Transient)
147
148 protected:
149
150
151
152
153 private:
154
155
156   Handle(IntSurf_LineOn2S) line;
157   IntSurf_SequenceOfCouple couple;
158   Standard_Boolean closed;
159   Standard_Boolean hasFirst;
160   Standard_Boolean hasLast;
161   Standard_Integer firstIndex;
162   Standard_Integer lastIndex;
163   IntSurf_PathPoint theFirstPoint;
164   IntSurf_PathPoint theLastPoint;
165   Standard_Integer indextg;
166   gp_Vec vcttg;
167   Standard_Boolean istgtbeg;
168   Standard_Boolean istgtend;
169
170
171 };
172
173 #define TheStartPoint IntSurf_PathPoint
174 #define TheStartPoint_hxx <IntSurf_PathPoint.hxx>
175 #define IntWalk_IWLine IntPatch_TheIWLineOfTheIWalking
176 #define IntWalk_IWLine_hxx <IntPatch_TheIWLineOfTheIWalking.hxx>
177 #define Handle_IntWalk_IWLine Handle(IntPatch_TheIWLineOfTheIWalking)
178
179 #include <IntWalk_IWLine.lxx>
180
181 #undef TheStartPoint
182 #undef TheStartPoint_hxx
183 #undef IntWalk_IWLine
184 #undef IntWalk_IWLine_hxx
185 #undef Handle_IntWalk_IWLine
186
187
188
189
190 #endif // _IntPatch_TheIWLineOfTheIWalking_HeaderFile