1 // Created on: 1992-08-25
2 // Created by: Modelistation
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and / or modify it
9 // under the terms of the GNU Lesser General Public 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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <BRep_TEdge.ixx>
19 #include <BRep_CurveRepresentation.hxx>
20 #include <BRep_ListOfCurveRepresentation.hxx>
21 #include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
22 #include <BRep_GCurve.hxx>
23 #include <BRep_CurveOn2Surfaces.hxx>
25 static const Standard_Integer ParameterMask = 1;
26 static const Standard_Integer RangeMask = 2;
27 static const Standard_Integer DegeneratedMask = 4;
29 //=======================================================================
30 //function : BRep_TEdge
32 //=======================================================================
34 BRep_TEdge::BRep_TEdge() :
36 myTolerance(RealEpsilon()),
39 SameParameter(Standard_True);
40 SameRange(Standard_True);
43 //=======================================================================
44 //function : SameParameter
46 //=======================================================================
48 Standard_Boolean BRep_TEdge::SameParameter()const
50 return myFlags & ParameterMask;
54 //=======================================================================
55 //function : SameParameter
57 //=======================================================================
59 void BRep_TEdge::SameParameter(const Standard_Boolean S)
61 if (S) myFlags |= ParameterMask;
62 else myFlags &= ~ParameterMask;
66 //=======================================================================
67 //function : SameRange
69 //=======================================================================
71 Standard_Boolean BRep_TEdge::SameRange()const
73 return myFlags & RangeMask;
77 //=======================================================================
78 //function : SameRange
80 //=======================================================================
82 void BRep_TEdge::SameRange(const Standard_Boolean S)
84 if (S) myFlags |= RangeMask;
85 else myFlags &= ~RangeMask;
89 //=======================================================================
90 //function : Degenerated
92 //=======================================================================
94 Standard_Boolean BRep_TEdge::Degenerated()const
96 return myFlags & DegeneratedMask;
100 //=======================================================================
101 //function : Degenerated
103 //=======================================================================
105 void BRep_TEdge::Degenerated(const Standard_Boolean S)
107 if (S) myFlags |= DegeneratedMask;
108 else myFlags &= ~DegeneratedMask;
111 //=======================================================================
112 //function : EmptyCopy
114 //=======================================================================
116 Handle(TopoDS_TShape) BRep_TEdge::EmptyCopy() const
118 Handle(BRep_TEdge) TE =
120 TE->Tolerance(myTolerance);
121 // copy the curves representations
122 BRep_ListOfCurveRepresentation& l = TE->ChangeCurves();
123 BRep_ListIteratorOfListOfCurveRepresentation itr(myCurves);
126 // on ne recopie PAS les polygones
127 if ( itr.Value()->IsKind(STANDARD_TYPE(BRep_GCurve)) ||
128 itr.Value()->IsKind(STANDARD_TYPE(BRep_CurveOn2Surfaces)) ) {
129 l.Append(itr.Value()->Copy());
134 TE->Degenerated(Degenerated());
135 TE->SameParameter(SameParameter());
136 TE->SameRange(SameRange());