8 #include <qwt_legend.h>
15 nieGUIDs( nieGUIDs ), ti_noise( ti_noise ), ri_noise( ri_noise )
17 setWindowTitle( ( db == (
US_DB2*) 0 ?
18 tr(
"Noise Vector Local Disk Load" ) :
19 tr(
"Noise Vector Database Load" ) ) );
27 QString hmsg = tr(
"You may select multiple noise records.\n\n" )
28 + tr(
"Click on a tree noise entry to add it\n" )
29 + tr(
" to the list below of selected noise records.\n" )
30 + tr(
"Click on a top-level entry to add all\n" )
31 + tr(
" of its children to the selected list.\n" )
32 + tr(
"Ctrl-click on multiple noise entries\n" )
33 + tr(
" to add them to the selected list.\n\n" )
34 + tr(
"Click the \"Load\" button to load selected noise\n" )
35 + tr(
" or the \"Cancel\" button to select no noise.\n" )
36 + tr(
"Click \"Details\" for noise entry details." );
39 lb_noises->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
41 QLabel* lb_selects =
us_banner(
"Selected Noise Vectors" );
42 lb_selects->setAlignment( Qt::AlignVCenter | Qt::AlignHCenter );
45 QFontMetrics fm( font );
46 int fontHeight = fm.lineSpacing();
49 tw_noises->setFrameStyle( QFrame::NoFrame );
52 tw_noises->setSelectionMode( QAbstractItemView::ExtendedSelection );
55 lw_selects->setMaximumHeight( fontHeight * 3 + 12 );
74 QTreeWidgetItem* twi_null = (QTreeWidgetItem*)0;
75 QString twtitle = QString(
"Models-in-Edit / Noises-in-Model" );
76 QString mititle = QString(
"Latest/Loaded Model" );
77 QList< QTreeWidgetItem* > items;
81 QTreeWidgetItem* twi_curr =
82 new QTreeWidgetItem( twi_null, QStringList( mititle ) );
83 items.append( twi_curr );
85 for (
int ii = 1; ii < mieGUIDs.size(); ii++ )
87 mititle = QString().sprintf(
"Model Sibling %4.4d", ii );
88 twi_curr =
new QTreeWidgetItem( twi_null, QStringList( mititle ) );
89 items.append( twi_curr );
94 for (
int ii = 0; ii < nieGUIDs.size(); ii++ )
96 QString nie = nieGUIDs.at( ii );
97 QString typ = nie.section(
":", 1, 1 );
98 QString mdx = nie.section(
":", 2, 2 );
99 nie = typ +
"_noise " + mdx;
100 int ndx = mdx.toInt();
102 twi_curr =
new QTreeWidgetItem( QStringList( nie ) );
103 items.at( ndx )->addChild( twi_curr );
106 if ( nieGUIDs.at( 0 ).section(
":", 2, 2 ).toInt() == 0 )
111 connect(
tw_noises, SIGNAL( itemSelectionChanged() ),
113 connect( pb_detail, SIGNAL( clicked() ),
115 connect( pb_cancel, SIGNAL( clicked() ),
117 connect( pb_load, SIGNAL( clicked() ),
125 double datmin = edata->
value( 0, 0 );
126 double datmax = datmin;
128 for (
int ii = 0; ii < nscans; ii++ )
130 for (
int jj = 0; jj < npoints; jj++ )
132 double datval = edata->
value( ii, jj );
133 datmin = qMin( datmin, datval );
134 datmax = qMax( datmax, datval );
147 QList< QTreeWidgetItem* > selitems =
tw_noises->selectedItems();
148 int nsels = selitems.size();
154 for (
int ii = 0; ii < nsels; ii++ )
156 QTreeWidgetItem* item = selitems[ ii ];
157 QString itemtext = item->text( 0 );
159 if ( itemtext.contains(
"_noise" ) )
164 else if ( itemtext.contains(
"Model" ) )
166 for (
int jj = 0; jj < item->childCount(); jj++ )
168 lw_selects->addItem( item->child( jj )->text( 0 ) );
201 for (
int ii = 0; ii <
lw_selects->count(); ii++ )
203 QString selntext =
lw_selects->item( ii )->text();
204 QString snumtext = selntext.section(
" ", 1, 1 );
205 QString styptext = selntext.left( 2 );
206 QString noisGUID =
"";
208 for (
int jj = 0; jj <
nieGUIDs.size(); jj++ )
211 QString typ = nie.section(
":", 1, 1 );
212 QString mdx = nie.section(
":", 2, 2 );
214 if ( typ == styptext && mdx == snumtext )
216 noisGUID = nie.section(
":", 0, 0 );
221 if ( styptext ==
"ti" )
228 t2_noise.
load( isDB, noisGUID,
db );
242 t2_noise.
load( isDB, noisGUID,
db );
258 double noimax = noimin;
263 noimin = qMin( noimin, noival );
264 noimax = qMax( noimax, noival );
267 if ( ( noimax - noimin ) >
darange ) nurnois++;
273 double noimax = noimin;
278 noimin = qMin( noimin, noival );
279 noimax = qMax( noimax, noival );
282 if ( ( noimax - noimin ) >
darange ) nurnois++;
288 "Noise values exceed the range of experimental data.<br/>"
289 "Do you still want to honor the current noise selection(s)?<br/>"
290 "<ul><li><b>Yes</b> to proceed, anyway, with selected noise;</li>"
291 "<li><b>No </b> to retry with a new noise selection></li></ul>" );
292 QMessageBox msgBox (
this );
293 msgBox.setWindowTitle ( tr(
"Noise Value Problems" ) );
294 msgBox.setTextFormat ( Qt::RichText );
295 msgBox.setText ( msg );
296 msgBox.addButton ( QMessageBox::No );
297 msgBox.addButton ( QMessageBox::Yes );
298 msgBox.setDefaultButton( QMessageBox::Yes );
300 if ( msgBox.exec() == QMessageBox::No )
320 mtxt = tr(
"All models derive from the common loaded Edit.\n"
321 "All noise vector records derive from the latest/loaded model\n"
322 " or from common-edit siblings of that model " )
323 + ( isDB ? tr(
"in the database.\n" ) : tr(
"on local disk.\n" ) )
324 + tr(
"Details for noise vector records follow.\n" );
326 for (
int ii = 0; ii <
nieGUIDs.size(); ii++ )
329 QString typ = nie.section(
":", 1, 1 );
330 QString mdx = nie.section(
":", 2, 2 );
331 QString noisGUID = nie.section(
":", 0, 0 );
335 typedesc = tr(
"Time-Invariant" );
338 typedesc = tr(
"Radially-Invariant" );
340 noise.
load( isDB, noisGUID,
db );
342 mtxt += tr(
"\nNoise record \"" ) + typ +
"_noise " + mdx +
"\"";
344 if ( mdx.toInt() == 0 )
345 mtxt += tr(
" (from Latest/Loaded Model):\n" );
348 mtxt += tr(
" (from Model Sibling):\n" );
350 mtxt += tr(
" Type: " ) + typedesc +
"\n";
351 mtxt += tr(
" Description: " ) + noise.
description +
"\n";
352 mtxt += tr(
" Noise GUID: " ) + noise.
noiseGUID +
"\n";
353 mtxt += tr(
" Model GUID: " ) + noise.
modelGUID +
"\n";
354 mtxt += tr(
" Values Count: " )
355 + QString::number( noise.
count ) +
"\n";
359 mtxt += tr(
" Minimum Radius: " )
360 + QString::number( noise.
minradius ) +
"\n";
361 mtxt += tr(
" Maximum Radius: " )
362 + QString::number( noise.
maxradius ) +
"\n";
369 detaild->setWindowTitle( tr(
"Noise Vector Details" ) );
370 detaild->move( this->pos() + QPoint( 200, 200 ) );
371 detaild->resize( 720, 560 );
373 detaild->
editor->
e->setText( mtxt );
375 qApp->processEvents();