patterns
This commit is contained in:
parent
c7b2c17370
commit
d60da7f7ac
|
@ -23,57 +23,57 @@ class BasicLayer_BasicLayers : public Collection<BasicLayer*> {
|
|||
// Types
|
||||
// *****
|
||||
|
||||
public: typedef Collection<BasicLayer*> Inherit;
|
||||
public: typedef Collection<BasicLayer*> Inherit;
|
||||
|
||||
public: class Locator : public Hurricane::Locator<BasicLayer*> {
|
||||
// ***********************************************************
|
||||
public: class Locator : public Hurricane::Locator<BasicLayer*> {
|
||||
// ***********************************************************
|
||||
|
||||
public: typedef Hurricane::Locator<BasicLayer*> Inherit;
|
||||
public: typedef Hurricane::Locator<BasicLayer*> Inherit;
|
||||
|
||||
private: const BasicLayer* _basicLayer;
|
||||
private: const BasicLayer* _basicLayer;
|
||||
|
||||
public: Locator(const BasicLayer* basicLayer = NULL);
|
||||
public: Locator(const Locator& locator);
|
||||
public: Locator(const BasicLayer* basicLayer = NULL);
|
||||
public: Locator(const Locator& locator);
|
||||
|
||||
public: Locator& operator=(const Locator& locator);
|
||||
public: Locator& operator=(const Locator& locator);
|
||||
|
||||
public: virtual BasicLayer* GetElement() const;
|
||||
public: virtual Hurricane::Locator<BasicLayer*>* GetClone() const;
|
||||
public: virtual BasicLayer* GetElement() const;
|
||||
public: virtual Hurricane::Locator<BasicLayer*>* GetClone() const;
|
||||
|
||||
public: virtual bool IsValid() const;
|
||||
public: virtual bool IsValid() const;
|
||||
|
||||
public: virtual void Progress();
|
||||
public: virtual void Progress();
|
||||
|
||||
public: virtual string _GetString() const;
|
||||
public: virtual string _GetString() const;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
// Atributes
|
||||
// *********
|
||||
|
||||
private: const BasicLayer* _basicLayer;
|
||||
private: const BasicLayer* _basicLayer;
|
||||
|
||||
// Constructors
|
||||
// ************
|
||||
|
||||
public: BasicLayer_BasicLayers(const BasicLayer* basicLayer = NULL);
|
||||
public: BasicLayer_BasicLayers(const BasicLayer_BasicLayers& basicLayers);
|
||||
public: BasicLayer_BasicLayers(const BasicLayer* basicLayer = NULL);
|
||||
public: BasicLayer_BasicLayers(const BasicLayer_BasicLayers& basicLayers);
|
||||
|
||||
// Operators
|
||||
// *********
|
||||
|
||||
public: BasicLayer_BasicLayers& operator=(const BasicLayer_BasicLayers& basicLayers);
|
||||
public: BasicLayer_BasicLayers& operator=(const BasicLayer_BasicLayers& basicLayers);
|
||||
|
||||
// Accessors
|
||||
// *********
|
||||
|
||||
public: virtual Collection<BasicLayer*>* GetClone() const;
|
||||
public: virtual Hurricane::Locator<BasicLayer*>* GetLocator() const;
|
||||
public: virtual Collection<BasicLayer*>* GetClone() const;
|
||||
public: virtual Hurricane::Locator<BasicLayer*>* GetLocator() const;
|
||||
|
||||
// Others
|
||||
// ******
|
||||
|
||||
public: virtual string _GetString() const;
|
||||
public: virtual string _GetString() const;
|
||||
|
||||
};
|
||||
|
||||
|
@ -85,211 +85,211 @@ class BasicLayer_BasicLayers : public Collection<BasicLayer*> {
|
|||
|
||||
BasicLayer::BasicLayer(Technology* technology, const Name& name, const Type& type, unsigned extractNumber, const Unit& minimalSize, const Unit& minimalSpacing)
|
||||
// ****************************************************************************************************
|
||||
: Inherit(technology, name, minimalSize, minimalSpacing),
|
||||
_type(type),
|
||||
_extractNumber(extractNumber),
|
||||
_redValue(255),
|
||||
_greenValue(255),
|
||||
_blueValue(255),
|
||||
_fillPattern("FFFFFFFFFFFFFFFF"),
|
||||
_displayThreshold(0.0)
|
||||
: Inherit(technology, name, minimalSize, minimalSpacing),
|
||||
_type(type),
|
||||
_extractNumber(extractNumber),
|
||||
_redValue(255),
|
||||
_greenValue(255),
|
||||
_blueValue(255),
|
||||
_fillPattern("FFFFFFFFFFFFFFFF"),
|
||||
_displayThreshold(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
BasicLayer* BasicLayer::Create(Technology* technology, const Name& name, const Type& type, unsigned extractNumber, const Unit& minimalSize, const Unit& minimalSpacing)
|
||||
// ****************************************************************************************************
|
||||
{
|
||||
BasicLayer* basicLayer =
|
||||
new BasicLayer(technology, name, type, extractNumber, minimalSize, minimalSpacing);
|
||||
BasicLayer* basicLayer =
|
||||
new BasicLayer(technology, name, type, extractNumber, minimalSize, minimalSpacing);
|
||||
|
||||
basicLayer->_PostCreate();
|
||||
basicLayer->_PostCreate();
|
||||
|
||||
return basicLayer;
|
||||
return basicLayer;
|
||||
}
|
||||
|
||||
BasicLayers BasicLayer::GetBasicLayers() const
|
||||
// *******************************************
|
||||
{
|
||||
return BasicLayer_BasicLayers(this);
|
||||
return BasicLayer_BasicLayers(this);
|
||||
}
|
||||
|
||||
void BasicLayer::SetColor(unsigned short redValue, unsigned short greenValue, unsigned short blueValue)
|
||||
// ****************************************************************************************************
|
||||
{
|
||||
if ((redValue != _redValue) || (greenValue != _greenValue) || (blueValue != _blueValue)) {
|
||||
_redValue = redValue;
|
||||
_greenValue = greenValue;
|
||||
_blueValue = blueValue;
|
||||
//if (_drawGC) {
|
||||
// gdk_gc_destroy(_drawGC);
|
||||
// _drawGC = NULL;
|
||||
//}
|
||||
//if (_fillGC) {
|
||||
// gdk_gc_destroy(_fillGC);
|
||||
// _fillGC = NULL;
|
||||
//}
|
||||
}
|
||||
if ((redValue != _redValue) || (greenValue != _greenValue) || (blueValue != _blueValue)) {
|
||||
_redValue = redValue;
|
||||
_greenValue = greenValue;
|
||||
_blueValue = blueValue;
|
||||
//if (_drawGC) {
|
||||
// gdk_gc_destroy(_drawGC);
|
||||
// _drawGC = NULL;
|
||||
//}
|
||||
//if (_fillGC) {
|
||||
// gdk_gc_destroy(_fillGC);
|
||||
// _fillGC = NULL;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
void BasicLayer::SetFillPattern(const string& fillPattern)
|
||||
// *******************************************************
|
||||
{
|
||||
if (fillPattern != _fillPattern) {
|
||||
if (fillPattern.size() != 16)
|
||||
throw Error("Can't set fill pattern (bad value)");
|
||||
if (fillPattern != _fillPattern) {
|
||||
if (fillPattern.size() != 16)
|
||||
throw Error("Can't set fill pattern (bad value)");
|
||||
|
||||
string validChars = "0123456789ABCDEFabcdef";
|
||||
for (unsigned i = 0; i < 16; i++) {
|
||||
if (validChars.find(fillPattern[i]) == string::npos)
|
||||
throw Error("Can't set fill pattern (bad value)");
|
||||
}
|
||||
_fillPattern = fillPattern;
|
||||
//if (_drawGC) {
|
||||
// gdk_gc_destroy(_drawGC);
|
||||
// _drawGC = NULL;
|
||||
//}
|
||||
//if (_fillGC) {
|
||||
// gdk_gc_destroy(_fillGC);
|
||||
// _fillGC = NULL;
|
||||
//}
|
||||
}
|
||||
string validChars = "0123456789ABCDEFabcdef";
|
||||
for (unsigned i = 0; i < 16; i++) {
|
||||
if (validChars.find(fillPattern[i]) == string::npos)
|
||||
throw Error("Can't set fill pattern (bad value)");
|
||||
}
|
||||
_fillPattern = fillPattern;
|
||||
//if (_drawGC) {
|
||||
// gdk_gc_destroy(_drawGC);
|
||||
// _drawGC = NULL;
|
||||
//}
|
||||
//if (_fillGC) {
|
||||
// gdk_gc_destroy(_fillGC);
|
||||
// _fillGC = NULL;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
void BasicLayer::_PostCreate()
|
||||
// ***************************
|
||||
{
|
||||
Mask basicLayersMask = 0;
|
||||
for_each_basic_layer(basicLayer, GetTechnology()->GetBasicLayers()) {
|
||||
basicLayersMask |= basicLayer->GetMask();
|
||||
end_for;
|
||||
}
|
||||
Mask basicLayersMask = 0;
|
||||
for_each_basic_layer(basicLayer, GetTechnology()->GetBasicLayers()) {
|
||||
basicLayersMask |= basicLayer->GetMask();
|
||||
end_for;
|
||||
}
|
||||
|
||||
Mask mask = 1;
|
||||
while (mask && (mask & basicLayersMask)) mask = mask<<1;
|
||||
Mask mask = 1;
|
||||
while (mask && (mask & basicLayersMask)) mask = mask<<1;
|
||||
|
||||
if (!mask)
|
||||
throw Error("Can't create " + _TName("BasicLayer") + " : mask capacity overflow");
|
||||
if (!mask)
|
||||
throw Error("Can't create " + _TName("BasicLayer") + " : mask capacity overflow");
|
||||
|
||||
_SetMask(mask);
|
||||
_SetMask(mask);
|
||||
|
||||
if (_extractNumber) {
|
||||
Mask extractMask = (1 << _extractNumber);
|
||||
if (_extractNumber) {
|
||||
Mask extractMask = (1 << _extractNumber);
|
||||
|
||||
if (!extractMask)
|
||||
throw Error("Can't create " + _TName("BasicLayer") + " : extract mask capacity overflow");
|
||||
if (!extractMask)
|
||||
throw Error("Can't create " + _TName("BasicLayer") + " : extract mask capacity overflow");
|
||||
|
||||
_SetExtractMask(extractMask);
|
||||
}
|
||||
_SetExtractMask(extractMask);
|
||||
}
|
||||
|
||||
Inherit::_PostCreate();
|
||||
Inherit::_PostCreate();
|
||||
}
|
||||
|
||||
void BasicLayer::_PreDelete()
|
||||
// **************************
|
||||
{
|
||||
Inherit::_PreDelete();
|
||||
Inherit::_PreDelete();
|
||||
|
||||
//if (_drawGC) gdk_gc_destroy(_drawGC);
|
||||
//if (_fillGC) gdk_gc_destroy(_fillGC);
|
||||
//if (_drawGC) gdk_gc_destroy(_drawGC);
|
||||
//if (_fillGC) gdk_gc_destroy(_fillGC);
|
||||
|
||||
CompositeLayers compositeLayers = GetTechnology()->GetCompositeLayers();
|
||||
for_each_composite_layer(compositeLayer, compositeLayers) {
|
||||
if (compositeLayer->Contains(this)) compositeLayer->Remove(this);
|
||||
end_for;
|
||||
}
|
||||
CompositeLayers compositeLayers = GetTechnology()->GetCompositeLayers();
|
||||
for_each_composite_layer(compositeLayer, compositeLayers) {
|
||||
if (compositeLayer->Contains(this)) compositeLayer->Remove(this);
|
||||
end_for;
|
||||
}
|
||||
}
|
||||
|
||||
string BasicLayer::_GetString() const
|
||||
// **********************************
|
||||
{
|
||||
string s = Inherit::_GetString();
|
||||
// s.insert(s.length() - 1, " " + GetString(_type));
|
||||
return s;
|
||||
string s = Inherit::_GetString();
|
||||
// s.insert(s.length() - 1, " " + GetString(_type));
|
||||
return s;
|
||||
}
|
||||
|
||||
Record* BasicLayer::_GetRecord() const
|
||||
// *****************************
|
||||
{
|
||||
Record* record = Inherit::_GetRecord();
|
||||
if (record) {
|
||||
record->Add(GetSlot("Type", &_type));
|
||||
record->Add(GetSlot("RedValue", &_redValue));
|
||||
record->Add(GetSlot("GreenValue", &_greenValue));
|
||||
record->Add(GetSlot("BlueValue", &_blueValue));
|
||||
record->Add(GetSlot("FillPattern", &_fillPattern));
|
||||
record->Add(GetSlot("DisplayThreshold", &_displayThreshold));
|
||||
}
|
||||
return record;
|
||||
Record* record = Inherit::_GetRecord();
|
||||
if (record) {
|
||||
record->Add(GetSlot("Type", &_type));
|
||||
record->Add(GetSlot("RedValue", &_redValue));
|
||||
record->Add(GetSlot("GreenValue", &_greenValue));
|
||||
record->Add(GetSlot("BlueValue", &_blueValue));
|
||||
record->Add(GetSlot("FillPattern", &_fillPattern));
|
||||
record->Add(GetSlot("DisplayThreshold", &_displayThreshold));
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
//GdkGC* BasicLayer::_GetDrawGC()
|
||||
//// ****************************
|
||||
//{
|
||||
// if (!_drawGC) _drawGC = gtk_gc_new(_redValue, _greenValue, _blueValue);
|
||||
// if (!_drawGC) _drawGC = gtk_gc_new(_redValue, _greenValue, _blueValue);
|
||||
//
|
||||
// return _drawGC;
|
||||
// return _drawGC;
|
||||
//}
|
||||
//
|
||||
//GdkGC* BasicLayer::_GetFillGC()
|
||||
//// ****************************
|
||||
//{
|
||||
// if (!_fillGC) _fillGC = gtk_gc_new(_redValue, _greenValue, _blueValue, _fillPattern);
|
||||
// if (!_fillGC) _fillGC = gtk_gc_new(_redValue, _greenValue, _blueValue, _fillPattern);
|
||||
//
|
||||
// return _fillGC;
|
||||
// return _fillGC;
|
||||
//}
|
||||
//
|
||||
|
||||
//void BasicLayer::_Fill(View* view, const Box& box) const
|
||||
//// *****************************************************
|
||||
//{
|
||||
// switch (_type) {
|
||||
// case Type::CONTACT : {
|
||||
// switch (_type) {
|
||||
// case Type::CONTACT : {
|
||||
//
|
||||
// Unit minimalSize = GetMinimalSize();
|
||||
// Unit minimalSpacing = GetMinimalSpacing();
|
||||
// Unit minimalSize = GetMinimalSize();
|
||||
// Unit minimalSpacing = GetMinimalSpacing();
|
||||
//
|
||||
// if ((minimalSize <= 0) || (minimalSpacing <= 0))
|
||||
// view->FillRectangle(box);
|
||||
// else {
|
||||
// view->DrawRectangle(box);
|
||||
// if ((minimalSize <= 0) || (minimalSpacing <= 0))
|
||||
// view->FillRectangle(box);
|
||||
// else {
|
||||
// view->DrawRectangle(box);
|
||||
//
|
||||
// Unit width = box.GetWidth();
|
||||
// Unit height = box.GetHeight();
|
||||
// Unit offset = minimalSize + minimalSpacing;
|
||||
// Unit width = box.GetWidth();
|
||||
// Unit height = box.GetHeight();
|
||||
// Unit offset = minimalSize + minimalSpacing;
|
||||
//
|
||||
// int nx = (int)(GetValue(width) / GetValue(offset));
|
||||
// int ny = (int)(GetValue(height) / GetValue(offset));
|
||||
// int nx = (int)(GetValue(width) / GetValue(offset));
|
||||
// int ny = (int)(GetValue(height) / GetValue(offset));
|
||||
//
|
||||
// Unit dx = (width - (minimalSize + (offset * nx))) / 2;
|
||||
// Unit dy = (height - (minimalSize + (offset * ny))) / 2;
|
||||
// Unit dx = (width - (minimalSize + (offset * nx))) / 2;
|
||||
// Unit dy = (height - (minimalSize + (offset * ny))) / 2;
|
||||
//
|
||||
// if (dx < 0) dx = (width - (minimalSize + (offset * (--nx)))) / 2;
|
||||
// if (dy < 0) dy = (height - (minimalSize + (offset * (--ny)))) / 2;
|
||||
// if (dx < 0) dx = (width - (minimalSize + (offset * (--nx)))) / 2;
|
||||
// if (dy < 0) dy = (height - (minimalSize + (offset * (--ny)))) / 2;
|
||||
//
|
||||
// Unit xmin = box.GetXMin() + dx;
|
||||
// Unit ymin = box.GetYMin() + dy;
|
||||
// Unit xmax = box.GetXMax() - dx;
|
||||
// Unit ymax = box.GetYMax() - dy;
|
||||
// Unit xmin = box.GetXMin() + dx;
|
||||
// Unit ymin = box.GetYMin() + dy;
|
||||
// Unit xmax = box.GetXMax() - dx;
|
||||
// Unit ymax = box.GetYMax() - dy;
|
||||
//
|
||||
// if ((xmin < xmax) && (ymin < ymax)) {
|
||||
// Unit y = ymin;
|
||||
// do {
|
||||
// Unit x = xmin;
|
||||
// do {
|
||||
// view->FillRectangle(x, y, x + minimalSize, y + minimalSize, true);
|
||||
// x += offset;
|
||||
// } while (x < xmax);
|
||||
// y += offset;
|
||||
// } while (y < ymax);
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// default : {
|
||||
// view->FillRectangle(box);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if ((xmin < xmax) && (ymin < ymax)) {
|
||||
// Unit y = ymin;
|
||||
// do {
|
||||
// Unit x = xmin;
|
||||
// do {
|
||||
// view->FillRectangle(x, y, x + minimalSize, y + minimalSize, true);
|
||||
// x += offset;
|
||||
// } while (x < xmax);
|
||||
// y += offset;
|
||||
// } while (y < ymax);
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// default : {
|
||||
// view->FillRectangle(box);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
// ****************************************************************************************************
|
||||
|
@ -298,44 +298,44 @@ Record* BasicLayer::_GetRecord() const
|
|||
|
||||
BasicLayer_BasicLayers::BasicLayer_BasicLayers(const BasicLayer* basicLayer)
|
||||
// *************************************************************************
|
||||
: Inherit(),
|
||||
_basicLayer(basicLayer)
|
||||
: Inherit(),
|
||||
_basicLayer(basicLayer)
|
||||
{
|
||||
}
|
||||
|
||||
BasicLayer_BasicLayers::BasicLayer_BasicLayers(const BasicLayer_BasicLayers& basicLayers)
|
||||
// **************************************************************************************
|
||||
: Inherit(),
|
||||
_basicLayer(basicLayers._basicLayer)
|
||||
: Inherit(),
|
||||
_basicLayer(basicLayers._basicLayer)
|
||||
{
|
||||
}
|
||||
|
||||
BasicLayer_BasicLayers& BasicLayer_BasicLayers::operator=(const BasicLayer_BasicLayers& basicLayers)
|
||||
// *************************************************************************************************
|
||||
{
|
||||
_basicLayer = basicLayers._basicLayer;
|
||||
return *this;
|
||||
_basicLayer = basicLayers._basicLayer;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Collection<BasicLayer*>* BasicLayer_BasicLayers::GetClone() const
|
||||
// **************************************************************
|
||||
{
|
||||
return new BasicLayer_BasicLayers(*this);
|
||||
return new BasicLayer_BasicLayers(*this);
|
||||
}
|
||||
|
||||
Locator<BasicLayer*>* BasicLayer_BasicLayers::GetLocator() const
|
||||
// *************************************************************
|
||||
{
|
||||
return new Locator(_basicLayer);
|
||||
return new Locator(_basicLayer);
|
||||
}
|
||||
|
||||
string BasicLayer_BasicLayers::_GetString() const
|
||||
// **********************************************
|
||||
{
|
||||
string s = "<" + _TName("BasicLayer::BasicLayers");
|
||||
if (_basicLayer) s += " " + GetString(_basicLayer);
|
||||
s += ">";
|
||||
return s;
|
||||
string s = "<" + _TName("BasicLayer::BasicLayers");
|
||||
if (_basicLayer) s += " " + GetString(_basicLayer);
|
||||
s += ">";
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
|
@ -346,56 +346,56 @@ string BasicLayer_BasicLayers::_GetString() const
|
|||
|
||||
BasicLayer_BasicLayers::Locator::Locator(const BasicLayer* basicLayer)
|
||||
// *******************************************************************
|
||||
: Inherit(),
|
||||
_basicLayer(basicLayer)
|
||||
: Inherit(),
|
||||
_basicLayer(basicLayer)
|
||||
{
|
||||
}
|
||||
|
||||
BasicLayer_BasicLayers::Locator::Locator(const Locator& locator)
|
||||
// *************************************************************
|
||||
: Inherit(),
|
||||
_basicLayer(locator._basicLayer)
|
||||
: Inherit(),
|
||||
_basicLayer(locator._basicLayer)
|
||||
{
|
||||
}
|
||||
|
||||
BasicLayer_BasicLayers::Locator& BasicLayer_BasicLayers::Locator::operator=(const Locator& locator)
|
||||
// ************************************************************************************************
|
||||
{
|
||||
_basicLayer = locator._basicLayer;
|
||||
return *this;
|
||||
_basicLayer = locator._basicLayer;
|
||||
return *this;
|
||||
}
|
||||
|
||||
BasicLayer* BasicLayer_BasicLayers::Locator::GetElement() const
|
||||
// ************************************************************
|
||||
{
|
||||
return (BasicLayer*)_basicLayer;
|
||||
return (BasicLayer*)_basicLayer;
|
||||
}
|
||||
|
||||
Locator<BasicLayer*>* BasicLayer_BasicLayers::Locator::GetClone() const
|
||||
// ********************************************************************
|
||||
{
|
||||
return new Locator(*this);
|
||||
return new Locator(*this);
|
||||
}
|
||||
|
||||
bool BasicLayer_BasicLayers::Locator::IsValid() const
|
||||
// **************************************************
|
||||
{
|
||||
return (_basicLayer != NULL);
|
||||
return (_basicLayer != NULL);
|
||||
}
|
||||
|
||||
void BasicLayer_BasicLayers::Locator::Progress()
|
||||
// *********************************************
|
||||
{
|
||||
_basicLayer = NULL;
|
||||
_basicLayer = NULL;
|
||||
}
|
||||
|
||||
string BasicLayer_BasicLayers::Locator::_GetString() const
|
||||
// *******************************************************
|
||||
{
|
||||
string s = "<" + _TName("BasicLayer::BasicLayers::Locator");
|
||||
if (_basicLayer) s += " " + GetString(_basicLayer);
|
||||
s += ">";
|
||||
return s;
|
||||
string s = "<" + _TName("BasicLayer::BasicLayers::Locator");
|
||||
if (_basicLayer) s += " " + GetString(_basicLayer);
|
||||
s += ">";
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
|
@ -406,35 +406,35 @@ string BasicLayer_BasicLayers::Locator::_GetString() const
|
|||
|
||||
BasicLayer::Type::Type(const Code& code)
|
||||
// *************************************
|
||||
: _code(code)
|
||||
: _code(code)
|
||||
{
|
||||
}
|
||||
|
||||
BasicLayer::Type::Type(const Type& type)
|
||||
// *************************************
|
||||
: _code(type._code)
|
||||
: _code(type._code)
|
||||
{
|
||||
}
|
||||
|
||||
BasicLayer::Type& BasicLayer::Type::operator=(const Type& type)
|
||||
// ************************************************************
|
||||
{
|
||||
_code = type._code;
|
||||
return *this;
|
||||
_code = type._code;
|
||||
return *this;
|
||||
}
|
||||
|
||||
string BasicLayer::Type::_GetString() const
|
||||
// ****************************************
|
||||
{
|
||||
return GetString(_code);
|
||||
return GetString(_code);
|
||||
}
|
||||
|
||||
Record* BasicLayer::Type::_GetRecord() const
|
||||
// ***********************************
|
||||
{
|
||||
Record* record = new Record(GetString(this));
|
||||
record->Add(GetSlot("Code", &_code));
|
||||
return record;
|
||||
Record* record = new Record(GetString(this));
|
||||
record->Add(GetSlot("Code", &_code));
|
||||
return record;
|
||||
}
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
@ -442,19 +442,19 @@ Record* BasicLayer::Type::_GetRecord() const
|
|||
bool Scan(const string& s, H::BasicLayer::Type& type)
|
||||
// **************************************************
|
||||
{
|
||||
if (s == "UNDEFINED") {
|
||||
type = H::BasicLayer::Type::UNDEFINED;
|
||||
return true;
|
||||
}
|
||||
if (s == "CONDUCTING") {
|
||||
type = H::BasicLayer::Type::CONDUCTING;
|
||||
return true;
|
||||
}
|
||||
if (s == "CONTACT") {
|
||||
type = H::BasicLayer::Type::CONTACT;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if (s == "UNDEFINED") {
|
||||
type = H::BasicLayer::Type::UNDEFINED;
|
||||
return true;
|
||||
}
|
||||
if (s == "CONDUCTING") {
|
||||
type = H::BasicLayer::Type::CONDUCTING;
|
||||
return true;
|
||||
}
|
||||
if (s == "CONTACT") {
|
||||
type = H::BasicLayer::Type::CONTACT;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ****************************************************************************************************
|
||||
|
|
|
@ -27,84 +27,84 @@ class BasicLayer : public Layer {
|
|||
// Types
|
||||
// *****
|
||||
|
||||
public: typedef Layer Inherit;
|
||||
public: typedef Layer Inherit;
|
||||
|
||||
public: class Type {
|
||||
// ***************
|
||||
// ***************
|
||||
|
||||
public: enum Code {UNDEFINED=0, CONDUCTING=1, CONTACT=2};
|
||||
public: enum Code {UNDEFINED=0, CONDUCTING=1, CONTACT=2};
|
||||
|
||||
private: Code _code;
|
||||
private: Code _code;
|
||||
|
||||
public: Type(const Code& code = UNDEFINED);
|
||||
public: Type(const Type& type);
|
||||
public: Type(const Code& code = UNDEFINED);
|
||||
public: Type(const Type& type);
|
||||
|
||||
public: Type& operator=(const Type& type);
|
||||
public: Type& operator=(const Type& type);
|
||||
|
||||
public: operator const Code&() const {return _code;};
|
||||
public: operator const Code&() const {return _code;};
|
||||
|
||||
public: const Code& GetCode() const {return _code;};
|
||||
public: const Code& GetCode() const {return _code;};
|
||||
|
||||
public: string _GetTypeName() const { return _TName("BasicLayer::Type"); };
|
||||
public: string _GetString() const;
|
||||
public: Record* _GetRecord() const;
|
||||
public: string _GetString() const;
|
||||
public: Record* _GetRecord() const;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
// Attributes
|
||||
// **********
|
||||
|
||||
private: Type _type;
|
||||
private: unsigned _extractNumber;
|
||||
private: unsigned short _redValue;
|
||||
private: unsigned short _greenValue;
|
||||
private: unsigned short _blueValue;
|
||||
private: string _fillPattern;
|
||||
private: double _displayThreshold;
|
||||
// private: GdkGC* _drawGC;
|
||||
// private: GdkGC* _fillGC;
|
||||
private: Type _type;
|
||||
private: unsigned _extractNumber;
|
||||
private: unsigned short _redValue;
|
||||
private: unsigned short _greenValue;
|
||||
private: unsigned short _blueValue;
|
||||
private: string _fillPattern;
|
||||
private: double _displayThreshold;
|
||||
// private: GdkGC* _drawGC;
|
||||
// private: GdkGC* _fillGC;
|
||||
|
||||
// Constructors
|
||||
// ************
|
||||
|
||||
protected: BasicLayer(Technology* technology, const Name& name, const Type& type, unsigned extractNumber, const Unit& minimalSize = 0, const Unit& minimalSpacing = 0);
|
||||
protected: BasicLayer(Technology* technology, const Name& name, const Type& type, unsigned extractNumber, const Unit& minimalSize = 0, const Unit& minimalSpacing = 0);
|
||||
|
||||
public: static BasicLayer* Create(Technology* technology, const Name& name, const Type& type, unsigned extractNumber, const Unit& minimalSize = 0, const Unit& minimalSpacing = 0);
|
||||
public: static BasicLayer* Create(Technology* technology, const Name& name, const Type& type, unsigned extractNumber, const Unit& minimalSize = 0, const Unit& minimalSpacing = 0);
|
||||
|
||||
// Accessors
|
||||
// *********
|
||||
|
||||
public: const Type& GetType() const {return _type;};
|
||||
public: unsigned GetExtractNumber() const {return _extractNumber;};
|
||||
public: const unsigned short& GetRedValue() const {return _redValue;};
|
||||
public: const unsigned short& GetGreenValue() const {return _greenValue;};
|
||||
public: const unsigned short& GetBlueValue() const {return _blueValue;};
|
||||
public: const string& GetFillPattern() const {return _fillPattern;};
|
||||
public: double GetDisplayThreshold() const {return _displayThreshold;};
|
||||
public: virtual BasicLayers GetBasicLayers() const;
|
||||
public: const Type& GetType() const {return _type;};
|
||||
public: unsigned GetExtractNumber() const {return _extractNumber;};
|
||||
public: const unsigned short& GetRedValue() const {return _redValue;};
|
||||
public: const unsigned short& GetGreenValue() const {return _greenValue;};
|
||||
public: const unsigned short& GetBlueValue() const {return _blueValue;};
|
||||
public: const string& GetFillPattern() const {return _fillPattern;};
|
||||
public: double GetDisplayThreshold() const {return _displayThreshold;};
|
||||
public: virtual BasicLayers GetBasicLayers() const;
|
||||
|
||||
// Updators
|
||||
// ********
|
||||
|
||||
public: void SetColor(unsigned short redValue, unsigned short greenValue, unsigned short blueValue);
|
||||
public: void SetFillPattern(const string& fillPattern);
|
||||
public: void SetDisplayThreshold(double threshold) {_displayThreshold = threshold;};
|
||||
public: void SetColor(unsigned short redValue, unsigned short greenValue, unsigned short blueValue);
|
||||
public: void SetFillPattern(const string& fillPattern);
|
||||
public: void SetDisplayThreshold(double threshold) {_displayThreshold = threshold;};
|
||||
|
||||
// Others
|
||||
// ******
|
||||
|
||||
protected: virtual void _PostCreate();
|
||||
protected: virtual void _PostCreate();
|
||||
|
||||
protected: virtual void _PreDelete();
|
||||
protected: virtual void _PreDelete();
|
||||
|
||||
public: virtual string _GetTypeName() const {return _TName("BasicLayer");};
|
||||
public: virtual string _GetString() const;
|
||||
public: virtual Record* _GetRecord() const;
|
||||
public: virtual BasicLayer* _GetSymbolicBasicLayer() {return this;};
|
||||
//public: GdkGC* _GetDrawGC();
|
||||
//public: GdkGC* _GetFillGC();
|
||||
public: virtual string _GetTypeName() const {return _TName("BasicLayer");};
|
||||
public: virtual string _GetString() const;
|
||||
public: virtual Record* _GetRecord() const;
|
||||
public: virtual BasicLayer* _GetSymbolicBasicLayer() {return this;};
|
||||
//public: GdkGC* _GetDrawGC();
|
||||
//public: GdkGC* _GetFillGC();
|
||||
|
||||
public: void _Fill(View* view, const Box& box) const;
|
||||
public: void _Fill(View* view, const Box& box) const;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -16,6 +16,47 @@ using namespace H;
|
|||
|
||||
namespace {
|
||||
|
||||
QBrush getBrush(const string &pattern, int redValue, int greenValue, int blueValue) {
|
||||
if (pattern == "FFFFFFFFFFFFFFFF") {
|
||||
return QBrush(QColor(redValue, greenValue, blueValue));
|
||||
} else {
|
||||
char bits[8];
|
||||
for (int i = 0; i < 8; i++) {
|
||||
int high = pattern[i * 2];
|
||||
if (('0' <= high) && (high <= '9')) {
|
||||
high = high - '0';
|
||||
} else {
|
||||
if (('a' <= high) && (high <= 'f')) {
|
||||
high = 10 + high - 'a';
|
||||
} else {
|
||||
if (('A' <= high) && (high <= 'F')) {
|
||||
high = 10 + high - 'A';
|
||||
} else {
|
||||
high = '0';
|
||||
}
|
||||
}
|
||||
}
|
||||
int low = pattern[(i * 2) + 1];
|
||||
if (('0' <= low) && (low <= '9')) {
|
||||
low = low - '0';
|
||||
} else {
|
||||
if (('a' <= low) && (low <= 'f')) {
|
||||
low = 10 + low - 'a';
|
||||
} else {
|
||||
if (('A' <= low) && (low <= 'F')) {
|
||||
low = 10 + low - 'A';
|
||||
} else {
|
||||
low = '0';
|
||||
}
|
||||
}
|
||||
}
|
||||
bits[i] = (char)((high * 16) + low);
|
||||
}
|
||||
return QBrush(QColor(redValue, greenValue, blueValue),
|
||||
QPixmap(bits));
|
||||
}
|
||||
}
|
||||
|
||||
Technology* getTechnology() {
|
||||
DataBase* database = GetDataBase();
|
||||
if (database) {
|
||||
|
@ -28,7 +69,7 @@ static QColor backgroundColor = QColor( 50, 50, 50 );
|
|||
static QColor foregroundColor = QColor( 255, 255, 255 );
|
||||
static QColor rubberColor = QColor( 192, 0, 192 );
|
||||
static QColor phantomColor = QColor( 139, 134, 130 );
|
||||
static QColor boundaryColor = QColor( 208*255, 199*255, 192*255 );
|
||||
static QColor boundaryColor = QColor( 208, 199, 192 );
|
||||
static QColor markerColor = QColor( 80, 250, 80 );
|
||||
static QColor selectionDrawColor = QColor( 255, 255, 255 );
|
||||
static QColor selectionFillColor = QColor( 255, 255, 255 );
|
||||
|
@ -62,7 +103,10 @@ CellWidget::CellWidget(Cell* c, QWidget* parent)
|
|||
basicLayersPen() {
|
||||
for_each_basic_layer(basiclayer, getTechnology()->GetBasicLayers()) {
|
||||
basicLayersBrush[basiclayer] =
|
||||
QBrush(QColor(basiclayer->GetRedValue(), basiclayer->GetGreenValue(), basiclayer->GetBlueValue()));
|
||||
getBrush(basiclayer->GetFillPattern(),
|
||||
basiclayer->GetRedValue(),
|
||||
basiclayer->GetGreenValue(),
|
||||
basiclayer->GetBlueValue());
|
||||
basicLayersPen[basiclayer] =
|
||||
QPen(QColor(basiclayer->GetRedValue(), basiclayer->GetGreenValue(), basiclayer->GetBlueValue()));
|
||||
end_for;
|
||||
|
@ -105,10 +149,9 @@ void CellWidget::redraw() {
|
|||
|
||||
double brightness = 1.0;
|
||||
|
||||
//painter->save();
|
||||
//setBrush(phantomsBrush, brightness);
|
||||
//drawPhantoms(cell, area, Transformation());
|
||||
//painter->restore();
|
||||
painter->setClipRegion(invalidRegion);
|
||||
|
||||
painter->fillRect(invalidRect, QBrush(getBackgroundColor()));
|
||||
|
||||
painter->save();
|
||||
setPen(boundariesPen, brightness);
|
||||
|
|
Loading…
Reference in New Issue