1 // Created on: 1993-03-16
2 // Created by: Denis PASCAL
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.
17 #include <Standard_NoSuchObject.hxx>
18 #include <Standard_NoMoreObject.hxx>
19 #include <Standard_DomainError.hxx>
20 #include <Standard_NotImplemented.hxx>
23 //=======================================================================
24 //function : GraphDS_Vertex
26 //=======================================================================
28 GraphDS_Vertex::GraphDS_Vertex (const GraphDS_Item& value) : myItem(value)
33 //=======================================================================
36 //=======================================================================
38 const GraphDS_Item& GraphDS_Vertex::GetItem () const
44 //=======================================================================
47 //=======================================================================
49 void GraphDS_Vertex::SetItem (const GraphDS_Item& Value)
54 //=======================================================================
57 //=======================================================================
59 Standard_Boolean GraphDS_Vertex::Contains (const Handle(GraphDS_Edge)& E) const
61 return myEdges.Contains(E);
65 Standard_Boolean GraphDS_Vertex::IsFront (const Handle(GraphDS_Edge)& ) const
67 Standard_NotImplemented::Raise();
68 return Standard_False;
72 Standard_Boolean GraphDS_Vertex::IsBack (const Handle(GraphDS_Edge)& ) const
74 Standard_NotImplemented::Raise();
75 return Standard_False;
80 //=======================================================================
82 //purpose : never destination of an edge
83 //=======================================================================
85 Standard_Boolean GraphDS_Vertex::IsRoot (const Standard_Boolean ignoreselfloop) const
87 Handle(GraphDS_Vertex) me = this;
88 Handle(GraphDS_Edge) E;
89 TColStd_MapIteratorOfMapOfTransient it;
90 for (it.Initialize(myEdges); it.More(); it.Next()) {
91 E = Handle(GraphDS_Edge)::DownCast(it.Key());
92 if (ignoreselfloop && E->IsLoop()) continue;
93 if (E->Destination() == me) return Standard_False;
99 //=======================================================================
101 //purpose : never source of an edge
102 //=======================================================================
104 Standard_Boolean GraphDS_Vertex::IsLeaf (const Standard_Boolean ignoreselfloop) const
106 Handle(GraphDS_Vertex) me = this;
107 Handle(GraphDS_Edge) E;
108 TColStd_MapIteratorOfMapOfTransient it;
109 for (it.Initialize(myEdges); it.More(); it.Next()) {
110 E = Handle(GraphDS_Edge)::DownCast(it.Key());
111 if (ignoreselfloop && E->IsLoop()) continue;
112 if (E->Source() == me) return Standard_False;
114 return Standard_True;
117 //=======================================================================
120 //=======================================================================
122 Standard_Boolean GraphDS_Vertex::AddEdge (const Handle(GraphDS_Edge)& E)
124 return myEdges.Add(E);
128 //=======================================================================
129 //function : RemoveEdge
131 //=======================================================================
133 void GraphDS_Vertex::RemoveEdge (const Handle(GraphDS_Edge)& E)
140 //=======================================================================
141 //function : GetEdges
143 //=======================================================================
145 const TColStd_MapOfTransient& GraphDS_Vertex::GetEdges () const