1 // Created on: 1993-05-04
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1993-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 under
9 // the terms of the GNU Lesser General Public License 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.
18 #include <MAT_Arc.hxx>
19 #include <MAT_BasicElt.hxx>
20 #include <MAT_Node.hxx>
21 #include <Standard_DomainError.hxx>
22 #include <Standard_Type.hxx>
24 IMPLEMENT_STANDARD_RTTIEXT(MAT_Arc,MMgt_TShared)
26 //========================================================================
29 //========================================================================
30 MAT_Arc::MAT_Arc (const Standard_Integer ArcIndex,
31 const Standard_Integer GeomIndex,
32 const Handle(MAT_BasicElt)& FirstElement,
33 const Handle(MAT_BasicElt)& SecondElement)
41 firstElement = FirstElement;
42 secondElement = SecondElement;
45 //========================================================================
48 //========================================================================
49 Standard_Integer MAT_Arc::Index() const
54 //========================================================================
55 // function: GeomIndex
57 //========================================================================
58 Standard_Integer MAT_Arc::GeomIndex() const
63 //========================================================================
64 // function: FirstElement
66 //========================================================================
67 Handle(MAT_BasicElt) MAT_Arc::FirstElement() const
72 //========================================================================
73 // function: SecondElement
75 //========================================================================
76 Handle(MAT_BasicElt) MAT_Arc::SecondElement() const
81 //========================================================================
82 // function: FirstNode
84 //========================================================================
85 Handle(MAT_Node) MAT_Arc::FirstNode() const
90 //========================================================================
91 // function: SecondNode
93 //========================================================================
94 Handle(MAT_Node) MAT_Arc::SecondNode() const
99 //========================================================================
100 // function: TheOtherNode
102 //========================================================================
103 Handle(MAT_Node) MAT_Arc::TheOtherNode(const Handle(MAT_Node)& aNode)const
105 if (FirstNode() == aNode)
107 else if (SecondNode() == aNode)
110 throw Standard_DomainError("MAT_Arc::TheOtherNode");
114 //========================================================================
115 // function: HasNeighbour
117 //========================================================================
118 Standard_Boolean MAT_Arc::HasNeighbour(const Handle(MAT_Node)& aNode,
119 const MAT_Side aSide ) const
121 if (aSide == MAT_Left) {
122 // if (aNode == FirstNode()) return (!firstArcLeft == NULL);
123 if (aNode == FirstNode()) return (firstArcLeft != 0);
124 // if (aNode == SecondNode()) return (!secondArcLeft == NULL);
125 if (aNode == SecondNode()) return (secondArcLeft != 0);
128 // if (aNode == FirstNode()) return (!firstArcRight == NULL);
129 if (aNode == FirstNode()) return (firstArcRight != 0);
130 // if (aNode == SecondNode()) return (!secondArcRight == NULL);
131 if (aNode == SecondNode()) return (secondArcRight != 0);
133 throw Standard_DomainError("MAT_Arc::HasNeighbour");
136 //========================================================================
137 // function: Neighbour
139 //========================================================================
140 Handle(MAT_Arc) MAT_Arc::Neighbour(const Handle(MAT_Node)& aNode,
141 const MAT_Side aSide )
145 if (aSide == MAT_Left) {
146 if (aNode == FirstNode()) return (MAT_Arc*)firstArcLeft;
147 if (aNode == SecondNode()) return (MAT_Arc*)secondArcLeft;
150 if (aNode == FirstNode()) return (MAT_Arc*)firstArcRight;
151 if (aNode == SecondNode()) return (MAT_Arc*)secondArcRight;
153 throw Standard_DomainError("MAT_Arc::Neighbour");
156 //========================================================================
157 // function: SetIndex
159 //========================================================================
160 void MAT_Arc::SetIndex(const Standard_Integer anInteger)
162 arcIndex = anInteger;
165 //========================================================================
166 // function: SetGeomIndex
168 //========================================================================
169 void MAT_Arc::SetGeomIndex(const Standard_Integer anInteger)
171 geomIndex = anInteger;
174 //========================================================================
175 // function: SetFirstElement
177 //========================================================================
178 void MAT_Arc::SetFirstElement(const Handle(MAT_BasicElt)& aBasicElt)
180 firstElement = aBasicElt;
183 //========================================================================
184 // function: SetSecondElement
186 //========================================================================
187 void MAT_Arc::SetSecondElement(const Handle(MAT_BasicElt)& aBasicElt)
189 secondElement = aBasicElt;
192 //========================================================================
193 // function: SetFirstNode
195 //========================================================================
196 void MAT_Arc::SetFirstNode(const Handle(MAT_Node)& aNode)
201 //========================================================================
202 // function: SetSecondNode
204 //========================================================================
205 void MAT_Arc::SetSecondNode(const Handle(MAT_Node)& aNode)
210 //========================================================================
211 // function: SetFirstArc
213 //========================================================================
214 void MAT_Arc::SetFirstArc(const MAT_Side aSide ,
215 const Handle(MAT_Arc)& anArc)
217 if (aSide == MAT_Left)
218 firstArcLeft = anArc.operator->();
220 firstArcRight = anArc.operator->();
223 //========================================================================
224 // function: SetSecondArc
226 //========================================================================
227 void MAT_Arc::SetSecondArc(const MAT_Side aSide ,
228 const Handle(MAT_Arc)& anArc)
230 if (aSide == MAT_Left)
231 secondArcLeft = anArc.operator->();
233 secondArcRight = anArc.operator->();
236 //========================================================================
237 // function: SetNeighbour
239 //========================================================================
240 void MAT_Arc::SetNeighbour(const MAT_Side aSide,
241 const Handle(MAT_Node)& aNode,
242 const Handle(MAT_Arc)& anArc)
244 if (aSide == MAT_Left) {
245 if (aNode == FirstNode())
246 firstArcLeft = anArc.operator->();
247 else if (aNode == SecondNode())
248 secondArcLeft = anArc.operator->();
250 throw Standard_DomainError("MAT_Arc::SetNeighbour");
253 if (aNode == FirstNode())
254 firstArcRight = anArc.operator->();
255 else if (aNode == SecondNode())
256 secondArcRight = anArc.operator->();
258 throw Standard_DomainError("MAT_Arc::SetNeighbour");