#include <FKTimeWindows.h>
Public Member Functions | |
| FKTimeWindows (QWidget *parent=0) | |
| virtual void | setArray (const ArrayStations &array) |
| void | setGrid (FKParameters *param) |
| bool | setParameters (double frequency, FKParameters *param, bool doNSampleWarning=true) |
| void | setTimeWindowLayer (TimeWindowLayer *twLayer) |
| TimeWindowList * | timeWindowList () const |
| ~FKTimeWindows () | |
Protected Slots | |
| void | currentVelocitySlowness (QPoint mousePos) |
| void | on_component_currentIndexChanged (int index) |
| void | on_direction_valueChanged (double value) |
| void | on_kEdit_valueChanged (const QString &) |
| void | on_vEdit_valueChanged (const QString &) |
| virtual void | setComponent () |
| virtual void | setCurrentWindow () |
Protected Attributes | |
| int | _currentWindow |
| CircleViewer * | _fkCircleLayer |
| FKMeshLayer * | _fkMeshLayer |
| LiveGridLayer * | _gridLayer |
| FKArrayProcess * | _process |
| TimeWindowLayer * | _timeWindowLayer |
| FKTimeWindows::FKTimeWindows | ( | QWidget * | parent = 0 | ) |
References _currentWindow, _fkCircleLayer, _fkMeshLayer, _gridLayer, _process, _timeWindowLayer, currentVelocitySlowness(), SciFigs::GraphContentLayer::graphContent(), SciFigs::CircleViewer::resize(), setComponent(), setCurrentWindow(), SciFigs::GraphContent::setGridLines(), SciFigs::LiveGridLayer::setSampling(), and TRACE.
: QWidget(parent)
{
TRACE;
setupUi(this);
_currentWindow=-1;
_timeWindowLayer=0;
/*
setup graph properties
*/
waveNumGrid->graphContent()->setGridLines(false);
_gridLayer=new LiveGridLayer(waveNumGrid);
_gridLayer->setSampling(3);
_fkMeshLayer=new FKMeshLayer (waveNumGrid);
_fkMeshLayer->setObjectName( "fkMesh" );
_fkCircleLayer=new CircleViewer(waveNumGrid);
_fkCircleLayer->setObjectName( "userSlowness" );
_fkCircleLayer->resize(1);
connect(waveNumGrid->graphContent(), SIGNAL(mouseMoved( QPoint, Qt::MouseButtons, Qt::KeyboardModifiers) ),
this, SLOT(currentVelocitySlowness( QPoint) ));
/*
Set axis
*/
waveNumGrid->xAxis()->setTitle( "Wave number X (rad/m)" );
waveNumGrid->xAxis()->setTitleInversedScale( "Wave length X/(2*pi) (m/rad)" );
waveNumGrid->xAxis()->setSizeType(Axis::Scaled);
waveNumGrid->yAxis()->setTitle( "Wave number Y (rad/m)" );
waveNumGrid->yAxis()->setTitleInversedScale( "Wave length Y/(2*pi) (m/rad)" );
waveNumGrid->yAxis()->setSizeType(Axis::Scaled);
connect(component, SIGNAL(activated(int)), this, SLOT(setComponent()) );
connect(winScroll, SIGNAL(valueChanged(int)), this, SLOT(setCurrentWindow()) );
_process=0;
}
| void FKTimeWindows::currentVelocitySlowness | ( | QPoint | mousePos | ) | [protected, slot] |
References _process, QGpCoreTools::Point2D::azimuthTo(), ArrayCore::FrequencyBand::center(), QGpCoreTools::Point2D::distanceTo(), ArrayCore::ArrayProcess::frequency(), QGpCoreTools::tr(), and TRACE.
Referenced by FKTimeWindows().
{
TRACE;
Point2D p=waveNumGrid->graphContent()->options().s2r(mousePos);
Point2D origin(0, 0);
double kr=p.distanceTo(origin);
double az=Angle::mathToGeographic(origin.azimuthTo(p));
double sr=kr/(2.0*M_PI*_process->frequency().center());
velSlowLabel->setText(tr( "Propagation towards %1 counted from North\nat k=%2 rad/m, v=%3 m/s or s=%4 s/km" ).
arg(az, 0, 'f', 4).arg(kr, 0, 'g', 3).
arg(1.0/sr, 0, 'f', 0).arg(sr*1000.0, 0, 'g', 5) );;
}
| void FKTimeWindows::on_component_currentIndexChanged | ( | int | index | ) | [protected, slot] |
References setComponent(), and QGpCoreTools::tr().
{
if(component->currentText()==tr("Horizontal")) {
direction->setEnabled(true);
} else {
direction->setEnabled(false);
}
setComponent();
}
| void FKTimeWindows::on_direction_valueChanged | ( | double | value | ) | [protected, slot] |
References setComponent().
{
setComponent();
}
| void FKTimeWindows::on_kEdit_valueChanged | ( | const QString & | ) | [protected, slot] |
References _fkCircleLayer, _process, ArrayCore::FrequencyBand::center(), SciFigs::GraphContentLayer::deepUpdate(), ArrayCore::ArrayProcess::frequency(), SciFigs::CircleViewer::set(), and TRACE.
{
TRACE;
double val=kEdit->value();
vEdit->blockSignals(true);
vEdit->setValue(2 * M_PI * _process->frequency().center()/val);
vEdit->blockSignals(false);
_fkCircleLayer->set(0, 0, 0, val, val, 0.0, Qt::black);
_fkCircleLayer->deepUpdate();
}
| void FKTimeWindows::on_vEdit_valueChanged | ( | const QString & | ) | [protected, slot] |
References _fkCircleLayer, _process, ArrayCore::FrequencyBand::center(), SciFigs::GraphContentLayer::deepUpdate(), ArrayCore::ArrayProcess::frequency(), SciFigs::CircleViewer::set(), and TRACE.
Referenced by setParameters().
{
TRACE;
double val=vEdit->value();
kEdit->blockSignals(true);
kEdit->setValue(2 * M_PI * _process->frequency().center()/val);
kEdit->blockSignals(false);
double r=2 * M_PI * _process->frequency().center()/val;
_fkCircleLayer->set(0, 0, 0, r, r, 0.0, Qt::black);
_fkCircleLayer->deepUpdate();
}
| void FKTimeWindows::setArray | ( | const ArrayStations & | array | ) | [virtual] |
Reimplemented in HRFKTimeWindows.
References _process, GeopsyCore::StationList::components(), ArrayCore::ArrayProcess::setTimeRangeList(), and QGpCoreTools::tr().
{
// Check whether we are multi component
StationSignals::Components c=array.components();
if(c & StationSignals::VerticalComponent) {
component->addItem(tr("Vertical"));
}
if(c & StationSignals::HorizontalComponent) {
component->addItem(tr("Horizontal"));
component->addItem(tr("Radial"));
component->addItem(tr("Transverse"));
}
_process=new FKArrayProcess(array);
_process->setTimeRangeList(new TimeWindowList);
}
| void FKTimeWindows::setComponent | ( | ) | [protected, virtual, slot] |
Reimplemented in HRFKTimeWindows.
References _currentWindow, _gridLayer, _process, GeopsyCore::TimeRangeList::at(), ArrayCore::ArrayProcess::frequency(), ArrayCore::FKArrayProcess::function(), GeopsyCore::TimeRange::lengthSeconds(), ArrayCore::FK::setFrequencyBand(), SciFigs::LiveGridLayer::setFunction(), ArrayCore::ArrayProcess::setHorizontalDirection(), ArrayCore::FK::setMaximumSlowness(), ArrayCore::FK::setMaximumWavenumber(), ArrayCore::ArrayProcess::timeRangeList(), QGpCoreTools::tr(), and TRACE.
Referenced by FKTimeWindows(), on_component_currentIndexChanged(), on_direction_valueChanged(), and setParameters().
{
TRACE;
// Before changing anything to parameters, disable the grid plot
_gridLayer->setFunction(0);
if(_currentWindow<0) {
return;
}
_process->setHorizontalDirection(direction->value());
FK * fk;
if(component->currentText()==tr("Radial")) {
fk=_process->function(1);
} else if(component->currentText()==tr("Transverse")) {
fk=_process->function(2);
} else if(component->currentText()==tr("Horizontal")) {
fk=_process->function(3);
} else {
fk=_process->function(0);
}
fk->setMaximumWavenumber(1e99); // No limit for plot
fk->setMaximumSlowness(1e99);
double winLength=_process->timeRangeList()->at(_currentWindow).lengthSeconds();
fk->setFrequencyBand(_process->frequency(), winLength);
_gridLayer->setFunction(fk);
waveNumGrid->deepUpdate();
}
| void FKTimeWindows::setCurrentWindow | ( | ) | [protected, virtual, slot] |
Reimplemented in HRFKTimeWindows.
References _currentWindow, _gridLayer, _process, _timeWindowLayer, GeopsyGui::TimeWindowList::at(), GeopsyCore::TimeRangeList::count(), SciFigs::GraphContentLayer::deepUpdate(), QGpCoreTools::endl(), GeopsyCore::TimeRangeList::isEmpty(), ArrayCore::ArrayProcess::lockTimeWindow(), GeopsyGui::TimeWindowList::resetColors(), GeopsyGui::TimeWindow::setColor(), SciFigs::LiveGridLayer::setFunction(), SciFigs::LiveGridLayer::takeFunction(), ArrayCore::ArrayProcess::timeRangeList(), QGpCoreTools::tr(), and SciFigs::LayerLocker::unlock().
Referenced by FKTimeWindows(), and setParameters().
{
// Before changing anything to parameters, disable the grid plot
AbstractFunction2 * func=_gridLayer->takeFunction();
/*
Make sure _currentWin is valid and uncolor previous time window
Set color for the new current time window
*/
LayerLocker ll(_timeWindowLayer);
TimeWindowList& winList=*static_cast<TimeWindowList *>(_process->timeRangeList());
if(winList.isEmpty()) {
_currentWindow=-1;
return ;
}
winList.resetColors();
_currentWindow=winScroll->value();
if(_currentWindow < 0 || _currentWindow >= winList.count()) {
_currentWindow=0;
}
winList.at(_currentWindow).setColor(QColor(255, 166, 166));
ll.unlock();
if( !_process->lockTimeWindow(&winList.at(_currentWindow)) ) {
App::stream() << tr("cannot allocate all signals, increase buffer size\n") << endl;
return;
}
_gridLayer->setFunction(func);
waveNumGrid->deepUpdate();
if(_timeWindowLayer) _timeWindowLayer->deepUpdate();
}
| void FKTimeWindows::setGrid | ( | FKParameters * | param | ) |
References _fkMeshLayer, _process, ArrayCore::FrequencyBand::center(), SciFigs::GraphContentLayer::deepUpdate(), ArrayCore::ArrayProcess::frequency(), SciFigs::GraphContentLayer::lockDelayPainting(), ArrayCore::FKParameters::maximumSlowness(), ArrayCore::FKParameters::maximumWaveNumber(), ArrayCore::FKParameters::minimumWaveNumber(), FKMeshLayer::setKmax(), FKMeshLayer::setKmin(), and SciFigs::GraphContentLayer::unlock().
Referenced by setParameters().
{
double kmax=2.0*M_PI*_process->frequency().center()*param->maximumSlowness();
if(param->maximumWaveNumber()<kmax) {
kmax=param->maximumWaveNumber();
}
_fkMeshLayer->lockDelayPainting();
_fkMeshLayer->setKmax(kmax);
_fkMeshLayer->setKmin(param->minimumWaveNumber());
_fkMeshLayer->unlock();
_fkMeshLayer->deepUpdate();
}
| bool FKTimeWindows::setParameters | ( | double | frequency, |
| FKParameters * | param, | ||
| bool | doNSampleWarning = true |
||
| ) |
References _gridLayer, _process, _timeWindowLayer, SciFigs::GraphContentLayer::deepUpdate(), ArrayCore::FKParameters::maximumWaveNumber(), on_vEdit_valueChanged(), setComponent(), setCurrentWindow(), ArrayCore::ArrayProcess::setFrequency(), SciFigs::LiveGridLayer::setFunction(), setGrid(), ArrayCore::FKArrayProcess::setParameters(), timeWindowList(), TRACE, and SciFigs::LayerLocker::unlock().
{
TRACE;
// Before changing anything to parameters, disable the grid plot (setComponent will reset it
_gridLayer->setFunction(0);
if(!_process->setParameters(param, doNSampleWarning)) {
return false;
}
LayerLocker ll(_timeWindowLayer);
if(!_process->setFrequency(frequency)) {
return false;
}
ll.unlock();
winScroll->setMaximum(timeWindowList()->count() - 1);
setCurrentWindow();
setGrid(param);
waveNumGrid->setMapScale(-param->maximumWaveNumber(), -param->maximumWaveNumber(),
param->maximumWaveNumber(), param->maximumWaveNumber());
setComponent();
on_vEdit_valueChanged( "" );
if(_timeWindowLayer) _timeWindowLayer->deepUpdate();
return true;
}
| void FKTimeWindows::setTimeWindowLayer | ( | TimeWindowLayer * | twLayer | ) |
References _timeWindowLayer, and GeopsyGui::TimeWindowLayer::setShowColors().
{
if(twLayer) {
twLayer->setShowColors(true);
_timeWindowLayer=twLayer;
}
}
| TimeWindowList* FKTimeWindows::timeWindowList | ( | ) | const [inline] |
References _process, and ArrayCore::ArrayProcess::timeRangeList().
Referenced by setParameters().
{return static_cast<TimeWindowList *>(_process->timeRangeList());}
int FKTimeWindows::_currentWindow [protected] |
Referenced by FKTimeWindows(), HRFKTimeWindows::setComponent(), setComponent(), and setCurrentWindow().
CircleViewer* FKTimeWindows::_fkCircleLayer [protected] |
Referenced by FKTimeWindows(), on_kEdit_valueChanged(), and on_vEdit_valueChanged().
FKMeshLayer* FKTimeWindows::_fkMeshLayer [protected] |
Referenced by FKTimeWindows(), and setGrid().
LiveGridLayer* FKTimeWindows::_gridLayer [protected] |
Referenced by FKTimeWindows(), HRFKTimeWindows::setComponent(), setComponent(), setCurrentWindow(), and setParameters().
FKArrayProcess* FKTimeWindows::_process [protected] |
TimeWindowLayer* FKTimeWindows::_timeWindowLayer [protected] |
Referenced by FKTimeWindows(), setCurrentWindow(), setParameters(), and setTimeWindowLayer().