From a404498be5bb2a5ba13f31d5f3c1be0e12f47139 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sun, 12 Apr 2009 21:05:51 +0000 Subject: [PATCH] * ./hurricane : - Bug : In Timer.h, forgot to declare the specialized getString() template, thus preventing the timer to be correctly display in output streams. - Bug : In CellWidget::_redraw(), uses "paintersBegin()" instead of "painterBegin()" (whithout the "s"). The former open painters for both normal & selection planes which are subsequently accessed by "setPen()". The laters opens only the normal plane painter resulting in warnings for the selection plane painter (shows only from Qt 4.5). - New : In CellWidget, ability to support the physical grid (not only the symbolic grid). Added selection symbolic/real in the DisplayFilter. - Change : add to Technology and all the Layers sub-classes a "_onDbuChange(float)" method. This is due to the fact that the symbolic technology is loaded first into the DataBase (needed for defining the BasicLayer ordering) along with all the symbolic dimensions for the symbolic Layers. Only afterward, we load the real technology (hcmos9 for instance) which will sets the "grids per lambda" factor to it's true value, changing the meaning of the already loaded symbolic values. Then, it is necessary to scale those values so they are coherent with the new "GPL" factor, hence the "_onDbuChange()" function. NEVER USE THIS FUNCTION AFTER THE TECHNOLOGY HAS BEEN LOADED, it would render all symbolic coordinates false... --- hurricane/src/hurricane/BasicLayer.cpp | 25 +- hurricane/src/hurricane/CompositeLayer.cpp | 312 ------------------ hurricane/src/hurricane/ContactLayer.cpp | 43 +-- hurricane/src/hurricane/DbU.cpp | 134 +++----- hurricane/src/hurricane/DiffusionLayer.cpp | 58 ++-- hurricane/src/hurricane/Layer.cpp | 8 + hurricane/src/hurricane/RegularLayer.cpp | 43 +-- hurricane/src/hurricane/Technology.cpp | 165 ++++----- hurricane/src/hurricane/TransistorLayer.cpp | 57 ++-- hurricane/src/hurricane/ViaLayer.cpp | 11 + .../src/hurricane/hurricane/BasicLayer.h | 16 +- hurricane/src/hurricane/hurricane/Commons.h | 4 +- .../src/hurricane/hurricane/CompositeLayer.h | 129 -------- .../src/hurricane/hurricane/ContactLayer.h | 95 ++---- hurricane/src/hurricane/hurricane/DbU.h | 79 ++--- .../src/hurricane/hurricane/DiffusionLayer.h | 96 ++---- hurricane/src/hurricane/hurricane/Layer.h | 15 +- .../src/hurricane/hurricane/RegularLayer.h | 12 +- .../src/hurricane/hurricane/Technology.h | 1 + hurricane/src/hurricane/hurricane/Timer.h | 3 + .../src/hurricane/hurricane/TransistorLayer.h | 60 +--- hurricane/src/hurricane/hurricane/ViaLayer.h | 44 +-- hurricane/src/hviewer/AreaCommand.cpp | 16 +- hurricane/src/hviewer/CellWidget.cpp | 87 +++-- hurricane/src/hviewer/Command.cpp | 10 +- hurricane/src/hviewer/DisplayFilterWidget.cpp | 80 ++++- hurricane/src/hviewer/DynamicLabel.cpp | 31 +- hurricane/src/hviewer/MousePositionWidget.cpp | 2 +- hurricane/src/hviewer/SelectCommand.cpp | 14 +- .../src/hviewer/hurricane/viewer/CellWidget.h | 53 +++ .../hurricane/viewer/DisplayFilterWidget.h | 6 + 31 files changed, 621 insertions(+), 1088 deletions(-) delete mode 100644 hurricane/src/hurricane/CompositeLayer.cpp delete mode 100644 hurricane/src/hurricane/hurricane/CompositeLayer.h diff --git a/hurricane/src/hurricane/BasicLayer.cpp b/hurricane/src/hurricane/BasicLayer.cpp index 09482b78..9a4bef7a 100644 --- a/hurricane/src/hurricane/BasicLayer.cpp +++ b/hurricane/src/hurricane/BasicLayer.cpp @@ -1,5 +1,4 @@ - // -*- C++ -*- // // This file is part of the Hurricane Software. @@ -158,12 +157,12 @@ namespace Hurricane { // Class : "Hurricane::BasicLayer". - BasicLayer::BasicLayer ( Technology* technology - , const Name& name - , const Material& material - , unsigned extractNumber - , const DbU::Unit& minimalSize - , const DbU::Unit& minimalSpacing + BasicLayer::BasicLayer ( Technology* technology + , const Name& name + , const Material& material + , unsigned extractNumber + , const DbU::Unit& minimalSize + , const DbU::Unit& minimalSpacing ) : Layer(technology ,name ,minimalSize @@ -174,12 +173,12 @@ namespace Hurricane { { } - BasicLayer* BasicLayer::create ( Technology* technology - , const Name& name - , const Material& material - , unsigned extractNumber - , const DbU::Unit& minimalSize - , const DbU::Unit& minimalSpacing + BasicLayer* BasicLayer::create ( Technology* technology + , const Name& name + , const Material& material + , unsigned extractNumber + , const DbU::Unit& minimalSize + , const DbU::Unit& minimalSpacing ) { BasicLayer* basicLayer = diff --git a/hurricane/src/hurricane/CompositeLayer.cpp b/hurricane/src/hurricane/CompositeLayer.cpp deleted file mode 100644 index 429d11bb..00000000 --- a/hurricane/src/hurricane/CompositeLayer.cpp +++ /dev/null @@ -1,312 +0,0 @@ -// **************************************************************************************************** -// File: CompositeLayer.cpp -// Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved -// **************************************************************************************************** - -#include "hurricane/CompositeLayer.h" -#include "hurricane/Technology.h" -#include "hurricane/BasicLayer.h" -#include "hurricane/Error.h" - -namespace Hurricane { - - - -// **************************************************************************************************** -// CompositeLayer implementation -// **************************************************************************************************** - -CompositeLayer::CompositeLayer(Technology* technology, const Name& name, const Type& type, const Unit& minimalSize, const Unit& minimalSpacing) -// **************************************************************************************************** -: Inherit(technology, name, minimalSize, minimalSpacing), - _type(type), - _basicLayerList(), - _contactSizeMap(), - _segmentSizeMap(), - _segmentExtentionMap(), - _padSizeMap(), - _maximalContactSize(0), - _maximalSegmentSize(0), - _maximalSegmentExtention(0), - _maximalPadSize(0), - _symbolicBasicLayer(NULL) -{ -} - -CompositeLayer* CompositeLayer::create(Technology* technology, const Name& name, const Type& type, const Unit& minimalSize, const Unit& minimalSpacing) -// **************************************************************************************************** -{ - CompositeLayer* compositeLayer = - new CompositeLayer(technology, name, type, minimalSize, minimalSpacing); - - compositeLayer->_postCreate(); - - return compositeLayer; -} - -BasicLayers CompositeLayer::getBasicLayers() const -// *********************************************** -{ - return getCollection(_basicLayerList); -} - -Unit CompositeLayer::getContactSize(const BasicLayer* basicLayer) const -// ************************************************************** -{ - SizeMap::const_iterator it = _contactSizeMap.find(basicLayer); - return ((it == _contactSizeMap.end()) ? 0 : (*it).second); -} - -Unit CompositeLayer::getSegmentSize(const BasicLayer* basicLayer) const -// ************************************************************** -{ - SizeMap::const_iterator it = _segmentSizeMap.find(basicLayer); - return ((it == _segmentSizeMap.end()) ? 0 : (*it).second); -} - -Unit CompositeLayer::getSegmentExtention(const BasicLayer* basicLayer) const -// ******************************************************************* -{ - SizeMap::const_iterator it = _segmentExtentionMap.find(basicLayer); - return ((it == _segmentExtentionMap.end()) ? 0 : (*it).second); -} - -Unit CompositeLayer::getPadSize(const BasicLayer* basicLayer) const -// ********************************************************** -{ - SizeMap::const_iterator it = _padSizeMap.find(basicLayer); - return ((it == _padSizeMap.end()) ? 0 : (*it).second); -} - -void CompositeLayer::add(BasicLayer* basicLayer, const Unit& contactSize, const Unit& segmentSize, const Unit& segmentExtention, const Unit& padSize) -// **************************************************************************************************** -{ - if (!basicLayer) - throw Error("Can't add basic layer : null basic layer"); - - if (contains(basicLayer)) - throw Error("Can't add basic layer : already done"); - - _basicLayerList.push_back(basicLayer); - - _setMask(getMask() | basicLayer->getMask()); - _setExtractMask(getExtractMask() | basicLayer->getExtractMask()); - - if (contactSize != 0) _contactSizeMap[basicLayer] = contactSize; - if (segmentSize != 0) _segmentSizeMap[basicLayer] = segmentSize; - if (segmentExtention != 0) _segmentExtentionMap[basicLayer] = segmentExtention; - if (padSize != 0) _padSizeMap[basicLayer] = padSize; - - _maximalContactSize = max(contactSize, _maximalContactSize); - _maximalSegmentSize = max(segmentSize, _maximalSegmentSize); - _maximalSegmentExtention = max(segmentExtention, _maximalSegmentExtention); - _maximalPadSize = max(padSize, _maximalPadSize); -} - -void CompositeLayer::setContactSize(BasicLayer* basicLayer, const Unit& contactSize) -// ********************************************************************************* -{ - if (!basicLayer) - throw Error("Can't add basic layer : null basic layer"); - - if (!contains(basicLayer)) - throw Error("Basic layer not part of composite layer"); - - if (contactSize != 0) _contactSizeMap[basicLayer] = contactSize; - - _maximalContactSize = max(contactSize, _maximalContactSize); -} - -void CompositeLayer::setSegmentSize(BasicLayer* basicLayer, const Unit& segmentSize) -// ********************************************************************************* -{ - if (!basicLayer) - throw Error("Can't add basic layer : null basic layer"); - - if (!contains(basicLayer)) - throw Error("Basic layer not part of composite layer"); - - if (segmentSize != 0) _segmentSizeMap[basicLayer] = segmentSize; - - _maximalSegmentSize = max(segmentSize, _maximalSegmentSize); -} - -void CompositeLayer::setSegmentExtention(BasicLayer* basicLayer, const Unit& segmentExtention) -// ********************************************************************************* -{ - if (!basicLayer) - throw Error("Can't add basic layer : null basic layer"); - - if (!contains(basicLayer)) - throw Error("Basic layer not part of composite layer"); - - if (segmentExtention != 0) _segmentExtentionMap[basicLayer] = segmentExtention; - - _maximalSegmentExtention = max(segmentExtention, _maximalSegmentExtention); -} - -void CompositeLayer::remove(BasicLayer* basicLayer) -// ************************************************ -{ - if (!basicLayer) - throw Error("Can't remove basic layer : null basic layer"); - - if (!contains(basicLayer)) - throw Error("Can't remove basic layer : not contained"); - - _basicLayerList.remove(basicLayer); - - _contactSizeMap.erase(basicLayer); - _segmentSizeMap.erase(basicLayer); - _segmentExtentionMap.erase(basicLayer); - _padSizeMap.erase(basicLayer); - - _maximalContactSize = 0; - _maximalSegmentSize = 0; - _maximalSegmentExtention = 0; - _maximalPadSize = 0; - - Mask mask = 0; - Mask extractMask = 0; - - for_each_basic_layer(basicLayer, getBasicLayers()) { - mask |= basicLayer->getMask(); - extractMask |= basicLayer->getExtractMask(); - _maximalContactSize = max(getContactSize(basicLayer), _maximalContactSize); - _maximalSegmentSize = max(getSegmentSize(basicLayer), _maximalSegmentSize); - _maximalSegmentExtention = max(getSegmentExtention(basicLayer), _maximalSegmentExtention); - _maximalPadSize = max(getPadSize(basicLayer), _maximalPadSize); - end_for; - } - - _setMask(mask); - _setExtractMask(extractMask); -} - -string CompositeLayer::_getString() const -// ************************************** -{ - string s = Inherit::_getString(); - /* - s.insert(s.length() - 1, " " + getString(_type)); - s.insert(s.length() - 1, " {"); - string separator = ""; - for_each_basic_layer(basicLayer, getBasicLayers()) { - s.insert(s.length() - 1, separator + getString(basicLayer->getName())); - separator = "|"; - end_for; - } - s.insert(s.length() - 1, "}"); - */ - return s; -} - -Record* CompositeLayer::_getRecord() const -// *************************************** -{ - Record* record = Inherit::_getRecord(); - if (record) { - record->add(getSlot("Type", &_type)); - record->add(getSlot("BasicLayers", &_basicLayerList)); - record->add(getSlot("ContactSizes", &_contactSizeMap)); - record->add(getSlot("SegmentSizes", &_segmentSizeMap)); - record->add(getSlot("SegmentExtentions", &_segmentExtentionMap)); - record->add(getSlot("PadSizes", &_padSizeMap)); - record->add(getSlot("MaximalContactSize", &_maximalContactSize)); - record->add(getSlot("MaximalSegmentSize", &_maximalSegmentSize)); - record->add(getSlot("MaximalSegmentExtention", &_maximalSegmentExtention)); - record->add(getSlot("MaximalPadSize", &_maximalPadSize)); - } - return record; -} - -void CompositeLayer::_updateSymbolicBasicLayer(const Layer::Mask& visibleBasicLayersMask) -// ************************************************************************************** -{ - _symbolicBasicLayer = NULL; - BasicLayer* symbolicBasicLayer = NULL; - for_each_basic_layer(basicLayer, getBasicLayers()) { - if (basicLayer->getMask() & visibleBasicLayersMask) { - symbolicBasicLayer = basicLayer; - if (basicLayer->getMaterial() == BasicLayer::Material::cut) - _symbolicBasicLayer = basicLayer; - } - end_for; - } - if (!_symbolicBasicLayer) _symbolicBasicLayer = symbolicBasicLayer; -} - -// **************************************************************************************************** -// CompositeLayer::Type implementation -// **************************************************************************************************** - -CompositeLayer::Type::Type(const Code& code) -// ***************************************** -: _code(code) -{ -} - -CompositeLayer::Type::Type(const Type& type) -// ***************************************** -: _code(type._code) -{ -} - -CompositeLayer::Type& CompositeLayer::Type::operator=(const Type& type) -// ******************************************************************** -{ - _code = type._code; - return *this; -} - -string CompositeLayer::Type::_getString() const -// ******************************************** -{ - switch (_code) { - case UNDEFINED : return "UNDEFINED"; - case METAL : return "METAL"; - case VIA : return "VIA"; - } - return "ABNORMAL"; -} - -Record* CompositeLayer::Type::_getRecord() const -// ********************************************* -{ - Record* record = new Record(getString(this)); - record->add(getSlot("Code", (int)_code)); - return record; -} - - - - -} // End of Hurricane namespace. - -// **************************************************************************************************** -// Generic functions -// **************************************************************************************************** - -bool Scan(const string& s, Hurricane::CompositeLayer::Type& type) -// *************************************************** -{ - if (s == "UNDEFINED") { - type = Hurricane::CompositeLayer::Type::UNDEFINED; - return true; - } - if (s == "METAL") { - type = Hurricane::CompositeLayer::Type::METAL; - return true; - } - if (s == "VIA") { - type = Hurricane::CompositeLayer::Type::VIA; - return true; - } - return false; -} - - -// **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved -// **************************************************************************************************** diff --git a/hurricane/src/hurricane/ContactLayer.cpp b/hurricane/src/hurricane/ContactLayer.cpp index 2471229a..4b6cfa68 100644 --- a/hurricane/src/hurricane/ContactLayer.cpp +++ b/hurricane/src/hurricane/ContactLayer.cpp @@ -1,42 +1,14 @@ - // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie -// -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved // // =================================================================== // // $Id$ // +// // x-----------------------------------------------------------------x // | | // | H U R R I C A N E | @@ -182,6 +154,15 @@ namespace Hurricane { } + void ContactLayer::_onDbuChange ( float scale ) + { + Layer::_onDbuChange ( scale ); + for ( size_t i=0 ; i<_enclosures.size() ; i++ ) + _enclosures[i] = (DbU::Unit)( (float)_enclosures[i] * scale ); + _maximalEnclosure = (DbU::Unit)( (float)_maximalEnclosure * scale ); + } + + string ContactLayer::_getTypeName () const { return _TName("ContactLayer"); } diff --git a/hurricane/src/hurricane/DbU.cpp b/hurricane/src/hurricane/DbU.cpp index f0c42c49..a92ef9a3 100644 --- a/hurricane/src/hurricane/DbU.cpp +++ b/hurricane/src/hurricane/DbU.cpp @@ -1,9 +1,8 @@ - // -*- C++ -*- // -// This file is part of the Hurricane Software. -// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved // // =================================================================== // @@ -24,25 +23,28 @@ // x-----------------------------------------------------------------x -# include -# include +#include +#include -# include "hurricane/DbU.h" -# include "hurricane/Error.h" +#include "hurricane/DbU.h" +#include "hurricane/Error.h" +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" namespace Hurricane { - const unsigned int DbU::_maximalPrecision = 3; - unsigned int DbU::_precision = 1; - double DbU::_resolution = 0.1; - double DbU::_gridsPerLambda = 10.0; - double DbU::_physicalsPerGrid = 1.0; - unsigned int DbU::_stringMode = DbU::Symbolic; - DbU::Unit DbU::_snapGridStep = DbU::lambda(1.0); - const DbU::Unit DbU::Min = LONG_MIN; - const DbU::Unit DbU::Max = LONG_MAX; + const unsigned int DbU::_maximalPrecision = 3; + unsigned int DbU::_precision = 1; + double DbU::_resolution = 0.1; + double DbU::_gridsPerLambda = 10.0; + double DbU::_physicalsPerGrid = 1.0; + unsigned int DbU::_stringMode = DbU::Symbolic; + DbU::Unit DbU::_symbolicSnapGridStep = DbU::lambda(1.0); + DbU::Unit DbU::_realSnapGridStep = DbU::grid (10.0); + const DbU::Unit DbU::Min = LONG_MIN; + const DbU::Unit DbU::Max = LONG_MAX; // ------------------------------------------------------------------- @@ -103,12 +105,17 @@ namespace Hurricane { , _maximalPrecision ); + float scale = (float)precision / (float)_precision; + _precision = precision; _resolution = 1; while ( precision-- ) _resolution /= 10; - setSnapGridStep ( DbU::lambda(1) ); + DataBase::getDB()->getTechnology()->_onDbuChange ( scale ); + + setSymbolicSnapGridStep ( DbU::lambda( 1.0) ); + setRealSnapGridStep ( DbU::grid (10.0) ); } @@ -127,9 +134,7 @@ namespace Hurricane { void DbU::setPhysicalsPerGrid ( double physicalsPerGrid, UnitPower p ) - { - _physicalsPerGrid = physicalsPerGrid * getUnitPower(p); - } + { _physicalsPerGrid = physicalsPerGrid * getUnitPower(p); } double DbU::getPhysicalsPerGrid () @@ -137,9 +142,7 @@ namespace Hurricane { double DbU::physicalToGrid ( double physical, UnitPower p ) - { - return ( physical * getUnitPower(p) ) / _physicalsPerGrid; - } + { return ( physical * getUnitPower(p) ) / _physicalsPerGrid; } void DbU::setGridsPerLambda ( double gridsPerLambda ) @@ -150,9 +153,13 @@ namespace Hurricane { , gridsPerLambda ); + float scale = gridsPerLambda / (float)_gridsPerLambda; + _gridsPerLambda = gridsPerLambda; - setSnapGridStep ( DbU::lambda(1) ); + DataBase::getDB()->getTechnology()->_onDbuChange ( scale ); + + setSymbolicSnapGridStep ( DbU::lambda(1) ); } @@ -160,79 +167,40 @@ namespace Hurricane { { return _gridsPerLambda; } - DbU::Unit DbU::getSnapGridStep () - { - return _snapGridStep; - } + DbU::Unit DbU::getSymbolicSnapGridStep () + { return _symbolicSnapGridStep; } - DbU::Unit DbU::getOnSnapGrid ( DbU::Unit u, SnapMode mode ) + DbU::Unit DbU::getOnSymbolicSnapGrid ( DbU::Unit u, SnapMode mode ) { - DbU::Unit inferior = ( u / _snapGridStep ) * _snapGridStep; - DbU::Unit modulo = u % _snapGridStep; + DbU::Unit inferior = ( u / _symbolicSnapGridStep ) * _symbolicSnapGridStep; + DbU::Unit modulo = u % _symbolicSnapGridStep; if ( !modulo ) return u; if ( mode == Inferior ) { return inferior; } - else if ( mode == Superior ) { return inferior + _snapGridStep; } + else if ( mode == Superior ) { return inferior + _symbolicSnapGridStep; } - return inferior + ( (modulo > (_snapGridStep/2)) ? _snapGridStep : 0 ); + return inferior + ( (modulo > (_symbolicSnapGridStep/2)) ? _symbolicSnapGridStep : 0 ); } - + + DbU::Unit DbU::getRealSnapGridStep () + { return _realSnapGridStep; } -// **************************************************************************************************** -// Grid managers -// **************************************************************************************************** + DbU::Unit DbU::getOnRealSnapGrid ( DbU::Unit u, SnapMode mode ) + { + DbU::Unit inferior = ( u / _realSnapGridStep ) * _realSnapGridStep; + DbU::Unit modulo = u % _realSnapGridStep; -// const DbU::Unit& getGridStep() -// // ********************** -// { -// return GRID_STEP; -// } + if ( !modulo ) return u; -// void setGridStep(const DbU::Unit& gridStep) -// // *********************************** -// { -// if (!gridStep) throw Error("Can't set grid step : invalid value"); - -// GRID_STEP = gridStep; -// } - -// bool isOnGrid(const DbU::Unit& unit, int n) -// // *********************************** -// { -// if (n <= 0) throw Error("Can't compute : invalid value"); - -// n *= GRID_STEP; - -// return (((abs(unit) / n) * n) == abs(unit)); -// } - -// DbU::Unit getOnGridUnit(const DbU::Unit& unit, int s) -// // **************************************** -// { -// switch (s) { -// case -1 : { -// if (0 < unit) return (unit / GRID_STEP) * GRID_STEP; -// else if (unit < 0) return ((unit / GRID_STEP) - 1) * GRID_STEP; -// return unit; -// } -// case 0 : { -// int g1 = (unit / GRID_STEP) * GRID_STEP; -// int g2 = ((g1 < unit) ? (g1 + GRID_STEP) : (g1 - GRID_STEP)); -// return (abs(g1 - unit) <= abs(g2 - unit)) ? g1 : g2; -// } -// case +1 : { -// if (0 < unit) return ((unit / GRID_STEP) + 1) * GRID_STEP; -// else if (unit < 0) return (unit / GRID_STEP) * GRID_STEP; -// return unit; -// } -// } -// throw Error("Can't get on grid unit : invalid parameter s (should be -1, 0 or +1)"); -// return 0; -// } + if ( mode == Inferior ) { return inferior; } + else if ( mode == Superior ) { return inferior + _realSnapGridStep; } + + return inferior + ( (modulo > (_realSnapGridStep/2)) ? _realSnapGridStep : 0 ); + } string DbU::getValueString ( DbU::Unit u, int mode ) diff --git a/hurricane/src/hurricane/DiffusionLayer.cpp b/hurricane/src/hurricane/DiffusionLayer.cpp index 18d06c20..42af01c4 100644 --- a/hurricane/src/hurricane/DiffusionLayer.cpp +++ b/hurricane/src/hurricane/DiffusionLayer.cpp @@ -1,37 +1,8 @@ - // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie -// -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved // // =================================================================== // @@ -45,17 +16,17 @@ // | Author : Jean-Paul Chaput | // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | -// | C++ Module : "./DiffusionLayer.cpp" | +// | C++ Module : "./DiffusionLayer.cpp" | // | *************************************************************** | // | U p d a t e s | // | | // x-----------------------------------------------------------------x -# include "hurricane/BasicLayer.h" -# include "hurricane/DiffusionLayer.h" -# include "hurricane/Technology.h" -# include "hurricane/Error.h" +#include "hurricane/BasicLayer.h" +#include "hurricane/DiffusionLayer.h" +#include "hurricane/Technology.h" +#include "hurricane/Error.h" namespace { @@ -203,6 +174,21 @@ namespace Hurricane { } + void DiffusionLayer::_onDbuChange ( float scale ) + { + Layer::_onDbuChange ( scale ); + + for ( size_t i=0 ; i<_extentionCaps.size() ; i++ ) + _extentionCaps[i] = (DbU::Unit)( (float)_extentionCaps[i] * scale ); + + for ( size_t i=0 ; i<_extentionWidths.size() ; i++ ) + _extentionWidths[i] = (DbU::Unit)( (float)_extentionWidths[i] * scale ); + + _maximalExtentionCap = (DbU::Unit)( (float)_maximalExtentionCap * scale ); + _maximalExtentionWidth = (DbU::Unit)( (float)_maximalExtentionWidth * scale ); + } + + string DiffusionLayer::_getTypeName () const { return _TName("DiffusionLayer"); } diff --git a/hurricane/src/hurricane/Layer.cpp b/hurricane/src/hurricane/Layer.cpp index 62712475..f514e088 100644 --- a/hurricane/src/hurricane/Layer.cpp +++ b/hurricane/src/hurricane/Layer.cpp @@ -209,6 +209,14 @@ namespace Hurricane { } + void Layer::_onDbuChange ( float scale ) + { + _minimalSize = (DbU::Unit)( (float)_minimalSize * scale ); + _minimalSpacing = (DbU::Unit)( (float)_minimalSpacing * scale ); + _pitch = (DbU::Unit)( (float)_pitch * scale ); + } + + string Layer::_getString() const { string s = DBo::_getString(); diff --git a/hurricane/src/hurricane/RegularLayer.cpp b/hurricane/src/hurricane/RegularLayer.cpp index a2affd07..afa56b1d 100644 --- a/hurricane/src/hurricane/RegularLayer.cpp +++ b/hurricane/src/hurricane/RegularLayer.cpp @@ -1,37 +1,8 @@ - // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie -// -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved // // =================================================================== // @@ -145,6 +116,16 @@ namespace Hurricane { { return new Locator(_regularLayer->getBasicLayer()); } + void RegularLayer::_onDbuChange ( float scale ) + { + Layer::_onDbuChange ( scale ); + + _enclosure = (DbU::Unit)( (float)_enclosure * scale ); + _extentionCap = (DbU::Unit)( (float)_extentionCap * scale ); + _extentionWidth = (DbU::Unit)( (float)_extentionWidth * scale ); + } + + string RegularLayer_RegularLayers::_getString () const { string s = "<" + _TName("RegularLayer::RegularLayers"); diff --git a/hurricane/src/hurricane/Technology.cpp b/hurricane/src/hurricane/Technology.cpp index ebbab660..b01275b9 100644 --- a/hurricane/src/hurricane/Technology.cpp +++ b/hurricane/src/hurricane/Technology.cpp @@ -176,91 +176,98 @@ ViaLayers Technology::getViaLayers() const } -Layer* Technology::getLayer ( const Layer::Mask& mask, bool useWorking ) const -{ - LayerMaskMap::const_iterator lb = _layerMaskMap.lower_bound ( mask ); - LayerMaskMap::const_iterator ub = _layerMaskMap.upper_bound ( mask ); - for ( ; lb != ub ; lb++ ) { - if ( !useWorking || lb->second->isWorking() ) return lb->second; + Layer* Technology::getLayer ( const Layer::Mask& mask, bool useWorking ) const + { + LayerMaskMap::const_iterator lb = _layerMaskMap.lower_bound ( mask ); + LayerMaskMap::const_iterator ub = _layerMaskMap.upper_bound ( mask ); + for ( ; lb != ub ; lb++ ) { + if ( !useWorking || lb->second->isWorking() ) return lb->second; + } + return NULL; } - return NULL; -} -Layer* Technology::getMetalAbove ( const Layer* layer, bool useWorking ) const -{ - if ( !layer ) return NULL; + Layer* Technology::getMetalAbove ( const Layer* layer, bool useWorking ) const + { + if ( !layer ) return NULL; - LayerMaskMap::const_iterator ub = _layerMaskMap.upper_bound ( layer->getMask() ); - for ( ; ub != _layerMaskMap.end() ; ub++ ) { - if ( _metalMask.contains(ub->second->getMask()) + LayerMaskMap::const_iterator ub = _layerMaskMap.upper_bound ( layer->getMask() ); + for ( ; ub != _layerMaskMap.end() ; ub++ ) { + if ( _metalMask.contains(ub->second->getMask()) && ( !useWorking || ub->second->isWorking() ) ) - return ub->second; + return ub->second; + } + return NULL; } - return NULL; -} -Layer* Technology::getMetalBelow ( const Layer* layer, bool useWorking ) const -{ - if ( !layer ) return NULL; + Layer* Technology::getMetalBelow ( const Layer* layer, bool useWorking ) const + { + if ( !layer ) return NULL; - LayerMaskMap::const_iterator lb = _layerMaskMap.lower_bound ( layer->getMask() ); - if ( lb->second == layer ) lb--; - for ( ; lb != _layerMaskMap.begin() ; lb-- ) { - if ( _metalMask.contains(lb->second->getMask()) + LayerMaskMap::const_iterator lb = _layerMaskMap.lower_bound ( layer->getMask() ); + if ( lb->second == layer ) lb--; + for ( ; lb != _layerMaskMap.begin() ; lb-- ) { + if ( _metalMask.contains(lb->second->getMask()) && ( !useWorking || lb->second->isWorking() ) ) - return lb->second; + return lb->second; + } + return NULL; } - return NULL; -} -Layer* Technology::getCutAbove ( const Layer* layer, bool useWorking ) const -{ - if ( !layer ) return NULL; + Layer* Technology::getCutAbove ( const Layer* layer, bool useWorking ) const + { + if ( !layer ) return NULL; - LayerMaskMap::const_iterator ub = _layerMaskMap.upper_bound ( layer->getMask() ); - for ( ; ub != _layerMaskMap.end() ; ub++ ) { - if ( _cutMask.contains(ub->second->getMask()) + LayerMaskMap::const_iterator ub = _layerMaskMap.upper_bound ( layer->getMask() ); + for ( ; ub != _layerMaskMap.end() ; ub++ ) { + if ( _cutMask.contains(ub->second->getMask()) && ( !useWorking || ub->second->isWorking() ) ) - return ub->second; + return ub->second; + } + return NULL; } - return NULL; -} -Layer* Technology::getCutBelow ( const Layer* layer, bool useWorking ) const -{ - if ( !layer ) return NULL; + Layer* Technology::getCutBelow ( const Layer* layer, bool useWorking ) const + { + if ( !layer ) return NULL; - LayerMaskMap::const_iterator lb = _layerMaskMap.lower_bound ( layer->getMask() ); - if ( lb->second == layer ) lb--; - for ( ; lb != _layerMaskMap.begin() ; lb-- ) { - if ( _cutMask.contains(lb->second->getMask()) + LayerMaskMap::const_iterator lb = _layerMaskMap.lower_bound ( layer->getMask() ); + if ( lb->second == layer ) lb--; + for ( ; lb != _layerMaskMap.begin() ; lb-- ) { + if ( _cutMask.contains(lb->second->getMask()) && ( !useWorking || lb->second->isWorking() ) ) - return lb->second; + return lb->second; + } + return NULL; } - return NULL; -} -Layer* Technology::getViaBetween ( const Layer* metal1, const Layer* metal2 ) const -{ - if ( !metal1 || !metal2 ) return NULL; - if ( metal1->above(metal2) ) swap ( metal1, metal2 ); + Layer* Technology::getViaBetween ( const Layer* metal1, const Layer* metal2 ) const + { + if ( !metal1 || !metal2 ) return NULL; + if ( metal1->above(metal2) ) swap ( metal1, metal2 ); - Layer* cutLayer = getCutBelow ( metal2 ); - if ( !cutLayer ) return NULL; + Layer* cutLayer = getCutBelow ( metal2 ); + if ( !cutLayer ) return NULL; - return getLayer ( metal1->getMask() | metal2->getMask() | cutLayer->getMask() ); -} + return getLayer ( metal1->getMask() | metal2->getMask() | cutLayer->getMask() ); + } -Layer* Technology::getNthMetal ( int nth ) const -{ - return getLayer ( _metalMask.nthbit(nth) ); -} + Layer* Technology::getNthMetal ( int nth ) const + { + return getLayer ( _metalMask.nthbit(nth) ); + } + + + void Technology::_onDbuChange ( float scale ) + { + forEach ( Layer*, layer, getLayers() ) + layer->_onDbuChange ( scale ); + } void Technology::setName(const Name& name) @@ -275,29 +282,29 @@ void Technology::setName(const Name& name) } -bool Technology::setWorkingLayer ( const Name& name ) -{ - Layer* layer = getLayer ( name ); - if ( !layer ) return false; + bool Technology::setWorkingLayer ( const Name& name ) + { + Layer* layer = getLayer ( name ); + if ( !layer ) return false; - return setWorkingLayer ( layer ); -} - - -bool Technology::setWorkingLayer ( const Layer* layer ) -{ - bool found = false; - LayerMaskMap::iterator lb = _layerMaskMap.lower_bound ( layer->getMask() ); - LayerMaskMap::iterator ub = _layerMaskMap.upper_bound ( layer->getMask() ); - for ( ; lb != ub ; lb++ ) { - if ( lb->second == layer ) { - lb->second->setWorking ( true ); - found = true; - } else - lb->second->setWorking ( false ); + return setWorkingLayer ( layer ); + } + + + bool Technology::setWorkingLayer ( const Layer* layer ) + { + bool found = false; + LayerMaskMap::iterator lb = _layerMaskMap.lower_bound ( layer->getMask() ); + LayerMaskMap::iterator ub = _layerMaskMap.upper_bound ( layer->getMask() ); + for ( ; lb != ub ; lb++ ) { + if ( lb->second == layer ) { + lb->second->setWorking ( true ); + found = true; + } else + lb->second->setWorking ( false ); + } + return found; } - return found; -} void Technology::_postCreate() diff --git a/hurricane/src/hurricane/TransistorLayer.cpp b/hurricane/src/hurricane/TransistorLayer.cpp index c2cf9d12..91a8c2ef 100644 --- a/hurricane/src/hurricane/TransistorLayer.cpp +++ b/hurricane/src/hurricane/TransistorLayer.cpp @@ -1,42 +1,14 @@ - // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie -// -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved // // =================================================================== // // $Id$ // +// // x-----------------------------------------------------------------x // | | // | H U R R I C A N E | @@ -52,10 +24,10 @@ // x-----------------------------------------------------------------x -# include "hurricane/BasicLayer.h" -# include "hurricane/TransistorLayer.h" -# include "hurricane/Technology.h" -# include "hurricane/Error.h" +#include "hurricane/BasicLayer.h" +#include "hurricane/TransistorLayer.h" +#include "hurricane/Technology.h" +#include "hurricane/Error.h" namespace { @@ -205,6 +177,21 @@ namespace Hurricane { } + void TransistorLayer::_onDbuChange ( float scale ) + { + Layer::_onDbuChange ( scale ); + + for ( size_t i=0 ; i<_extentionCaps.size() ; i++ ) + _extentionCaps[i] = (DbU::Unit)( (float)_extentionCaps[i] * scale ); + + for ( size_t i=0 ; i<_extentionWidths.size() ; i++ ) + _extentionWidths[i] = (DbU::Unit)( (float)_extentionWidths[i] * scale ); + + _maximalExtentionCap = (DbU::Unit)( (float)_maximalExtentionCap * scale ); + _maximalExtentionWidth = (DbU::Unit)( (float)_maximalExtentionWidth * scale ); + } + + string TransistorLayer::_getTypeName () const { return _TName("TransistorLayer"); } diff --git a/hurricane/src/hurricane/ViaLayer.cpp b/hurricane/src/hurricane/ViaLayer.cpp index afbcf894..f1f46039 100644 --- a/hurricane/src/hurricane/ViaLayer.cpp +++ b/hurricane/src/hurricane/ViaLayer.cpp @@ -191,6 +191,17 @@ namespace Hurricane { } + void ViaLayer::_onDbuChange ( float scale ) + { + Layer::_onDbuChange ( scale ); + + for ( size_t i=0 ; i<_enclosures.size() ; i++ ) + _enclosures[i] = (DbU::Unit)( (float)_enclosures[i] * scale ); + + _maximalEnclosure = (DbU::Unit)( (float)_maximalEnclosure * scale ); + } + + string ViaLayer::_getTypeName () const { return _TName("ViaLayer"); } diff --git a/hurricane/src/hurricane/hurricane/BasicLayer.h b/hurricane/src/hurricane/hurricane/BasicLayer.h index 98f3f9b7..f92be236 100644 --- a/hurricane/src/hurricane/hurricane/BasicLayer.h +++ b/hurricane/src/hurricane/hurricane/BasicLayer.h @@ -78,14 +78,14 @@ namespace Hurricane { , const DbU::Unit& minimalSize = 0 , const DbU::Unit& minimalSpacing = 0 ); - // Accessors. + // Accessors. inline const Material& getMaterial () const; inline unsigned getExtractNumber () const; virtual BasicLayers getBasicLayers () const; virtual BasicLayer* getConnectorLayer () const; virtual BasicLayer* getObstructionLayer () const; inline const Name& getRealName () const; - // Updators + // Updators inline void setConnectorLayer ( BasicLayer* layer); inline void setObstructionLayer ( BasicLayer* layer); inline void setRealName ( const char* realName); @@ -105,12 +105,12 @@ namespace Hurricane { protected: // Internal: Constructors & Destructors. - BasicLayer ( Technology* technology - , const Name& name - , const Material& material - , unsigned extractNumber - , const DbU::Unit& minimalSize = 0 - , const DbU::Unit& minimalSpacing = 0 + BasicLayer ( Technology* technology + , const Name& name + , const Material& material + , unsigned extractNumber + , const DbU::Unit& minimalSize = 0 + , const DbU::Unit& minimalSpacing = 0 ); virtual void _postCreate (); virtual void _preDestroy (); diff --git a/hurricane/src/hurricane/hurricane/Commons.h b/hurricane/src/hurricane/hurricane/Commons.h index 419a8a7d..774a082f 100644 --- a/hurricane/src/hurricane/hurricane/Commons.h +++ b/hurricane/src/hurricane/hurricane/Commons.h @@ -547,7 +547,7 @@ inline Hurricane::Record* getRecord ( const std::multiset* s ) template<> inline std::string getString( Data* data ) \ { \ if (!data) return "NULL [" #Data "]"; \ - return const_cast(data)->_getString(); \ + return data->_getString(); \ } \ \ template<> inline std::string getString( const Data* data ) \ @@ -605,7 +605,7 @@ inline Hurricane::Record* getRecord ( const std::multiset* s ) # define IOSTREAM_VALUE_SUPPORT(Data) \ - inline std::ostream& operator<< ( std::ostream& o, Data d ) \ + inline std::ostream& operator<< ( std::ostream& o, Data d ) \ { return o << getString(d); } diff --git a/hurricane/src/hurricane/hurricane/CompositeLayer.h b/hurricane/src/hurricane/hurricane/CompositeLayer.h deleted file mode 100644 index bf77ca20..00000000 --- a/hurricane/src/hurricane/hurricane/CompositeLayer.h +++ /dev/null @@ -1,129 +0,0 @@ -// **************************************************************************************************** -// File: CompositeLayer.h -// Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved -// **************************************************************************************************** - -#ifndef HURRICANE_COMPOSITE_LAYER -#define HURRICANE_COMPOSITE_LAYER - -#include "hurricane/Layer.h" -#include "hurricane/CompositeLayers.h" - -namespace Hurricane { - - - -// **************************************************************************************************** -// CompositeLayer declaration -// **************************************************************************************************** - -class CompositeLayer : public Layer { -// ******************************** - -// Types -// ***** - - public: typedef Layer Inherit; - - public: class Type { - // *************** - - public: enum Code {UNDEFINED=0, METAL=1, VIA=2}; - - private: Code _code; - - public: Type(const Code& code = UNDEFINED); - public: Type(const Type& type); - - public: Type& operator=(const Type& type); - - public: operator const Code&() const {return _code;}; - - public: const Code& getCode() const {return _code;}; - - public: string _getTypeName() const { return _TName("CompositeLayer::Type"); }; - public: string _getString() const; - public: Record* _getRecord() const; - - }; - - public: typedef list BasicLayerList; - - public: typedef map SizeMap; - -// Attributes -// ********** - - private: Type _type; - private: BasicLayerList _basicLayerList; - private: SizeMap _contactSizeMap; - private: SizeMap _segmentSizeMap; - private: SizeMap _segmentExtentionMap; - private: SizeMap _padSizeMap; - private: Unit _maximalContactSize; - private: Unit _maximalSegmentSize; - private: Unit _maximalSegmentExtention; - private: Unit _maximalPadSize; - private: BasicLayer* _symbolicBasicLayer; - -// Constructors -// ************ - - protected: CompositeLayer(Technology* technology, const Name& name, const Type& type, const Unit& minimalSize = 0, const Unit& minimalSpacing = 0); - - public: static CompositeLayer* create(Technology* technology, const Name& name, const Type& type, const Unit& minimalSize = 0, const Unit& minimalSpacing = 0); - -// Accessors -// ********* - - public: const Type& getType() const {return _type;}; - public: virtual BasicLayers getBasicLayers() const; - public: Unit getContactSize(const BasicLayer* basicLayer) const; - public: Unit getSegmentSize(const BasicLayer* basicLayer) const; - public: Unit getSegmentExtention(const BasicLayer* basicLayer) const; - public: Unit getPadSize(const BasicLayer* basicLayer) const; - public: const Unit& getMaximalContactSize() const {return _maximalContactSize;}; - public: const Unit& getMaximalSegmentSize() const {return _maximalSegmentSize;}; - public: const Unit& getMaximalSegmentExtention() const {return _maximalSegmentExtention;}; - public: const Unit& getMaximalPadSize() const {return _maximalPadSize;}; - -// Updators -// ******** - - public: void add(BasicLayer* basicLayer, const Unit& contactSize, const Unit& segmentSize, const Unit& segmentExtention, const Unit& padSize); - public: void setContactSize(BasicLayer* basicLayer, const Unit& contactSize); - public: void setSegmentSize(BasicLayer* basicLayer, const Unit& segmentSize); - public: void setSegmentExtention(BasicLayer* basicLayer, const Unit& segmentExtention); - public: void remove(BasicLayer* basicLayer); - -// Others -// ****** - - public: virtual string _getTypeName() const {return _TName("CompositeLayer");}; - public: virtual string _getString() const; - public: virtual Record* _getRecord() const; - public: virtual BasicLayer* _getSymbolicBasicLayer() {return _symbolicBasicLayer;}; - public: BasicLayerList& _getBasicLayerList() {return _basicLayerList;}; - - public: void _updateSymbolicBasicLayer(const Layer::Mask& visibleBasicLayersMask); - -}; - - -} // End of Hurricane namespace. - - - -// **************************************************************************************************** -// Generic functions -// **************************************************************************************************** - - -bool Scan(const string& s, Hurricane::CompositeLayer::Type& type); - -#endif // HURRICANE_COMPOSITE_LAYER - -// **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved -// **************************************************************************************************** diff --git a/hurricane/src/hurricane/hurricane/ContactLayer.h b/hurricane/src/hurricane/hurricane/ContactLayer.h index ab2e143b..20a423b2 100644 --- a/hurricane/src/hurricane/hurricane/ContactLayer.h +++ b/hurricane/src/hurricane/hurricane/ContactLayer.h @@ -1,37 +1,8 @@ - // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie -// -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved // // =================================================================== // @@ -52,12 +23,12 @@ // x-----------------------------------------------------------------x -# ifndef __HURRICANE_CONTACT_LAYER__ -# define __HURRICANE_CONTACT_LAYER__ +#ifndef __HURRICANE_CONTACT_LAYER__ +#define __HURRICANE_CONTACT_LAYER__ -# include +#include -# include "hurricane/Layer.h" +#include "hurricane/Layer.h" namespace Hurricane { @@ -67,41 +38,41 @@ namespace Hurricane { public: // Constructor. - static ContactLayer* create ( Technology* technology - , const Name& name - , BasicLayer* metalLayer - , BasicLayer* cutLayer - , BasicLayer* activeLayer - , BasicLayer* diffusionLayer - , BasicLayer* wellLayer - ); + static ContactLayer* create ( Technology* technology + , const Name& name + , BasicLayer* metalLayer + , BasicLayer* cutLayer + , BasicLayer* activeLayer + , BasicLayer* diffusionLayer + , BasicLayer* wellLayer + ); // Accessors. - virtual BasicLayers getBasicLayers () const; - virtual DbU::Unit getEnclosure () const; - virtual DbU::Unit getEnclosure ( const BasicLayer* layer ) const; + virtual BasicLayers getBasicLayers () const; + virtual DbU::Unit getEnclosure () const; + virtual DbU::Unit getEnclosure ( const BasicLayer* layer ) const; // Updators. - virtual void setEnclosure ( const BasicLayer* layer, DbU::Unit enclosure ); + virtual void setEnclosure ( const BasicLayer* layer, DbU::Unit enclosure ); // Hurricane Managment. - virtual string _getTypeName () const; - virtual string _getString () const; - virtual Record* _getRecord () const; + virtual void _onDbuChange ( float scale ); + virtual string _getTypeName () const; + virtual string _getString () const; + virtual Record* _getRecord () const; private: // Internal: Attributes - vector _basicLayers; - vector _enclosures; - DbU::Unit _maximalEnclosure; + vector _basicLayers; + vector _enclosures; + DbU::Unit _maximalEnclosure; protected: - // Internal: Constructors & Destructors. - ContactLayer ( Technology* technology - , const Name& name - , BasicLayer* metalLayer - , BasicLayer* cutLayer - , BasicLayer* activeLayer - , BasicLayer* diffusionLayer - , BasicLayer* wellLayer - ); + ContactLayer ( Technology* technology + , const Name& name + , BasicLayer* metalLayer + , BasicLayer* cutLayer + , BasicLayer* activeLayer + , BasicLayer* diffusionLayer + , BasicLayer* wellLayer + ); }; diff --git a/hurricane/src/hurricane/hurricane/DbU.h b/hurricane/src/hurricane/hurricane/DbU.h index 532e8008..6f6fe9ba 100644 --- a/hurricane/src/hurricane/hurricane/DbU.h +++ b/hurricane/src/hurricane/hurricane/DbU.h @@ -60,38 +60,37 @@ namespace Hurricane { public: // User to DB Converters. - static inline Unit db ( long value ); - static inline Unit grid ( double value ); - static inline Unit lambda ( double value ); - // Precision & Resolution Managment. - static unsigned int getPrecision (); - static unsigned int getMaximalPrecision (); - static double getResolution (); - static void setPrecision ( unsigned int precision ); - // Founder Grid Managment. - static double getUnitPower ( UnitPower p ); - static void setPhysicalsPerGrid ( double gridsPerLambda, UnitPower p ); - static double getPhysicalsPerGrid (); - static double physicalToGrid ( double physical, UnitPower p ); - // Lamba Managment. - static void setGridsPerLambda ( double gridsPerLambda ); - static double getGridsPerLambda (); + static inline Unit db ( long value ); + static inline Unit grid ( double value ); + static inline Unit lambda ( double value ); + // Precision & Resolution Managment. + static unsigned int getPrecision (); + static unsigned int getMaximalPrecision (); + static double getResolution (); + static void setPrecision ( unsigned int precision ); + // Founder Grid Managment. + static double getUnitPower ( UnitPower p ); + static void setPhysicalsPerGrid ( double gridsPerLambda, UnitPower p ); + static double getPhysicalsPerGrid (); + static double physicalToGrid ( double physical, UnitPower p ); + // Lamba Managment. + static void setGridsPerLambda ( double gridsPerLambda ); + static double getGridsPerLambda (); // Snap Grid Managment. - static DbU::Unit getSnapGridStep (); - static DbU::Unit getOnSnapGrid ( DbU::Unit u, SnapMode mode=Nearest ); - static inline void setSnapGridStep ( DbU::Unit step ); - //static void setGridStep ( const Unit& gridStep ); - //static const Unit getGridStep (); - //static Unit getOnGridUnit ( const DbU::Unit& unit, int s=0 ); - //static bool isOnGrid ( const Unit& unit, int n=1 ); + static DbU::Unit getRealSnapGridStep (); + static DbU::Unit getOnRealSnapGrid ( DbU::Unit u, SnapMode mode=Nearest ); + static inline void setRealSnapGridStep ( DbU::Unit step ); + static DbU::Unit getSymbolicSnapGridStep (); + static DbU::Unit getOnSymbolicSnapGrid ( DbU::Unit u, SnapMode mode=Nearest ); + static inline void setSymbolicSnapGridStep ( DbU::Unit step ); // Conversions. - static inline long getDb ( Unit u ); - static inline double getGrid ( Unit u ); - static inline double getLambda ( Unit u ); - static string getValueString ( Unit u, int mode=SmartTruncate ); - static Record* getValueRecord ( const Unit* u ); - static Slot* getValueSlot ( const string& name, const Unit* u ); - static inline void setStringMode ( unsigned int mode ); + static inline long getDb ( Unit u ); + static inline double getGrid ( Unit u ); + static inline double getLambda ( Unit u ); + static string getValueString ( Unit u, int mode=SmartTruncate ); + static Record* getValueRecord ( const Unit* u ); + static Slot* getValueSlot ( const string& name, const Unit* u ); + static inline void setStringMode ( unsigned int mode ); public: // Static Attributes: constants. @@ -105,19 +104,21 @@ namespace Hurricane { static double _gridsPerLambda; static double _physicalsPerGrid; static unsigned int _stringMode; - static DbU::Unit _snapGridStep; + static DbU::Unit _realSnapGridStep; + static DbU::Unit _symbolicSnapGridStep; }; // Inline Functions. - inline DbU::Unit DbU::db ( long value ) { return value; } - inline DbU::Unit DbU::grid ( double value ) { return (long)rint( value/_resolution ); } - inline DbU::Unit DbU::lambda ( double value ) { return grid(value*_gridsPerLambda); } - inline long DbU::getDb ( DbU::Unit u ) { return u; } - inline double DbU::getGrid ( DbU::Unit u ) { return _resolution*(double)u; } - inline double DbU::getLambda ( DbU::Unit u ) { return getGrid(u)/_gridsPerLambda; } - inline void DbU::setStringMode ( unsigned int mode ) { _stringMode = mode; } - inline void DbU::setSnapGridStep ( DbU::Unit step ) { _snapGridStep = step; } + inline DbU::Unit DbU::db ( long value ) { return value; } + inline DbU::Unit DbU::grid ( double value ) { return (long)rint( value/_resolution ); } + inline DbU::Unit DbU::lambda ( double value ) { return grid(value*_gridsPerLambda); } + inline long DbU::getDb ( DbU::Unit u ) { return u; } + inline double DbU::getGrid ( DbU::Unit u ) { return _resolution*(double)u; } + inline double DbU::getLambda ( DbU::Unit u ) { return getGrid(u)/_gridsPerLambda; } + inline void DbU::setStringMode ( unsigned int mode ) { _stringMode = mode; } + inline void DbU::setRealSnapGridStep ( DbU::Unit step ) { _realSnapGridStep = step; } + inline void DbU::setSymbolicSnapGridStep ( DbU::Unit step ) { _symbolicSnapGridStep = step; } } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/DiffusionLayer.h b/hurricane/src/hurricane/hurricane/DiffusionLayer.h index 90776b65..1163357f 100644 --- a/hurricane/src/hurricane/hurricane/DiffusionLayer.h +++ b/hurricane/src/hurricane/hurricane/DiffusionLayer.h @@ -1,37 +1,8 @@ - // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie -// -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved // // =================================================================== // @@ -52,12 +23,12 @@ // x-----------------------------------------------------------------x -# ifndef __HURRICANE_DIFFUSION_LAYER__ -# define __HURRICANE_DIFFUSION_LAYER__ +#ifndef __HURRICANE_DIFFUSION_LAYER__ +#define __HURRICANE_DIFFUSION_LAYER__ -# include +#include -# include "hurricane/Layer.h" +#include "hurricane/Layer.h" namespace Hurricane { @@ -67,42 +38,43 @@ namespace Hurricane { public: // Constructor. - static DiffusionLayer* create ( Technology* technology - , const Name& name - , BasicLayer* activeLayer - , BasicLayer* diffusionLayer - , BasicLayer* wellLayer - ); + static DiffusionLayer* create ( Technology* technology + , const Name& name + , BasicLayer* activeLayer + , BasicLayer* diffusionLayer + , BasicLayer* wellLayer + ); // Accessors. - virtual BasicLayers getBasicLayers () const; - virtual DbU::Unit getExtentionCap () const; - virtual DbU::Unit getExtentionWidth () const; - virtual DbU::Unit getExtentionCap ( const BasicLayer* layer ) const; - virtual DbU::Unit getExtentionWidth ( const BasicLayer* layer ) const; + virtual BasicLayers getBasicLayers () const; + virtual DbU::Unit getExtentionCap () const; + virtual DbU::Unit getExtentionWidth () const; + virtual DbU::Unit getExtentionCap ( const BasicLayer* layer ) const; + virtual DbU::Unit getExtentionWidth ( const BasicLayer* layer ) const; // Updators. - virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit cap ); - virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit width ); + virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit cap ); + virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit width ); // Hurricane Managment. - virtual string _getTypeName () const; - virtual string _getString () const; - virtual Record* _getRecord () const; + virtual void _onDbuChange ( float scale ); + virtual string _getTypeName () const; + virtual string _getString () const; + virtual Record* _getRecord () const; private: // Internal: Attributes - vector _basicLayers; - vector _extentionCaps; - vector _extentionWidths; - DbU::Unit _maximalExtentionCap; - DbU::Unit _maximalExtentionWidth; + vector _basicLayers; + vector _extentionCaps; + vector _extentionWidths; + DbU::Unit _maximalExtentionCap; + DbU::Unit _maximalExtentionWidth; protected: // Internal: Constructors & Destructors. - DiffusionLayer ( Technology* technology - , const Name& name - , BasicLayer* activeLayer - , BasicLayer* diffusionLayer - , BasicLayer* wellLayer - ); + DiffusionLayer ( Technology* technology + , const Name& name + , BasicLayer* activeLayer + , BasicLayer* diffusionLayer + , BasicLayer* wellLayer + ); }; diff --git a/hurricane/src/hurricane/hurricane/Layer.h b/hurricane/src/hurricane/hurricane/Layer.h index 34173d80..99991d93 100644 --- a/hurricane/src/hurricane/hurricane/Layer.h +++ b/hurricane/src/hurricane/hurricane/Layer.h @@ -23,14 +23,14 @@ // x-----------------------------------------------------------------x -# ifndef __HURRICANE_LAYER__ -# define __HURRICANE_LAYER__ +#ifndef __HURRICANE_LAYER__ +#define __HURRICANE_LAYER__ -# include "hurricane/Mask.h" -# include "hurricane/DBo.h" -# include "hurricane/Layers.h" -# include "hurricane/DbU.h" -# include "hurricane/BasicLayers.h" +#include "hurricane/Mask.h" +#include "hurricane/DBo.h" +#include "hurricane/Layers.h" +#include "hurricane/DbU.h" +#include "hurricane/BasicLayers.h" namespace Hurricane { @@ -90,6 +90,7 @@ namespace Hurricane { inline void _setMask ( const Mask& mask ); inline void _setExtractMask ( const Mask& extractMask ); inline void _setNextOfTechnologyLayerMap ( Layer* layer ); + virtual void _onDbuChange ( float scale ); public: struct MaskCompare { inline bool operator () ( const Layer*, const Layer* ) const; diff --git a/hurricane/src/hurricane/hurricane/RegularLayer.h b/hurricane/src/hurricane/hurricane/RegularLayer.h index 161fc40b..165c27bb 100644 --- a/hurricane/src/hurricane/hurricane/RegularLayer.h +++ b/hurricane/src/hurricane/hurricane/RegularLayer.h @@ -1,9 +1,8 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved // // =================================================================== // @@ -24,11 +23,11 @@ // x-----------------------------------------------------------------x -# ifndef __HURRICANE_REGULAR_LAYER__ -# define __HURRICANE_REGULAR_LAYER__ +#ifndef __HURRICANE_REGULAR_LAYER__ +#define __HURRICANE_REGULAR_LAYER__ -# include "hurricane/Layer.h" -# include "hurricane/RegularLayers.h" +#include "hurricane/Layer.h" +#include "hurricane/RegularLayers.h" namespace Hurricane { @@ -59,6 +58,7 @@ namespace Hurricane { virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit cap ); virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit width ); // Hurricane Managment. + virtual void _onDbuChange ( float scale ); virtual string _getTypeName () const; virtual string _getString () const; virtual Record* _getRecord () const; diff --git a/hurricane/src/hurricane/hurricane/Technology.h b/hurricane/src/hurricane/hurricane/Technology.h index 916bc74a..58f3748b 100644 --- a/hurricane/src/hurricane/hurricane/Technology.h +++ b/hurricane/src/hurricane/hurricane/Technology.h @@ -103,6 +103,7 @@ namespace Hurricane { void _removeFromLayerMaskMap ( Layer* ); inline Layer::Mask& _getCutMask (); inline Layer::Mask& _getMetalMask (); + void _onDbuChange ( float scale ); // Hurricane Managment. virtual string _getTypeName () const; virtual string _getString () const; diff --git a/hurricane/src/hurricane/hurricane/Timer.h b/hurricane/src/hurricane/hurricane/Timer.h index c21139fb..2d6856ee 100644 --- a/hurricane/src/hurricane/hurricane/Timer.h +++ b/hurricane/src/hurricane/hurricane/Timer.h @@ -182,7 +182,10 @@ namespace Hurricane { } // End of Hurricane namespace. +GETSTRING_VALUE_SUPPORT(Hurricane::Timer); IOSTREAM_VALUE_SUPPORT(Hurricane::Timer); +//inline std::ostream& operator<< ( std::ostream& o, Hurricane::Timer d ) +//{ return o << "<" << "Hurricane::Timer" << ">" << getString(d); } #endif // __HURRICANE_TIMER__ diff --git a/hurricane/src/hurricane/hurricane/TransistorLayer.h b/hurricane/src/hurricane/hurricane/TransistorLayer.h index 9c6508f8..1382f5ea 100644 --- a/hurricane/src/hurricane/hurricane/TransistorLayer.h +++ b/hurricane/src/hurricane/hurricane/TransistorLayer.h @@ -1,37 +1,8 @@ - // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie -// -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved // // =================================================================== // @@ -52,13 +23,13 @@ // x-----------------------------------------------------------------x -# ifndef __HURRICANE_TRANSISTOR_LAYER__ -# define __HURRICANE_TRANSISTOR_LAYER__ +#ifndef __HURRICANE_TRANSISTOR_LAYER__ +#define __HURRICANE_TRANSISTOR_LAYER__ -# include +#include -# include "hurricane/Layer.h" -# include "hurricane/TransistorLayers.h" +#include "hurricane/Layer.h" +#include "hurricane/TransistorLayers.h" namespace Hurricane { @@ -77,14 +48,15 @@ namespace Hurricane { ); // Accessors. virtual BasicLayers getBasicLayers () const; - virtual DbU::Unit getExtentionCap () const; - virtual DbU::Unit getExtentionWidth () const; - virtual DbU::Unit getExtentionCap ( const BasicLayer* layer ) const; - virtual DbU::Unit getExtentionWidth ( const BasicLayer* layer ) const; + virtual DbU::Unit getExtentionCap () const; + virtual DbU::Unit getExtentionWidth () const; + virtual DbU::Unit getExtentionCap ( const BasicLayer* layer ) const; + virtual DbU::Unit getExtentionWidth ( const BasicLayer* layer ) const; // Updators. virtual void setExtentionCap ( const BasicLayer* layer, DbU::Unit cap ); virtual void setExtentionWidth ( const BasicLayer* layer, DbU::Unit width ); // Hurricane Managment. + virtual void _onDbuChange ( float scale ); virtual string _getTypeName () const; virtual string _getString () const; virtual Record* _getRecord () const; @@ -92,10 +64,10 @@ namespace Hurricane { private: // Internal: Attributes vector _basicLayers; - vector _extentionCaps; - vector _extentionWidths; - DbU::Unit _maximalExtentionCap; - DbU::Unit _maximalExtentionWidth; + vector _extentionCaps; + vector _extentionWidths; + DbU::Unit _maximalExtentionCap; + DbU::Unit _maximalExtentionWidth; protected: // Internal: Constructors & Destructors. diff --git a/hurricane/src/hurricane/hurricane/ViaLayer.h b/hurricane/src/hurricane/hurricane/ViaLayer.h index 6481af1c..f3381b59 100644 --- a/hurricane/src/hurricane/hurricane/ViaLayer.h +++ b/hurricane/src/hurricane/hurricane/ViaLayer.h @@ -1,37 +1,8 @@ - // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie -// -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved // // =================================================================== // @@ -52,13 +23,13 @@ // x-----------------------------------------------------------------x -# ifndef __HURRICANE_VIA_LAYER__ -# define __HURRICANE_VIA_LAYER__ +#ifndef __HURRICANE_VIA_LAYER__ +#define __HURRICANE_VIA_LAYER__ -# include +#include -# include "hurricane/Layer.h" -# include "hurricane/ViaLayers.h" +#include "hurricane/Layer.h" +#include "hurricane/ViaLayers.h" namespace Hurricane { @@ -84,6 +55,7 @@ namespace Hurricane { // Updators. virtual void setEnclosure ( const BasicLayer* layer, DbU::Unit enclosure ); // Hurricane Managment. + virtual void _onDbuChange ( float scale ); virtual string _getTypeName () const; virtual string _getString () const; virtual Record* _getRecord () const; diff --git a/hurricane/src/hviewer/AreaCommand.cpp b/hurricane/src/hviewer/AreaCommand.cpp index 5cbed54c..b1cb49a8 100644 --- a/hurricane/src/hviewer/AreaCommand.cpp +++ b/hurricane/src/hviewer/AreaCommand.cpp @@ -23,12 +23,12 @@ // x-----------------------------------------------------------------x -# include -# include +#include +#include -# include -# include -# include +#include +#include +#include namespace Hurricane { @@ -40,10 +40,10 @@ namespace Hurricane { AreaCommand::AreaCommand () : Command() - , _startPoint() - , _stopPoint() + , _startPoint () + , _stopPoint () , _drawingThreshold(10) - , _drawingEnabled(false) + , _drawingEnabled (false) { } diff --git a/hurricane/src/hviewer/CellWidget.cpp b/hurricane/src/hviewer/CellWidget.cpp index 7190f42c..ae5366f1 100644 --- a/hurricane/src/hviewer/CellWidget.cpp +++ b/hurricane/src/hviewer/CellWidget.cpp @@ -158,8 +158,8 @@ namespace Hurricane { QPoint CellWidget::Spot::computeSpotPoint ( const QPoint& screenPoint ) { Point mousePoint = _cellWidget->screenToDbuPoint ( screenPoint ); - Point spotPoint = Point ( DbU::getOnSnapGrid(mousePoint.getX()) - , DbU::getOnSnapGrid(mousePoint.getY()) + Point spotPoint = Point ( _cellWidget->_onSnapGrid(mousePoint.getX()) + , _cellWidget->_onSnapGrid(mousePoint.getY()) ); return _cellWidget->dbuToScreenPoint(spotPoint); } @@ -1037,7 +1037,7 @@ namespace Hurricane { void CellWidget::detachFromPalette () { if ( _palette ) { - disconnect ( _palette, SIGNAL(paletteChanged()) , this , SLOT(refresh()) ); + disconnect ( _palette, SIGNAL(paletteChanged()) , this , SLOT(refresh()) ); disconnect ( this , SIGNAL(cellChanged(Cell*)) , _palette, SLOT(updateExtensions(Cell*)) ); disconnect ( this , SIGNAL(updatePalette(Cell*)), _palette, SLOT(updateExtensions(Cell*)) ); disconnect ( this , SIGNAL(styleChanged(void*)) , _palette, SLOT(styleChange(void*)) ); @@ -1101,6 +1101,43 @@ namespace Hurricane { } + void CellWidget::changeLayoutMode () + { + if ( symbolicMode() ) + setSymbolicMode (); + else + setRealMode (); + } + + + void CellWidget::setRealMode () + { + if ( !realMode() ) { + _state->setRealMode (); + DbU::setStringMode ( DbU::Grid ); + + updateMousePosition (); + refresh (); + + emit layoutModeChanged (); + } + } + + + void CellWidget::setSymbolicMode () + { + if ( !symbolicMode() ) { + _state->setSymbolicMode (); + DbU::setStringMode ( DbU::Symbolic ); + + updateMousePosition (); + refresh (); + + emit layoutModeChanged (); + } + } + + void CellWidget::setShowSelection ( bool state ) { if ( state != _state->showSelection() ) { @@ -1162,7 +1199,7 @@ namespace Hurricane { _spot.setRestore ( false ); //_drawingPlanes.copyToSelect ( redrawArea ); _drawingPlanes.select ( PlaneId::Normal ); - _drawingPlanes.painterBegin (); + _drawingPlanes.paintersBegin (); _drawingPlanes.painter().setPen ( Qt::NoPen ); _drawingPlanes.painter().setBackground ( Graphics::getBrush("background") ); @@ -1248,7 +1285,7 @@ namespace Hurricane { repaint (); } - _drawingPlanes.painterEnd (); + _drawingPlanes.paintersEnd (); _cellModificated = false; } @@ -1292,7 +1329,7 @@ namespace Hurricane { ); _drawingPlanes.select ( PlaneId::Selection ); - _drawingPlanes.painterBegin (); + _drawingPlanes.paintersBegin (); _drawingPlanes.painter().setPen ( Qt::NoPen ); _drawingPlanes.painter().setBackground ( Graphics::getBrush("background") ); _drawingPlanes.painter().setClipRect ( redrawArea ); @@ -1365,7 +1402,7 @@ namespace Hurricane { repaint (); } - _drawingPlanes.painterEnd (); + _drawingPlanes.paintersEnd (); _selectionHasChanged = false; } @@ -1379,10 +1416,12 @@ namespace Hurricane { bool CellWidget::isDrawable ( const Name& name ) { - PaletteItem* item = (_palette) ? _palette->find(name) : NULL; + PaletteItem* item = (_palette) ? _palette->find(name) : NULL; + //DbU::Unit unity = symbolicMode() ? DbU::lambda(1.0) : DbU::grid(10.0); + DbU::Unit unity = DbU::lambda(1.0); return (!item || item->isItemVisible()) - && ( Graphics::getThreshold(name)/DbU::lambda(1.0) < getScale() ); + && ( Graphics::getThreshold(name) < getScale()*unity ); } @@ -1501,6 +1540,14 @@ namespace Hurricane { } + bool CellWidget::_underDetailedGridThreshold () const + { + if ( symbolicMode() ) + return Graphics::getThreshold("grid")/DbU::lambda(1.0) < getScale()/5; + return Graphics::getThreshold("grid")/DbU::grid(10.0) < getScale()/5; + } + + void CellWidget::drawGrid ( QRect redrawArea ) { _drawingPlanes.select ( PlaneId::Normal ); @@ -1510,31 +1557,29 @@ namespace Hurricane { Box redrawBox = displayToDbuBox ( redrawArea ).inflate ( DbU::lambda(1.0) ); - bool lambdaGrid = false; - if ( Graphics::getThreshold("grid")/DbU::lambda(1.0) < getScale()/5 ) - lambdaGrid = true; + bool detailedGrid = _underDetailedGridThreshold(); - DbU::Unit gridStep = DbU::getSnapGridStep(); + DbU::Unit gridStep = _snapGridStep(); DbU::Unit superGridStep = gridStep*5; DbU::Unit xGrid; DbU::Unit yGrid; QPoint center; - for ( yGrid = DbU::getOnSnapGrid(redrawBox.getYMin()) + for ( yGrid = _onSnapGrid(redrawBox.getYMin()) ; yGrid < redrawBox.getYMax() ; yGrid += gridStep ) { - for ( xGrid = DbU::getOnSnapGrid(redrawBox.getXMin()) + for ( xGrid = _onSnapGrid(redrawBox.getXMin()) ; xGrid < redrawBox.getXMax() ; xGrid += gridStep ) { center = dbuToDisplayPoint(xGrid,yGrid); if ( (xGrid % superGridStep) || (yGrid % superGridStep) ) { - if ( lambdaGrid ) { + if ( detailedGrid ) { _drawingPlanes.painter(PlaneId::Normal).drawPoint ( center ); } } else { - if ( lambdaGrid ) { + if ( detailedGrid ) { _drawingPlanes.painter(PlaneId::Normal).drawLine ( center.x()-3, center.y() , center.x()+3, center.y() ); _drawingPlanes.painter(PlaneId::Normal).drawLine ( center.x() , center.y()-3, center.x() , center.y()+3 ); } else { @@ -1961,11 +2006,8 @@ namespace Hurricane { commandActive = _commands[i]->mouseMoveEvent ( this, event ); if ( !commandActive ) { - Point mousePoint = screenToDbuPoint ( _mousePosition = event->pos() ); - emit mousePositionChanged ( Point ( DbU::getOnSnapGrid(mousePoint.getX()) - , DbU::getOnSnapGrid(mousePoint.getY()) - ) ); - + _mousePosition = event->pos(); + updateMousePosition (); repaint (); } } @@ -2050,6 +2092,7 @@ namespace Hurricane { shared_ptr state ( new State(cell) ); setState ( state ); + //setRealMode (); fitToContents ( false ); diff --git a/hurricane/src/hviewer/Command.cpp b/hurricane/src/hviewer/Command.cpp index 70009bcb..10aaba45 100644 --- a/hurricane/src/hviewer/Command.cpp +++ b/hurricane/src/hviewer/Command.cpp @@ -23,12 +23,12 @@ // x-----------------------------------------------------------------x -# include -# include -# include +#include +#include +#include -# include -# include +#include +#include namespace Hurricane { diff --git a/hurricane/src/hviewer/DisplayFilterWidget.cpp b/hurricane/src/hviewer/DisplayFilterWidget.cpp index e2eecdc0..b09dd97e 100644 --- a/hurricane/src/hviewer/DisplayFilterWidget.cpp +++ b/hurricane/src/hviewer/DisplayFilterWidget.cpp @@ -55,6 +55,8 @@ namespace Hurricane { , _steiner (new QRadioButton()) , _centric (new QRadioButton()) , _barycentric (new QRadioButton()) + , _symbolicMode (new QRadioButton()) + , _realMode (new QRadioButton()) , _updateState (ExternalEmit) { setAttribute ( Qt::WA_QuitOnClose, false ); @@ -137,6 +139,27 @@ namespace Hurricane { group->addButton ( _steiner ); hLayout->addWidget ( _steiner ); + groupBox->setLayout ( hLayout ); + wLayout->addWidget ( groupBox ); + + groupBox = new QGroupBox ( tr("Layout Mode") ); + hLayout = new QHBoxLayout (); + group = new QButtonGroup (); + + hLayout->setContentsMargins ( 5, 0, 5, 0 ); + + _symbolicMode->setText ( tr("Symbolic (lambda)") ); + _symbolicMode->setFont ( Graphics::getNormalFont() ); + group->setId ( _symbolicMode, 0 ); + group->addButton ( _symbolicMode ); + hLayout->addWidget ( _symbolicMode ); + + _realMode->setText ( tr("Real (foundry grid)") ); + _realMode->setFont ( Graphics::getNormalFont() ); + group->setId ( _realMode, 0 ); + group->addButton ( _realMode ); + hLayout->addWidget ( _realMode ); + groupBox->setLayout ( hLayout ); wLayout->addWidget ( groupBox ); wLayout->addStretch (); @@ -148,6 +171,8 @@ namespace Hurricane { connect ( _steiner , SIGNAL(clicked()) , this, SLOT(setRubberSteiner()) ); connect ( _centric , SIGNAL(clicked()) , this, SLOT(setRubberCentric()) ); connect ( _barycentric , SIGNAL(clicked()) , this, SLOT(setRubberBarycentric()) ); + connect ( _symbolicMode, SIGNAL(clicked()) , this, SLOT(setSymbolicMode()) ); + connect ( _realMode , SIGNAL(clicked()) , this, SLOT(setRealMode()) ); } @@ -156,6 +181,8 @@ namespace Hurricane { if ( _cellWidget ) { disconnect ( this , SIGNAL(queryFilterChanged()), _cellWidget, SLOT(changeQueryFilter()) ); disconnect ( _cellWidget , SIGNAL(queryFilterChanged()), this , SLOT(changeQueryFilter()) ); + disconnect ( this , SIGNAL(layoutModeChanged ()), _cellWidget, SLOT(changeLayoutMode ()) ); + disconnect ( _cellWidget , SIGNAL(layoutModeChanged ()), this , SLOT(changeLayoutMode ()) ); } _cellWidget = cw; @@ -163,13 +190,39 @@ namespace Hurricane { connect ( this , SIGNAL(queryFilterChanged()), _cellWidget, SLOT(changeQueryFilter()) ); connect ( _cellWidget , SIGNAL(queryFilterChanged()), this , SLOT(changeQueryFilter()) ); + connect ( this , SIGNAL(layoutModeChanged ()), _cellWidget, SLOT(changeLayoutMode ()) ); + connect ( _cellWidget , SIGNAL(layoutModeChanged ()), this , SLOT(changeLayoutMode ()) ); _updateState = ExternalEmit; changeQueryFilter (); + changeLayoutMode (); } - void DisplayFilterWidget::changeQueryFilter() + void DisplayFilterWidget::changeLayoutMode () + { + if ( !_cellWidget ) return; + + if ( _updateState == InternalEmit ) { + _updateState = InternalReceive; + emit layoutModeChanged (); + } else { + if ( _updateState == ExternalEmit ) { + blockAllSignals ( true ); + + if ( _cellWidget->symbolicMode() ) + _symbolicMode->setChecked(true); + else + _realMode->setChecked(true); + + blockAllSignals ( false ); + } + _updateState = ExternalEmit; + } + } + + + void DisplayFilterWidget::changeQueryFilter () { if ( !_cellWidget ) return; @@ -192,6 +245,7 @@ namespace Hurricane { case CellWidget::Centric: _centric->setChecked(true); break; case CellWidget::Barycentric: _barycentric->setChecked(true); break; } + blockAllSignals ( false ); } _updateState = ExternalEmit; @@ -209,6 +263,8 @@ namespace Hurricane { _steiner ->blockSignals ( state ); _centric ->blockSignals ( state ); _barycentric ->blockSignals ( state ); + _symbolicMode ->blockSignals ( state ); + _realMode ->blockSignals ( state ); } @@ -315,4 +371,26 @@ namespace Hurricane { } + void DisplayFilterWidget::setSymbolicMode () + { + if ( _cellWidget ) { + if ( !_cellWidget->symbolicMode() ) { + _updateState = InternalEmit; + _cellWidget->setSymbolicMode (); + } + } + } + + + void DisplayFilterWidget::setRealMode () + { + if ( _cellWidget ) { + if ( !_cellWidget->realMode() ) { + _updateState = InternalEmit; + _cellWidget->setRealMode (); + } + } + } + + } diff --git a/hurricane/src/hviewer/DynamicLabel.cpp b/hurricane/src/hviewer/DynamicLabel.cpp index 24dc7e42..5d89a2f0 100644 --- a/hurricane/src/hviewer/DynamicLabel.cpp +++ b/hurricane/src/hviewer/DynamicLabel.cpp @@ -1,36 +1,9 @@ // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved // -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project is distributed in the hope that it will be -// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag // =================================================================== // // $Id$ diff --git a/hurricane/src/hviewer/MousePositionWidget.cpp b/hurricane/src/hviewer/MousePositionWidget.cpp index 1bfe31ae..d80f3ca4 100644 --- a/hurricane/src/hviewer/MousePositionWidget.cpp +++ b/hurricane/src/hviewer/MousePositionWidget.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved // // =================================================================== // diff --git a/hurricane/src/hviewer/SelectCommand.cpp b/hurricane/src/hviewer/SelectCommand.cpp index 06193ff4..a1777dad 100644 --- a/hurricane/src/hviewer/SelectCommand.cpp +++ b/hurricane/src/hviewer/SelectCommand.cpp @@ -23,15 +23,15 @@ // x-----------------------------------------------------------------x -# include -# include -# include +#include +#include +#include -# include "hurricane/Cell.h" +#include "hurricane/Cell.h" -# include "hurricane/viewer/CellWidget.h" -# include "hurricane/viewer/SelectCommand.h" -# include "hurricane/viewer/SelectionPopup.h" +#include "hurricane/viewer/CellWidget.h" +#include "hurricane/viewer/SelectCommand.h" +#include "hurricane/viewer/SelectionPopup.h" namespace Hurricane { diff --git a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h index 3aea6467..f3cc8109 100644 --- a/hurricane/src/hviewer/hurricane/viewer/CellWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/CellWidget.h @@ -131,6 +131,8 @@ namespace Hurricane { void detachFromPalette (); void bindCommand ( Command* ); void unbindCommand ( Command* ); + inline bool realMode () const; + inline bool symbolicMode () const; inline bool showBoundaries () const; inline bool showSelection () const; inline bool cumulativeSelection () const; @@ -148,6 +150,7 @@ namespace Hurricane { inline void copyToImage ( QImage* ); inline const float& getScale () const; inline const QPoint& getMousePosition () const; + inline void updateMousePosition (); void setLayerVisible ( const Name& layer, bool visible ); bool isDrawable ( const Name& ); bool isDrawableLayer ( const Name& ); @@ -191,6 +194,9 @@ namespace Hurricane { Box computeVisibleArea ( float scale ) const; Box computeVisibleArea ( float scale, const Point& topLeft ) const; Box computeVisibleArea ( const Box&, float& scale ) const; + inline bool _underDetailedGridThreshold() const; + inline DbU::Unit _snapGridStep () const; + inline DbU::Unit _onSnapGrid ( DbU::Unit ) const; // Qt QWidget Functions Overloads. void pushCursor ( Qt::CursorShape cursor ); void popCursor (); @@ -211,6 +217,7 @@ namespace Hurricane { void stateChanged ( shared_ptr& ); void styleChanged (); void queryFilterChanged (); + void layoutModeChanged (); void updatePalette ( Cell* ); void mousePositionChanged ( const Point& position ); void selectionModeChanged (); @@ -240,6 +247,7 @@ namespace Hurricane { void _unselectAll (); void changeQueryFilter (); void rubberChange (); + void changeLayoutMode (); void setStyle ( int id ); void updatePalette (); void cellPreModificate (); @@ -257,6 +265,8 @@ namespace Hurricane { void setScale ( float ); void scaleHistoryUp (); void scaleHistoryDown (); + void setRealMode (); + void setSymbolicMode (); void setShowBoundaries ( bool state ); void reframe (); void reframe ( const Box& box, bool historyEnable=true ); @@ -486,6 +496,8 @@ namespace Hurricane { inline State ( Cell* cell=NULL ); inline void setCell ( Cell* ); inline void setCellWidget ( CellWidget* ); + inline void setRealMode (); + inline void setSymbolicMode (); inline void setShowBoundaries ( bool ); inline void setShowSelection ( bool ); inline void setCumulativeSelection ( bool ); @@ -502,6 +514,8 @@ namespace Hurricane { inline Cell* getCell () const; const Name& getName () const; inline SelectorCriterions& getSelection (); + inline bool realMode () const; + inline bool symbolicMode () const; inline bool showBoundaries () const; inline bool showSelection () const; inline bool cumulativeSelection () const; @@ -527,6 +541,7 @@ namespace Hurricane { Cell* _cell; CellWidget* _cellWidget; SelectorCriterions _selection; + bool _symbolicMode; bool _showBoundaries; bool _showSelection; Query::Mask _queryFilter; @@ -796,6 +811,7 @@ namespace Hurricane { : _cell (cell) , _cellWidget (NULL) , _selection () + , _symbolicMode (true) , _showBoundaries (true) , _showSelection (false) , _queryFilter (~Query::DoTerminalCells) @@ -811,6 +827,10 @@ namespace Hurricane { } + inline bool CellWidget::State::symbolicMode () const + { return _symbolicMode; } + + inline void CellWidget::State::setCell ( Cell* cell ) { _cell = cell; } @@ -822,6 +842,14 @@ namespace Hurricane { } + inline void CellWidget::State::setRealMode () + { _symbolicMode = false; } + + + inline void CellWidget::State::setSymbolicMode () + { _symbolicMode = true; } + + inline void CellWidget::State::setShowBoundaries ( bool state ) { _showBoundaries = state; } @@ -1077,6 +1105,14 @@ namespace Hurricane { { return _palette; } + inline bool CellWidget::realMode () const + { return !_state->symbolicMode(); } + + + inline bool CellWidget::symbolicMode () const + { return _state->symbolicMode(); } + + inline bool CellWidget::showBoundaries () const { return _state->showBoundaries(); } @@ -1105,6 +1141,15 @@ namespace Hurricane { { return _mousePosition; } + inline void CellWidget::updateMousePosition () + { + Point mousePoint = screenToDbuPoint ( _mousePosition ); + emit mousePositionChanged ( Point ( _onSnapGrid(mousePoint.getX()) + , _onSnapGrid(mousePoint.getY()) + ) ); + } + + inline void CellWidget::setQueryFilter ( Query::Mask filter ) { _state->setQueryFilter ( filter ); @@ -1147,6 +1192,14 @@ namespace Hurricane { } + inline DbU::Unit CellWidget::_snapGridStep () const + { return symbolicMode() ? DbU::getSymbolicSnapGridStep() : DbU::getRealSnapGridStep(); } + + + inline DbU::Unit CellWidget::_onSnapGrid ( DbU::Unit u ) const + { return symbolicMode() ? DbU::getOnSymbolicSnapGrid(u) : DbU::getOnRealSnapGrid(u); } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hviewer/hurricane/viewer/DisplayFilterWidget.h b/hurricane/src/hviewer/hurricane/viewer/DisplayFilterWidget.h index 20d38138..9d93667b 100644 --- a/hurricane/src/hviewer/hurricane/viewer/DisplayFilterWidget.h +++ b/hurricane/src/hviewer/hurricane/viewer/DisplayFilterWidget.h @@ -47,8 +47,10 @@ namespace Hurricane { void setCellWidget ( CellWidget* ); signals: void queryFilterChanged (); + void layoutModeChanged (); public slots: void changeQueryFilter (); + void changeLayoutMode (); void startLevelChanged ( int level ); void stopLevelChanged ( int level ); void setDoMasterCells ( int state ); @@ -57,6 +59,8 @@ namespace Hurricane { void setRubberSteiner (); void setRubberCentric (); void setRubberBarycentric (); + void setSymbolicMode (); + void setRealMode (); protected: void blockAllSignals ( bool state ); @@ -70,6 +74,8 @@ namespace Hurricane { QRadioButton* _steiner; QRadioButton* _centric; QRadioButton* _barycentric; + QRadioButton* _symbolicMode; + QRadioButton* _realMode; UpdateState _updateState; };