/*
 *
 * [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::getPortWest(Coord *c){
    int count=1;
    int nb=countPort("west"); 

    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(),"west"))
	  {
	    it->set_y( (c->get_hg_y()) + count*((c->get_size_y())/(nb+1)) );
	    it->set_x( c->get_hg_x() ); 
	    
	    result->append(*it);
	    count++;
	  }
      }
    return *result;
  }


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