0024428: Implementation of LGPL license
[occt.git] / src / BRep / BRep_TEdge.cxx
CommitLineData
b311480e 1// Created on: 1992-08-25
2// Created by: Modelistation
3// Copyright (c) 1992-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
17#include <BRep_TEdge.ixx>
18#include <TopAbs.hxx>
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>
24
25static const Standard_Integer ParameterMask = 1;
26static const Standard_Integer RangeMask = 2;
27static const Standard_Integer DegeneratedMask = 4;
28
29//=======================================================================
30//function : BRep_TEdge
31//purpose :
32//=======================================================================
33
34BRep_TEdge::BRep_TEdge() :
35 TopoDS_TEdge(),
36 myTolerance(RealEpsilon()),
37 myFlags(0)
38{
39 SameParameter(Standard_True);
40 SameRange(Standard_True);
41}
42
43//=======================================================================
44//function : SameParameter
45//purpose :
46//=======================================================================
47
48 Standard_Boolean BRep_TEdge::SameParameter()const
49{
50 return myFlags & ParameterMask;
51}
52
53
54//=======================================================================
55//function : SameParameter
56//purpose :
57//=======================================================================
58
59 void BRep_TEdge::SameParameter(const Standard_Boolean S)
60{
61 if (S) myFlags |= ParameterMask;
62 else myFlags &= ~ParameterMask;
63}
64
65
66//=======================================================================
67//function : SameRange
68//purpose :
69//=======================================================================
70
71 Standard_Boolean BRep_TEdge::SameRange()const
72{
73 return myFlags & RangeMask;
74}
75
76
77//=======================================================================
78//function : SameRange
79//purpose :
80//=======================================================================
81
82 void BRep_TEdge::SameRange(const Standard_Boolean S)
83{
84 if (S) myFlags |= RangeMask;
85 else myFlags &= ~RangeMask;
86}
87
88
89//=======================================================================
90//function : Degenerated
91//purpose :
92//=======================================================================
93
94 Standard_Boolean BRep_TEdge::Degenerated()const
95{
96 return myFlags & DegeneratedMask;
97}
98
99
100//=======================================================================
101//function : Degenerated
102//purpose :
103//=======================================================================
104
105 void BRep_TEdge::Degenerated(const Standard_Boolean S)
106{
107 if (S) myFlags |= DegeneratedMask;
108 else myFlags &= ~DegeneratedMask;
109}
110
111//=======================================================================
112//function : EmptyCopy
113//purpose :
114//=======================================================================
115
116Handle(TopoDS_TShape) BRep_TEdge::EmptyCopy() const
117{
118 Handle(BRep_TEdge) TE =
119 new BRep_TEdge();
120 TE->Tolerance(myTolerance);
121 // copy the curves representations
122 BRep_ListOfCurveRepresentation& l = TE->ChangeCurves();
123 BRep_ListIteratorOfListOfCurveRepresentation itr(myCurves);
124
125 while (itr.More()) {
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());
130 }
131 itr.Next();
132 }
133
134 TE->Degenerated(Degenerated());
135 TE->SameParameter(SameParameter());
136 TE->SameRange(SameRange());
137
138 return TE;
139}
140