#include <DCPlugin.h>
Public Slots | |
| void | autocorrViewer () |
| void | dispersionViewer () |
| void | ellipticityViewer () |
| void | groundProfilesViewer () |
| void | magnetoTelluricViewer () |
| void | refractionVpViewer () |
| void | refractionVsViewer () |
| void | setCurrentGroundModel (ParamGroundModel *gm) |
| void | setParamFromTargets () |
Public Member Functions | |
| virtual void | addViewMenu (QMenu *m) |
| virtual void | clear () |
| virtual AbstractForward * | createForward () |
| virtual QWidget * | createParamWidget () |
| virtual QWidget * | createTargetWidget () |
| DCPlugin () | |
| virtual QString | description () const |
| virtual bool | initForward (AbstractForward *forward) |
| virtual const char * | interfaceVersion () const |
| virtual void | setCurrentForward (AbstractForward *forwards, const QString &caption) |
| virtual QString | tag () const |
| virtual QString | title () const |
| virtual QString | version () const |
| virtual XMLMember | xml_member (XML_MEMBER_ARGS) |
| virtual bool | xml_polishChild (XML_POLISHCHILD_ARGS) |
| virtual void | xml_writeChildren (XML_WRITECHILDREN_ARGS) const |
| virtual bool | xmlSupport () const |
| ~DCPlugin () | |
| void DCPlugin::addViewMenu | ( | QMenu * | m | ) | [virtual] |
Place to add items to dinver view menu
Reimplemented from DinverCore::DinverInterface.
References autocorrViewer(), dispersionViewer(), ellipticityViewer(), groundProfilesViewer(), magnetoTelluricViewer(), refractionVpViewer(), refractionVsViewer(), QGpCoreTools::tr(), and TRACE.
{
TRACE;
QAction * a;
a=new QAction(tr( "Ground profiles" ), m);
a->setStatusTip(tr( "Create a new sheet with plots of ground profiles" ));
connect(a, SIGNAL(triggered()), this, SLOT(groundProfilesViewer()) );
m->addAction(a);
a=new QAction(tr( "Dispersion" ), m);
a->setStatusTip(tr( "Create a new sheet with plots of dispersion curves" ));
connect(a, SIGNAL(triggered()), this, SLOT(dispersionViewer()) );
m->addAction(a);
a=new QAction(tr( "Autocorrelation" ), m);
a->setStatusTip(tr( "Create a new sheet with plots of autocorr curves" ));
connect(a, SIGNAL(triggered()), this, SLOT(autocorrViewer()) );
m->addAction(a);
a=new QAction(tr( "Ellipticity" ), m);
a->setStatusTip(tr( "Create a new sheet with plots of ellipticity curves" ));
connect(a, SIGNAL(triggered()), this, SLOT(ellipticityViewer()) );
m->addAction(a);
a=new QAction(tr( "Refraction Vp" ), m);
a->setStatusTip(tr( "Create a new sheet with plots of refraction Vp curves" ));
connect(a, SIGNAL(triggered()), this, SLOT(refractionVpViewer()) );
m->addAction(a);
a=new QAction(tr( "Refraction Vs" ), m);
a->setStatusTip(tr( "Create a new sheet with plots of refraction Vs curves" ));
connect(a, SIGNAL(triggered()), this, SLOT(refractionVsViewer()) );
m->addAction(a);
a=new QAction(tr( "Magneto-telluric" ), m);
a->setStatusTip(tr( "Create a new sheet with plots of magneto-telluric curves" ));
connect(a, SIGNAL(triggered()), this, SLOT(magnetoTelluricViewer()) );
m->addAction(a);
}
| void DCPlugin::autocorrViewer | ( | ) | [slot] |
References DinverDCGui::ViewerParam::autocorr(), DinverCore::dinverCore, DinverCore::DinverCoreObject::selectedReports(), DinverDCGui::DCModelViewer::setTarget(), TargetListWidget::targetList(), QGpCoreTools::tr(), TRACE, and w.
Referenced by addViewMenu().
{
TRACE;
QStringList reportList=dinverCore->selectedReports(tr("View autocorr curves"));
if(reportList.isEmpty()) return;
ViewerParam * d=new ViewerParam(QApplication::activeWindow());
DCModelViewer * w=d->autocorr(reportList);
delete d;
if(w) {
w->setTarget(_targetWidget->targetList());
}
}
| void DCPlugin::clear | ( | ) | [virtual] |
Function called after "File/New"
Reimplemented from DinverCore::DinverInterface.
References TargetListWidget::clear(), ParamGroundModelWidget::clear(), and TRACE.
| AbstractForward * DCPlugin::createForward | ( | ) | [virtual] |
Implements DinverCore::DinverInterface.
{
return new Forward;
}
| QWidget * DCPlugin::createParamWidget | ( | ) | [virtual] |
Create and return a widget that lets the user customize the parameter space definition
Reimplemented from DinverCore::DinverInterface.
References TRACE.
{
TRACE;
_paramWidget=new ParamGroundModelWidget;
return _paramWidget;
}
| QWidget * DCPlugin::createTargetWidget | ( | ) | [virtual] |
Create and return a widget that lets the user customize the target definition
Reimplemented from DinverCore::DinverInterface.
References setParamFromTargets(), TargetListFrameWidget::targetListWidget, and TRACE.
{
TRACE;
TargetListFrameWidget * targetFrame=new TargetListFrameWidget;
_targetWidget=targetFrame->targetListWidget;
connect(_targetWidget, SIGNAL(targetChanged()), this, SLOT(setParamFromTargets()) );
return targetFrame;
}
| QString DCPlugin::description | ( | ) | const [virtual] |
Detailed description of the plugin
Reimplemented from DinverCore::DinverInterface.
References QGpCoreTools::tr(), and TRACE.
{
TRACE;
return tr("<p>Inversion of theoretical dispersion curves, autocorrelation curves, "
"ellipticity curves and refraction curves. This module is based upon "
"surface wave algorithms developed by Marc Wathelet (<a href=\"http://"
"marc.geopsy.org/publications.html\">http://marc.geopsy.org/publications.html</a>).</p>");
}
| void DCPlugin::dispersionViewer | ( | ) | [slot] |
References DinverCore::dinverCore, DinverDCGui::ViewerParam::dispersion(), DinverCore::DinverCoreObject::selectedReports(), DinverDCGui::DCModelViewer::setTarget(), TargetListWidget::targetList(), QGpCoreTools::tr(), TRACE, and w.
Referenced by addViewMenu().
{
TRACE;
QStringList reportList=dinverCore->selectedReports(tr("View dispersion curves"));
if(reportList.isEmpty()) return;
ViewerParam * d=new ViewerParam(QApplication::activeWindow());
DCModelViewer * w=d->dispersion(reportList);
delete d;
if(w) {
w->setTarget(_targetWidget->targetList());
}
}
| void DCPlugin::ellipticityViewer | ( | ) | [slot] |
References DinverCore::dinverCore, DinverDCGui::ViewerParam::ellipticity(), DinverCore::DinverCoreObject::selectedReports(), DinverDCGui::DCModelViewer::setTarget(), TargetListWidget::targetList(), QGpCoreTools::tr(), TRACE, and w.
Referenced by addViewMenu().
{
TRACE;
QStringList reportList=dinverCore->selectedReports(tr("View ellipticity curves"));
if(reportList.isEmpty()) return;
ViewerParam * d=new ViewerParam(QApplication::activeWindow());
DCModelViewer * w=d->ellipticity(reportList);
delete d;
if(w) {
w->setTarget(_targetWidget->targetList());
}
}
| void DCPlugin::groundProfilesViewer | ( | ) | [slot] |
References DinverCore::dinverCore, DinverDCGui::ViewerParam::groundProfile(), DinverCore::DinverCoreObject::selectedReports(), QGpCoreTools::tr(), and TRACE.
Referenced by addViewMenu().
{
TRACE;
QStringList reportList=dinverCore->selectedReports(tr("View ground profiles"));
if(reportList.isEmpty()) return;
ViewerParam * d=new ViewerParam(QApplication::activeWindow());
d->groundProfile(reportList);
delete d;
}
| bool DCPlugin::initForward | ( | AbstractForward * | forward | ) | [virtual] |
Reimplemented from DinverCore::DinverInterface.
References DinverDCCore::TargetList::dispersionSampleCount(), QGpCoreTools::endl(), DinverDCCore::ParamGroundModel::isEmpty(), MSG_ID, ParamGroundModelWidget::paramGroundModel(), Forward::setParamSpace(), Forward::setTargets(), TargetListWidget::targetList(), and QGpCoreTools::tr().
{
ParamGroundModel * gm;
if(_paramWidget) {
gm=_paramWidget->paramGroundModel();
} else {
if(!_param) {
App::stream() << tr("Parameters are missing.") << endl;
return 0;
}
gm=new ParamGroundModel(*_param);
}
if(gm->isEmpty()) {
App::stream() << tr("Parametrized model is empty or at least one of its profiles is missing.") << endl;
delete gm;
return false;
}
TargetList * tl;
if(_targetWidget)
tl=_targetWidget->targetList();
else {
if(_target) {
tl=new TargetList(*_target);
} else {
tl=new TargetList();
}
}
if(tl->dispersionSampleCount()>100) {
if(Message::warning(MSG_ID, tr("Creating a new inversion run"),
tr("The effective number of samples for dispersion curve is greater than 100 (%1). This is "
"likely to slow down the inversion process. A usual number of samples is 50. A high number "
"of samples may be observed when various curves are inverted together (dispersion, spac,...). "
"In this case make sure that all these curves use the same frequency samples. Resample "
"all curves if necessary.").arg(tl->dispersionSampleCount()),
tr("Continue"), Message::cancel(), true) ==Message::Answer1) {
delete gm;
delete tl;
return false;
}
}
Forward * f=static_cast<Forward *>(forward);
f->setTargets(tl);
return f->setParamSpace(gm);
}
| virtual const char* DCPlugin::interfaceVersion | ( | ) | const [inline, virtual] |
Returns the dinvercore version of the plugin (at compile time)
Implements DinverCore::DinverInterface.
{return DINVERCORE_VERSION;}
| void DCPlugin::magnetoTelluricViewer | ( | ) | [slot] |
References DinverCore::dinverCore, DinverDCGui::ViewerParam::magnetoTelluric(), DinverCore::DinverCoreObject::selectedReports(), DinverDCGui::DCModelViewer::setTarget(), TargetListWidget::targetList(), QGpCoreTools::tr(), TRACE, and w.
Referenced by addViewMenu().
{
TRACE;
QStringList reportList=dinverCore->selectedReports(tr("View magneto-telluric curves"));
if(reportList.isEmpty()) return;
ViewerParam * d=new ViewerParam(QApplication::activeWindow());
DCModelViewer * w=d->magnetoTelluric(reportList);
delete d;
if(w) {
w->setTarget(_targetWidget->targetList());
}
}
| void DCPlugin::refractionVpViewer | ( | ) | [slot] |
References DinverCore::dinverCore, DinverDCGui::ViewerParam::refractionVp(), DinverCore::DinverCoreObject::selectedReports(), DinverDCGui::DCModelViewer::setTarget(), TargetListWidget::targetList(), QGpCoreTools::tr(), TRACE, and w.
Referenced by addViewMenu().
{
TRACE;
QStringList reportList=dinverCore->selectedReports(tr("View refraction Vp curves"));
if(reportList.isEmpty()) return;
ViewerParam * d=new ViewerParam(QApplication::activeWindow());
DCModelViewer * w=d->refractionVp(reportList);
delete d;
if(w) {
w->setTarget(_targetWidget->targetList());
}
}
| void DCPlugin::refractionVsViewer | ( | ) | [slot] |
References DinverCore::dinverCore, DinverDCGui::ViewerParam::refractionVs(), DinverCore::DinverCoreObject::selectedReports(), DinverDCGui::DCModelViewer::setTarget(), TargetListWidget::targetList(), QGpCoreTools::tr(), TRACE, and w.
Referenced by addViewMenu().
{
TRACE;
QStringList reportList=dinverCore->selectedReports(tr("View refraction Vs curves"));
if(reportList.isEmpty()) return;
ViewerParam * d=new ViewerParam(QApplication::activeWindow());
DCModelViewer * w=d->refractionVs(reportList);
delete d;
if(w) {
w->setTarget(_targetWidget->targetList());
}
}
| void DCPlugin::setCurrentForward | ( | AbstractForward * | forwards, |
| const QString & | caption | ||
| ) | [virtual] |
Reimplemented from DinverCore::DinverInterface.
References Forward::paramGroundModel(), ParamGroundModelWidget::paramGroundModel(), ParamGroundModelWidget::setEditable(), TargetListWidget::setEditable(), ParamGroundModelWidget::setFrom(), TargetListWidget::setFrom(), TargetListWidget::setTitles(), Forward::targetList(), TargetListWidget::targetList(), and TRACE.
{
TRACE;
if(forward) {
if(!_param) {
// Means that last list of forwards was null or contained more than 1 forward
// Hence the main global parameterization and target are currently active
// Save them before showing a particular case
ASSERT(!_target);
_param=_paramWidget->paramGroundModel();
_target=_targetWidget->targetList();
}
Forward * f=static_cast<Forward *>(forward);
_paramWidget->setFrom(f->paramGroundModel());
_paramWidget->setEditable(false);
_targetWidget->setEditable(false);
_targetWidget->setFrom(f->targetList());
_targetWidget->setTitles(caption);
} else if(_param) {
ASSERT(_target);
_paramWidget->setFrom(_param);
_paramWidget->setEditable(true);
_targetWidget->setFrom(_target);
_targetWidget->setEditable(true);
_targetWidget->setTitles(QString::null);
delete _param;
delete _target;
_param=0;
_target=0;
}
}
| void DCPlugin::setCurrentGroundModel | ( | ParamGroundModel * | gm | ) | [slot] |
References ParamGroundModelWidget::setFrom(), and TRACE.
| void DCPlugin::setParamFromTargets | ( | ) | [slot] |
References TargetListWidget::setParamProfiles(), and TRACE.
Referenced by createTargetWidget().
{
TRACE;
_targetWidget->setParamProfiles(_paramWidget);
}
| QString DCPlugin::tag | ( | ) | const [virtual] |
Unique tag to identify in .report files models generated by this plugin.
Implements DinverCore::DinverInterface.
References TRACE.
Referenced by xml_member().
{
TRACE;
return "DispersionCurve";
}
| QString DCPlugin::title | ( | ) | const [virtual] |
User friendly title, displayed at Dinver startup.
Implements DinverCore::DinverInterface.
References QGpCoreTools::tr(), and TRACE.
| QString DCPlugin::version | ( | ) | const [virtual] |
Current version of the plugin
Implements DinverCore::DinverInterface.
References TRACE.
{
TRACE;
return DINVERDC_VERSION;
}
| XMLMember DCPlugin::xml_member | ( | XML_MEMBER_ARGS | ) | [virtual] |
Re-implement this function to load parameters and targets (e.g. while restoring dinver environments)
Reimplemented from DinverCore::DinverInterface.
References DinverCore::XMLDinverContext::parameters(), tag(), DinverCore::XMLDinverContext::targets(), and TRACE.
{
TRACE;
Q_UNUSED(attributes)
XMLDinverContext * dinverContext=static_cast<XMLDinverContext *>(context);
if(tag=="TargetList" ) {
if(dinverContext->targets()) {
if(_targetWidget) {
return XMLMember(new TargetList, true);
} else {
delete _target;
_target=new TargetList;
return XMLMember(_target);
}
} else {
return XMLMember(XMLMember::Skip);
}
} else if(tag=="ParamGroundModel" ) {
if(dinverContext->parameters()) {
if(_paramWidget) {
return XMLMember(new ParamGroundModel, true);
} else {
delete _param;
_param=new ParamGroundModel;
return XMLMember(_param);
}
} else {
return XMLMember(XMLMember::Skip);
}
} else return XMLMember(XMLMember::Unknown);
}
| bool DCPlugin::xml_polishChild | ( | XML_POLISHCHILD_ARGS | ) | [virtual] |
Re-implement this function to initialize parameters and targets (e.g. after restoring dinver environments)
Reimplemented from DinverCore::DinverInterface.
References DinverCore::XMLDinverContext::parameters(), ParamGroundModelWidget::setFrom(), TargetListWidget::setFrom(), DinverCore::XMLDinverContext::targets(), and TRACE.
{
TRACE;
XMLDinverContext * dinverContext=static_cast<XMLDinverContext *>(context);
if(dinverContext->targets() && child->xml_tagName()=="TargetList") {
if(_targetWidget) {
_targetWidget->setFrom(static_cast<TargetList *>(child));
}
return true;
} else if(dinverContext->parameters() && child->xml_tagName()=="ParamGroundModel") {
if(_paramWidget) { // gui run
_paramWidget->setFrom(static_cast<ParamGroundModel *>(child));
}
return true;
} else
return false;
}
| void DCPlugin::xml_writeChildren | ( | XML_WRITECHILDREN_ARGS | ) | const [virtual] |
Re-implement this function to save parameters and targets (e.g. while saving dinver environments)
Reimplemented from DinverCore::DinverInterface.
References DinverCore::XMLDinverContext::parameters(), ParamGroundModelWidget::paramGroundModel(), TargetListWidget::targetList(), DinverCore::XMLDinverContext::targets(), TRACE, and QGpCoreTools::XMLClass::xml_save().
{
TRACE;
XMLDinverContext * dinverContext=static_cast<XMLDinverContext *>(context);
if(dinverContext->targets()) {
if(_targetWidget) {
TargetList * t=_targetWidget->targetList();
t->xml_save(s, context);
delete t;
} else {
_target->xml_save(s, context);
}
}
if(dinverContext->parameters()) {
if(_paramWidget) {
ParamGroundModel * p=_paramWidget->paramGroundModel();
p->xml_save(s, context);
delete p;
} else {
_param->xml_save(s, context);
}
}
}
| virtual bool DCPlugin::xmlSupport | ( | ) | const [inline, virtual] |
Reimplemented from DinverCore::DinverInterface.
{return true;}