24 #include <qpushbutton.h>
33 #include <QGridLayout>
35 #include <QCloseEvent>
36 #include <QTreeWidget>
40 #define TR(id) OLocalizator::getString("TYResultatTreeDialog", (id))
43 : QDialog(parent, f), _pPtCalcul(NULL)
46 setWindowTitle(
TR(
"id_caption"));
49 QGridLayout* pLayout =
new QGridLayout();
53 QStringList stringList;
54 stringList.append(
TR(
"id_column_element_type"));
55 stringList.append(
TR(
"id_column_element_name"));
56 stringList.append(
TR(
"id_column_puissance_dba"));
57 stringList.append(
TR(
"id_column_puissance_dblin"));
60 _pListView->setSelectionMode(QTreeWidget::NoSelection);
67 QObject::connect(
_pCloseButton, &QPushButton::clicked,
this, &TYResultatTreeDialog::close);
92 QMap<TYElement*, childTreeItem*> mapElementChilds;
100 for (
int i = 0; i < nbSources; i++)
115 if (pSrc->
isA(
"TYUserSourcePonctuelle"))
121 mapElementChilds.insert(pSrc, pChildItem);
127 if (mapElementChilds.contains(pParent))
130 mapElementChilds[pParent]->spectre = mapElementChilds[pParent]->spectre.sumdB(spectre.
toDB());
132 mapElementChilds[pParent]->pChildsList[pChild] = pChild;
140 mapElementChilds.insert(pParent, pChildItem);
150 QMap<TYElement*, QTreeWidgetItem*> mapParentItem;
151 QStringList stringList;
154 QTreeWidgetItem* pRootItem =
new QTreeWidgetItem(
_pListView, stringList);
156 QTreeWidgetItem* pCurItem = NULL;
157 QMap<TYElement*, childTreeItem*>::iterator it;
159 for (it = mapElementChilds.begin(); it != mapElementChilds.end(); it++)
162 pCurItem = pRootItem;
164 if (pParent->
isA(
"TYUserSourcePonctuelle"))
167 OSpectre spectre = it.value()->spectre;
168 QStringList stringList;
170 stringList.append(pParent->
getName());
171 pCurItem =
new QTreeWidgetItem(pCurItem, stringList);
172 pCurItem->setText(2, QString().setNum(spectre.
valGlobDBA(),
'f', 2));
173 pCurItem->setText(3, QString().setNum(spectre.
valGlobDBLin(),
'f', 2));
176 mapParentItem.insert(pParent, pCurItem);
181 OSpectre spectre = it.value()->spectre;
182 QStringList stringList;
184 stringList.append(pParent->
getName());
185 pCurItem =
new QTreeWidgetItem(pCurItem, stringList);
186 pCurItem->setText(2, QString().setNum(spectre.
valGlobDBA(),
'f', 2));
187 pCurItem->setText(3, QString().setNum(spectre.
valGlobDBLin(),
'f', 2));
190 mapParentItem.insert(pParent, pCurItem);
194 QMap<TYElement*, childTreeItem*>::iterator it2 = mapElementChilds.find(pParent);
195 followChilds(mapElementChilds, it2, mapParentItem, pCurItem);
198 pCurItem = pRootItem;
202 QMap<TYElement*, childTreeItem*>::iterator itdel;
204 for (itdel = mapElementChilds.begin(); itdel != mapElementChilds.end(); itdel++)
206 delete itdel.value();
207 itdel.value() = NULL;
212 QMap<TYElement*, childTreeItem*>::iterator it,
213 QMap<TYElement*, QTreeWidgetItem*>& mapParentItem,
214 QTreeWidgetItem* pCurItem)
223 OSpectre spectre = it.value()->spectre;
224 QStringList stringList;
226 stringList.append(pParent->
getName());
227 pCurItem =
new QTreeWidgetItem(pCurItem, stringList);
228 pCurItem->setText(2, QString().setNum(spectre.
valGlobDBA(),
'f', 2));
229 pCurItem->setText(3, QString().setNum(spectre.
valGlobDBLin(),
'f', 2));
232 std::map<TYElement*, TYElement*>::iterator itmap;
234 for (itmap = it.value()->pChildsList.begin(); itmap != it.value()->pChildsList.end(); itmap++)
236 QMap<TYElement*, childTreeItem*>::iterator it2 = mapElementChilds.find((*itmap).first);
238 followChilds(mapElementChilds, it2, mapParentItem, pCurItem);
316 TYPreferenceManager::loadGeometryFromPreferences(metaObject()->className(),
this);
322 TYPreferenceManager::saveGeometryToPreferences(metaObject()->className(),
this);
324 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