All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Signals | Public Member Functions | Public Attributes | Protected Slots | Protected Member Functions | Protected Attributes
MonoStation::WinResults Class Reference

#include <WinResults.h>

Inheritance diagram for MonoStation::WinResults:
SciFigs::GraphicSheetMenu HVRotateWinResults HVWinResults SpectrumRotateWinResults SpectrumWinResults StructureWinResults

List of all members.

Signals

void categoryChanged ()
void peakChanged ()

Public Member Functions

virtual void addActions ()
int indexOf (AbstractStation *c)
void restoreMakeUp (QString fileName)
void setLayout (int nPlotsPerLine, double pageHeight)
virtual void setLimits (double maxAmplitude)
virtual void setStations (QList< AbstractStation * > stations)
virtual void setWindowTitle (QString subPoolName)=0
AbstractStationstation (int index) const
AbstractStationstation (const QString &name) const
int stationCount () const
 WinResults (QWidget *parent=0)

Public Attributes

QMenu * menuTools

Protected Slots

void categoriesToGroups ()
void editPeaks ()
void groupsToCategories ()
virtual void loadResults ()
void options ()
void saveResults ()
void setCategories ()
void setPeaks ()
void studentTest ()

Protected Member Functions

virtual void closeEvent (QCloseEvent *e)
void loadResults (QStringList fileNames)
bool selectAll (QString title)

Protected Attributes

QList< AbstractStation * > _stations
QString _yAxisTitle

Constructor & Destructor Documentation

MonoStation::WinResults::WinResults ( QWidget *  parent = 0)

References TRACE.

  : GraphicSheetMenu(parent)
{
  TRACE;
  setGeometry(5, 80, 500, 500);
}

Member Function Documentation

Reimplemented from SciFigs::GraphicSheetMenu.

Reimplemented in SpectrumWinResults, HVRotateWinResults, and SpectrumRotateWinResults.

References SciFigs::GraphicSheetMenu::addMenu(), categoriesToGroups(), editPeaks(), groupsToCategories(), loadResults(), SciFigs::GraphicSheetMenu::menuFormat, menuTools, options(), saveResults(), setCategories(), studentTest(), QGpCoreTools::tr(), and TRACE.

{
  TRACE;
  QAction * a;

  menuFormat->addSeparator();

  a=new QAction(tr("&Options"), this);
  connect(a, SIGNAL(triggered()), this, SLOT(options()));
  menuFormat->addAction(a);

  menuTools=addMenu(tr("&Tools"));

  a=new QAction(tr("&Load results"), this);
  a->setStatusTip(tr("Plot results previously saved"));
  QObject::connect(a, SIGNAL(triggered()), this, SLOT(loadResults()));
  menuTools->addAction(a);

  a=new QAction(tr("&Save results"), this);
  a->setStatusTip(tr("Save results of spectral analysis in a text file with process information (.log file)"));
  connect(a, SIGNAL(triggered()), this, SLOT(saveResults()));
  menuTools->addAction(a);

  menuTools->addSeparator();

  a=new QAction(tr("&Edit peaks"), this);
  a->setStatusTip(tr( "Do you think that the automatically computed peak frequency is not correct? Fix it ..."));
  connect(a, SIGNAL(triggered()), this, SLOT(editPeaks()) );
  menuTools->addAction(a);

  a=new QAction(tr("&Statistical comparison"), this);
  a->setStatusTip(tr("Use statistical tests to quantify how well two spectral curves compare."));
  connect(a, SIGNAL(triggered()), this, SLOT(studentTest()) );
  menuTools->addAction(a);

  a=new QAction(tr("&Set categories"), this);
  a->setStatusTip(tr("Sort results into categories."));
  connect(a, SIGNAL(triggered()), this, SLOT(setCategories()));
  menuTools->addAction(a);

  a=new QAction(tr("&Categories to groups"), this);
  a->setStatusTip(tr( "Create signal groups from categories."));
  connect(a, SIGNAL(triggered()), this, SLOT(categoriesToGroups()));
  menuTools->addAction(a);

  a=new QAction(tr("&Groups to categories"), this);
  a->setStatusTip(tr("Set categories from signal groups."));
  connect(a, SIGNAL(triggered()), this, SLOT(groupsToCategories()));
  menuTools->addAction(a);
}
void MonoStation::WinResults::categoriesToGroups ( ) [protected, slot]

Creates groups from categories of selected stations.

References _stations, GeopsyCore::SignalGroup::addSignals(), MonoStation::StationResults::category(), GeopsyCore::GeopsyCoreEngine::currentDB(), GeopsyCore::AbstractSignalGroup::find(), GeopsyCore::geopsyCore, MonoStation::AbstractStation::isSelected(), GeopsyCore::SignalDB::masterGroup(), MonoStation::AbstractStation::name(), MonoStation::AbstractStation::nComponents(), GeopsyCore::StationSignals::originals(), MonoStation::AbstractStation::originalSignals(), MonoStation::AbstractStation::results(), selectAll(), GeopsyCore::StationGroup::setName(), GeopsyCore::AbstractSignalGroup::setName(), GeopsyCore::AbstractSignalGroup::setParent(), QGpCoreTools::tr(), and TRACE.

Referenced by addActions().

{
  TRACE;
  if(_stations.isEmpty()) return;
  static const QString title=tr("Categories to groups");
  if(!selectAll(title)) return;

  SignalGroupFolder * baseFolder=new SignalGroupFolder;
  baseFolder->setParent(geopsyCore->currentDB()->masterGroup());
  baseFolder->setName(tr("categories-%1").arg(QDateTime::currentDateTime().toString("yyyyMMdd-hhmmss")));
  for(QList<AbstractStation *>::iterator it=_stations.begin();it!=_stations.end();it++) {
    AbstractStation * stat=*it;
    if(stat->isSelected()) {
      QString cat=stat->results(0)->category();
      SignalGroupFolder * catFolder;
      if(!cat.isEmpty()) {
        catFolder=static_cast<SignalGroupFolder *>(baseFolder->find(cat));
        if(!catFolder) {
          catFolder=new SignalGroupFolder(baseFolder);
          catFolder->setName(cat);
        }
      } else {
        catFolder=baseFolder;
      }
      StationGroup * g=new StationGroup(catFolder);
      g->setName(stat->name());
      int n=stat->nComponents();
      for(int i=0; i<n; i++) {
        g->addSignals(stat->originalSignals()->originals(i));
      }
    }
  }
}
void MonoStation::WinResults::closeEvent ( QCloseEvent *  e) [protected, virtual]

References geopsyGui, and TRACE.

{
  TRACE;
  if(testAttribute( Qt::WA_DeleteOnClose) ) {
    geopsyGui->removeWindow(this);
  }
  e->accept();
}
void MonoStation::WinResults::editPeaks ( ) [protected, slot]

References _stations, peakChanged(), selectAll(), QGpGuiTools::Dialog::setMainWidget(), setPeaks(), MonoStation::PeakEditor::setStations(), QGpCoreTools::tr(), and TRACE.

Referenced by addActions().

{
  TRACE;
  static const QString title=tr("Edit peaks");
  if(!selectAll(title)) return;

  Dialog * d=new Dialog(this);
  PeakEditor * e=new PeakEditor(this);
  d->setMainWidget(e, Dialog::Close);
  e->setStations(_stations);
  connect(e, SIGNAL(touched()), this, SLOT(setPeaks()));
  Settings::getRect(d, "PeakEditor");
  if(d->exec() ==QDialog::Accepted) {
    Settings::setRect(d, "PeakEditor");
  }
  emit peakChanged();
  delete d;
}
void MonoStation::WinResults::groupsToCategories ( ) [protected, slot]

Sets categories from signal groups.

References _stations, MonoStation::CategoryGroupItem::belongsTo(), categoryChanged(), GeopsyCore::GeopsyCoreEngine::currentDB(), QGpCoreTools::endl(), GeopsyCore::geopsyCore, GeopsyGui::SignalGroupItem::group(), MonoStation::AbstractStation::isSelected(), GeopsyCore::AbstractSignalGroup::name(), MonoStation::AbstractStation::name(), MonoStation::AbstractStation::results(), selectAll(), MonoStation::StationResults::setCategory(), GeopsyGui::SignalGroupItem::setDatabase(), QGpGuiTools::Dialog::setMainWidget(), MonoStation::CategoryGroupItem::setSignals(), QGpCoreTools::tr(), TRACE, and w.

Referenced by addActions().

{
  TRACE;
  if(_stations.isEmpty()) return;
  static const QString title=tr("Group to categories");
  if(!selectAll(title)) return;

  Dialog * d=new Dialog(this);
  QTreeView * w=new QTreeView;
  CategoryGroupItem * model=new CategoryGroupItem(w);
  model->setDatabase(geopsyCore->currentDB());
  model->setSignals(_stations);
  w->setModel(model);
  w->setSelectionMode(QAbstractItemView::ExtendedSelection);
  w->setEditTriggers(QAbstractItemView::NoEditTriggers);
  w->setHeaderHidden(true);
  d->setMainWidget(w, Dialog::OkCancel);
  d->setWindowTitle(title);
  Settings::getRect(d, "GroupsToCategories");
  if(d->exec()==QDialog::Accepted) {
    Settings::setRect(d, "GroupsToCategories");
    QModelIndexList sel=w->selectionModel()->selectedIndexes();
    for(QModelIndexList::iterator it=sel.begin(); it!=sel.end(); it++) {
      AbstractSignalGroup * g=model->group(*it);
      for(QList<AbstractStation *>::iterator it=_stations.begin();it!=_stations.end();it++) {
        AbstractStation * stat=*it;
        if(stat->isSelected()) {
          if(CategoryGroupItem::belongsTo(stat, g)) {
            App::stream() << tr("station %1 belongs to category %2").arg(stat->name()).arg(g->name()) << endl;
            stat->results(0)->setCategory(g->name());
          }
        }
      }
    }
    emit categoryChanged();
  }
}

Referenced by MonoStation::StudentTestCurveModel::parent().

{return _stations.indexOf(c);}
virtual void MonoStation::WinResults::loadResults ( ) [inline, protected, virtual, slot]

Reimplemented in SpectrumWinResults, StructureWinResults, and HVWinResults.

Referenced by addActions().

{}
void MonoStation::WinResults::loadResults ( QStringList  fileNames) [protected]

References SciFigs::GraphicSheetMenu::_sheet, _stations, _yAxisTitle, SciFigs::GraphicSheetMenu::addGraph(), SciFigs::GraphicSheetMenu::addText(), MonoStation::StationResults::load(), MSG_ID, MonoStation::AbstractStation::name(), peakChanged(), SciFigs::GraphicSheet::printBottom(), SciFigs::GraphicObject::printHeight, MonoStation::AbstractStation::results(), SciFigs::GraphicObject::setAnchor(), MonoStation::StationResults::setGraph(), SciFigs::GraphicSheetMenu::setGraphGeometry(), SciFigs::GraphicObject::setObjectName(), SciFigs::GraphicObject::setPrintXAnchor(), SciFigs::GraphicObject::setPrintYAnchor(), SciFigs::Axis::setRange(), SciFigs::TextEdit::setText(), SciFigs::Axis::setTitle(), station(), QGpCoreTools::tr(), TRACE, SciFigs::TextEdit::update(), SciFigs::GraphicObject::updateGeometry(), w, and SciFigs::AxisWindow::yAxis().

{
  TRACE;
  if(_stations.isEmpty()) return;
  if(fileNames.count()>0) {
    // Check that either all stations exist or none of them exist. If not, ask user
    enum LoadType {Unknown, NewStations, ExistingStations, Mixed};
    LoadType loadType=Unknown;
    QString newStation, existingStation;
    for(QStringList::Iterator it=fileNames.begin();it!=fileNames.end();++it) {
      QFileInfo fi(*it);
      AbstractStation * s=station(fi.baseName());
      switch(loadType) {
      case Unknown:
        loadType=s ? ExistingStations : NewStations;
        break;
      case NewStations:
        if(s) {
          loadType=Mixed;
        }
        break;
      case ExistingStations:
        if(!s) {
          loadType=Mixed;
        }
        break;
      case Mixed:
        break;
      }
      if(s) {
        existingStation+=s->name()+"\n";
      } else {
        newStation+=fi.baseName()+"\n";
      }
    }
    if(loadType==Mixed) {
      switch(Message::warning(MSG_ID, tr("Loading results"),
                              tr("Some of the selected files are not part of the current processing.\n\n"
                                 "Station(s) in the current processing:\n"
                                 "%1\n"
                                 "New station(s):\n"
                                 "%2\n"
                                 "Do you want to add them as new plots?").arg(existingStation).arg(newStation),
                              Message::yes(), Message::no(), Message::cancel())) {
      case Message::Answer0:
        break;
      case Message::Answer1:
        loadType=ExistingStations;
        break;
      case Message::Answer2:
        return;
      }
    }
    double y=_sheet.printBottom();
    // Grab y axis limits from last station
    double maximumY=_stations.last()->results(0)->graph()->yAxis()->maximum();
    for(QStringList::Iterator it=fileNames.begin();it!=fileNames.end();++it) {
      QFileInfo fi(*it);
      AbstractStation * s=station(fi.baseName());
      if(s) {
        // TODO: take result index into account
        s->results(0)->load(*it);
      } else if(loadType!=ExistingStations) {
        AxisWindow * w=addGraph();
        w->setAnchor(GraphicObject::TopRight);
        setGraphGeometry(w, 9.0, 7.5, y, 7.5, Axis::AxisSize);
        w->setObjectName("result_"+fi.baseName());
        StationResults res;
        res.setGraph(w);
        res.load(*it);
        w->yAxis()->setTitle(_yAxisTitle);
        // Set y axis limits from last station
        w->yAxis()->setRange(0.0, maximumY);

        TextEdit * t=addText(9.0, y, 4.0, 1.0);
        t->setAnchor(GraphicObject::BottomRight);
        t->setPrintXAnchor(9.0);
        t->setPrintYAnchor(y);
        t->setText(fi.fileName());
        t->update();  // Forces size adjustment
        t->updateGeometry();
        y+=7.5+t->printHeight();
      }
    }
    emit peakChanged();
  }
}
void MonoStation::WinResults::options ( ) [protected, slot]

References _stations, SciFigs::AxisWindow::deepUpdate(), MonoStation::StationResults::graph(), MonoStation::AbstractStation::graphCount(), SciFigs::GraphicObject::isSelected(), MonoStation::AbstractStation::results(), selectAll(), QGpGuiTools::Dialog::setMainWidget(), MonoStation::WinResultsOptions::setVisibleLayers(), QGpCoreTools::tr(), TRACE, MonoStation::WinResultsOptions::visibleLayers(), and w.

Referenced by addActions().

{
  TRACE;
  if(_stations.isEmpty()) return;
  static const QString title=tr("Options");
  if( !selectAll(title) ) return;
  Dialog * d=new Dialog(this);
  WinResultsOptions * optionWidget=new WinResultsOptions;
  d->setMainWidget(optionWidget);
  Settings::getWidget(optionWidget);
  optionWidget->setVisibleLayers(_stations.first()->results(0));
  if(d->exec()==QDialog::Accepted) {
    Settings::setWidget(optionWidget);
    for(QList<AbstractStation *>::iterator it=_stations.begin();it!=_stations.end();it++) {
      AbstractStation& s=**it;
      int nGraphs=s.graphCount();
      for(int igs=0; igs<nGraphs; igs++ ) {
        StationResults * sr=s.results(igs);
        AxisWindow * w=sr->graph();
        if(w->isSelected()) {
          optionWidget->visibleLayers(sr);
          w->deepUpdate();
        }
      }
    }
  }
  delete d;
}

Referenced by editPeaks(), and loadResults().

void MonoStation::WinResults::restoreMakeUp ( QString  fileName)

References _stations, MonoStation::AbstractStation::graphCount(), SciFigs::GraphicObject::restoreMakeUp(), MonoStation::AbstractStation::resultGraph(), TRACE, and w.

{
  TRACE;
  for(QList<AbstractStation *>::iterator it=_stations.begin();it!=_stations.end();it++) {
    AbstractStation& s=**it;
    int nGraphs=s.graphCount();
    for(int igs=0; igs<nGraphs; igs++) {
      AxisWindow * w=s.resultGraph(igs);
      w->restoreMakeUp(fileName);
    }
  }
}
void MonoStation::WinResults::saveResults ( ) [protected, slot]

References _stations, MonoStation::StationResults::graph(), MonoStation::AbstractStation::graphCount(), SciFigs::GraphicObject::isSelected(), GeopsyCore::StationSignals::name(), MonoStation::AbstractStation::originalSignals(), MonoStation::AbstractStation::results(), MonoStation::AbstractStation::save(), selectAll(), QGpCoreTools::tr(), and TRACE.

Referenced by addActions().

{
  TRACE;
  static const QString title=tr("Save results");
  if(!selectAll(title)) return;
  // Checks if all stations have a name, a condition to export everything in a directory
  bool hasEmptyNames=false;
  for(QList<AbstractStation *>::iterator it=_stations.begin(); it!=_stations.end(); it++) {
    AbstractStation& s=**it;
    if(s.originalSignals()->name().isEmpty()) {
      hasEmptyNames=true;
      break;
    }
  }
  // Count selected stations
  int nSelected=0;
  for(QList<AbstractStation *>::iterator it=_stations.begin(); it!=_stations.end(); it++) {
    AbstractStation& s=**it;
    int nGraphs=s.graphCount();
    for(int igs=0; igs<nGraphs; igs++) {
      if(s.results(igs)->graph()->isSelected()) {
        nSelected++;
        break;
      }
    }
  }
  QString dirName;
  if(!hasEmptyNames) {
    dirName=Message::getExistingDirectory(title);
    if(dirName.isEmpty()) {
      return;
    }
  }
  QDir d(dirName);
  for(QList<AbstractStation *>::iterator it=_stations.begin(); it!=_stations.end(); it++) {
    AbstractStation& s=**it;
    int nGraphs=s.graphCount();
    for(int igs=0; igs<nGraphs; igs++) {
      if(s.results(igs)->graph()->isSelected()) {
        s.save(igs, d, nSelected==1 || hasEmptyNames);
      }
    }
  }
}
bool MonoStation::WinResults::selectAll ( QString  title) [protected]

References SciFigs::GraphicSheetMenu::_sheet, _stations, MonoStation::StationResults::graph(), MonoStation::AbstractStation::graphCount(), SciFigs::GraphicObject::isSelected(), MonoStation::AbstractStation::results(), and SciFigs::GraphicSheet::selectAll().

Referenced by categoriesToGroups(), editPeaks(), groupsToCategories(), options(), saveResults(), and setCategories().

{
  if(_stations.count()==1) {
    _sheet.selectAll();
    return true;
  } else {
    for(QList<AbstractStation *>::iterator it=_stations.begin(); it!=_stations.end(); it++) {
      AbstractStation& s=**it;
      int nGraphs=s.graphCount();
      for(int igs=0; igs<nGraphs; igs++) {
        if(s.results(igs)->graph()->isSelected()) {
          return true;
        }
      }
    }
    return _sheet.selectAll(title);
  }
}
void MonoStation::WinResults::setCategories ( ) [protected, slot]

TODO: operate on StationResults rather than stations

References _stations, MonoStation::StationResults::category(), categoryChanged(), MonoStation::SetCategory::currentCategory(), MonoStation::AbstractStation::isSelected(), MSG_ID, MonoStation::AbstractStation::name(), MonoStation::AbstractStation::results(), selectAll(), MonoStation::StationResults::setCategory(), MonoStation::SetCategory::setCategoryNames(), MonoStation::SetCategory::setCurrentCategory(), QGpCoreTools::tr(), TRACE, and QGpCoreTools::unique().

Referenced by addActions().

{
  TRACE;
  if(_stations.isEmpty()) return;
  static const QString title=tr("Categories");
  if( !selectAll(title) ) return;
  QString msg;
  // Build a message with a summary of all categories and search for the most used
  QStringList allCategories;
  QMap<QString, int> selCategories;
  for(QList<AbstractStation *>::iterator it=_stations.begin();it!=_stations.end();it++) {
    AbstractStation * stat=*it;
    QString cat=stat->results(0)->category();
    if(stat->isSelected()) {
      QMap<QString, int>::iterator itcat=selCategories.find(cat);
      if(itcat==selCategories.end()) {
        selCategories.insert(cat, 1);
      } else {
        itcat.value()++;
      }
      msg+=stat->name();
      msg+=": ";
      msg+=cat;
      msg+="\n";
    }
    allCategories.append(cat);
  }
  qSort(allCategories);
  unique(allCategories);
  QString cat;
  if(selCategories.count()>1) {
    if(Message::information(MSG_ID, tr("Categories"), tr("Selected stations belong to different categories:\n\n"
                                  "%1\nDo you realy want to change them?").arg(msg),
                                  Message::yes(), Message::no())==Message::Answer1) {
      return;
    }
    int maxi=0;
    for(QMap<QString,int>::iterator it=selCategories.begin(); it!=selCategories.end(); it++ ) {
      if(it.value()>maxi) {
        cat=it.key();
        maxi=it.value();
      }
    }
  } else {
    cat=selCategories.keys().first();
  }
  SetCategory * d=new SetCategory(this);
  d->setCategoryNames(allCategories);
  Settings::getWidget(d);
  d->setCurrentCategory(cat);
  if(d->exec()==QDialog::Accepted) {
    Settings::setWidget(d);
    QString catName=d->currentCategory();
    for(QList<AbstractStation *>::iterator it=_stations.begin();it!=_stations.end();it++) {
      AbstractStation * stat=*it;
      if(stat->isSelected()) {
        stat->results(0)->setCategory(catName);
      }
    }
    emit categoryChanged();
  }
}
void MonoStation::WinResults::setLayout ( int  nPlotsPerLine,
double  pageHeight 
)

References _stations, MonoStation::AbstractStation::graphCount(), SciFigs::GraphicObject::printHeight, SciFigs::GraphicObject::printLeft(), SciFigs::GraphicObject::printRight(), SciFigs::GraphicObject::printTop(), SciFigs::GraphicObject::printWidth, MonoStation::AbstractStation::resultGraph(), MonoStation::AbstractStation::resultLabel(), SAFE_UNINITIALIZED, SciFigs::GraphicObject::setPrintBottom(), SciFigs::GraphicObject::setPrintLeft(), SciFigs::GraphicObject::setPrintRight(), SciFigs::GraphicObject::setPrintTop(), TRACE, SciFigs::TextEdit::update(), SciFigs::AxisWindow::updateGeometry(), SciFigs::GraphicObject::updateGeometry(), and w.

{
  TRACE;
  double x, y, dx=-1.0, dy=-1.0, minx, maxx, miny;
  SAFE_UNINITIALIZED(x,0);
  SAFE_UNINITIALIZED(y,0);
  SAFE_UNINITIALIZED(minx,0);
  SAFE_UNINITIALIZED(miny,0);
  SAFE_UNINITIALIZED(maxx,0);
  int pageIndex=0;
  for(QList<AbstractStation *>::iterator it=_stations.begin();it!=_stations.end();it++) {
    AbstractStation& s=**it;
    int nGraphs=s.graphCount();
    for(int igs=0; igs<nGraphs; igs++ ) {
      TextEdit * t=s.resultLabel(igs);
      AxisWindow * w=s.resultGraph(igs);
      if(dx<0.0) { // Init geometry parameters from geometry of first graph
        minx=w->printLeft();
        miny=w->printTop();
        if(miny>pageHeight) miny=0.5;
        dx=minx+w->printWidth();
        dy=miny+w->printHeight();
        x=minx;
        y=miny;
        maxx=minx+nPlotsPerLine*dx;
      } else {
        x+=dx;
        if(x+dx>maxx) {
          x=minx;
          y+=dy;
        }
        if(y+dy>(pageIndex+1)*pageHeight) {
          pageIndex++;
          y=miny+pageIndex*pageHeight;
        }
      }
      w->setPrintLeft(x);
      w->setPrintTop(y);
      w->updateGeometry();
      t->setPrintBottom(w->printTop());
      t->setPrintRight(w->printRight());
      t->update();  // Forces size adjustment
      t->updateGeometry();
    }
  }
}
void MonoStation::WinResults::setLimits ( double  maxAmplitude) [virtual]

Reimplemented in HVRotateWinResults, and SpectrumRotateWinResults.

References _stations, SciFigs::LineLayer::boundingRect(), MonoStation::StationResults::graph(), MonoStation::AbstractStation::graphCount(), MonoStation::AbstractStation::results(), SciFigs::Axis::setRange(), MonoStation::StationResults::stddevLayer(), TRACE, w, MonoStation::StationResults::windowCount(), QGpCoreTools::Rect::x1(), QGpCoreTools::Rect::x2(), SciFigs::AxisWindow::xAxis(), and SciFigs::AxisWindow::yAxis().

{
  TRACE;
  if(_stations.isEmpty()) return;
  QList<AbstractStation *>::iterator it;
  // Grab x axis limits from first station with time windows: it is the same for all stations
  const StationResults * res=0;
  for(it=_stations.begin(); it!=_stations.end(); it++) {
    AbstractStation& s=**it;
    res=s.results(0);
    if(res->windowCount()>0) break;
    res=0;
  }
  if(!res) return;
  Rect r=res->stddevLayer()->boundingRect();
  for(QList<AbstractStation *>::iterator it=_stations.begin();it!=_stations.end();it++) {
    AbstractStation& s=**it;
    int nGraphs=s.graphCount();
    for(int igs=0; igs<nGraphs; igs++ ) {
      AxisWindow * w=s.results(igs)->graph();
      w->xAxis()->setRange(r.x1(), r.x2());
      w->yAxis()->setRange(0.0, maxAmplitude);
    }
  }
}
void MonoStation::WinResults::setPeaks ( ) [protected, slot]

References _stations, SciFigs::AxisWindow::deepUpdate(), MonoStation::StationResults::graph(), MonoStation::AbstractStation::graphCount(), SciFigs::GraphicObject::isSelected(), MonoStation::AbstractStation::results(), and w.

Referenced by editPeaks().

{
  for(QList<AbstractStation *>::iterator it=_stations.begin();it!=_stations.end();it++) {
    AbstractStation& s=**it;
    int nGraphs=s.graphCount();
    for(int igs=0; igs<nGraphs; igs++) {
      StationResults * sr=s.results(igs);
      AxisWindow * w=sr->graph();
      if(w->isSelected()) {
        w->deepUpdate();
      }
    }
  }
}
void MonoStation::WinResults::setStations ( QList< AbstractStation * >  stations) [virtual]

Reimplemented in HVRotateWinResults, and SpectrumRotateWinResults.

References _stations, _yAxisTitle, SciFigs::GraphicSheetMenu::addGraph(), SciFigs::GraphicSheetMenu::addText(), geopsyGui, SciFigs::GraphicObject::setAnchor(), SciFigs::GraphicSheetMenu::setGraphGeometry(), SciFigs::GraphicObject::setObjectName(), SciFigs::GraphicObject::setPrintXAnchor(), SciFigs::GraphicSheet::setStatusBar(), SciFigs::TextEdit::setText(), SciFigs::Axis::setTitle(), SciFigs::GraphicSheetMenu::sheet(), TRACE, SciFigs::TextEdit::update(), SciFigs::AxisWindow::updateExternalGeometry(), SciFigs::AxisWindow::updateGeometry(), SciFigs::GraphicObject::updateGeometry(), w, and SciFigs::AxisWindow::yAxis().

{
  TRACE;
  _stations=stations;
  int n=_stations.count();
  sheet()->setStatusBar(geopsyGui->statusBar());
  int ig=0;
  for(int is=0; is<n; is++) {
    int nGraphs=_stations[is]->graphCount();
    for(int igs=0; igs<nGraphs; igs++, ig++) {
      AxisWindow * w=addGraph();
      w->setAnchor(GraphicObject::TopRight);
      setGraphGeometry(w, 9.0, 7.5, 1.0, 7.5, Axis::AxisSize);
      w->setObjectName("result_"+QString::number(ig));
      w->yAxis()->setTitle(_yAxisTitle);
      _stations[is]->setResultGraph(igs, w);
      w->updateExternalGeometry();
      w->updateGeometry();
      TextEdit * t=addText(9.0, 1.0, 4.0, 1.0);
      t->setObjectName("stationLabel_"+QString::number(ig));
      t->setAnchor(GraphicObject::BottomRight);
      t->setPrintXAnchor(9.0);
      t->setText(_stations[is]->name(igs));
      t->update();  // Forces size adjustment
      t->updateGeometry();
      _stations[is]->setResultLabel(igs, t);
    }
  }
}
void MonoStation::WinResults::setWindowTitle ( QString  subPoolName) [pure virtual]
AbstractStation* MonoStation::WinResults::station ( int  index) const [inline]
AbstractStation * MonoStation::WinResults::station ( const QString &  name) const

References _stations, MonoStation::AbstractStation::name(), and TRACE.

{
  TRACE;
  for(QList<AbstractStation *>::const_iterator it=_stations.begin(); it!=_stations.end(); it++) {
    AbstractStation * s=*it;
    if(s->name()==name) {
      return s;
    }
  }
  return 0;
}
int MonoStation::WinResults::stationCount ( ) const [inline]
void MonoStation::WinResults::studentTest ( ) [protected, slot]

References _yAxisTitle, MonoStation::StationResults::averageCurve(), MonoStation::StudentTest::firstCurve(), MonoStation::StudentTest::init(), MonoStation::StudentTest::makeUp(), MSG_ID, QGpCoreTools::Curve< pointType >::sameSampling(), MonoStation::StudentTest::secondCurve(), MonoStation::StudentTest::significance(), QGpCoreTools::tr(), TRACE, and w.

Referenced by addActions().

{
  TRACE;
  StudentTest * d=new StudentTest(this);
  // Gather all similar WinResults (with the same Y axis title)
  QWorkspace * ws=qobject_cast<QWorkspace *>(parentWidget()->parentWidget());
  ASSERT(ws);
  QWidgetList windows=ws->windowList(QWorkspace::StackingOrder);
  // Get the list of widget that can serve as test
  QList<WinResults *> tests;
  for(int i=0; i<windows.count(); ++i) {
    WinResults * w=qobject_cast<WinResults *>(windows.at(i));
    if(w && w->_yAxisTitle==_yAxisTitle) {
      tests.append(w);
    }
  }
  d->init(tests);
  Settings::getWidget(d);
  if(d->exec()==QDialog::Accepted) {
    Settings::setWidget(d);
    const StationResults * r1=d->firstCurve();
    const StationResults * r2=d->secondCurve();
    if(r1 && r2) {
      if(r1==r2) {
        Message::warning(MSG_ID, tr("Student test"), tr("Identical stations selected."));
      } else {
        if(r1->averageCurve().sameSampling(r2->averageCurve())) {
          StatisticResults::studentTest(r1, r2, d->significance(), d->makeUp());
        } else {
          Message::warning(MSG_ID, tr("Student test"), tr("Selected curves have not a compatible frequency sampling."));
        }
      }
    } else {
      Message::warning(MSG_ID, tr("Student test"), tr("Missing at least one station."));
    }
  }
  delete d;
}

Member Data Documentation


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines