0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[occt.git] / src / IFGraph / IFGraph_ConnectedComponants.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
42cf5bc1 14
7fd59977 15#include <IFGraph_AllConnected.hxx>
42cf5bc1 16#include <IFGraph_ConnectedComponants.hxx>
17#include <Interface_Graph.hxx>
7fd59977 18#include <Standard_Transient.hxx>
19
7fd59977 20// Pour travailler, ConnectedComponants exploite AllConnected :
21// On prend un 1er Vertex, on determine ses AllConnected -> voila un 1er
22// Connected Componant
23// On recommence jusqu'a ce qu'il n'y ait plus de Vertex libre
7fd59977 24// Honnetement, si ca ne marche pas, cf classe ConnectedVerticesIterator
25// de GraphTools qui fait en principe la meme chose
b311480e 26IFGraph_ConnectedComponants::IFGraph_ConnectedComponants
7fd59977 27 (const Interface_Graph& agraph, const Standard_Boolean whole)
28 : IFGraph_SubPartsIterator (agraph, whole) { }
29
30 void IFGraph_ConnectedComponants::Evaluate()
31{
32// On part des "loaded"
33// Pour chacun : s il est note dans le graphe, on passe
34// Sinon, on ajoute les AllConnected en tant que sub-part
35 Interface_EntityIterator loaded = Loaded();
36 Reset();
37 for (loaded.Start(); loaded.More(); loaded.Next()) {
38 Handle(Standard_Transient) ent = loaded.Value();
39 if (IsInPart(ent)) continue;
40 IFGraph_AllConnected connect(Model(),ent);
41 AddPart();
42 GetFromIter (connect);
43 }
44}