- 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 const Name& GCell::getName () const
{ return _extensionName; } { return _extensionName; }

View File

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