0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / ChFiDS / ChFiDS_Spine.hxx
CommitLineData
42cf5bc1 1// Created on: 1993-11-09
2// Created by: Laurent BOURESCHE
3// Copyright (c) 1993-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 _ChFiDS_Spine_HeaderFile
18#define _ChFiDS_Spine_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
23#include <BRepAdaptor_Curve.hxx>
24#include <Standard_Integer.hxx>
25#include <ChFiDS_State.hxx>
26#include <TopTools_SequenceOfShape.hxx>
27#include <TColStd_HArray1OfReal.hxx>
28#include <Standard_Boolean.hxx>
29#include <ChFiDS_ListOfHElSpine.hxx>
30#include <Standard_Real.hxx>
31#include <gp_Pnt.hxx>
32#include <gp_Vec.hxx>
33#include <ChFiDS_ErrorStatus.hxx>
25e59720 34#include <Standard_Transient.hxx>
42cf5bc1 35#include <GeomAbs_CurveType.hxx>
36class TopoDS_Edge;
37class ChFiDS_HElSpine;
42cf5bc1 38class gp_Lin;
39class gp_Circ;
40class TopoDS_Vertex;
41
9fd2d2c3 42// resolve name collisions with X11 headers
43#ifdef Status
44 #undef Status
45#endif
42cf5bc1 46
47class ChFiDS_Spine;
25e59720 48DEFINE_STANDARD_HANDLE(ChFiDS_Spine, Standard_Transient)
42cf5bc1 49
50//! Contains information necessary for construction of
51//! a 3D fillet or chamfer:
52//!
53//! - guideline composed of edges of the solid, tangents
54//! between them, and borders by faces tangents
55//! between them.
56//!
57//! Tools for construction of the Sp
58//! by propagation from an edge of solid
59//! are provided in the Builder of Fil3d.
60//!
61//! The Spine contains among others the
62//! information about the nature of extremities
63//! of the fillet ( on free border , on section or closed ).
64//!
65//! IMPORTANT NOTE : the guideline
66//! represented in this way is not C2, although the path
67//! claims it. Several palliative workarounds
68//! (see the methods at the end) are planned,
69//! but they are not enough. It is necessary to change
70//! the approach and double the Spine of line C2 with
71//! the known consequences for management of
72//! interactions between KPart Blend in Fil3d.
25e59720 73class ChFiDS_Spine : public Standard_Transient
42cf5bc1 74{
75
76public:
77
78
79 Standard_EXPORT ChFiDS_Spine();
80
81 Standard_EXPORT ChFiDS_Spine(const Standard_Real Tol);
82
83 //! store edges composing the guideline
84 void SetEdges (const TopoDS_Edge& E);
85
86 //! store the edge at the first position before all others
87 void PutInFirst (const TopoDS_Edge& E);
88
89 Standard_Integer NbEdges() const;
90
91 const TopoDS_Edge& Edges (const Standard_Integer I) const;
92
93 //! stores if the start of a set of edges starts on a
94 //! section of free border or forms a closed contour
95 void SetFirstStatus (const ChFiDS_State S);
96
97 //! stores if the end of a set of edges starts on a
98 //! section of free border or forms a closed contour
99 void SetLastStatus (const ChFiDS_State S);
100
101 Standard_EXPORT virtual void AppendElSpine (const Handle(ChFiDS_HElSpine)& Els);
102
103 Standard_EXPORT Handle(ChFiDS_HElSpine) ElSpine (const Standard_Integer IE) const;
104
105 Standard_EXPORT Handle(ChFiDS_HElSpine) ElSpine (const TopoDS_Edge& E) const;
106
107 Standard_EXPORT Handle(ChFiDS_HElSpine) ElSpine (const Standard_Real W) const;
108
109 Standard_EXPORT ChFiDS_ListOfHElSpine& ChangeElSpines();
110
111 Standard_EXPORT virtual void Reset (const Standard_Boolean AllData = Standard_False);
112
113 Standard_EXPORT Standard_Boolean SplitDone() const;
114
115 Standard_EXPORT void SplitDone (const Standard_Boolean B);
116
117 //! prepare the guideline depending on the edges that
118 //! are elementary arks (take parameters from
119 //! a single curvilinear abscissa); to be able to call
120 //! methods on the geometry (first,last,value,d1,d2)
121 //! it is necessary to start with preparation otherwise an
122 //! exception will be raised
123 Standard_EXPORT void Load();
124
125 Standard_EXPORT Standard_Real Resolution (const Standard_Real R3d) const;
126
127 Standard_EXPORT Standard_Boolean IsClosed() const;
128
129 Standard_EXPORT Standard_Real FirstParameter() const;
130
131 Standard_EXPORT Standard_Real LastParameter() const;
132
133 Standard_EXPORT void SetFirstParameter (const Standard_Real Par);
134
135 Standard_EXPORT void SetLastParameter (const Standard_Real Par);
136
137 //! gives the total length of all arcs before the
138 //! number IndexSp
139 Standard_EXPORT Standard_Real FirstParameter (const Standard_Integer IndexSpine) const;
140
141 //! gives the total length till the ark with number
142 //! IndexSpine (inclus)
143 Standard_EXPORT Standard_Real LastParameter (const Standard_Integer IndexSpine) const;
144
145 //! gives the length of ark with number IndexSp
146 Standard_EXPORT Standard_Real Length (const Standard_Integer IndexSpine) const;
147
148 Standard_EXPORT Standard_Boolean IsPeriodic() const;
149
150 Standard_EXPORT Standard_Real Period() const;
151
152 Standard_EXPORT Standard_Real Absc (const Standard_Real U);
153
154 Standard_EXPORT Standard_Real Absc (const Standard_Real U, const Standard_Integer I);
155
156 Standard_EXPORT void Parameter (const Standard_Real AbsC, Standard_Real& U, const Standard_Boolean Oriented = Standard_True);
157
158 Standard_EXPORT void Parameter (const Standard_Integer Index, const Standard_Real AbsC, Standard_Real& U, const Standard_Boolean Oriented = Standard_True);
159
160 Standard_EXPORT gp_Pnt Value (const Standard_Real AbsC);
161
162 Standard_EXPORT void D0 (const Standard_Real AbsC, gp_Pnt& P);
163
164 Standard_EXPORT void D1 (const Standard_Real AbsC, gp_Pnt& P, gp_Vec& V1);
165
166 Standard_EXPORT void D2 (const Standard_Real AbsC, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2);
167
168 Standard_EXPORT void SetCurrent (const Standard_Integer Index);
169
170 //! sets the current curve and returns it
171 Standard_EXPORT const BRepAdaptor_Curve& CurrentElementarySpine (const Standard_Integer Index);
172
173 Standard_Integer CurrentIndexOfElementarySpine() const;
174
175 Standard_EXPORT GeomAbs_CurveType GetType() const;
176
177 Standard_EXPORT gp_Lin Line() const;
178
179 Standard_EXPORT gp_Circ Circle() const;
180
181 //! returns if the set of edges starts on a free boundary
182 //! or if the first vertex is a breakpoint or if the set is
183 //! closed
184 ChFiDS_State FirstStatus() const;
185
186 //! returns the state at the end of the set
187 ChFiDS_State LastStatus() const;
188
189 ChFiDS_State Status (const Standard_Boolean IsFirst) const;
190
191 void SetStatus (const ChFiDS_State S, const Standard_Boolean IsFirst);
192
193 //! returns if the set of edges starts (or end) on
194 //! Tangency point.
195 Standard_Boolean IsTangencyExtremity (const Standard_Boolean IsFirst) const;
196
197 void SetTangencyExtremity (const Standard_Boolean IsTangency, const Standard_Boolean IsFirst);
198
199 Standard_EXPORT Standard_Real Absc (const TopoDS_Vertex& V) const;
200
201 Standard_EXPORT TopoDS_Vertex FirstVertex() const;
202
203 Standard_EXPORT TopoDS_Vertex LastVertex() const;
204
205 Standard_EXPORT void SetFirstTgt (const Standard_Real W);
206
207 Standard_EXPORT void SetLastTgt (const Standard_Real W);
208
209 Standard_EXPORT Standard_Boolean HasFirstTgt() const;
210
211 Standard_EXPORT Standard_Boolean HasLastTgt() const;
212
213 //! set a parameter reference for the approx.
214 Standard_EXPORT void SetReference (const Standard_Real W);
215
216 //! set a parameter reference for the approx, at the
217 //! middle of edge I.
218 Standard_EXPORT void SetReference (const Standard_Integer I);
219
220 Standard_EXPORT Standard_Integer Index (const Standard_Real W, const Standard_Boolean Forward = Standard_True) const;
221
222 Standard_EXPORT Standard_Integer Index (const TopoDS_Edge& E) const;
223
224 Standard_EXPORT void UnsetReference();
225
226 Standard_EXPORT void SetErrorStatus (const ChFiDS_ErrorStatus state);
227
228 Standard_EXPORT ChFiDS_ErrorStatus ErrorStatus() const;
229
230
231
232
25e59720 233 DEFINE_STANDARD_RTTIEXT(ChFiDS_Spine,Standard_Transient)
42cf5bc1 234
235protected:
236
237
238 Standard_Boolean splitdone;
239 ChFiDS_ListOfHElSpine elspines;
240
241
242private:
243
244
245 Standard_EXPORT void Prepare (Standard_Real& L, Standard_Integer& Index) const;
246
247 BRepAdaptor_Curve myCurve;
248 Standard_Integer indexofcurve;
249 ChFiDS_State firstState;
250 ChFiDS_State lastState;
251 TopTools_SequenceOfShape spine;
252 Handle(TColStd_HArray1OfReal) abscissa;
253 Standard_Real tolesp;
254 Standard_Real firstparam;
255 Standard_Real lastparam;
256 Standard_Boolean firstprolon;
257 Standard_Boolean lastprolon;
258 Standard_Boolean firstistgt;
259 Standard_Boolean lastistgt;
260 Standard_Real firsttgtpar;
261 Standard_Real lasttgtpar;
262 Standard_Boolean hasfirsttgt;
263 Standard_Boolean haslasttgt;
264 gp_Pnt firstori;
265 gp_Pnt lastori;
266 gp_Vec firsttgt;
267 gp_Vec lasttgt;
268 Standard_Real valref;
269 Standard_Boolean hasref;
270 ChFiDS_ErrorStatus errorstate;
271
272
273};
274
275
276#include <ChFiDS_Spine.lxx>
277
278
279
280
281
282#endif // _ChFiDS_Spine_HeaderFile