24 #include <qpushbutton.h>
33 #include <QGridLayout>
35 #include <QCloseEvent>
36 #include <QTreeWidget>
41 #define TR(id) OLocalizator::getString("TYResultatTreeDialog", (id))
44 : QDialog(parent, f), _pPtCalcul(NULL)
47 setWindowTitle(
TR(
"id_caption"));
50 QGridLayout* pLayout =
new QGridLayout();
54 QStringList stringList;
55 stringList.append(
TR(
"id_column_element_type"));
56 stringList.append(
TR(
"id_column_element_name"));
57 stringList.append(
TR(
"id_column_puissance_dba"));
58 stringList.append(
TR(
"id_column_puissance_dblin"));
61 _pListView->setSelectionMode(QTreeWidget::NoSelection);
68 QObject::connect(
_pCloseButton, &QPushButton::clicked,
this, &TYResultatTreeDialog::close);
93 QMap<TYElement*, childTreeItem*> mapElementChilds;
101 for (
int i = 0; i < nbSources; i++)
116 if (pSrc->
isA(
"TYUserSourcePonctuelle"))
122 mapElementChilds.insert(pSrc, pChildItem);
128 if (mapElementChilds.contains(pParent))
131 mapElementChilds[pParent]->spectre = mapElementChilds[pParent]->spectre.sumdB(spectre.
toDB());
133 mapElementChilds[pParent]->pChildsList[pChild] = pChild;
141 mapElementChilds.insert(pParent, pChildItem);
151 QMap<TYElement*, QTreeWidgetItem*> mapParentItem;
152 QStringList stringList;
155 QTreeWidgetItem* pRootItem =
new QTreeWidgetItem(
_pListView, stringList);
157 QTreeWidgetItem* pCurItem = NULL;
158 QMap<TYElement*, childTreeItem*>::iterator it;
160 for (it = mapElementChilds.begin(); it != mapElementChilds.end(); it++)
163 pCurItem = pRootItem;
165 if (pParent->
isA(
"TYUserSourcePonctuelle"))
168 OSpectre spectre = it.value()->spectre;
169 QStringList stringList;
171 stringList.append(pParent->
getName());
172 pCurItem =
new QTreeWidgetItem(pCurItem, stringList);
173 pCurItem->setText(2, QString().setNum(spectre.
valGlobDBA(),
'f', 2));
174 pCurItem->setText(3, QString().setNum(spectre.
valGlobDBLin(),
'f', 2));
177 mapParentItem.insert(pParent, pCurItem);
182 OSpectre spectre = it.value()->spectre;
183 QStringList stringList;
185 stringList.append(pParent->
getName());
186 pCurItem =
new QTreeWidgetItem(pCurItem, stringList);
187 pCurItem->setText(2, QString().setNum(spectre.
valGlobDBA(),
'f', 2));
188 pCurItem->setText(3, QString().setNum(spectre.
valGlobDBLin(),
'f', 2));
191 mapParentItem.insert(pParent, pCurItem);
195 QMap<TYElement*, childTreeItem*>::iterator it2 = mapElementChilds.find(pParent);
196 followChilds(mapElementChilds, it2, mapParentItem, pCurItem);
199 pCurItem = pRootItem;
203 QMap<TYElement*, childTreeItem*>::iterator itdel;
205 for (itdel = mapElementChilds.begin(); itdel != mapElementChilds.end(); itdel++)
207 delete itdel.value();
208 itdel.value() = NULL;
213 QMap<TYElement*, childTreeItem*>::iterator it,
214 QMap<TYElement*, QTreeWidgetItem*>& mapParentItem,
215 QTreeWidgetItem* pCurItem)
224 OSpectre spectre = it.value()->spectre;
225 QStringList stringList;
227 stringList.append(pParent->
getName());
228 pCurItem =
new QTreeWidgetItem(pCurItem, stringList);
229 pCurItem->setText(2, QString().setNum(spectre.
valGlobDBA(),
'f', 2));
230 pCurItem->setText(3, QString().setNum(spectre.
valGlobDBLin(),
'f', 2));
233 std::map<TYElement*, TYElement*>::iterator itmap;
235 for (itmap = it.value()->pChildsList.begin(); itmap != it.value()->pChildsList.end(); itmap++)
237 QMap<TYElement*, childTreeItem*>::iterator it2 = mapElementChilds.find((*itmap).first);
239 followChilds(mapElementChilds, it2, mapParentItem, pCurItem);
317 TYPreferenceManager::loadGeometryFromPreferences(metaObject()->className(),
this);
323 TYPreferenceManager::saveGeometryToPreferences(metaObject()->className(),
this);
325 QDialog::closeEvent(pEvent);
Boite de dialogue pour la representation par une arborescence des elements contribuant au resultat d'...
bool isA(const char *className) const
double valGlobDBA() const
Compute the global value dB[A] of a one-third Octave spectrum.
double valGlobDBLin() const
Compute the global value dB[Lin] of a one-third Octave spectrum.
OSpectreAbstract & toDB() const
Converts to dB.
TYElement * getParent() const
virtual QString getName() const
QTreeWidget * _pListView
La liste pour la representation de l'arborescence.
LPTYResultat _pResultat
Le resultat associe.
TYResultatTreeDialog(QWidget *parent=0, const char *name=0, Qt::WindowFlags f=QFlag(0))
void set(LPTYResultat pResultat, LPTYPointCalcul pPtCalcul)
virtual ~TYResultatTreeDialog()
void followChilds(QMap< TYElement *, childTreeItem * > &mapElementChilds, QMap< TYElement *, childTreeItem * >::iterator it, QMap< TYElement *, QTreeWidgetItem * > &mapParentItem, QTreeWidgetItem *pCurItem)
QPushButton * _pCloseButton
Bouton pour fermer la boite de dialogue.
virtual void closeEvent(QCloseEvent *pEvent)
LPTYPointCalcul _pPtCalcul
Le point de calcul associe.
virtual void showEvent(QShowEvent *pEvent)
int getIndexRecepteur(TYPointCalcul *pRecepteur)
Retourne l'index d'un recepteur.
size_t getInitialNbOfSources() const
Retourne le nombre de sources initialement utilisees par le calcul.
LPTYElement getElementSource(const int &indexSource)
Retourne la source elementaire correspondant a l'indice passe.
const OSpectre & getElementSpectre(int indexRecepteur, int indexSource) const
Retourne le spectre de la matrice brute (avant condensation)pour un couple S-R (S = Source elementair...
std::map< TYElement *, TYElement * > pChildsList