0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- automatic
[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//
d5f74e42 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
973c2be1 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
42cf5bc1 17
18#include <BRep_CurveOn2Surfaces.hxx>
7fd59977 19#include <BRep_CurveRepresentation.hxx>
7fd59977 20#include <BRep_GCurve.hxx>
42cf5bc1 21#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
22#include <BRep_ListOfCurveRepresentation.hxx>
23#include <BRep_TEdge.hxx>
24#include <Standard_Type.hxx>
25#include <TopAbs.hxx>
26#include <TopoDS_TShape.hxx>
7fd59977 27
92efcf78 28IMPLEMENT_STANDARD_RTTIEXT(BRep_TEdge,TopoDS_TEdge)
29
7fd59977 30static const Standard_Integer ParameterMask = 1;
31static const Standard_Integer RangeMask = 2;
32static const Standard_Integer DegeneratedMask = 4;
33
34//=======================================================================
35//function : BRep_TEdge
36//purpose :
37//=======================================================================
38
39BRep_TEdge::BRep_TEdge() :
40 TopoDS_TEdge(),
41 myTolerance(RealEpsilon()),
42 myFlags(0)
43{
44 SameParameter(Standard_True);
45 SameRange(Standard_True);
46}
47
48//=======================================================================
49//function : SameParameter
50//purpose :
51//=======================================================================
52
53 Standard_Boolean BRep_TEdge::SameParameter()const
54{
55 return myFlags & ParameterMask;
56}
57
58
59//=======================================================================
60//function : SameParameter
61//purpose :
62//=======================================================================
63
64 void BRep_TEdge::SameParameter(const Standard_Boolean S)
65{
66 if (S) myFlags |= ParameterMask;
67 else myFlags &= ~ParameterMask;
68}
69
70
71//=======================================================================
72//function : SameRange
73//purpose :
74//=======================================================================
75
76 Standard_Boolean BRep_TEdge::SameRange()const
77{
78 return myFlags & RangeMask;
79}
80
81
82//=======================================================================
83//function : SameRange
84//purpose :
85//=======================================================================
86
87 void BRep_TEdge::SameRange(const Standard_Boolean S)
88{
89 if (S) myFlags |= RangeMask;
90 else myFlags &= ~RangeMask;
91}
92
93
94//=======================================================================
95//function : Degenerated
96//purpose :
97//=======================================================================
98
99 Standard_Boolean BRep_TEdge::Degenerated()const
100{
101 return myFlags & DegeneratedMask;
102}
103
104
105//=======================================================================
106//function : Degenerated
107//purpose :
108//=======================================================================
109
110 void BRep_TEdge::Degenerated(const Standard_Boolean S)
111{
112 if (S) myFlags |= DegeneratedMask;
113 else myFlags &= ~DegeneratedMask;
114}
115
116//=======================================================================
117//function : EmptyCopy
118//purpose :
119//=======================================================================
120
121Handle(TopoDS_TShape) BRep_TEdge::EmptyCopy() const
122{
123 Handle(BRep_TEdge) TE =
124 new BRep_TEdge();
125 TE->Tolerance(myTolerance);
126 // copy the curves representations
127 BRep_ListOfCurveRepresentation& l = TE->ChangeCurves();
128 BRep_ListIteratorOfListOfCurveRepresentation itr(myCurves);
129
130 while (itr.More()) {
131 // on ne recopie PAS les polygones
132 if ( itr.Value()->IsKind(STANDARD_TYPE(BRep_GCurve)) ||
133 itr.Value()->IsKind(STANDARD_TYPE(BRep_CurveOn2Surfaces)) ) {
134 l.Append(itr.Value()->Copy());
135 }
136 itr.Next();
137 }
138
139 TE->Degenerated(Degenerated());
140 TE->SameParameter(SameParameter());
141 TE->SameRange(SameRange());
142
143 return TE;
144}
145