/*
 *
 * [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::getPortEast(Coord *c){

    int count=1;
    int nb=countPort("east"); 
    

    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("east",it->getLocalisation().c_str()))
	  {
	    it->set_y( (c->get_bd_y())-(c->get_size_y()) + count*((c->get_size_y())/(nb+1)) );
	    it->set_x( c->get_bd_x() ); 
	    result->append(*it);
	    count ++;
	  }
      }
    return *result;
  }


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