2010-03-09 09:23:58 -06:00
|
|
|
#include "knik/VEdge.h"
|
|
|
|
#include "knik/Vertex.h"
|
|
|
|
#include "knik/Graph.h"
|
|
|
|
|
|
|
|
namespace Knik {
|
|
|
|
|
|
|
|
VEdge::VEdge ( Vertex* from, Vertex* to )
|
|
|
|
// **************************************
|
|
|
|
: Inherit (from, to)
|
|
|
|
{
|
|
|
|
DbU::Unit thickness = DbU::lambda( (_realOccupancy>_capacity)?5.0:2.5 );
|
|
|
|
|
|
|
|
Point fromPoint = getFrom()->getPosition();
|
|
|
|
Point toPoint = getTo()->getPosition();
|
|
|
|
|
|
|
|
_boundingBox = Box ( fromPoint.getX() - thickness, fromPoint.getY(), toPoint.getX() + thickness, toPoint.getY() );
|
|
|
|
}
|
|
|
|
|
|
|
|
VEdge::VEdge ( Vertex* from, Vertex* to, unsigned capacity )
|
|
|
|
// *********************************************************
|
|
|
|
: Inherit (from, to, capacity)
|
|
|
|
{
|
|
|
|
DbU::Unit thickness = DbU::lambda( (_realOccupancy>_capacity)?5.0:2.5 );
|
|
|
|
|
|
|
|
Point fromPoint = getFrom()->getPosition();
|
|
|
|
Point toPoint = getTo()->getPosition();
|
|
|
|
|
|
|
|
_boundingBox = Box ( fromPoint.getX() - thickness, fromPoint.getY(), toPoint.getX() + thickness, toPoint.getY() );
|
|
|
|
}
|
|
|
|
|
|
|
|
VEdge* VEdge::create ( Vertex* from, Vertex* to )
|
|
|
|
// **********************************************
|
|
|
|
{
|
|
|
|
if ( !from || !to )
|
|
|
|
throw Error ("VEdge::create(): cannot create VEdge with NULL vertex.");
|
|
|
|
|
|
|
|
VEdge* vEdge = new VEdge ( from, to );
|
|
|
|
|
2014-12-09 16:49:46 -06:00
|
|
|
vEdge->_postCreate();
|
2010-03-09 09:23:58 -06:00
|
|
|
|
|
|
|
return vEdge;
|
|
|
|
}
|
|
|
|
|
|
|
|
VEdge* VEdge::create ( Vertex* from, Vertex* to, unsigned capacity )
|
|
|
|
// *****************************************************************
|
|
|
|
{
|
|
|
|
if ( !from || !to )
|
|
|
|
throw Error ("VEdge::create(): cannot create VEdge with NULL vertex.");
|
|
|
|
|
|
|
|
VEdge* vEdge = new VEdge ( from, to, capacity );
|
|
|
|
|
2014-12-09 16:49:46 -06:00
|
|
|
vEdge->_postCreate();
|
2010-03-09 09:23:58 -06:00
|
|
|
|
|
|
|
return vEdge;
|
|
|
|
}
|
|
|
|
|
2014-12-09 16:49:46 -06:00
|
|
|
void VEdge::_postCreate()
|
|
|
|
// **********************
|
2010-03-09 09:23:58 -06:00
|
|
|
{
|
2014-12-09 16:49:46 -06:00
|
|
|
Inherit::_postCreate ();
|
2010-03-09 09:23:58 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
VEdge::~VEdge()
|
|
|
|
// **********
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Box VEdge::computeBoundingBox() const
|
|
|
|
// **********************************
|
|
|
|
{
|
|
|
|
DbU::Unit thickness = DbU::lambda( (_realOccupancy>_capacity)?2.5:2.5 );
|
|
|
|
|
|
|
|
Point fromPoint = getFrom()->getPosition();
|
|
|
|
Point toPoint = getTo()->getPosition();
|
|
|
|
|
|
|
|
return Box ( fromPoint.getX() - thickness, fromPoint.getY(), toPoint.getX() + thickness, toPoint.getY() );
|
|
|
|
}
|
|
|
|
|
|
|
|
Point VEdge::getReferencePoint() const
|
|
|
|
// ************************************
|
|
|
|
{
|
|
|
|
return Point ( getBoundingBox().getXMin(), getBoundingBox().getYMin() );
|
|
|
|
}
|
|
|
|
|
|
|
|
DbU::Unit VEdge::getWidth() const
|
|
|
|
// *******************************
|
|
|
|
{
|
|
|
|
return getBoundingBox().getWidth();
|
|
|
|
}
|
|
|
|
|
|
|
|
float VEdge::getNormalisedLength() const
|
|
|
|
// *************************************
|
|
|
|
{
|
|
|
|
return _from->getRoutingGraph()->getVEdgeNormalisedLength();
|
|
|
|
}
|
|
|
|
|
|
|
|
//void VEdge::createSplitter ( Net* net )
|
|
|
|
//// ************************************
|
|
|
|
//{
|
|
|
|
// if ( !_splitter )
|
|
|
|
// {
|
|
|
|
// DbU::Unit _size = DbU::lambda(3);
|
|
|
|
// _splitter = Splitter::createVertical ( net, _fence->getGrid()->getLayer(), _fence, DbU::lambda(2), _size, _size );
|
|
|
|
// _fence->attachSplitter ( _splitter );
|
|
|
|
// // when attaching a splitter : fence's occupancity is incremented. do the same for the edge
|
|
|
|
// _realOccupancy++;
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
//Hook* VEdge::getSplitterHook ( Vertex* vertex )
|
|
|
|
//// ********************************************
|
|
|
|
//{
|
|
|
|
// assert ( _splitter );
|
|
|
|
// assert ( (vertex == _from) || (vertex == _to) );
|
|
|
|
// if ( vertex == _from )
|
|
|
|
// return _splitter->getBottomHook();
|
|
|
|
// else
|
|
|
|
// return _splitter->getTopHook();
|
|
|
|
//}
|
|
|
|
|
|
|
|
} // end namespace
|