This commit is contained in:
Christophe Alexandre 2008-01-08 18:22:32 +00:00
parent c7b2c17370
commit d60da7f7ac
3 changed files with 286 additions and 243 deletions

View File

@ -23,57 +23,57 @@ class BasicLayer_BasicLayers : public Collection<BasicLayer*> {
// Types // 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 BasicLayer* basicLayer = NULL);
public: Locator(const Locator& locator); public: Locator(const Locator& locator);
public: Locator& operator=(const Locator& locator); public: Locator& operator=(const Locator& locator);
public: virtual BasicLayer* GetElement() const; public: virtual BasicLayer* GetElement() const;
public: virtual Hurricane::Locator<BasicLayer*>* GetClone() 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 // Atributes
// ********* // *********
private: const BasicLayer* _basicLayer; private: const BasicLayer* _basicLayer;
// Constructors // Constructors
// ************ // ************
public: BasicLayer_BasicLayers(const BasicLayer* basicLayer = NULL); public: BasicLayer_BasicLayers(const BasicLayer* basicLayer = NULL);
public: BasicLayer_BasicLayers(const BasicLayer_BasicLayers& basicLayers); public: BasicLayer_BasicLayers(const BasicLayer_BasicLayers& basicLayers);
// Operators // Operators
// ********* // *********
public: BasicLayer_BasicLayers& operator=(const BasicLayer_BasicLayers& basicLayers); public: BasicLayer_BasicLayers& operator=(const BasicLayer_BasicLayers& basicLayers);
// Accessors // Accessors
// ********* // *********
public: virtual Collection<BasicLayer*>* GetClone() const; public: virtual Collection<BasicLayer*>* GetClone() const;
public: virtual Hurricane::Locator<BasicLayer*>* GetLocator() const; public: virtual Hurricane::Locator<BasicLayer*>* GetLocator() const;
// Others // 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) BasicLayer::BasicLayer(Technology* technology, const Name& name, const Type& type, unsigned extractNumber, const Unit& minimalSize, const Unit& minimalSpacing)
// **************************************************************************************************** // ****************************************************************************************************
: Inherit(technology, name, minimalSize, minimalSpacing), : Inherit(technology, name, minimalSize, minimalSpacing),
_type(type), _type(type),
_extractNumber(extractNumber), _extractNumber(extractNumber),
_redValue(255), _redValue(255),
_greenValue(255), _greenValue(255),
_blueValue(255), _blueValue(255),
_fillPattern("FFFFFFFFFFFFFFFF"), _fillPattern("FFFFFFFFFFFFFFFF"),
_displayThreshold(0.0) _displayThreshold(0.0)
{ {
} }
BasicLayer* BasicLayer::Create(Technology* technology, const Name& name, const Type& type, unsigned extractNumber, const Unit& minimalSize, const Unit& minimalSpacing) BasicLayer* BasicLayer::Create(Technology* technology, const Name& name, const Type& type, unsigned extractNumber, const Unit& minimalSize, const Unit& minimalSpacing)
// **************************************************************************************************** // ****************************************************************************************************
{ {
BasicLayer* basicLayer = BasicLayer* basicLayer =
new BasicLayer(technology, name, type, extractNumber, minimalSize, minimalSpacing); new BasicLayer(technology, name, type, extractNumber, minimalSize, minimalSpacing);
basicLayer->_PostCreate(); basicLayer->_PostCreate();
return basicLayer; return basicLayer;
} }
BasicLayers BasicLayer::GetBasicLayers() const BasicLayers BasicLayer::GetBasicLayers() const
// ******************************************* // *******************************************
{ {
return BasicLayer_BasicLayers(this); return BasicLayer_BasicLayers(this);
} }
void BasicLayer::SetColor(unsigned short redValue, unsigned short greenValue, unsigned short blueValue) void BasicLayer::SetColor(unsigned short redValue, unsigned short greenValue, unsigned short blueValue)
// **************************************************************************************************** // ****************************************************************************************************
{ {
if ((redValue != _redValue) || (greenValue != _greenValue) || (blueValue != _blueValue)) { if ((redValue != _redValue) || (greenValue != _greenValue) || (blueValue != _blueValue)) {
_redValue = redValue; _redValue = redValue;
_greenValue = greenValue; _greenValue = greenValue;
_blueValue = blueValue; _blueValue = blueValue;
//if (_drawGC) { //if (_drawGC) {
// gdk_gc_destroy(_drawGC); // gdk_gc_destroy(_drawGC);
// _drawGC = NULL; // _drawGC = NULL;
//} //}
//if (_fillGC) { //if (_fillGC) {
// gdk_gc_destroy(_fillGC); // gdk_gc_destroy(_fillGC);
// _fillGC = NULL; // _fillGC = NULL;
//} //}
} }
} }
void BasicLayer::SetFillPattern(const string& fillPattern) void BasicLayer::SetFillPattern(const string& fillPattern)
// ******************************************************* // *******************************************************
{ {
if (fillPattern != _fillPattern) { if (fillPattern != _fillPattern) {
if (fillPattern.size() != 16) if (fillPattern.size() != 16)
throw Error("Can't set fill pattern (bad value)"); throw Error("Can't set fill pattern (bad value)");
string validChars = "0123456789ABCDEFabcdef"; string validChars = "0123456789ABCDEFabcdef";
for (unsigned i = 0; i < 16; i++) { for (unsigned i = 0; i < 16; i++) {
if (validChars.find(fillPattern[i]) == string::npos) if (validChars.find(fillPattern[i]) == string::npos)
throw Error("Can't set fill pattern (bad value)"); throw Error("Can't set fill pattern (bad value)");
} }
_fillPattern = fillPattern; _fillPattern = fillPattern;
//if (_drawGC) { //if (_drawGC) {
// gdk_gc_destroy(_drawGC); // gdk_gc_destroy(_drawGC);
// _drawGC = NULL; // _drawGC = NULL;
//} //}
//if (_fillGC) { //if (_fillGC) {
// gdk_gc_destroy(_fillGC); // gdk_gc_destroy(_fillGC);
// _fillGC = NULL; // _fillGC = NULL;
//} //}
} }
} }
void BasicLayer::_PostCreate() void BasicLayer::_PostCreate()
// *************************** // ***************************
{ {
Mask basicLayersMask = 0; Mask basicLayersMask = 0;
for_each_basic_layer(basicLayer, GetTechnology()->GetBasicLayers()) { for_each_basic_layer(basicLayer, GetTechnology()->GetBasicLayers()) {
basicLayersMask |= basicLayer->GetMask(); basicLayersMask |= basicLayer->GetMask();
end_for; end_for;
} }
Mask mask = 1; Mask mask = 1;
while (mask && (mask & basicLayersMask)) mask = mask<<1; while (mask && (mask & basicLayersMask)) mask = mask<<1;
if (!mask) if (!mask)
throw Error("Can't create " + _TName("BasicLayer") + " : mask capacity overflow"); throw Error("Can't create " + _TName("BasicLayer") + " : mask capacity overflow");
_SetMask(mask); _SetMask(mask);
if (_extractNumber) { if (_extractNumber) {
Mask extractMask = (1 << _extractNumber); Mask extractMask = (1 << _extractNumber);
if (!extractMask) if (!extractMask)
throw Error("Can't create " + _TName("BasicLayer") + " : extract mask capacity overflow"); throw Error("Can't create " + _TName("BasicLayer") + " : extract mask capacity overflow");
_SetExtractMask(extractMask); _SetExtractMask(extractMask);
} }
Inherit::_PostCreate(); Inherit::_PostCreate();
} }
void BasicLayer::_PreDelete() void BasicLayer::_PreDelete()
// ************************** // **************************
{ {
Inherit::_PreDelete(); Inherit::_PreDelete();
//if (_drawGC) gdk_gc_destroy(_drawGC); //if (_drawGC) gdk_gc_destroy(_drawGC);
//if (_fillGC) gdk_gc_destroy(_fillGC); //if (_fillGC) gdk_gc_destroy(_fillGC);
CompositeLayers compositeLayers = GetTechnology()->GetCompositeLayers(); CompositeLayers compositeLayers = GetTechnology()->GetCompositeLayers();
for_each_composite_layer(compositeLayer, compositeLayers) { for_each_composite_layer(compositeLayer, compositeLayers) {
if (compositeLayer->Contains(this)) compositeLayer->Remove(this); if (compositeLayer->Contains(this)) compositeLayer->Remove(this);
end_for; end_for;
} }
} }
string BasicLayer::_GetString() const string BasicLayer::_GetString() const
// ********************************** // **********************************
{ {
string s = Inherit::_GetString(); string s = Inherit::_GetString();
// s.insert(s.length() - 1, " " + GetString(_type)); // s.insert(s.length() - 1, " " + GetString(_type));
return s; return s;
} }
Record* BasicLayer::_GetRecord() const Record* BasicLayer::_GetRecord() const
// ***************************** // *****************************
{ {
Record* record = Inherit::_GetRecord(); Record* record = Inherit::_GetRecord();
if (record) { if (record) {
record->Add(GetSlot("Type", &_type)); record->Add(GetSlot("Type", &_type));
record->Add(GetSlot("RedValue", &_redValue)); record->Add(GetSlot("RedValue", &_redValue));
record->Add(GetSlot("GreenValue", &_greenValue)); record->Add(GetSlot("GreenValue", &_greenValue));
record->Add(GetSlot("BlueValue", &_blueValue)); record->Add(GetSlot("BlueValue", &_blueValue));
record->Add(GetSlot("FillPattern", &_fillPattern)); record->Add(GetSlot("FillPattern", &_fillPattern));
record->Add(GetSlot("DisplayThreshold", &_displayThreshold)); record->Add(GetSlot("DisplayThreshold", &_displayThreshold));
} }
return record; return record;
} }
//GdkGC* BasicLayer::_GetDrawGC() //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() //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 //void BasicLayer::_Fill(View* view, const Box& box) const
//// ***************************************************** //// *****************************************************
//{ //{
// switch (_type) { // switch (_type) {
// case Type::CONTACT : { // case Type::CONTACT : {
// //
// Unit minimalSize = GetMinimalSize(); // Unit minimalSize = GetMinimalSize();
// Unit minimalSpacing = GetMinimalSpacing(); // Unit minimalSpacing = GetMinimalSpacing();
// //
// if ((minimalSize <= 0) || (minimalSpacing <= 0)) // if ((minimalSize <= 0) || (minimalSpacing <= 0))
// view->FillRectangle(box); // view->FillRectangle(box);
// else { // else {
// view->DrawRectangle(box); // view->DrawRectangle(box);
// //
// Unit width = box.GetWidth(); // Unit width = box.GetWidth();
// Unit height = box.GetHeight(); // Unit height = box.GetHeight();
// Unit offset = minimalSize + minimalSpacing; // Unit offset = minimalSize + minimalSpacing;
// //
// int nx = (int)(GetValue(width) / GetValue(offset)); // int nx = (int)(GetValue(width) / GetValue(offset));
// int ny = (int)(GetValue(height) / GetValue(offset)); // int ny = (int)(GetValue(height) / GetValue(offset));
// //
// Unit dx = (width - (minimalSize + (offset * nx))) / 2; // Unit dx = (width - (minimalSize + (offset * nx))) / 2;
// Unit dy = (height - (minimalSize + (offset * ny))) / 2; // Unit dy = (height - (minimalSize + (offset * ny))) / 2;
// //
// if (dx < 0) dx = (width - (minimalSize + (offset * (--nx)))) / 2; // if (dx < 0) dx = (width - (minimalSize + (offset * (--nx)))) / 2;
// if (dy < 0) dy = (height - (minimalSize + (offset * (--ny)))) / 2; // if (dy < 0) dy = (height - (minimalSize + (offset * (--ny)))) / 2;
// //
// Unit xmin = box.GetXMin() + dx; // Unit xmin = box.GetXMin() + dx;
// Unit ymin = box.GetYMin() + dy; // Unit ymin = box.GetYMin() + dy;
// Unit xmax = box.GetXMax() - dx; // Unit xmax = box.GetXMax() - dx;
// Unit ymax = box.GetYMax() - dy; // Unit ymax = box.GetYMax() - dy;
// //
// if ((xmin < xmax) && (ymin < ymax)) { // if ((xmin < xmax) && (ymin < ymax)) {
// Unit y = ymin; // Unit y = ymin;
// do { // do {
// Unit x = xmin; // Unit x = xmin;
// do { // do {
// view->FillRectangle(x, y, x + minimalSize, y + minimalSize, true); // view->FillRectangle(x, y, x + minimalSize, y + minimalSize, true);
// x += offset; // x += offset;
// } while (x < xmax); // } while (x < xmax);
// y += offset; // y += offset;
// } while (y < ymax); // } while (y < ymax);
// } // }
// } // }
// break; // break;
// } // }
// default : { // default : {
// view->FillRectangle(box); // view->FillRectangle(box);
// break; // break;
// } // }
// } // }
//} //}
// //
// **************************************************************************************************** // ****************************************************************************************************
@ -298,44 +298,44 @@ Record* BasicLayer::_GetRecord() const
BasicLayer_BasicLayers::BasicLayer_BasicLayers(const BasicLayer* basicLayer) BasicLayer_BasicLayers::BasicLayer_BasicLayers(const BasicLayer* basicLayer)
// ************************************************************************* // *************************************************************************
: Inherit(), : Inherit(),
_basicLayer(basicLayer) _basicLayer(basicLayer)
{ {
} }
BasicLayer_BasicLayers::BasicLayer_BasicLayers(const BasicLayer_BasicLayers& basicLayers) BasicLayer_BasicLayers::BasicLayer_BasicLayers(const BasicLayer_BasicLayers& basicLayers)
// ************************************************************************************** // **************************************************************************************
: Inherit(), : Inherit(),
_basicLayer(basicLayers._basicLayer) _basicLayer(basicLayers._basicLayer)
{ {
} }
BasicLayer_BasicLayers& BasicLayer_BasicLayers::operator=(const BasicLayer_BasicLayers& basicLayers) BasicLayer_BasicLayers& BasicLayer_BasicLayers::operator=(const BasicLayer_BasicLayers& basicLayers)
// ************************************************************************************************* // *************************************************************************************************
{ {
_basicLayer = basicLayers._basicLayer; _basicLayer = basicLayers._basicLayer;
return *this; return *this;
} }
Collection<BasicLayer*>* BasicLayer_BasicLayers::GetClone() const Collection<BasicLayer*>* BasicLayer_BasicLayers::GetClone() const
// ************************************************************** // **************************************************************
{ {
return new BasicLayer_BasicLayers(*this); return new BasicLayer_BasicLayers(*this);
} }
Locator<BasicLayer*>* BasicLayer_BasicLayers::GetLocator() const Locator<BasicLayer*>* BasicLayer_BasicLayers::GetLocator() const
// ************************************************************* // *************************************************************
{ {
return new Locator(_basicLayer); return new Locator(_basicLayer);
} }
string BasicLayer_BasicLayers::_GetString() const string BasicLayer_BasicLayers::_GetString() const
// ********************************************** // **********************************************
{ {
string s = "<" + _TName("BasicLayer::BasicLayers"); string s = "<" + _TName("BasicLayer::BasicLayers");
if (_basicLayer) s += " " + GetString(_basicLayer); if (_basicLayer) s += " " + GetString(_basicLayer);
s += ">"; s += ">";
return s; return s;
} }
@ -346,56 +346,56 @@ string BasicLayer_BasicLayers::_GetString() const
BasicLayer_BasicLayers::Locator::Locator(const BasicLayer* basicLayer) BasicLayer_BasicLayers::Locator::Locator(const BasicLayer* basicLayer)
// ******************************************************************* // *******************************************************************
: Inherit(), : Inherit(),
_basicLayer(basicLayer) _basicLayer(basicLayer)
{ {
} }
BasicLayer_BasicLayers::Locator::Locator(const Locator& locator) BasicLayer_BasicLayers::Locator::Locator(const Locator& locator)
// ************************************************************* // *************************************************************
: Inherit(), : Inherit(),
_basicLayer(locator._basicLayer) _basicLayer(locator._basicLayer)
{ {
} }
BasicLayer_BasicLayers::Locator& BasicLayer_BasicLayers::Locator::operator=(const Locator& locator) BasicLayer_BasicLayers::Locator& BasicLayer_BasicLayers::Locator::operator=(const Locator& locator)
// ************************************************************************************************ // ************************************************************************************************
{ {
_basicLayer = locator._basicLayer; _basicLayer = locator._basicLayer;
return *this; return *this;
} }
BasicLayer* BasicLayer_BasicLayers::Locator::GetElement() const BasicLayer* BasicLayer_BasicLayers::Locator::GetElement() const
// ************************************************************ // ************************************************************
{ {
return (BasicLayer*)_basicLayer; return (BasicLayer*)_basicLayer;
} }
Locator<BasicLayer*>* BasicLayer_BasicLayers::Locator::GetClone() const Locator<BasicLayer*>* BasicLayer_BasicLayers::Locator::GetClone() const
// ******************************************************************** // ********************************************************************
{ {
return new Locator(*this); return new Locator(*this);
} }
bool BasicLayer_BasicLayers::Locator::IsValid() const bool BasicLayer_BasicLayers::Locator::IsValid() const
// ************************************************** // **************************************************
{ {
return (_basicLayer != NULL); return (_basicLayer != NULL);
} }
void BasicLayer_BasicLayers::Locator::Progress() void BasicLayer_BasicLayers::Locator::Progress()
// ********************************************* // *********************************************
{ {
_basicLayer = NULL; _basicLayer = NULL;
} }
string BasicLayer_BasicLayers::Locator::_GetString() const string BasicLayer_BasicLayers::Locator::_GetString() const
// ******************************************************* // *******************************************************
{ {
string s = "<" + _TName("BasicLayer::BasicLayers::Locator"); string s = "<" + _TName("BasicLayer::BasicLayers::Locator");
if (_basicLayer) s += " " + GetString(_basicLayer); if (_basicLayer) s += " " + GetString(_basicLayer);
s += ">"; s += ">";
return s; return s;
} }
@ -406,35 +406,35 @@ string BasicLayer_BasicLayers::Locator::_GetString() const
BasicLayer::Type::Type(const Code& code) BasicLayer::Type::Type(const Code& code)
// ************************************* // *************************************
: _code(code) : _code(code)
{ {
} }
BasicLayer::Type::Type(const Type& type) BasicLayer::Type::Type(const Type& type)
// ************************************* // *************************************
: _code(type._code) : _code(type._code)
{ {
} }
BasicLayer::Type& BasicLayer::Type::operator=(const Type& type) BasicLayer::Type& BasicLayer::Type::operator=(const Type& type)
// ************************************************************ // ************************************************************
{ {
_code = type._code; _code = type._code;
return *this; return *this;
} }
string BasicLayer::Type::_GetString() const string BasicLayer::Type::_GetString() const
// **************************************** // ****************************************
{ {
return GetString(_code); return GetString(_code);
} }
Record* BasicLayer::Type::_GetRecord() const Record* BasicLayer::Type::_GetRecord() const
// *********************************** // ***********************************
{ {
Record* record = new Record(GetString(this)); Record* record = new Record(GetString(this));
record->Add(GetSlot("Code", &_code)); record->Add(GetSlot("Code", &_code));
return record; return record;
} }
} // End of Hurricane namespace. } // End of Hurricane namespace.
@ -442,19 +442,19 @@ Record* BasicLayer::Type::_GetRecord() const
bool Scan(const string& s, H::BasicLayer::Type& type) bool Scan(const string& s, H::BasicLayer::Type& type)
// ************************************************** // **************************************************
{ {
if (s == "UNDEFINED") { if (s == "UNDEFINED") {
type = H::BasicLayer::Type::UNDEFINED; type = H::BasicLayer::Type::UNDEFINED;
return true; return true;
} }
if (s == "CONDUCTING") { if (s == "CONDUCTING") {
type = H::BasicLayer::Type::CONDUCTING; type = H::BasicLayer::Type::CONDUCTING;
return true; return true;
} }
if (s == "CONTACT") { if (s == "CONTACT") {
type = H::BasicLayer::Type::CONTACT; type = H::BasicLayer::Type::CONTACT;
return true; return true;
} }
return false; return false;
} }
// **************************************************************************************************** // ****************************************************************************************************

View File

@ -27,84 +27,84 @@ class BasicLayer : public Layer {
// Types // Types
// ***** // *****
public: typedef Layer Inherit; public: typedef Layer Inherit;
public: class Type { 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 Code& code = UNDEFINED);
public: Type(const Type& type); 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 _GetTypeName() const { return _TName("BasicLayer::Type"); };
public: string _GetString() const; public: string _GetString() const;
public: Record* _GetRecord() const; public: Record* _GetRecord() const;
}; };
// Attributes // Attributes
// ********** // **********
private: Type _type; private: Type _type;
private: unsigned _extractNumber; private: unsigned _extractNumber;
private: unsigned short _redValue; private: unsigned short _redValue;
private: unsigned short _greenValue; private: unsigned short _greenValue;
private: unsigned short _blueValue; private: unsigned short _blueValue;
private: string _fillPattern; private: string _fillPattern;
private: double _displayThreshold; private: double _displayThreshold;
// private: GdkGC* _drawGC; // private: GdkGC* _drawGC;
// private: GdkGC* _fillGC; // private: GdkGC* _fillGC;
// Constructors // 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 // Accessors
// ********* // *********
public: const Type& GetType() const {return _type;}; public: const Type& GetType() const {return _type;};
public: unsigned GetExtractNumber() const {return _extractNumber;}; public: unsigned GetExtractNumber() const {return _extractNumber;};
public: const unsigned short& GetRedValue() const {return _redValue;}; public: const unsigned short& GetRedValue() const {return _redValue;};
public: const unsigned short& GetGreenValue() const {return _greenValue;}; public: const unsigned short& GetGreenValue() const {return _greenValue;};
public: const unsigned short& GetBlueValue() const {return _blueValue;}; public: const unsigned short& GetBlueValue() const {return _blueValue;};
public: const string& GetFillPattern() const {return _fillPattern;}; public: const string& GetFillPattern() const {return _fillPattern;};
public: double GetDisplayThreshold() const {return _displayThreshold;}; public: double GetDisplayThreshold() const {return _displayThreshold;};
public: virtual BasicLayers GetBasicLayers() const; public: virtual BasicLayers GetBasicLayers() const;
// Updators // Updators
// ******** // ********
public: void SetColor(unsigned short redValue, unsigned short greenValue, unsigned short blueValue); public: void SetColor(unsigned short redValue, unsigned short greenValue, unsigned short blueValue);
public: void SetFillPattern(const string& fillPattern); public: void SetFillPattern(const string& fillPattern);
public: void SetDisplayThreshold(double threshold) {_displayThreshold = threshold;}; public: void SetDisplayThreshold(double threshold) {_displayThreshold = threshold;};
// Others // 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 _GetTypeName() const {return _TName("BasicLayer");};
public: virtual string _GetString() const; public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const; public: virtual Record* _GetRecord() const;
public: virtual BasicLayer* _GetSymbolicBasicLayer() {return this;}; public: virtual BasicLayer* _GetSymbolicBasicLayer() {return this;};
//public: GdkGC* _GetDrawGC(); //public: GdkGC* _GetDrawGC();
//public: GdkGC* _GetFillGC(); //public: GdkGC* _GetFillGC();
public: void _Fill(View* view, const Box& box) const; public: void _Fill(View* view, const Box& box) const;
}; };

View File

@ -16,6 +16,47 @@ using namespace H;
namespace { 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() { Technology* getTechnology() {
DataBase* database = GetDataBase(); DataBase* database = GetDataBase();
if (database) { if (database) {
@ -28,7 +69,7 @@ static QColor backgroundColor = QColor( 50, 50, 50 );
static QColor foregroundColor = QColor( 255, 255, 255 ); static QColor foregroundColor = QColor( 255, 255, 255 );
static QColor rubberColor = QColor( 192, 0, 192 ); static QColor rubberColor = QColor( 192, 0, 192 );
static QColor phantomColor = QColor( 139, 134, 130 ); 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 markerColor = QColor( 80, 250, 80 );
static QColor selectionDrawColor = QColor( 255, 255, 255 ); static QColor selectionDrawColor = QColor( 255, 255, 255 );
static QColor selectionFillColor = QColor( 255, 255, 255 ); static QColor selectionFillColor = QColor( 255, 255, 255 );
@ -62,7 +103,10 @@ CellWidget::CellWidget(Cell* c, QWidget* parent)
basicLayersPen() { basicLayersPen() {
for_each_basic_layer(basiclayer, getTechnology()->GetBasicLayers()) { for_each_basic_layer(basiclayer, getTechnology()->GetBasicLayers()) {
basicLayersBrush[basiclayer] = basicLayersBrush[basiclayer] =
QBrush(QColor(basiclayer->GetRedValue(), basiclayer->GetGreenValue(), basiclayer->GetBlueValue())); getBrush(basiclayer->GetFillPattern(),
basiclayer->GetRedValue(),
basiclayer->GetGreenValue(),
basiclayer->GetBlueValue());
basicLayersPen[basiclayer] = basicLayersPen[basiclayer] =
QPen(QColor(basiclayer->GetRedValue(), basiclayer->GetGreenValue(), basiclayer->GetBlueValue())); QPen(QColor(basiclayer->GetRedValue(), basiclayer->GetGreenValue(), basiclayer->GetBlueValue()));
end_for; end_for;
@ -105,10 +149,9 @@ void CellWidget::redraw() {
double brightness = 1.0; double brightness = 1.0;
//painter->save(); painter->setClipRegion(invalidRegion);
//setBrush(phantomsBrush, brightness);
//drawPhantoms(cell, area, Transformation()); painter->fillRect(invalidRect, QBrush(getBackgroundColor()));
//painter->restore();
painter->save(); painter->save();
setPen(boundariesPen, brightness); setPen(boundariesPen, brightness);