diff --git a/.gitignore b/.gitignore index f225bc9..aab0c8f 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,7 @@ packages/Release/ packages/x64/ bin/x64/Release/qgis_umesh.lib packages/qgis_umesh.vcxproj.user +*.bak +*.obj +packages/generated/moc_create_vector_layers.cpp +packages/generated/moc_handle_vector_layers.cpp diff --git a/dispatch_release_dll_to_qgis.bat b/dispatch_release_dll_to_qgis.bat index 4f15f82..fef3228 100644 --- a/dispatch_release_dll_to_qgis.bat +++ b/dispatch_release_dll_to_qgis.bat @@ -6,8 +6,8 @@ copy .\doc\qgis_umesh_installation.pdf "c:\Program Files\Deltares\qgis_umesh\do copy .\icons\*.* "c:\Program Files\Deltares\qgis_umesh\icons\*.*" rem copy to Bulletin -copy "c:\OSGeo4W\apps\qgis\plugins\qgis_umesh.dll" n:\Deltabox\Bulletin\mooiman\programs\QGIS_3.38.03_qgis_umesh\*.* -copy .\doc\qgis_umesh_um.pdf n:\Deltabox\Bulletin\mooiman\programs\QGIS_3.38.03_qgis_umesh\doc\*.* -copy .\doc\qgis_umesh_installation.pdf n:\Deltabox\Bulletin\mooiman\programs\QGIS_3.38.03_qgis_umesh\doc\*.* -copy .\icons\*.* n:\Deltabox\Bulletin\mooiman\programs\QGIS_3.38.03_qgis_umesh\icons\*.* +copy "c:\OSGeo4W\apps\qgis\plugins\qgis_umesh.dll" n:\Deltabox\Bulletin\mooiman\programs\QGIS_3.34.00_qgis_umesh\*.* +copy .\doc\qgis_umesh_um.pdf n:\Deltabox\Bulletin\mooiman\programs\QGIS_3.34.00_qgis_umesh\doc\*.* +copy .\doc\qgis_umesh_installation.pdf n:\Deltabox\Bulletin\mooiman\programs\QGIS_3.34.00_qgis_umesh\doc\*.* +copy .\icons\*.* n:\Deltabox\Bulletin\mooiman\programs\QGIS_3.34.00_qgis_umesh\icons\*.* rem pause diff --git a/packages/Debug/vc142.pdb b/packages/Debug/vc142.pdb new file mode 100644 index 0000000..15c047f Binary files /dev/null and b/packages/Debug/vc142.pdb differ diff --git a/packages/src/map_time_manager_window.cpp b/packages/src/map_time_manager_window.cpp index 1214453..432d031 100644 --- a/packages/src/map_time_manager_window.cpp +++ b/packages/src/map_time_manager_window.cpp @@ -137,8 +137,8 @@ void MapTimeManagerWindow::create_window() QFrame* line = new QFrame(); line->setFrameShape(QFrame::HLine); line->setFrameShadow(QFrame::Sunken); - vl->addWidget(line); vl->addWidget(m_slider); + vl->addWidget(line); // Selection of parameter and/or vector @@ -687,7 +687,7 @@ QVBoxLayout * MapTimeManagerWindow::create_scalar_selection_1d_2d_3d() { m_layerLabelPrefix = new QLabel(tr("Layer")); m_layerLabelSuffix = new QLabel(tr("[0,0]")); - m_layerLabelSuffix->setText(tr("z/sigma: %1").arg(var->layer_center[var->nr_hydro_layers - 1])); + m_layerLabelSuffix->setText(tr("[1,%1]").arg(var->layer_center[var->nr_hydro_layers - 1])); m_sb_hydro_layer = spinbox_layer(var->nr_hydro_layers); connect(m_sb_hydro_layer, SIGNAL(valueChanged(int)), this, SLOT(spinbox_value_changed(int))); @@ -768,7 +768,7 @@ QVBoxLayout * MapTimeManagerWindow::create_vector_selection_2d_3d() struct _variable * var = m_vars->variable[strings[3].toInt()]; m_layerLabelPrefix_vec = new QLabel(tr("Layer")); m_layerLabelSuffix_vec = new QLabel(tr("[0,0]")); - m_layerLabelSuffix_vec->setText(tr("z/sigma: %1").arg(var->layer_center[var->nr_hydro_layers - 1])); + m_layerLabelSuffix_vec->setText(tr("[1,%1]").arg(var->layer_center[var->nr_hydro_layers - 1])); m_sb_hydro_layer_vec = spinbox_layer(var->nr_hydro_layers); connect(m_sb_hydro_layer_vec, SIGNAL(valueChanged(int)), this, SLOT(spinbox_vec_value_changed(int))); @@ -1220,7 +1220,7 @@ void MapTimeManagerWindow::cb_clicked_3d(int item) m_sb_hydro_layer->setValue(var->nr_hydro_layers); } int i_lay = m_sb_hydro_layer->value(); - m_layerLabelSuffix->setText(tr("z/sigma: %1").arg(var->layer_center[i_lay - 1])); + m_layerLabelSuffix->setText(tr("[1,%1]").arg(var->layer_center[i_lay - 1])); } if (var->nr_bed_layers > 0) @@ -1311,7 +1311,7 @@ void MapTimeManagerWindow::cb_clicked_vec_3d(int item) m_sb_hydro_layer_vec->setValue(var->nr_hydro_layers); } int i_lay = m_sb_hydro_layer_vec->value(); - m_layerLabelSuffix_vec->setText(tr("z/sigma: %1").arg(var->layer_center[i_lay - 1])); + m_layerLabelSuffix_vec->setText(tr("[1,%1]").arg(var->layer_center[i_lay - 1])); m_MyCanvas->reset_min_max(); if (!m_show_map_vector_3d) @@ -1424,20 +1424,20 @@ void MapTimeManagerWindow::draw_time_dependent_data_1d(QComboBox * cb, int item) // begin HACK edge vs contact if (location == "edge" || location == "contact") { - var->draw = true;; + var->draw = true; int i = m_q_times.indexOf(curr_date_time->dateTime()); m_MyCanvas->set_current_step(i); m_MyCanvas->draw_all(); } else if (location == "face") { - var->draw = true;; + var->draw = true; //int i = m_q_times.indexOf(curr_date_time->dateTime()); m_MyCanvas->draw_all(); } else if (location == "node") { - var->draw = true;; + var->draw = true; int i = m_q_times.indexOf(curr_date_time->dateTime()); m_MyCanvas->set_current_step(i); m_MyCanvas->draw_all(); @@ -1567,13 +1567,14 @@ void MapTimeManagerWindow::spinbox_value_changed(int i_lay) struct _variable * var = m_vars->variable[jj]; if (var->nr_hydro_layers > 0) { - m_layerLabelSuffix->setText(tr("z/sigma: %1").arg(var->layer_center[i_lay - 1])); + m_layerLabelSuffix->setText(tr("[1,%1]").arg(var->layer_center[i_lay - 1])); } if (var->nr_bed_layers > 0) { m_layerLabelSuffix->setText(tr("Bed layer: %1").arg(var->layer_center[i_lay - 1])); } m_show_check_3d->setChecked(false); + m_show_check_3d->setChecked(true); return; } @@ -1585,7 +1586,9 @@ void MapTimeManagerWindow::spinbox_vec_value_changed(int i_lay) int jj = slist[3].toInt(); struct _variable * var = m_vars->variable[jj]; - m_layerLabelSuffix_vec->setText(tr("z/sigma: %1").arg(var->layer_center[i_lay - 1])); + m_layerLabelSuffix_vec->setText(tr("[1,%1]").arg(var->layer_center[i_lay - 1])); + m_show_check_vec_3d->setChecked(false); + m_show_check_vec_3d->setChecked(true); return; } void MapTimeManagerWindow::clicked_current_view() diff --git a/packages/src/ugrid.cpp b/packages/src/ugrid.cpp index a92d8c6..c543ad5 100644 --- a/packages/src/ugrid.cpp +++ b/packages/src/ugrid.cpp @@ -806,17 +806,41 @@ long UGRID::read_variables() m_mesh_vars->variable[m_nr_mesh_var - 1]->nr_hydro_layers = nr_layers; std::string name = m_map_dim_name["zs_name_layer"]; - int ii; - status = nc_inq_varid(m_ncid, name.c_str(), &ii); + int var_id; + status = nc_inq_varid(m_ncid, name.c_str(), &var_id); if (status == NC_NOERR) { - double * values_c = (double *)malloc(sizeof(double) * nr_layers); - status = nc_get_var_double(this->m_ncid, ii, values_c); std::vector values; values.reserve(nr_layers); + int dim_of_var; + status = nc_inq_varndims(this->m_ncid, var_id, &dim_of_var); for (int j = 0; j < nr_layers; j++) { - values.push_back(*(values_c + j)); + values.push_back(j + 1); + } + if (dim_of_var != 1) + { + } + if (false) // janm + { + if (nc_type == NC_DOUBLE) + { + double* values_c = (double*)malloc(sizeof(double) * nr_layers); + status = nc_get_var_double(this->m_ncid, var_id, values_c); + for (int j = 0; j < nr_layers; j++) + { + values.push_back(*(values_c + j)); + } + } + else if (nc_type == NC_FLOAT) + { + float* values_c = (float*)malloc(sizeof(float) * nr_layers); + status = nc_get_var_float(this->m_ncid, var_id, values_c); + for (int j = 0; j < nr_layers; j++) + { + values.push_back(*(values_c + j)); + } + } } m_mesh_vars->variable[m_nr_mesh_var - 1]->layer_center = values; } @@ -831,17 +855,38 @@ long UGRID::read_variables() m_mesh_vars->variable[m_nr_mesh_var - 1]->nr_hydro_layers = nr_layers; std::string name = m_map_dim_name["zs_name_interface"]; - int ii; - status = nc_inq_varid(m_ncid, name.c_str(), &ii); + int var_id; + status = nc_inq_varid(m_ncid, name.c_str(), &var_id); if (status == NC_NOERR) { - double* values_c = (double*)malloc(sizeof(double) * nr_layers); - status = nc_get_var_double(this->m_ncid, ii, values_c); std::vector values; values.reserve(nr_layers); + int dim_of_var; + status = nc_inq_varndims(this->m_ncid, var_id, &dim_of_var); for (int j = 0; j < nr_layers; j++) { - values.push_back(*(values_c + j)); + values.push_back(j + 1); + } + if (false) // janm + { + if (nc_type == NC_DOUBLE) + { + double* values_c = (double*)malloc(sizeof(double) * nr_layers); + status = nc_get_var_double(this->m_ncid, var_id, values_c); + for (int j = 0; j < nr_layers; j++) + { + values.push_back(*(values_c + j)); + } + } + else if (nc_type == NC_FLOAT) + { + float* values_c = (float*)malloc(sizeof(float) * nr_layers); + status = nc_get_var_float(this->m_ncid, var_id, values_c); + for (int j = 0; j < nr_layers; j++) + { + values.push_back(*(values_c + j)); + } + } } m_mesh_vars->variable[m_nr_mesh_var - 1]->layer_center = values; }