#include <ParamGroundModelWidget.h>
Public Slots | |
void | clear () |
void | load () |
void | load (QString fileName) |
void | save () |
void | save (QString fileName) |
void | setDHLinks () |
void | setFrom (ParamGroundModel *gm) |
void | updateSize () |
Signals | |
void | rangeEdited () |
Public Member Functions | |
ParamProfileWidget * | find (QString shortName) |
ParamProfileWidget * | newProfile () |
ParamGroundModel * | paramGroundModel () |
ParamGroundModelWidget (QWidget *parent=0, Qt::WFlags fl=0) | |
void | setEditable (bool e) |
~ParamGroundModelWidget () | |
Public Attributes | |
ParamSpaceEditor * | customConditions |
QScrollArea * | modelSheet |
QHBoxLayout * | profileGeometry |
QVBoxLayout * | vboxLayout |
Protected Member Functions | |
virtual void | showEvent (QShowEvent *e) |
ParamGroundModelWidget::ParamGroundModelWidget | ( | QWidget * | parent = 0 , |
Qt::WFlags | fl = 0 |
||
) |
References customConditions, modelSheet, profileGeometry, QGpCoreTools::tr(), TRACE, and vboxLayout.
: QWidget(parent, fl) { TRACE; vboxLayout=new QVBoxLayout(this); vboxLayout->setSpacing(6); vboxLayout->setMargin(0); modelSheet=new QScrollArea; vboxLayout->addWidget(modelSheet); QWidget * modelSheetArea=new QWidget; profileGeometry=new QHBoxLayout(modelSheetArea); profileGeometry->setSpacing(5); modelSheet->setWidget(modelSheetArea); // Add custom condition editor QVBoxLayout * ccLayout=new QVBoxLayout(); ccLayout->setSpacing(6); ccLayout->setMargin(0); QLabel * label=new QLabel(this); label->setObjectName(QString::fromUtf8("label")); QFont font; font.setBold(true); font.setWeight(75); label->setFont(font); label->setTextFormat(Qt::PlainText); label->setAlignment(Qt::AlignCenter); label->setText(tr("Custom conditions")); ccLayout->addWidget(label); customConditions=new ParamSpaceEditor(this); customConditions->setObjectName(QString::fromUtf8("customConditions")); customConditions->setFrom("// linear(\"TopVs1\",\">\",1.2,\"BottomVs0\",1000);\n" "// which means: TopVs1>1.2*BottomVs0+1000"); connect(customConditions, SIGNAL(check()), this, SLOT(checkCustomConditions())); ccLayout->addWidget(customConditions); profileGeometry->addLayout(ccLayout); }
void ParamGroundModelWidget::clear | ( | ) | [slot] |
References TRACE.
Referenced by DCPlugin::clear().
{ TRACE; QList<ParamProfileWidget *> wList=findChildren<ParamProfileWidget *>(); qDeleteAll(wList); }
ParamProfileWidget * ParamGroundModelWidget::find | ( | QString | shortName | ) |
References modelSheet, and TRACE.
Referenced by setFrom(), and TargetListWidget::setParamProfiles().
{ TRACE; QList<ParamProfileWidget *> objList=modelSheet->widget() ->findChildren<ParamProfileWidget *>(); QList<ParamProfileWidget *>::iterator it; for(it=objList.begin();it!=objList.end();++it) { if(( *it) ->shortName()==shortName) break; } if(it!=objList.end()) return * it; else return 0; }
void ParamGroundModelWidget::load | ( | ) | [slot] |
void ParamGroundModelWidget::load | ( | QString | fileName | ) | [slot] |
References MSG_ID, setFrom(), QGpCoreTools::tr(), TRACE, and QGpCoreTools::XMLHeader::xml_restoreFile().
{ TRACE; if(fileName.isEmpty()) { fileName=Message::getOpenFileName(tr("Load parameterization"), tr("Dinver parameters (*.param);;" "Dinver environment (*.dinver)")); } if(fileName.length() > 0) { ParamGroundModel p; XMLVirtualPlugin plugin(&p, "DispersionCurve"); XMLDinverHeader hdr(&plugin); if(hdr.xml_restoreFile(fileName)==XMLClass::NoError) setFrom(&p); else Message::warning(MSG_ID, tr("Loading parameters"), tr("Error parsing file"), Message::cancel(), true); } }
References profileGeometry, rangeEdited(), setDHLinks(), TRACE, updateSize(), and w.
Referenced by setFrom(), and TargetListWidget::setParamProfiles().
{ TRACE; ParamProfileWidget * w=new ParamProfileWidget(this); connect(w, SIGNAL(sizeChanged()), this, SLOT(updateSize()) ); connect(w, SIGNAL(rangeEdited()), this, SIGNAL(rangeEdited()) ); profileGeometry->insertWidget(profileGeometry->count()-1, w); connect(w, SIGNAL(updateDHLinks()), this, SLOT(setDHLinks()) ); updateSize(); w->show(); return w; }
References DinverDCCore::ParamGroundModel::addProfile(), customConditions, modelSheet, DinverDCCore::ParamGroundModel::setCustomConditions(), and TRACE.
Referenced by DCPlugin::initForward(), save(), DCPlugin::setCurrentForward(), and DCPlugin::xml_writeChildren().
{ TRACE; ParamGroundModel * gm=new ParamGroundModel; QList<ParamProfileWidget *> objList=modelSheet->widget() ->findChildren<ParamProfileWidget *>(); for(QList<ParamProfileWidget *>::iterator it=objList.begin();it!=objList.end();++it) { gm->addProfile(( *it) ->paramProfile()); } gm->setCustomConditions(customConditions->text()); return gm; }
void ParamGroundModelWidget::rangeEdited | ( | ) | [signal] |
Referenced by newProfile().
void ParamGroundModelWidget::save | ( | ) | [slot] |
void ParamGroundModelWidget::save | ( | QString | fileName | ) | [slot] |
References MSG_ID, paramGroundModel(), QGpCoreTools::tr(), TRACE, and QGpCoreTools::XMLHeader::xml_saveFile().
{ TRACE; if(fileName.isEmpty()) { fileName=Message::getSaveFileName(tr("Save parameterization"), tr("Dinver parameters (*.param)"), QString::null); } if(fileName.length() > 0) { ParamGroundModel * p=paramGroundModel(); XMLVirtualPlugin plugin(p, "DispersionCurve"); XMLDinverHeader hdr(&plugin); if(hdr.xml_saveFile(fileName)==XMLClass::ErrorFileNotOpen) { Message::warning(MSG_ID, tr("Saving parameters"), tr("Cannot open file for writing"), Message::cancel(), true); } delete p; } }
void ParamGroundModelWidget::setDHLinks | ( | ) | [slot] |
References ParamProfileWidget::interfaces(), modelSheet, ParamProfileWidget::setDHLinks(), and TRACE.
Referenced by newProfile(), and setFrom().
{ TRACE; QList<ParamProfileWidget *> objList=modelSheet->widget() ->findChildren<ParamProfileWidget *>(); for(QList<ParamProfileWidget *>::iterator it=objList.begin();it!=objList.end();++it) { QList<ParamLayerWidget *> layerList; ParamProfileWidget * p=*it; for(QList<ParamProfileWidget *>::iterator it=objList.begin();it!=objList.end();++it) { if( *it!=p) { layerList << ( *it) ->interfaces(); } } p->setDHLinks(layerList); } }
void ParamGroundModelWidget::setEditable | ( | bool | e | ) |
References modelSheet, ParamProfileWidget::setEditable(), and TRACE.
Referenced by DCPlugin::setCurrentForward().
{ TRACE; QList<ParamProfileWidget *> objList=modelSheet->widget() ->findChildren<ParamProfileWidget *>(); for(QList<ParamProfileWidget *>::iterator it=objList.begin();it!=objList.end();++it) { ( *it)->setEditable(e); } }
void ParamGroundModelWidget::setFrom | ( | ParamGroundModel * | gm | ) | [slot] |
References customConditions, DinverDCCore::ParamGroundModel::customConditions(), find(), newProfile(), DinverDCCore::ParamGroundModel::nProfiles(), DinverDCCore::ParamGroundModel::profile(), setDHLinks(), ParamProfileWidget::setFrom(), ParamProfileWidget::setLayerIndex(), ParamProfileWidget::setLinksFrom(), DinverDCCore::ParamProfile::shortName(), TRACE, and updateSize().
Referenced by load(), DCPlugin::setCurrentForward(), DCPlugin::setCurrentGroundModel(), and DCPlugin::xml_polishChild().
{ TRACE; setUpdatesEnabled(false); int nProfiles=gm->nProfiles(); ParamProfile * p; ParamProfileWidget * profileW; for(int i=0; i<nProfiles; i++ ) { p=gm->profile(i); profileW=find(p->shortName()); if( !profileW) profileW=newProfile(); // Each time a layer is modified, all links are automatically updated // disconnect this signal to avoid useless updates disconnect(profileW, SIGNAL(updateDHLinks()), this, SLOT(setDHLinks()) ); profileW->setFrom(p); connect(profileW, SIGNAL(updateDHLinks()), this, SLOT(setDHLinks()) ); } setDHLinks(); for(int i=0; i<nProfiles; i++ ) { p=gm->profile(i); profileW=find(p->shortName()); ASSERT(profileW); profileW->setLayerIndex(); profileW->setLinksFrom(p); } customConditions->setFrom(&gm->customConditions()); QApplication::processEvents(); updateSize(); setUpdatesEnabled(true); }
void ParamGroundModelWidget::showEvent | ( | QShowEvent * | e | ) | [protected, virtual] |
References TRACE, and updateSize().
{ TRACE; updateSize(); }
void ParamGroundModelWidget::updateSize | ( | ) | [slot] |
References profileGeometry, and TRACE.
Referenced by newProfile(), setFrom(), and showEvent().
{ TRACE; profileGeometry->parentWidget() ->adjustSize(); }
ParamSpaceEditor* ParamGroundModelWidget::customConditions |
Referenced by paramGroundModel(), ParamGroundModelWidget(), and setFrom().
QScrollArea* ParamGroundModelWidget::modelSheet |
Referenced by find(), paramGroundModel(), ParamGroundModelWidget(), setDHLinks(), setEditable(), and TargetListWidget::setParamProfiles().
QHBoxLayout* ParamGroundModelWidget::profileGeometry |
Referenced by newProfile(), ParamGroundModelWidget(), and updateSize().
QVBoxLayout* ParamGroundModelWidget::vboxLayout |
Referenced by ParamGroundModelWidget().