1 #include "DlgInterpolateField.hxx"
2 #include "DatasourceConstants.hxx"
6 #include <QDoubleValidator>
8 DlgInterpolateField::DlgInterpolateField(SALOME_AppStudyEditor * studyEditor,
10 : GenericDialog(parent)
12 ui.setupUi(this->getPanel());
14 _studyEditor = studyEditor;
16 QDoubleValidator* precisionValidator = new QDoubleValidator(1e-15, 1e-1, 1, this);
17 precisionValidator->setNotation(QDoubleValidator::ScientificNotation);
18 this->ui.lineEditPrecision->setValidator(precisionValidator);
19 this->ui.lineEditPrecision->setText("1e-12");
21 QDoubleValidator* defaultValueValidator = new QDoubleValidator(this);
22 this->ui.lineEditDefaultValue->setValidator(defaultValueValidator);
23 this->ui.lineEditDefaultValue->setText("0");
25 QStringList intersectionTypes;
26 intersectionTypes << "Triangulation" << "Convex" << "Geometric2D" << "PointLocator" << "Barycentric" << "BarycentricGeo2D";
27 this->ui.comboBoxIntersType->addItems(intersectionTypes);
30 methods << "P0P0" << "P0P1" << "P1P0" << "P1P1" << "P2P0";
31 this->ui.comboBoxMethod->addItems(methods);
34 natures << "NoNature" << "IntensiveMaximum" << "ExtensiveMaximum" << "ExtensiveConservation" << "IntensiveConservation";
35 this->ui.comboBoxNature->addItems(natures);
37 connect(this->ui.btnSelectMesh, SIGNAL(clicked()), this, SLOT(OnSelectMesh()));
38 this->setWindowTitle("Field interpolation");
39 this->getPanel()->adjustSize();
43 /** This reset the dialog for a new selection */
44 void DlgInterpolateField::setFieldId(int fieldId) {
47 this->ui.txtMesh->setText(QString(""));
49 int DlgInterpolateField::getFieldId() {
53 int DlgInterpolateField::getMeshId() {
57 double DlgInterpolateField::getPrecision() {
58 return this->ui.lineEditPrecision->text().toDouble();
61 double DlgInterpolateField::getDefaultValue() {
62 return this->ui.lineEditDefaultValue->text().toDouble();
65 bool DlgInterpolateField::getReverse() {
66 return this->ui.checkBoxReverse->isChecked();
69 std::string DlgInterpolateField::getIntersectionType() {
70 return this->ui.comboBoxIntersType->currentText().toStdString();
73 std::string DlgInterpolateField::getMethod() {
74 return this->ui.comboBoxMethod->currentText().toStdString();
77 std::string DlgInterpolateField::getFieldNature() {
78 return this->ui.comboBoxNature->currentText().toStdString();
81 void DlgInterpolateField::accept() {
82 if ( _meshId == -1 ) {
83 QMessageBox::warning(this,
84 tr("Data verification"),
85 tr("You must select a mesh in the explorer and clic the button Mesh"));
88 GenericDialog::accept();
89 emit inputValidated();
93 void DlgInterpolateField::OnSelectMesh() {
94 SALOME_StudyEditor::SObjectList * listOfSObject = _studyEditor->getSelectedObjects();
95 if ( listOfSObject->size() > 0 ) {
96 SALOMEDS::SObject_var soMesh = listOfSObject->at(0);
97 // _GBO_ TODO: we should test here if it is a mesh (attribute in
99 _meshId = _studyEditor->getParameterInt(soMesh,OBJECT_ID);
100 const char * meshname = _studyEditor->getName(soMesh);
101 this->ui.txtMesh->setText(QString(meshname));