coriolis/tramontana/src/TabEquipotentials.cpp

162 lines
5.3 KiB
C++
Raw Normal View History

// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) Sorbonne Université 2007-2023, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | T r a m o n t a n a - Extractor & LVX |
// | |
// | Algorithm : Christian MASSON |
// | First impl. : Yifei WU |
// | Second impl. : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./TabEquipotentials.cpp" |
// +-----------------------------------------------------------------+
#include <QAction>
#include <QFrame>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QCheckBox>
#include <QComboBox>
#include "tramontana/TabEquipotentials.h"
namespace Tramontana {
using std::cerr;
using std::endl;
using Hurricane::Graphics;
// -------------------------------------------------------------------
// Class : "Tramontana::TabEquipotentials".
TabEquipotentials::TabEquipotentials ( QWidget* parent )
: ControllerTab (parent)
, _browser (new EquipotentialsWidget())
, _syncEquipotentials (new QCheckBox())
, _syncSelection (new QCheckBox())
, _showBuried (new QCheckBox())
, _cwCumulativeSelection(false)
{
_browser->setObjectName ( "controller.tabEquipotentials.browser" );
QVBoxLayout* wLayout = new QVBoxLayout ();
wLayout->setContentsMargins( 10, 0, 10, 0 );
wLayout->setSpacing( 0 );
_syncEquipotentials->setText ( tr("Sync Equipotentials") );
_syncEquipotentials->setChecked( false );
_syncEquipotentials->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) );
connect( _syncEquipotentials, SIGNAL(toggled(bool)), this, SLOT(setSyncEquipotentials(bool)) );
_syncSelection->setText ( tr("Sync Selection") );
_syncSelection->setChecked( false );
_syncSelection->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) );
connect( _syncSelection, SIGNAL(toggled(bool)), this, SLOT(setSyncSelection(bool)) );
_showBuried->setText ( tr("Show Buried") );
_showBuried->setChecked( false );
_showBuried->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) );
connect( _showBuried, SIGNAL(toggled(bool)), this, SLOT(setShowBuried(bool)) );
QHBoxLayout* commands = new QHBoxLayout ();
commands->setContentsMargins( 0, 0, 0, 0 );
commands->addStretch();
commands->addWidget ( _syncEquipotentials );
commands->addStretch();
commands->addWidget ( _showBuried );
commands->addStretch();
commands->addWidget ( _syncSelection );
commands->addStretch();
wLayout->addLayout ( commands );
QFrame* separator = new QFrame ();
separator->setFrameShape ( QFrame::HLine );
separator->setFrameShadow( QFrame::Sunken );
wLayout->addWidget( separator );
wLayout->addWidget( _browser );
setLayout( wLayout );
}
void TabEquipotentials::setSyncEquipotentials ( bool state )
{
if (state and getCellWidget()) {
_browser->setCell( getCellWidget()->getCell() );
} else {
_browser->setCell( nullptr );
}
}
void TabEquipotentials::setSyncSelection ( bool state )
{
if (state and getCellWidget() and _syncEquipotentials->isChecked()) {
_cwCumulativeSelection = getCellWidget()->cumulativeSelection();
if (not _cwCumulativeSelection) {
getCellWidget()->openRefreshSession ();
getCellWidget()->unselectAll ();
getCellWidget()->closeRefreshSession ();
}
getCellWidget()->setShowSelection( true );
Full transhierarchical implementation done. * New: Equipotential elements includes now: 1. Components at the top level (the cell owning the Equi). 2. Nets at the top level. If an equi include all the components of a Net, own the Net, not all it's individual components. 3. Other equipotentials from the Instances immediatey below. Thoses equis should be equivalents to the Plug of the Net. They are stored in the form of Occurrences <Instance,Equi>, the relation is stored on that Occurrence. * New: Equipotential::getFlatComponents(), a collection to recursively get all the *component* occurrences of the equi. Transhierarchically. Go through components, nets components, and recursively through the child equis. * New: EquipotentialRelation, the master of this relation is the Equipotential and the slaves, all its elements. * Change: In Tile, in case the tile is build on a deep component, we trace up the Equipotential it belongs to in the Instance level immediately belonging to the Cell under extraction. They must exists as we extract from bottom to top all the master cells. So we have, for that tile an Occurrence <Instance,Equi> that we can store in the current Equi level. * Change/Bug: In Tile, add an Id to be reliably sort the tiles in the IntervalTree. As we replaced the tile component occurrence by a <Instance,Equi> we were having multiple tiles with the same equi. This was causing havoc again in the IntervalTree. Should add a check in the RbTree for elements with the exact same key, but that would imply passing a new template parameter for the "equal" function.
2023-04-13 07:00:50 -05:00
connect( _browser, SIGNAL(equipotentialSelect (Occurrences)), getCellWidget(), SLOT(select (Occurrences)) );
connect( _browser, SIGNAL(equipotentialUnselect(Occurrences)), getCellWidget(), SLOT(unselect(Occurrences)) );
_browser->updateSelecteds();
} else {
getCellWidget()->setShowSelection( false );
getCellWidget()->setCumulativeSelection( _cwCumulativeSelection );
Full transhierarchical implementation done. * New: Equipotential elements includes now: 1. Components at the top level (the cell owning the Equi). 2. Nets at the top level. If an equi include all the components of a Net, own the Net, not all it's individual components. 3. Other equipotentials from the Instances immediatey below. Thoses equis should be equivalents to the Plug of the Net. They are stored in the form of Occurrences <Instance,Equi>, the relation is stored on that Occurrence. * New: Equipotential::getFlatComponents(), a collection to recursively get all the *component* occurrences of the equi. Transhierarchically. Go through components, nets components, and recursively through the child equis. * New: EquipotentialRelation, the master of this relation is the Equipotential and the slaves, all its elements. * Change: In Tile, in case the tile is build on a deep component, we trace up the Equipotential it belongs to in the Instance level immediately belonging to the Cell under extraction. They must exists as we extract from bottom to top all the master cells. So we have, for that tile an Occurrence <Instance,Equi> that we can store in the current Equi level. * Change/Bug: In Tile, add an Id to be reliably sort the tiles in the IntervalTree. As we replaced the tile component occurrence by a <Instance,Equi> we were having multiple tiles with the same equi. This was causing havoc again in the IntervalTree. Should add a check in the RbTree for elements with the exact same key, but that would imply passing a new template parameter for the "equal" function.
2023-04-13 07:00:50 -05:00
_browser->disconnect( getCellWidget(), SLOT(select (Occurrences)) );
_browser->disconnect( getCellWidget(), SLOT(unselect(Occurrences)) );
}
}
void TabEquipotentials::setShowBuried ( bool state )
{
if (not getCellWidget()) return;
_browser->setShowBuried( state );
}
void TabEquipotentials::setCell ( Cell* cell )
{
setSyncEquipotentials( _syncEquipotentials->isChecked() );
}
void TabEquipotentials::setCellWidget ( CellWidget* cellWidget )
{
if (getCellWidget() != cellWidget) {
ControllerTab::setCellWidget( cellWidget );
_browser->setCellWidget( cellWidget );
if (getCellWidget()) {
connect( getCellWidget(), SIGNAL(cellChanged(Cell*)), this, SLOT(setCell(Cell*)) );
}
setSyncEquipotentials( _syncEquipotentials->isChecked() );
}
}
void TabEquipotentials::cellPreModificate ()
{
_browser->setCell( nullptr );
}
void TabEquipotentials::cellPostModificate ()
{
setSyncEquipotentials( _syncEquipotentials->isChecked() );
}
}