0032969: Coding - get rid of unused headers [IMeshData to PLib]
[occt.git] / src / MAT / MAT_Node.cxx
1 // Created on: 1993-05-06
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17
18 #include <MAT_Node.hxx>
19 #include <Precision.hxx>
20 #include <Standard_Type.hxx>
21
22 IMPLEMENT_STANDARD_RTTIEXT(MAT_Node,Standard_Transient)
23
24 //=============================================================================
25 //function : 
26 //Purpose  :
27 //=============================================================================
28 MAT_Node::MAT_Node(const Standard_Integer     GeomIndex, 
29                    const Handle(MAT_Arc)&     LinkedArc, 
30                    const Standard_Real        Distance)
31      : nodeIndex(0),
32        geomIndex(GeomIndex),
33        distance(Distance)
34 {
35   aLinkedArc = LinkedArc.get();
36 }
37
38 //=============================================================================
39 //function : GeomIndex 
40 //Purpose  :
41 //=============================================================================
42 Standard_Integer  MAT_Node::GeomIndex() const
43 {
44   return geomIndex;
45 }
46
47 //=============================================================================
48 //function : Index
49 //Purpose  :
50 //=============================================================================
51 Standard_Integer  MAT_Node::Index() const
52 {
53   return nodeIndex;
54 }
55
56 //=============================================================================
57 //function : LinkedArcs
58 //Purpose  :
59 //=============================================================================
60 void MAT_Node::LinkedArcs(MAT_SequenceOfArc& S) const
61 {
62   S.Clear();
63   Handle(MAT_Node) Me = this;
64   Handle(MAT_Arc)  LA((MAT_Arc*)aLinkedArc);
65
66   S.Append(LA);
67
68   if (LA->HasNeighbour(Me, MAT_Left)) {
69     Handle(MAT_Arc)  CA = LA->Neighbour(Me, MAT_Left);
70     while (CA != LA) {
71       S.Append(CA);
72       CA = CA->Neighbour(Me, MAT_Left);
73     }
74   }
75 }
76
77 //=============================================================================
78 //function : NearElts 
79 //Purpose  :
80 //=============================================================================
81 void MAT_Node::NearElts(MAT_SequenceOfBasicElt& S) const
82 {
83   S.Clear();
84
85   Handle(MAT_Node) Me = this;
86   Handle(MAT_Arc)  LA((MAT_Arc*)aLinkedArc);
87
88   S.Append(LA->FirstElement());
89   S.Append(LA->SecondElement());
90
91   if (LA->HasNeighbour(Me, MAT_Left)) {
92
93     Handle(MAT_Arc)  CA = LA->Neighbour(Me, MAT_Left);
94     Standard_Boolean Pair = Standard_False;
95     
96     //---------------------------------------------------------
97     // Recuperation des deux elements separes pour un arc sur
98     // deux.
99     //---------------------------------------------------------
100     
101     while (CA != LA) {
102       if (Pair) {
103         S.Append(CA->FirstElement());
104         S.Append(CA->SecondElement());
105       }
106       else {
107         Pair = Standard_True;
108       }
109       CA = CA->Neighbour(Me, MAT_Left);
110     }
111   }
112 }
113   
114 //=============================================================================
115 //function : Distance
116 //Purpose  :
117 //=============================================================================
118 Standard_Real  MAT_Node::Distance() const
119 {
120   return distance;
121 }
122
123
124 //=============================================================================
125 //function : PendingNode
126 //Purpose  :
127 //=============================================================================
128 Standard_Boolean  MAT_Node::PendingNode() const
129 {
130   Handle(MAT_Node) Me = this;
131   return (!((MAT_Arc*)aLinkedArc)->HasNeighbour(Me,MAT_Left));
132 }
133
134 //=============================================================================
135 //function : NodeOnFig
136 //Purpose  :
137 //=============================================================================
138 Standard_Boolean  MAT_Node::OnBasicElt() const
139 {
140   return (Distance() == 0.0);
141 }
142
143 //=============================================================================
144 //function : NodeInfinite
145 //Purpose  :
146 //=============================================================================
147 Standard_Boolean  MAT_Node::Infinite() const
148 {
149   return (Distance() == Precision::Infinite());
150 }
151
152 //=============================================================================
153 //function : SetLinkedArcs
154 //Purpose  :
155 //=============================================================================
156 void MAT_Node::SetLinkedArc (const Handle(MAT_Arc)& LinkedArc)
157 {
158   aLinkedArc = LinkedArc.get();
159 }
160
161 //=============================================================================
162 //function : SetIndex
163 //Purpose  :
164 //=============================================================================
165 void MAT_Node::SetIndex (const Standard_Integer anIndex)
166 {
167   nodeIndex = anIndex;
168 }
169
170
171
172