/*
 *
 * [desc.]
 */
#include "Tools/Viewer/Bdd/include/ListePorts.h"

namespace morpheo{
namespace tools{
namespace viewer{
namespace bdd{     
  
   /*p_x : centre abs; p_y : centre ordonnée ; s_x s_y : size entiere */
  /*
  *     x-------x
  *     |       |
  *     |   °   |
  *     \       \
  */
  QList<morpheo::tools::viewer::bdd::Port> ListePorts::getPortNorth(Coord *c){
    int count=1;
    int nb=countPort("north"); 
    

    QList<morpheo::tools::viewer::bdd::Port> *result=new \
      QList<morpheo::tools::viewer::bdd::Port>();

    for(QList<morpheo::tools::viewer::bdd::Port>::iterator it\
	  = ports->begin();it!=ports->end();++it)
      {
	if( !strcmp(it->getLocalisation().c_str(),"north"))
	  {
	    it->set_y( c->get_hg_y() );
	    it->set_x( c->get_hg_x() + count*( (c->get_size_x())/(nb+1)) ); 
	   
	    result->append(*it);
	    count++;
	  }
      }
    return *result;
  }


};//end bdd
};//end viewer
};//end tools
};//end morpheo
