Commit 39231d51 authored by Jean-Paul Chaput's avatar Jean-Paul Chaput
Browse files

Allow to enable/disable minimal size checking in Contact CTOR.

parent 1bff74a5
......@@ -103,6 +103,9 @@ class Contact_Hooks : public Collection<Hook*> {
// Contact implementation
// ****************************************************************************************************
bool Contact::_checkMinSize = true;
Contact::Contact(Net* net, const Layer* layer, DbU::Unit x, DbU::Unit y, DbU::Unit width, DbU::Unit height)
// ********************************************************************************************************
: Inherit(net),
......@@ -169,12 +172,13 @@ Contact* Contact::create(Component* anchor, const Layer* layer, DbU::Unit dx, Db
bool Contact::_postCheck ()
// *************************
{
DbU::Unit twoGrid = DbU::fromGrid( 2 );
bool rvalue = true;
if (_layer->isSymbolic()) {
if (not _width ) _width = _layer->getMinimalSize();
if (not _height) _height = _layer->getMinimalSize();
} else {
if ((_width) and (_width < _layer->getMinimalSize())) {
if ((_width) and _checkMinSize and (_width < _layer->getMinimalSize())) {
cerr << Warning( "Contact::_postCheck(): Width %s is inferior to layer minimal size %s, bumping.\n"
" (on %s)"
, DbU::getValueString(_width).c_str()
......@@ -184,7 +188,7 @@ Contact* Contact::create(Component* anchor, const Layer* layer, DbU::Unit dx, Db
_width = _layer->getMinimalSize();
rvalue = false;
}
if ((_height) and (_height < _layer->getMinimalSize())) {
if ((_height) and _checkMinSize and (_height < _layer->getMinimalSize())) {
cerr << Warning( "Contact::_postCheck(): Height %s is inferior to layer minimal size %s, bumping.\n"
" (on %s)"
, DbU::getValueString(_height).c_str()
......@@ -194,6 +198,24 @@ Contact* Contact::create(Component* anchor, const Layer* layer, DbU::Unit dx, Db
_height = _layer->getMinimalSize();
rvalue = false;
}
if ((_width % twoGrid) and _checkMinSize) {
cerr << Warning( "Contact::_postCheck(): Width %s is not a multiple of 2*%s, shrinking.\n"
" (on %s)"
, DbU::getValueString(_width).c_str()
, DbU::getValueString(DbU::fromGrid(1)).c_str()
, getString(this).c_str() )
<< endl;
_width -= (_width % twoGrid);
}
if ((_height % twoGrid) and _checkMinSize) {
cerr << Warning( "Contact::_postCheck(): Height %s is not a multiple of 2*%s, shrinking.\n"
" (on %s)"
, DbU::getValueString(_height).c_str()
, DbU::getValueString(DbU::fromGrid(1)).c_str()
, getString(this).c_str() )
<< endl;
_height -= (_height % twoGrid);
}
}
return rvalue;
}
......
......@@ -75,20 +75,22 @@ namespace Hurricane {
, DbU::Unit height
);
public:
static Contact* create ( Net* net
, const Layer* layer
, DbU::Unit x
, DbU::Unit y
, DbU::Unit width =0
, DbU::Unit height=0
);
static Contact* create ( Component* anchor
, const Layer* layer
, DbU::Unit dx
, DbU::Unit dy
, DbU::Unit width =0
, DbU::Unit height=0
);
static inline void enableCheckMinSize ();
static inline void disableCheckMinSize ();
static Contact* create ( Net* net
, const Layer* layer
, DbU::Unit x
, DbU::Unit y
, DbU::Unit width =0
, DbU::Unit height=0
);
static Contact* create ( Component* anchor
, const Layer* layer
, DbU::Unit dx
, DbU::Unit dy
, DbU::Unit width =0
, DbU::Unit height=0
);
public:
virtual Hooks getHooks () const;
virtual DbU::Unit getX () const;
......@@ -128,18 +130,23 @@ namespace Hurricane {
virtual std::string _getString () const;
virtual Record* _getRecord () const;
private:
AnchorHook _anchorHook;
const Layer* _layer;
DbU::Unit _dx;
DbU::Unit _dy;
static bool _checkMinSize;
AnchorHook _anchorHook;
const Layer* _layer;
DbU::Unit _dx;
DbU::Unit _dy;
protected:
DbU::Unit _width;
DbU::Unit _height;
DbU::Unit _width;
DbU::Unit _height;
};
inline void Contact::enableCheckMinSize () { _checkMinSize=true; }
inline void Contact::disableCheckMinSize () { _checkMinSize=false; }
// -------------------------------------------------------------------
// Class : "Hurricane::Contact".
// Class : "Hurricane::JsonContact".
class JsonContact : public JsonComponent {
public:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment