Public Member Functions | Protected Member Functions
SourceCoordinates Class Reference

Brief description of class still missing. More...

#include <SourceCoordinates.h>

Inheritance diagram for SourceCoordinates:
StationCoordinates QGpGuiTools::Dialog QGpGuiTools::FrameGrabber

List of all members.

Public Member Functions

bool init (SubSignalPool *subPool)
bool initLookup ()
 SourceCoordinates (QWidget *parent=0)
QString sourceNamePattern () const

Protected Member Functions

virtual Point coordinates (Signal *sig)
virtual QString keyName (Signal *sig)

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

SourceCoordinates::SourceCoordinates ( QWidget *  parent = 0)

Description of constructor still missing

References QGpCoreTools::tr(), and TRACE.

    : StationCoordinates(parent)
{
  TRACE;
  QVBoxLayout * vboxLayout=qobject_cast<QVBoxLayout *>(layout());
  ASSERT(vboxLayout);
  QHBoxLayout * hboxLayout=new QHBoxLayout();
  hboxLayout->setSpacing(6);
  hboxLayout->setMargin(0);
  hboxLayout->setObjectName(QString::fromUtf8("hboxLayoutSource"));

  QLabel * nameLabel=new QLabel(this);
  nameLabel->setObjectName(QString::fromUtf8("sourceNameLabel"));
  nameLabel->setText(tr("Source name pattern"));

  hboxLayout->addWidget(nameLabel);

  sourceNameEdit=new QComboBox(this);
  sourceNameEdit->setObjectName(QString::fromUtf8("sourceNameEdit"));
  QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(7), static_cast<QSizePolicy::Policy>(0));
  sizePolicy.setHorizontalStretch(0);
  sizePolicy.setVerticalStretch(0);
  sizePolicy.setHeightForWidth(sourceNameEdit->sizePolicy().hasHeightForWidth());
  sourceNameEdit->setSizePolicy(sizePolicy);
  sourceNameEdit->setEditable(true);
  sourceNameEdit->setToolTip(tr("The names listed here above will be mapped with the names generated by this pattern."));
  sourceNameEdit->setWhatsThis(tr("<p>Pattern follow the same syntax as in 'Set header' menu, 'Return' variable must "
                                  " contain at the end the string corresponding to a source name in the list. Typically, "
                                  " we want to map short file names (without extension) to source names.</p>"
                                  "<ul>"
                                  "  <li><b>If</b> 'ShortFileName' contains the following names: 1001.dat, 1002.dat,...</li>"
                                  "  <li><b>If</b> you want to set the same source coordinates for all signals belonging to each "
                                  " file</li>"
                                  "  <li><b>If</b> the names associated with the source coordinates are prefixed by 'Shot_'</li>"
                                  "</ul>"
                                  "<p><b>Then</b> a good source name pattern can be:</p>"
                                  "<p>Shot_{Return=left(ShortFileName,length(ShortFileName)-4);}</p>"));
  sourceNameEdit->setEditText("Shot_{Return=left(ShortFileName,length(ShortFileName)-4);}");
  connect(sourceNameEdit, SIGNAL(editTextChanged(const QString& )),
           this, SLOT(on_sourceNameEdit_editTextChanged(const QString& )));

  hboxLayout->addWidget(sourceNameEdit);

  applyBut=new QPushButton(this);
  applyBut->setObjectName(QString::fromUtf8("applyBut"));
  applyBut->setText(tr("Apply"));
  applyBut->setEnabled(false);
  connect(applyBut, SIGNAL(clicked()), this, SLOT(on_applyBut_clicked()));

  hboxLayout->addWidget(applyBut);

  vboxLayout->addLayout(hboxLayout);

  sourceNameEdit->addItems(Settings::getHistory("SourceNamePattern"));
  setWindowTitle(tr("Source coordinates"));
}

Member Function Documentation

virtual Point SourceCoordinates::coordinates ( Signal sig) [inline, protected, virtual]

Reimplemented from StationCoordinates.

References GeopsyCore::Signal::source().

{return sig->source();}

Return true if two stations have the same names

Reimplemented from StationCoordinates.

References TRACE.

Referenced by GeopsyMainWindow::setSources().

{
  TRACE;
  _subPool=subPool;
  on_applyBut_clicked();
  return false;
}

References QGpCoreTools::ExpressionString::clear(), QGpCoreTools::log(), MSG_ID, QGpCoreTools::ExpressionString::setPattern(), sourceNamePattern(), QGpCoreTools::tr(), and TRACE.

Referenced by GeopsyMainWindow::setSources().

{
  TRACE;
  QString log;
  StreamRedirection sr(new StringStream(&log));
  _keyExpression.clear();
  if(!_keyExpression.setPattern(sourceNamePattern(), &_keyExpressionContext)) {
    Message::warning(MSG_ID, tr("Set sources"), tr("Error(s) while parsing source name pattern:\n\n%1").arg(log));
    return false;
  } else {
    Settings::setHistory("SourceNamePattern", sourceNamePattern());
    return true;
  }
}
QString SourceCoordinates::keyName ( Signal sig) [protected, virtual]

Reimplemented from StationCoordinates.

References GeopsyCore::SignalExpressionContext::setSignal(), TRACE, and QGpCoreTools::ExpressionString::value().

{
  TRACE;
  _keyExpressionContext.setSignal(sig);
  return _keyExpression.value();
}

References TRACE.

Referenced by initLookup().

{
  TRACE;
  return sourceNameEdit->currentText();
}

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