0027772: Foundation Classes - define Standard_Boolean using C++ type "bool" instead...
[occt.git] / src / HLRBRep / HLRBRep_VertexList.cxx
CommitLineData
b311480e 1// Created on: 1997-04-17
2// Created by: Christophe MARION
3// Copyright (c) 1997-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.
733a0e55 16
7fd59977 17#ifndef No_Exception
18#define No_Exception
19#endif
7fd59977 20
42cf5bc1 21
22#include <HLRAlgo_Intersection.hxx>
23#include <HLRBRep_EdgeInterferenceTool.hxx>
24#include <HLRBRep_VertexList.hxx>
25#include <Standard_DomainError.hxx>
7fd59977 26#include <Standard_NoMoreObject.hxx>
27#include <Standard_NoSuchObject.hxx>
7fd59977 28
29//=======================================================================
30//function : HLRBRep_VertexList
31//purpose :
32//=======================================================================
7fd59977 33HLRBRep_VertexList::
34HLRBRep_VertexList(const HLRBRep_EdgeInterferenceTool& T,
35 const HLRAlgo_ListIteratorOfInterferenceList& I) :
36 myIterator(I),
37 myTool(T),
38 fromEdge(Standard_False),
39 fromInterf(Standard_False)
40{
41 myTool.InitVertices();
42 Next();
43}
44
45//=======================================================================
46//function : IsPeriodic
47//purpose :
48//=======================================================================
49
50Standard_Boolean HLRBRep_VertexList::IsPeriodic()const
51{
52 return myTool.IsPeriodic();
53}
54
55//=======================================================================
56//function : More
57//purpose :
58//=======================================================================
59
60Standard_Boolean HLRBRep_VertexList::More()const
61{
62 return (fromEdge || fromInterf);
63}
64
65//=======================================================================
66//function : Next
67//purpose :
68//=======================================================================
69
70void HLRBRep_VertexList::Next()
71{
72 if (fromInterf)
73 myIterator.Next();
74 if (fromEdge)
75 myTool.NextVertex();
76 fromInterf = myIterator.More();
77 fromEdge = myTool.MoreVertices();
78 if (fromEdge && fromInterf) {
79 if (!myTool.SameVertexAndInterference( myIterator.Value())) {
80 if (myTool.CurrentParameter() <
81 myTool.ParameterOfInterference(myIterator.Value())) {
82 fromInterf = Standard_False;
83 }
84 else {
85 fromEdge = Standard_False;
86 }
87 }
88 }
89}
90
91//=======================================================================
92//function : Current
93//purpose :
94//=======================================================================
95
96const HLRAlgo_Intersection & HLRBRep_VertexList::Current() const
97{
98 if (fromEdge)
99 return myTool.CurrentVertex();
100 else if (fromInterf)
101 return myIterator.Value().Intersection();
102 else
103 Standard_NoSuchObject::Raise("HLRBRep_VertexList::Current");
104 return myTool.CurrentVertex(); // only for WNT.
105}
106
107//=======================================================================
108//function : IsBoundary
109//purpose :
110//=======================================================================
111
112Standard_Boolean HLRBRep_VertexList::IsBoundary() const
113{
114 return fromEdge;
115}
116
117//=======================================================================
118//function : IsInterference
119//purpose :
120//=======================================================================
121
122Standard_Boolean HLRBRep_VertexList::IsInterference() const
123{
124 return fromInterf;
125}
126
127//=======================================================================
128//function : Orientation
129//purpose :
130//=======================================================================
131
132TopAbs_Orientation HLRBRep_VertexList::Orientation() const
133{
134 if (fromEdge)
135 return myTool.CurrentOrientation();
136 else
137 Standard_DomainError::Raise("HLRBRep_VertexList::Orientation");
138 return TopAbs_EXTERNAL; // only for WNT.
139}
140
141//=======================================================================
142//function : Transition
143//purpose :
144//=======================================================================
145
146TopAbs_Orientation HLRBRep_VertexList::Transition() const
147{
148 if (fromInterf)
149 return myIterator.Value().Transition();
150 else
151 Standard_DomainError::Raise("HLRBRep_VertexList::Transition");
152 return TopAbs_EXTERNAL; // only for WNT.
153}
154
155//=======================================================================
156//function : BoundaryTransition
157//purpose :
158//=======================================================================
159
160TopAbs_Orientation HLRBRep_VertexList::BoundaryTransition() const
161{
162 if (fromInterf)
163 return myIterator.Value().BoundaryTransition();
164 else
165 Standard_DomainError::Raise("HLRBRep_VertexList::BoundaryTransition");
166 return TopAbs_EXTERNAL; // only for WNT.
167}