void FEMConditionSetupDialog::directButton_pressed() { if (this->_mesh == nullptr) { const GeoLib::Polyline* line = dynamic_cast<const GeoLib::Polyline*>(_cond.getGeoObj()); const std::vector<size_t> nodes = _cond.getDisNodes(); const std::vector<double> values = _cond.getDisValues(); LinearEditDialog dlg(*line, nodes, values); connect(&dlg, SIGNAL(transmitDisValues(std::vector< std::pair<std::size_t,double> >)), this, SLOT(addDisValues(std::vector< std::pair<std::size_t,double> >))); dlg.exec(); } else { std::vector<MeshLib::Mesh*> msh_vec; msh_vec.push_back( const_cast<MeshLib::Mesh*>(this->_mesh) ); CondFromRasterDialog dlg(msh_vec); //connect(&dlg, SIGNAL(directNodesWritten(std::string)), this, SLOT(direct_path_changed(std::string))); connect(&dlg, SIGNAL(transmitDisValues(std::vector< std::pair<std::size_t,double> >)), this, SLOT(addDisValues(std::vector< std::pair<std::size_t,double> >))); dlg.exec(); } }
void CondFromRasterDialog::accept() { std::string mesh_name (this->meshBox->currentText().toStdString()); std::string raster_name (this->rasterEdit->text().toStdString()); double scaling_factor = this->scalingEdit->text().toDouble(); std::vector< std::pair<size_t,double> > direct_values; if (mesh_name.empty()) { OGSError::box("No mesh selected."); return; } if (raster_name.empty()) { OGSError::box("No raster selected."); return; } MeshLib::Mesh* mesh (NULL); for (size_t i=0; i<_msh_vec.size(); i++) if (_msh_vec[i]->getName().compare(mesh_name) == 0) { mesh = _msh_vec[i]; break; } if (this->directButton->isChecked()) { DirectConditionGenerator dcg; direct_values = dcg.directToSurfaceNodes(*mesh, raster_name); //dcg.writeToFile(direct_node_name); } else { if (scaling_factor <= 0) { OGSError::box("No valid scaling factor given."); return; } MeshLib::Mesh* new_mesh = const_cast<MeshLib::Mesh*>(mesh); DirectConditionGenerator dcg; direct_values = dcg.directWithSurfaceIntegration(*new_mesh, raster_name, scaling_factor); //dcg.writeToFile(direct_node_name); } //emit directNodesWritten(direct_node_name); emit transmitDisValues(direct_values); this->done(QDialog::Accepted); }
void LinearEditDialog::accept() { std::vector< std::pair<size_t,double> > linear_values; size_t nRows = tableWidget->rowCount(); for (size_t i=0; i<nRows; i++) { QString row_text (tableWidget->item(i,0)->text()); if (row_text.length()>0) linear_values.push_back( std::pair<size_t, double>(i, row_text.toDouble()) ); } emit transmitDisValues(linear_values); this->done(QDialog::Accepted); }