#include <WindowingParameterWidget.h>
Public Slots | |
| void | updateAllFields () |
Signals | |
| void | autoWindows () |
| void | beginAddWindowsManually () |
| void | beginRemoveWindowsManually () |
| void | clearWindows () |
| void | endAddWindowsManually () |
| void | endRemoveWindowsManually () |
| void | inverseWindows () |
| void | loadWindows () |
| void | parametersChanged () |
Public Member Functions | |
| void | addComponent (QString name) |
| void | addStation (QString name) |
| void | clear () |
| void | createSelectMenu (QToolButton *select) |
| void | getParameters (WindowingParameters ¶m) const |
| bool | isAddWindowsManually () const |
| bool | isRemoveWindowsManually () const |
| void | removeFilterOption () |
| void | removeFreqDepOption () |
| void | setLength (WindowingParameters::LengthType t, double min, double max=0.0) |
| void | setParameters (const WindowingParameters ¶m) |
| WindowingParameterWidget (QWidget *parent=0, Qt::WFlags fl=0) | |
| GeopsyGui::WindowingParameterWidget::WindowingParameterWidget | ( | QWidget * | parent = 0, |
| Qt::WFlags | fl = 0 |
||
| ) |
References parametersChanged(), and TRACE.
: QWidget(parent, fl)
{
TRACE;
setupUi(this);
_nComponents=0;
// signals and slots connections
connect(badSampleThreshold, SIGNAL(valueChanged( const QString& )), this, SIGNAL(parametersChanged()) );
connect(badSampleTol, SIGNAL(valueChanged( const QString& )), this, SIGNAL(parametersChanged()) );
connect(overlapValue, SIGNAL(valueChanged( const QString& )), this, SIGNAL(parametersChanged()) );
connect(filtApplyList, SIGNAL(itemChanged( QListWidgetItem * )), this, SIGNAL(parametersChanged()) );
connect(filtStaLength, SIGNAL(valueChanged( const QString& )), this, SIGNAL(parametersChanged()) );
connect(filtLtaLength, SIGNAL(valueChanged( const QString& )), this, SIGNAL(parametersChanged()) );
connect(filtMinStaLta, SIGNAL(valueChanged( const QString& )), this, SIGNAL(parametersChanged()) );
connect(filtMaxStaLta, SIGNAL(valueChanged( const QString& )), this, SIGNAL(parametersChanged()) );
connect(rawApplyList, SIGNAL(itemChanged( QListWidgetItem * )), this, SIGNAL(parametersChanged()) );
connect(staLength, SIGNAL(valueChanged( const QString& )), this, SIGNAL(parametersChanged()) );
connect(ltaLength, SIGNAL(valueChanged( const QString& )), this, SIGNAL(parametersChanged()) );
connect(minStaLta, SIGNAL(valueChanged( const QString& )), this, SIGNAL(parametersChanged()) );
connect(maxStaLta, SIGNAL(valueChanged( const QString& )), this, SIGNAL(parametersChanged()) );
connect(windowLength, SIGNAL(valueChanged( const QString& )), this, SIGNAL(parametersChanged()) );
connect(windowMaxLength, SIGNAL(valueChanged( const QString& )), this, SIGNAL(parametersChanged()) );
connect(filterWidget, SIGNAL(parametersChanged()), this, SIGNAL(parametersChanged()) );
}
| void GeopsyGui::WindowingParameterWidget::addComponent | ( | QString | name | ) |
Add component selectors in apply list, this function cannot be called after addStation()
References TRACE.
Referenced by ToolArrayBase::initStations().
{
TRACE;
QListWidgetItem * item;
item=new QListWidgetItem(name);
item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
item->setCheckState(Qt::Checked);
rawApplyList->addItem(item);
if(isFiltered) {
item=new QListWidgetItem(name);
item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
item->setCheckState(Qt::Checked);
filtApplyList->addItem(item);
}
_nComponents++;
}
| void GeopsyGui::WindowingParameterWidget::addStation | ( | QString | name | ) |
Add component selectors in apply list, this function cannot be called before addComponent()
References TRACE.
Referenced by ToolArrayBase::initStations().
{
TRACE;
ASSERT(_nComponents>0);
QListWidgetItem * item;
if(_nComponents==rawApplyList->count()) {
item=new QListWidgetItem( "---" );
item->setFlags(0);
rawApplyList->addItem(item);
if(isFiltered) {
item=new QListWidgetItem( "---" );
item->setFlags(0);
filtApplyList->addItem(item);
}
}
item=new QListWidgetItem(name);
item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
item->setCheckState(Qt::Checked);
rawApplyList->addItem(item);
if(isFiltered) {
item=new QListWidgetItem(name);
item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
item->setCheckState(Qt::Checked);
filtApplyList->addItem(item);
}
}
| void GeopsyGui::WindowingParameterWidget::autoWindows | ( | ) | [signal] |
Referenced by createSelectMenu().
| void GeopsyGui::WindowingParameterWidget::beginAddWindowsManually | ( | ) | [signal] |
| void GeopsyGui::WindowingParameterWidget::beginRemoveWindowsManually | ( | ) | [signal] |
| void GeopsyGui::WindowingParameterWidget::clearWindows | ( | ) | [signal] |
Referenced by createSelectMenu().
| void GeopsyGui::WindowingParameterWidget::createSelectMenu | ( | QToolButton * | select | ) |
References autoWindows(), clearWindows(), inverseWindows(), loadWindows(), and QGpCoreTools::tr().
{
// Init the select windows menu
QAction * a;
QMenu * m=new QMenu(this);
m->setTitle(tr("Select windows"));
m->setTearOffEnabled (true);
connect(select, SIGNAL(clicked()), this, SIGNAL(autoWindows()));
select->setMenu(m);
a=new QAction(tr("Auto"), this);
a->setWhatsThis(tr("Select time windows automatically using all parameters."));
connect(a, SIGNAL(triggered()), this, SIGNAL(autoWindows()));
m->addAction(a);
_addWindowsAction=new QAction(tr("Add"), this);
_addWindowsAction->setCheckable(true);
_addWindowsAction->setWhatsThis(tr("If switched on, you can select windows with the mouse by clicking and dragging on the wanted signal. "
"Only the \"length\" and the \"overlap\" parameters are considered."));
connect(_addWindowsAction, SIGNAL(triggered()), this, SLOT(toggleAddWindows()));
m->addAction(_addWindowsAction);
_removeWindowsAction=new QAction(tr("Remove"), this);
_removeWindowsAction->setCheckable(true);
_removeWindowsAction->setWhatsThis(tr("If switched on you can remove windows with the mouse by clicking and dragging on the existing windows."));
connect(_removeWindowsAction, SIGNAL(triggered()), this, SLOT(toggleRemoveWindows()));
m->addAction(_removeWindowsAction);
a=new QAction(tr("Inverse"), this);
a->setWhatsThis(tr("Select time windows inside the time ranges not included in the current time window list. "
"Only the \"length\" and the \"overlap\" parameters are considered."));
connect(a, SIGNAL(triggered()), this, SIGNAL(inverseWindows()));
m->addAction(a);
a=new QAction(tr("Clear"), this);
a->setWhatsThis(tr("Remove windows"));
connect(a, SIGNAL(triggered()), this, SIGNAL(clearWindows()));
m->addAction(a);
a=new QAction(tr("Load"), this);
a->setWhatsThis(tr("Add time windows defined in a text file. The .log file of previous processings can be used. "
"You can build your own file using .log files as a template. Section \"### Time Windows ###\" is mandatory."));
connect(a, SIGNAL(triggered()), this, SIGNAL(loadWindows()));
m->addAction(a);
}
| void GeopsyGui::WindowingParameterWidget::endAddWindowsManually | ( | ) | [signal] |
| void GeopsyGui::WindowingParameterWidget::endRemoveWindowsManually | ( | ) | [signal] |
| void GeopsyGui::WindowingParameterWidget::getParameters | ( | WindowingParameters & | param | ) | const |
References GeopsyCore::WindowingParameters::ShortLongTermAverage::enabled, GeopsyCore::WindowingParameters::ShortLongTermAverage::longLength, GeopsyCore::WindowingParameters::ShortLongTermAverage::maximumThreshold, GeopsyCore::WindowingParameters::ShortLongTermAverage::minimumThreshold, GeopsyCore::WindowingParameters::setBadSampleThreshold(), GeopsyCore::WindowingParameters::setBadSampleTolerance(), GeopsyCore::WindowingParameters::setComponentCount(), GeopsyCore::WindowingParameters::setFilter(), GeopsyCore::WindowingParameters::setFilterComponent(), GeopsyCore::WindowingParameters::setFilterSignalAntiTrigger(), GeopsyCore::WindowingParameters::setFilterStation(), GeopsyCore::WindowingParameters::setLength(), GeopsyCore::WindowingParameters::setOverlap(), GeopsyCore::WindowingParameters::setPeriodCount(), GeopsyCore::WindowingParameters::setRawComponent(), GeopsyCore::WindowingParameters::setRawSignalAntiTrigger(), GeopsyCore::WindowingParameters::setRawStation(), GeopsyCore::WindowingParameters::setStationCount(), GeopsyCore::WindowingParameters::ShortLongTermAverage::shortLength, and TRACE.
{
TRACE;
switch(windowLengthType->currentIndex()) {
case 0:
param.setLength(windowLength->value());
break;
case 1:
param.setLength(windowLength->value(),
windowMaxLength->value());
break;
case 2:
param.setPeriodCount(windowMaxLength->value());
break;
}
if(isOverlap->isChecked()) {
param.setOverlap(overlapValue->value());
} else {
param.setOverlap(0.0);
}
if(isTolerance->isChecked()) {
param.setBadSampleTolerance(badSampleTol->value());
} else {
param.setBadSampleTolerance(0.0);
}
if(isBadSample->isChecked()) {
param.setBadSampleThreshold(badSampleThreshold->value());
} else {
param.setBadSampleThreshold(100.0);
}
int deltaComponents=_nComponents > 0 ? (_nComponents+1) : 0;
param.setComponentCount(_nComponents);
int nStations=rawApplyList->count()-deltaComponents;
param.setStationCount(nStations);
WindowingParameters::ShortLongTermAverage slta;
for(int i=0; i<_nComponents; i++) {
param.setRawComponent(i, rawApplyList->item(i) ->checkState()==Qt::Checked);
}
for(int i=0; i<nStations; i++) {
param.setRawStation(i, rawApplyList->item(i+deltaComponents)->checkState()==Qt::Checked);
}
slta.enabled=isRaw->isChecked();
slta.shortLength=staLength->value();
slta.longLength=ltaLength->value();
slta.minimumThreshold=minStaLta->value();
slta.maximumThreshold=maxStaLta->value();
param.setRawSignalAntiTrigger(slta);
if(isFiltered) {
ASSERT(filtApplyList->count()==nStations+deltaComponents);
for(int i=0; i<_nComponents; i++) {
param.setFilterComponent(i, filtApplyList->item(i) ->checkState()==Qt::Checked);
}
int n=filtApplyList->count()-deltaComponents;
for(int i=0; i<n; i++) {
param.setFilterStation(i, filtApplyList->item(i+deltaComponents)->checkState()==Qt::Checked);
}
slta.enabled=isFiltered->isChecked();
slta.shortLength=filtStaLength->value();
slta.longLength=filtLtaLength->value();
slta.minimumThreshold=filtMinStaLta->value();
slta.maximumThreshold=filtMaxStaLta->value();
param.setFilterSignalAntiTrigger(slta);
FilterParameters filterParam;
filterWidget->getParameters(filterParam);
param.setFilter(filterParam);
} else {
for(int i=0; i<_nComponents; i++) {
param.setFilterComponent(i, false);
}
for(int i=0; i<nStations; i++) {
param.setFilterStation(i, false);
}
slta.enabled=false;
param.setFilterSignalAntiTrigger(slta);
}
}
| void GeopsyGui::WindowingParameterWidget::inverseWindows | ( | ) | [signal] |
Referenced by createSelectMenu().
| bool GeopsyGui::WindowingParameterWidget::isAddWindowsManually | ( | ) | const [inline] |
{return _addWindowsAction->isChecked();}
| bool GeopsyGui::WindowingParameterWidget::isRemoveWindowsManually | ( | ) | const [inline] |
{return _removeWindowsAction->isChecked();}
| void GeopsyGui::WindowingParameterWidget::loadWindows | ( | ) | [signal] |
Referenced by createSelectMenu().
| void GeopsyGui::WindowingParameterWidget::parametersChanged | ( | ) | [signal] |
Referenced by WindowingParameterWidget().
| void GeopsyGui::WindowingParameterWidget::setLength | ( | WindowingParameters::LengthType | t, |
| double | min, | ||
| double | max = 0.0 |
||
| ) |
References TRACE.
{
TRACE;
if(max==0.0 && t==WindowingParameters::AtLeast) {
t=WindowingParameters::Exactly;
}
switch (t) {
case WindowingParameters::Exactly:
windowLengthType->setCurrentIndex(0);
windowLength->setValue(min);
break;
case WindowingParameters::AtLeast:
windowLengthType->setCurrentIndex(1);
windowLength->setValue(min);
windowLength->setValue(max);
break;
case WindowingParameters::FrequencyDependent:
windowLengthType->setCurrentIndex(2);
windowLength->setValue(min);
break;
}
}
| void GeopsyGui::WindowingParameterWidget::setParameters | ( | const WindowingParameters & | param | ) |
References GeopsyCore::WindowingParameters::badSampleThreshold(), GeopsyCore::WindowingParameters::badSampleThresholdType(), GeopsyCore::WindowingParameters::badSampleTolerance(), GeopsyCore::WindowingParameters::ShortLongTermAverage::enabled, GeopsyCore::WindowingParameters::filter(), GeopsyCore::WindowingParameters::filterComponent(), GeopsyCore::WindowingParameters::filterSignalAntiTrigger(), GeopsyCore::WindowingParameters::filterStation(), GeopsyCore::WindowingParameters::lengthType(), GeopsyCore::WindowingParameters::ShortLongTermAverage::longLength, GeopsyCore::WindowingParameters::maximumLength(), GeopsyCore::WindowingParameters::ShortLongTermAverage::maximumThreshold, GeopsyCore::WindowingParameters::minimumLength(), GeopsyCore::WindowingParameters::ShortLongTermAverage::minimumThreshold, GeopsyCore::WindowingParameters::overlap(), GeopsyCore::WindowingParameters::periodCount(), GeopsyCore::WindowingParameters::rawComponent(), GeopsyCore::WindowingParameters::rawSignalAntiTrigger(), GeopsyCore::WindowingParameters::rawStation(), GeopsyCore::WindowingParameters::ShortLongTermAverage::shortLength, and TRACE.
{
TRACE;
switch(param.lengthType()) {
case 0:
windowLengthType->setCurrentIndex(0);
windowLength->setValue(param.minimumLength(0.0));
break;
case 1:
windowLengthType->setCurrentIndex(1);
windowLength->setValue(param.minimumLength(0.0));
windowMaxLength->setValue(param.maximumLength(0.0));
break;
case 2:
windowLengthType->setCurrentIndex(2);
windowMaxLength->setValue(param.periodCount());
break;
}
isOverlap->setChecked(param.overlap()>0.0);
overlapValue->setValue(param.overlap());
isTolerance->setChecked(param.badSampleTolerance()>0.0);
badSampleTol->setValue(param.badSampleTolerance());
isBadSample->setChecked(param.badSampleThresholdType()!=WindowingParameters::NoSampleThreshold);
badSampleRelative->setCurrentIndex(param.badSampleThresholdType()==WindowingParameters::RelativeSampleThreshold ? 0 : 1);
badSampleThreshold->setValue(param.badSampleThreshold());
int deltaComponents=_nComponents > 0 ? (_nComponents+1) : 0;
int nStations=rawApplyList->count()-deltaComponents;
for(int i=0; i<_nComponents; i++) {
rawApplyList->item(i)->setCheckState(param.rawComponent(i) ? Qt::Checked : Qt::Unchecked);
}
for(int i=0; i<nStations; i++) {
rawApplyList->item(i+deltaComponents)->setCheckState(param.rawStation(i) ? Qt::Checked : Qt::Unchecked);
}
isRaw->setChecked(param.rawSignalAntiTrigger().enabled);
staLength->setValue(param.rawSignalAntiTrigger().shortLength);
ltaLength->setValue(param.rawSignalAntiTrigger().longLength);
minStaLta->setValue(param.rawSignalAntiTrigger().minimumThreshold);
maxStaLta->setValue(param.rawSignalAntiTrigger().maximumThreshold);
if(isFiltered) {
ASSERT(filtApplyList->count()==nStations+deltaComponents);
for(int i=0; i<_nComponents; i++) {
filtApplyList->item(i)->setCheckState(param.filterComponent(i) ? Qt::Checked : Qt::Unchecked);
}
int n=filtApplyList->count()-deltaComponents;
for(int i=0; i<n; i++) {
filtApplyList->item(i+deltaComponents)->setCheckState(param.filterStation(i) ? Qt::Checked : Qt::Unchecked);
}
isFiltered->setChecked(param.filterSignalAntiTrigger().enabled);
filtStaLength->setValue(param.filterSignalAntiTrigger().shortLength);
filtLtaLength->setValue(param.filterSignalAntiTrigger().longLength);
filtMinStaLta->setValue(param.filterSignalAntiTrigger().minimumThreshold);
filtMaxStaLta->setValue(param.filterSignalAntiTrigger().maximumThreshold);
filterWidget->setParameters(param.filter());
}
}
| void GeopsyGui::WindowingParameterWidget::updateAllFields | ( | ) | [slot] |