// Created on: 1991-09-10 // Created by: Denis PASCAL // Copyright (c) 1991-1999 Matra Datavision // Copyright (c) 1999-2012 OPEN CASCADE SAS // // The content of this file is subject to the Open CASCADE Technology Public // License Version 6.5 (the "License"). You may not use the content of this file // except in compliance with the License. Please obtain a copy of the License // at http://www.opencascade.org and read it completely before using this file. // // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. // // The Original Code and all software distributed under the License is // distributed on an "AS IS" basis, without warranty of any kind, and the // Initial Developer hereby disclaims all such warranties, including without // limitation, any warranties of merchantability, fitness for a particular // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. // #include #include #include //======================================================================= //function : GraphDS_EntitiesIterator //purpose : //======================================================================= GraphDS_EntitiesIterator::GraphDS_EntitiesIterator () { } //======================================================================= //function : GraphDS_EntitiesIterator //purpose : //======================================================================= GraphDS_EntitiesIterator::GraphDS_EntitiesIterator (const GraphDS_RelationGraph& G) { Initialize (G); } //======================================================================= //function : GraphDS_EntitiesIterator //purpose : //======================================================================= GraphDS_EntitiesIterator::GraphDS_EntitiesIterator (const GraphDS_RelationGraph& G, const Handle(GraphDS_Entity)& E) { Initialize (G,E); } //======================================================================= //function : GraphDS_EntitiesIterator //purpose : //======================================================================= GraphDS_EntitiesIterator::GraphDS_EntitiesIterator (const GraphDS_RelationGraph& G, const Handle(GraphDS_Relation)& R) { Initialize (G,R); } //======================================================================= //function : Initialize //purpose : //======================================================================= void GraphDS_EntitiesIterator::Initialize (const GraphDS_RelationGraph& G) { myEntities.Initialize(G.myEntities); } //======================================================================= //function : Initialize //purpose : adjacent entities search //======================================================================= void GraphDS_EntitiesIterator::Initialize (const GraphDS_RelationGraph&, const Handle(GraphDS_Entity)& E) { myMap.Clear(); Handle(GraphDS_Relation) REL; GraphDS_DataMapIteratorOfEntityRoleMap itv; TColStd_MapIteratorOfMapOfTransient itr; for (itr.Initialize(E->GetRelations());itr.More();itr.Next()) { REL = Handle(GraphDS_Relation)::DownCast(itr.Key()); if (REL->IsInput(E)) { for (itv.Initialize(REL->GetEntities());itv.More();itv.Next()) { if (itv.Value() != GraphDS_OnlyInput) { myMap.Add(itv.Key()); } } } } myEntities.Initialize(myMap); } //======================================================================= //function : Initialize //purpose : //======================================================================= void GraphDS_EntitiesIterator::Initialize (const GraphDS_RelationGraph&, const Handle(GraphDS_Relation)& R) { myMap.Clear(); GraphDS_DataMapIteratorOfEntityRoleMap itv; for (itv.Initialize(R->GetEntities());itv.More();itv.Next()) { myMap.Add(itv.Key()); } myEntities.Initialize(myMap); } //======================================================================= //function : More //purpose : //======================================================================= Standard_Boolean GraphDS_EntitiesIterator::More () const { return myEntities.More(); } //======================================================================= //function : Next //purpose : //======================================================================= void GraphDS_EntitiesIterator::Next () { myEntities.Next(); } //======================================================================= //function : Value //purpose : //======================================================================= const Handle(GraphDS_Entity)& GraphDS_EntitiesIterator::Value () const { return *((Handle(GraphDS_Entity)*)& myEntities.Key()); //return Handle(GraphDS_Entity)::DownCast(myEntities.Key()); }