- Add: set new xmin and ymin, update contact position accordingly.
This commit is contained in:
EricLaoGitHub 2016-07-13 14:53:07 +02:00
parent 6bc2c1b94d
commit 07935d2872
2 changed files with 45 additions and 0 deletions

View File

@ -604,6 +604,39 @@ namespace Anabatic {
}
void GCell::setXY ( DbU::Unit x, DbU::Unit y )
{
UpdateSession::open();
_xmin = x;
_ymin = y;
UpdateSession::close();
}
void GCell::updateContactsPosition ()
{
UpdateSession::open();
DbU::Unit xc = (getXMax() + getXMin())/2;
DbU::Unit yc = (getYMax() + getYMin())/2;
for (vector<Contact*>::iterator it = _contacts.begin(); it != _contacts.end(); it++){
for ( Component* c : (*it)->getSlaveComponents() ){
Horizontal* h = dynamic_cast<Horizontal*>(c);
Vertical* v = dynamic_cast<Vertical*> (c);
if (h){
//if (h->getY() == (*it)->getY()) h->setY(yc);
h->setY(yc);
} else if (v) {
//if (v->getX() == (*it)->getX()) v->setX(xc);
v->setX(xc);
}
}
(*it)->setX(xc);
(*it)->setY(yc);
}
UpdateSession::close();
}
const Name& GCell::getName () const
{ return _extensionName; }

View File

@ -23,9 +23,15 @@
#include "hurricane/Name.h"
#include "hurricane/Box.h"
#include "hurricane/Cell.h"
#include "hurricane/Component.h"
#include "hurricane/Horizontal.h"
#include "hurricane/Vertical.h"
#include "hurricane/ExtensionGo.h"
namespace Hurricane {
class Contact;
class Component;
class Horizontal;
class Vertical;
}
#include "anabatic/Edge.h"
@ -46,6 +52,9 @@ namespace Anabatic {
using Hurricane::Entity;
using Hurricane::Contact;
using Hurricane::Cell;
using Hurricane::Component;
using Hurricane::Horizontal;
using Hurricane::Vertical;
class AnabaticEngine;
@ -113,6 +122,9 @@ namespace Anabatic {
Contact* getGContact ( Net* );
inline const vector<Contact*>& getGContacts () const;
bool unrefContact ( Contact* );
void setXY ( DbU::Unit x, DbU::Unit y );
void updateContactsPosition ();
// Misc. functions.
inline const Flags& flags () const;
inline Flags& flags ();