0026937: Eliminate NO_CXX_EXCEPTION macro support
[occt.git] / src / Draft / Draft_VertexInfo.cxx
CommitLineData
b311480e 1// Created on: 1994-09-01
2// Created by: Jacques GOUSSARD
3// Copyright (c) 1994-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
7fd59977 17
42cf5bc1 18#include <Draft_VertexInfo.hxx>
19#include <gp_Pnt.hxx>
20#include <Standard_DomainError.hxx>
21#include <Standard_NoMoreObject.hxx>
7fd59977 22#include <TColStd_ListIteratorOfListOfReal.hxx>
23#include <TopoDS.hxx>
42cf5bc1 24#include <TopoDS_Edge.hxx>
7fd59977 25
26//=======================================================================
27//function : Draft_VertexInfo
28//purpose :
29//=======================================================================
7fd59977 30Draft_VertexInfo::Draft_VertexInfo () {}
31
32
33//=======================================================================
34//function : Add
35//purpose :
36//=======================================================================
37
38void Draft_VertexInfo::Add(const TopoDS_Edge& E)
39{
40 for (myItEd.Initialize(myEdges); myItEd.More(); myItEd.Next()) {
41 if (E.IsSame(myItEd.Value())) {
42 break;
43 }
44 }
45 if (!myItEd.More()) {
46 myEdges.Append(E);
47 myParams.Append(RealLast());
48 }
49}
50
51
52//=======================================================================
53//function : Geometry
54//purpose :
55//=======================================================================
56
57const gp_Pnt& Draft_VertexInfo::Geometry () const
58{
59 return myGeom;
60}
61
62
63//=======================================================================
64//function : ChangeGeometry
65//purpose :
66//=======================================================================
67
68gp_Pnt& Draft_VertexInfo::ChangeGeometry ()
69{
70 return myGeom;
71}
72
73
74//=======================================================================
75//function : Parameter
76//purpose :
77//=======================================================================
78
79Standard_Real Draft_VertexInfo::Parameter (const TopoDS_Edge& E)
80{
81 TColStd_ListIteratorOfListOfReal itp(myParams);
82 myItEd.Initialize(myEdges);
83 for (; myItEd.More(); myItEd.Next(),itp.Next()) {
84 if (myItEd.Value().IsSame(E)) {
85 return itp.Value();
86 }
87 }
9775fa61 88 throw Standard_DomainError();
7fd59977 89}
90
91
92//=======================================================================
93//function : ChangeParameter
94//purpose :
95//=======================================================================
96
97Standard_Real& Draft_VertexInfo::ChangeParameter (const TopoDS_Edge& E)
98{
99 TColStd_ListIteratorOfListOfReal itp(myParams);
100 myItEd.Initialize(myEdges);
101 for (; myItEd.More(); myItEd.Next(),itp.Next()) {
102 if (myItEd.Value().IsSame(E)) {
103 return itp.Value();
104 }
105 }
9775fa61 106 throw Standard_DomainError();
7fd59977 107}
108
109
110//=======================================================================
111//function : InitEdgeIterator
112//purpose :
113//=======================================================================
114
115void Draft_VertexInfo::InitEdgeIterator ()
116{
117 myItEd.Initialize(myEdges);
118}
119
120
121//=======================================================================
122//function : Edge
123//purpose :
124//=======================================================================
125
126const TopoDS_Edge& Draft_VertexInfo::Edge () const
127{
128 return TopoDS::Edge(myItEd.Value());
129}
130
131
132//=======================================================================
133//function : MoreEdge
134//purpose :
135//=======================================================================
136
137Standard_Boolean Draft_VertexInfo::MoreEdge() const
138{
139 return myItEd.More();
140}
141
142
143//=======================================================================
144//function : NextEdge
145//purpose :
146//=======================================================================
147
148void Draft_VertexInfo::NextEdge()
149{
150 myItEd.Next();
151}
152
153