54 QMessageBox valueErrorBox;
57 valueErrorBox.setText(
"Selected Variable has not enough dimensions.");
60 else if (doubleSpinBoxDim2Start->value() ==
61 doubleSpinBoxDim2Start->maximum())
63 valueErrorBox.setText(
"Lon has invalid extend.");
66 else if (doubleSpinBoxDim1Start->value() ==
67 doubleSpinBoxDim1Start->maximum())
69 valueErrorBox.setText(
"Lat has invalid extend.");
75 this->done(QDialog::Accepted);
95 double firstValue = 0, lastValue = 0;
97 getDimEdges(comboBoxDim1->currentText().toStdString(), size, firstValue,
99 doubleSpinBoxDim1Start->setValue(firstValue);
100 doubleSpinBoxDim1End->setValue(lastValue);
123 double firstValue = 0, lastValue = 0;
125 getDimEdges(comboBoxDim3->currentText().toStdString(), size, firstValue,
127 dateTimeEditDim3->setValue(
static_cast<int>(firstValue));
128 dateTimeEditDim3->setMinimum(
static_cast<int>(firstValue));
129 dateTimeEditDim3->setMaximum(
static_cast<int>(lastValue));
130 lineEditName->setText(
setName());
173 std::array<QComboBox*, 4> dim_box = {
174 {comboBoxDim1, comboBoxDim2, comboBoxDim3, comboBoxDim4}};
176 for (
int i = 0; i < 4; ++i)
179 dim_box[i]->setEnabled(i < dim_count);
183 for (
int i = 0; i < dim_count; ++i)
185 for (
int j = 0; j < dim_count; ++j)
188 QString::fromStdString(
_currentVar.getDim(i).getName()));
191 comboBoxDim1->setCurrentIndex(dim_count - 2);
193 comboBoxDim2->setCurrentIndex(dim_count - 1);
196 dateTimeEditDim3->setEnabled(dim_count > 2);
198 spinBoxDim4->setEnabled(dim_count > 3);
202 comboBoxDim3->setCurrentIndex(0);
206 dateTimeEditDim3->setSingleStep(0);
210 comboBoxDim4->setCurrentIndex(1);
214 spinBoxDim4->setValue(0);
218 double& firstValue,
double& lastValue)
227 if ((tmpVarOfDim.getDimCount()) == 1)
229 size = tmpVarOfDim.getDim(0).getSize();
230 tmpVarOfDim.getVar({0}, {1}, &firstValue);
231 tmpVarOfDim.getVar({size - 1}, {1}, &lastValue);
256 if (comboBoxDim1->currentIndex() > -1)
259 _currentFile.getVar(comboBoxDim1->currentText().toStdString());
260 double firstValue = 0, lastValue = 0;
262 getDimEdges(var.getName(), size, firstValue, lastValue);
268 double interval = fabs(lastValue - firstValue);
269 double resolution = (double)interval / (size - 1);
278 double originLon = 0, originLat = 0;
279 double lastLon = 0, lastLat = 0;
280 unsigned sizeLon = 0, sizeLat = 0;
281 std::string
const dim1_name = comboBoxDim1->currentText().toStdString();
282 getDimEdges(dim1_name, sizeLat, originLat, lastLat);
283 std::string
const dim2_name = comboBoxDim2->currentText().toStdString();
284 getDimEdges(dim2_name, sizeLon, originLon, lastLon);
287 std::vector<double> data_array(sizeLat * sizeLon, 0);
289 std::vector<std::size_t> data_origin;
290 std::vector<std::size_t> data_length;
296 data_length.push_back(1);
300 data_origin.push_back(
getDim4());
301 data_length.push_back(1);
305 data_origin.push_back(0);
306 data_origin.push_back(0);
307 data_length.push_back(sizeLat);
308 data_length.push_back(sizeLon);
309 _currentVar.getVar(data_origin, data_length, data_array.data());
312 data_array.begin(), data_array.end(),
313 [](
double const& x) { return x <= -9999; }, -9999);
315 double origin_x = (originLon < lastLon) ? originLon : lastLon;
316 double origin_y = (originLat < lastLat) ? originLat : lastLat;
318 double resolution = (doubleSpinBoxResolution->value());
326 origin, resolution, -9999};
327 if (this->radioMesh->isChecked())
332 if (comboBoxMeshElemType->currentIndex() == 1)
340 if ((comboBoxUseIntensity->currentIndex()) == 1)
349 data_array.data(), header, meshElemType, useIntensity,
354 vtkImageImport* image =
358 QString::fromStdString(this->
getName()));
382 auto* cp_array =
new double[width * height];
384 for (std::size_t i = 0; i < height; i++)
386 for (std::size_t j = 0; j < width; j++)
388 std::size_t old_index((width * height) - (width * (i + 1)));
389 std::size_t new_index(width * i);
390 cp_array[new_index + j] = data[old_index + j];
394 std::size_t length(height * width);
395 for (std::size_t i = 0; i < length; i++)
396 data[i] = cp_array[i];
405 this->label_2->setEnabled(
true);
406 this->label_3->setEnabled(
false);
407 this->comboBoxMeshElemType->setEnabled(
true);
408 this->comboBoxUseIntensity->setEnabled(
false);
412 this->label_2->setEnabled(
false);
413 this->label_3->setEnabled(
true);
414 this->comboBoxMeshElemType->setEnabled(
false);
415 this->comboBoxUseIntensity->setEnabled(
true);