/*
 *
 * [BaseV_afficheBaseConsole]
 * debug : show contents of position file in memory
 */
#include "Tools/Viewer/Bdd/include/BaseV.h"

namespace morpheo{
namespace tools{
namespace viewer{
namespace bdd{     
  void BaseV::afficheBaseConsole(){
     for ( QList<BaseP>::iterator it\
        = pos->begin(); it != pos->end(); ++it)
    {
     
      morpheo::tools::viewer::bdd::Entity *test=(it->getEntity());
      string n2=test->getName();
      string n=it->getComment();
      cout << n << endl ;
      cout << "----Entity-----------------------------------------" <<endl;
      cout << "Entity name:"<< n2 <<" level:"<< it->getLevel()<< endl;
      cout << "------------------ports east-----------------------" <<endl;
      
      QList<Port> porteast=test->getPortEast(new Coord(50,50,50,50));
      for (QList<Port>::iterator it2\
	     = porteast.begin(); it2 != porteast.end(); ++it2)
	{
	  cout <<  "name : " <<it2->getName() << endl;
	  cout << it2->getComment() << endl;
	  cout <<  "x:"<<it2->get_x() << endl;
	  cout <<  "y:"<<it2->get_y() << endl;
	  cout <<  "direction : " <<it2->getDirection()<< endl;
	  cout << endl;
	}
     

      cout << "-----------------ports west-------------------------" <<endl;
      QList<Port> portwest=test->getPortWest(new Coord(50,50,50,50));
      for (QList<Port>::iterator it2\
	     = portwest.begin(); it2 != portwest.end(); ++it2)
	{
	  cout <<  "name : " << it2->getName() << endl;
	  cout << it2->getComment() << endl;
	  cout <<  "x:"<<it2->get_x() << endl;
	  cout <<  "y:"<<it2->get_y() << endl;
	  cout <<  "direction : " <<it2->getDirection()<< endl;
	  cout << endl;
	}
      
      
      cout << "-----------------ports south---------------------------" <<endl;
      
      QList<Port> portsouth=test->getPortSouth(new Coord(50,50,50,50));
      for (QList<Port>::iterator it2\
	     = portsouth.begin(); it2 != portsouth.end(); ++it2)
	{
	  cout << "name : " << it2->getName() << endl;
	  cout << it2->getComment() << endl;
	  cout << "x:"<<it2->get_x() << endl;
	  cout << "y:"<<it2->get_y() << endl;
	  cout << "direction :" << it2->getDirection()<< endl;
	  cout << endl;
	}
     
      cout << "-----------------ports north---------------------------" <<endl;
      QList<Port> portnorth=test->getPortNorth(new Coord(50,50,50,50));
      for (QList<Port>::iterator it2\
	     = portnorth.begin(); it2 != portnorth.end(); ++it2)
	{
	  cout << "name : " << it2->getName() << endl;
	  cout << it2->getComment() << endl;
	  cout << "x:"<<it2->get_x() << endl;
	  cout << "y:"<<it2->get_y() << endl;
	  cout << "direction :" << it2->getDirection()<< endl;
	  cout << endl;
	}

      if (it->getArchitecture()!=NULL){

      cout << "----architecture--------------------------------------" <<endl;
      
      QList<Component> *c=new QList<Component>\
	(*((it->getArchitecture())->getComponent()) );
       for (QList<Component>::iterator it2\
	      = c->begin(); it2 != c->end(); ++it2)
	 {
	   cout << "--------component--------------------------------------" <<endl;
	   cout << "name :" << it2->getName() <<endl;
	  
	   cout << "comment :" << it2->getComment() <<endl;
	   cout << "x:"<<(it2->get_x()) << endl;
	   cout << "y:"<<(it2->get_y()) << endl;
	   
	   
	   QList<PortMap> *pm=new QList<PortMap>(*(it2->getPortMap()));
	   for (QList<PortMap>::iterator it3\
		  = pm->begin(); it3 != pm->end(); ++it3)
	     {
	       cout << "------------------portmap----------------------------" <<endl;
	   cout << "name :" << it3->getName() <<endl;
	   cout << "port :" << it3->getPort() <<endl;
	   cout << "comment :" << it3->getComment() <<endl;

	   
	   
	     }
	 }
      }//if
      cout << endl<< "************    fin BASEP  *******************"<<endl <<endl;
	
    }//for
      
  }
  
};//end bdd
};//end viewer
};//end tools
};//end morpheo
