61 QMessageBox valueErrorBox;
64 valueErrorBox.setText(
"Selected Variable has not enough dimensions.");
67 else if (doubleSpinBoxDim2Start->value() ==
68 doubleSpinBoxDim2Start->maximum())
70 valueErrorBox.setText(
"Lon has invalid extend.");
73 else if (doubleSpinBoxDim1Start->value() ==
74 doubleSpinBoxDim1Start->maximum())
76 valueErrorBox.setText(
"Lat has invalid extend.");
82 this->done(QDialog::Accepted);
102 double firstValue = 0, lastValue = 0;
104 getDimEdges(comboBoxDim1->currentText().toStdString(), size, firstValue,
106 doubleSpinBoxDim1Start->setValue(firstValue);
107 doubleSpinBoxDim1End->setValue(lastValue);
130 double firstValue = 0, lastValue = 0;
132 getDimEdges(comboBoxDim3->currentText().toStdString(), size, firstValue,
134 dateTimeEditDim3->setValue(
static_cast<int>(firstValue));
135 dateTimeEditDim3->setMinimum(
static_cast<int>(firstValue));
136 dateTimeEditDim3->setMaximum(
static_cast<int>(lastValue));
137 lineEditName->setText(
setName());
180 std::array<QComboBox*, 4> dim_box = {
181 {comboBoxDim1, comboBoxDim2, comboBoxDim3, comboBoxDim4}};
183 for (
int i = 0; i < 4; ++i)
186 dim_box[i]->setEnabled(i < dim_count);
190 for (
int i = 0; i < dim_count; ++i)
192 for (
int j = 0; j < dim_count; ++j)
195 QString::fromStdString(
_currentVar.getDim(i).getName()));
198 comboBoxDim1->setCurrentIndex(dim_count - 2);
200 comboBoxDim2->setCurrentIndex(dim_count - 1);
203 dateTimeEditDim3->setEnabled(dim_count > 2);
205 spinBoxDim4->setEnabled(dim_count > 3);
209 comboBoxDim3->setCurrentIndex(0);
213 dateTimeEditDim3->setSingleStep(0);
217 comboBoxDim4->setCurrentIndex(1);
221 spinBoxDim4->setValue(0);
225 double& firstValue,
double& lastValue)
234 if ((tmpVarOfDim.getDimCount()) == 1)
236 size = tmpVarOfDim.getDim(0).getSize();
237 tmpVarOfDim.getVar({0}, {1}, &firstValue);
238 tmpVarOfDim.getVar({size - 1}, {1}, &lastValue);
263 if (comboBoxDim1->currentIndex() > -1)
266 _currentFile.getVar(comboBoxDim1->currentText().toStdString());
267 double firstValue = 0, lastValue = 0;
269 getDimEdges(var.getName(), size, firstValue, lastValue);
275 double interval = fabs(lastValue - firstValue);
276 double resolution = (double)interval / (size - 1);
285 double originLon = 0, originLat = 0;
286 double lastLon = 0, lastLat = 0;
287 unsigned sizeLon = 0, sizeLat = 0;
288 std::string
const dim1_name = comboBoxDim1->currentText().toStdString();
289 getDimEdges(dim1_name, sizeLat, originLat, lastLat);
290 std::string
const dim2_name = comboBoxDim2->currentText().toStdString();
291 getDimEdges(dim2_name, sizeLon, originLon, lastLon);
294 std::vector<double> data_array(sizeLat * sizeLon, 0);
296 std::vector<std::size_t> data_origin;
297 std::vector<std::size_t> data_length;
303 data_length.push_back(1);
307 data_origin.push_back(
getDim4());
308 data_length.push_back(1);
312 data_origin.push_back(0);
313 data_origin.push_back(0);
314 data_length.push_back(sizeLat);
315 data_length.push_back(sizeLon);
316 _currentVar.getVar(data_origin, data_length, data_array.data());
319 data_array.begin(), data_array.end(),
320 [](
double const& x) { return x <= -9999; }, -9999);
322 double origin_x = (originLon < lastLon) ? originLon : lastLon;
323 double origin_y = (originLat < lastLat) ? originLat : lastLat;
325 double resolution = (doubleSpinBoxResolution->value());
333 origin, resolution, -9999};
334 if (this->radioMesh->isChecked())
339 if (comboBoxMeshElemType->currentIndex() == 1)
347 if ((comboBoxUseIntensity->currentIndex()) == 1)
356 data_array.data(), header, meshElemType, useIntensity,
361 vtkImageImport* image =
365 QString::fromStdString(this->
getName()));
389 auto* cp_array =
new double[width * height];
391 for (std::size_t i = 0; i < height; i++)
393 for (std::size_t j = 0; j < width; j++)
395 std::size_t old_index((width * height) - (width * (i + 1)));
396 std::size_t new_index(width * i);
397 cp_array[new_index + j] = data[old_index + j];
401 std::size_t length(height * width);
402 for (std::size_t i = 0; i < length; i++)
403 data[i] = cp_array[i];
412 this->label_2->setEnabled(
true);
413 this->label_3->setEnabled(
false);
414 this->comboBoxMeshElemType->setEnabled(
true);
415 this->comboBoxUseIntensity->setEnabled(
false);
419 this->label_2->setEnabled(
false);
420 this->label_3->setEnabled(
true);
421 this->comboBoxMeshElemType->setEnabled(
false);
422 this->comboBoxUseIntensity->setEnabled(
true);