1 // Copyright (C) 2016-2021 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 #include "WidgetPresentationParameters.hxx"
25 #include <Basics_Utils.hxx>
31 WidgetPresentationParameters::WidgetPresentationParameters(QWidget* parent)
32 : QWidget(parent), _blockSig(false)
34 _ui.setupUi(this); // To be done first
37 QObject::connect(_ui.comboBoxCompo, SIGNAL(activated(int)),
38 this, SLOT(onComboCompoIndexChanged(int)) );
39 QObject::connect(_ui.comboBoxMesh, SIGNAL(activated(int)),
40 this, SLOT(onComboMeshIndexChanged(int)) );
41 QObject::connect(_ui.comboBoxScalarBarRange, SIGNAL(activated(int)),
42 this, SLOT(onComboScalarBarRangeIndexChanged(int)) );
43 QObject::connect(_ui.comboBoxColorMap, SIGNAL(activated(int)),
44 this, SLOT(onComboColorMapIndexChanged(int)) );
45 QObject::connect(_ui.comboBoxSliceOrient, SIGNAL(activated(int)),
46 this, SLOT(onComboOrientIndexChanged(int)) );
47 QObject::connect(_ui.comboBoxIntegrDir, SIGNAL(activated(int)),
48 this, SLOT(onComboIntegrDirIndexChanged(int)) );
49 QObject::connect(_ui.comboBoxContComp, SIGNAL(activated(int)),
50 this, SLOT(onComboContCompIndexChanged(int)) );
51 QObject::connect(_ui.spinBox, SIGNAL(editingFinished()),
52 this, SLOT(onSpinBoxEditingFinished()) );
53 QObject::connect(_ui.checkBoxShowScalarBar, SIGNAL(stateChanged(int)),
54 this, SLOT(onCheckboxScalarBarVisibilityChanged(int)));
55 QObject::connect(_ui.checkBoxCustomRange, SIGNAL(stateChanged(int)),
56 this, SLOT(onCheckboxCustomRangeChanged(int)));
57 QObject::connect(_ui.checkBoxScaleFactor, SIGNAL(stateChanged(int)),
58 this, SLOT(onCheckboxScaleFactorChanged(int)));
59 QObject::connect(_ui.checkBoxScaleFactor, SIGNAL(stateChanged(int)),
60 this, SLOT(onCheckboxCustomScaleFactorChanged(int)));
61 QObject::connect(_ui.spinCustomRangeMin, SIGNAL(editingFinished()),
62 this, SLOT(onSpinboxCustomRangeChanged()));
63 QObject::connect(_ui.spinCustomRangeMax, SIGNAL(editingFinished()),
64 this, SLOT(onSpinboxCustomRangeChanged()));
65 QObject::connect(_ui.spinScaleFactor, SIGNAL(editingFinished()),
66 this, SLOT(onSpinboxScaleFactorChanged()));
67 QObject::connect(_ui.checkBoxHideDataOutsideCR, SIGNAL(stateChanged(int)),
68 this, SLOT(onCheckboxHideDataOutsideCustomRangeChanged(int)));
69 QObject::connect(_ui.spinNormalX, SIGNAL(editingFinished()),
70 this, SLOT(onSpinNormalEditingFinished()) );
71 QObject::connect(_ui.spinNormalY, SIGNAL(editingFinished()),
72 this, SLOT(onSpinNormalEditingFinished()) );
73 QObject::connect(_ui.spinNormalZ, SIGNAL(editingFinished()),
74 this, SLOT(onSpinNormalEditingFinished()) );
75 QObject::connect(_ui.spinPoint1_X, SIGNAL(editingFinished()),
76 this, SLOT(onSpinCutPoint1EditingFinished()) );
77 QObject::connect(_ui.spinPoint1_Y, SIGNAL(editingFinished()),
78 this, SLOT(onSpinCutPoint1EditingFinished()) );
79 QObject::connect(_ui.spinPoint1_Z, SIGNAL(editingFinished()),
80 this, SLOT(onSpinCutPoint1EditingFinished()) );
81 QObject::connect(_ui.spinPoint2_X, SIGNAL(editingFinished()),
82 this, SLOT(onSpinCutPoint2EditingFinished()) );
83 QObject::connect(_ui.spinPoint2_Y, SIGNAL(editingFinished()),
84 this, SLOT(onSpinCutPoint2EditingFinished()) );
85 QObject::connect(_ui.spinPoint2_Z, SIGNAL(editingFinished()),
86 this, SLOT(onSpinCutPoint2EditingFinished()) );
87 QObject::connect(_ui.spinPlanePos, SIGNAL(editingFinished()),
88 this, SLOT(onSpinPlanePosEditingFinished()) );
90 // Disable Custom Range Spin boxes
91 _ui.spinCustomRangeMax->setEnabled(false);
92 _ui.spinCustomRangeMin->setEnabled(false);
93 _ui.spinScaleFactor->setEnabled(false);
94 _ui.checkBoxHideDataOutsideCR->setEnabled(false);
97 _ui.spinCustomRangeMin->setRange(std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
98 _ui.spinCustomRangeMax->setRange(std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
100 _ui.spinCustomRangeMin->setDecimals(6);
101 _ui.spinCustomRangeMax->setDecimals(6);
103 _ui.spinNormalX->setRange(0.0, 1.0);
104 _ui.spinNormalY->setRange(0.0, 1.0);
105 _ui.spinNormalZ->setRange(0.0, 1.0);
106 _ui.spinPlanePos->setRange(0.0, 1.0);
110 WidgetPresentationParameters::onComboCompoIndexChanged(int idx)
112 if (!_blockSig) emit comboCompoIndexChanged(idx);
116 WidgetPresentationParameters::onComboOrientIndexChanged(int idx)
118 if (!_blockSig) emit comboOrientIndexChanged(idx);
123 WidgetPresentationParameters::onComboMeshIndexChanged(int idx)
125 if (!_blockSig) emit comboMeshIndexChanged(idx);
129 WidgetPresentationParameters::onComboColorMapIndexChanged(int idx)
131 if (!_blockSig) emit comboColorMapIndexChanged(idx);
135 WidgetPresentationParameters::onComboScalarBarRangeIndexChanged(int idx)
137 if (!_blockSig) emit comboScalarBarRangeIndexChanged(idx);
141 WidgetPresentationParameters::onComboIntegrDirIndexChanged(int idx)
143 if (!_blockSig) emit comboIntegrDirIndexChanged(idx);
147 WidgetPresentationParameters::onComboContCompIndexChanged(int idx)
149 if (!_blockSig) emit comboContCompIndexChanged(idx);
153 WidgetPresentationParameters::onCheckboxScalarBarVisibilityChanged(int flag)
155 if (!_blockSig) emit checkboxScalarBarVisibilityChanged(flag);
159 WidgetPresentationParameters::onCheckboxCustomRangeChanged(int flag)
161 _ui.spinCustomRangeMin->setEnabled(flag);
162 _ui.spinCustomRangeMax->setEnabled(flag);
163 _ui.checkBoxHideDataOutsideCR->setEnabled(flag);
164 _ui.comboBoxScalarBarRange->setEnabled(!flag);
165 if (!_blockSig) emit checkboxCustomRangeChanged(flag);
169 WidgetPresentationParameters::onCheckboxScaleFactorChanged(int flag)
171 _ui.spinScaleFactor->setEnabled(flag);
172 if (!_blockSig) emit checkboxScaleFactorChanged(flag);
176 WidgetPresentationParameters::onSpinboxCustomRangeChanged()
178 if (!_blockSig) emit spinboxCustomRangeChanged(_ui.spinCustomRangeMin->value(),
179 _ui.spinCustomRangeMax->value());
183 WidgetPresentationParameters::onSpinboxScaleFactorChanged()
185 if (!_blockSig) emit spinboxScaleFactorChaged(_ui.spinScaleFactor->value());
189 WidgetPresentationParameters::
190 onCheckboxHideDataOutsideCustomRangeChanged(int flag)
192 if (!_blockSig) emit checkboxHideDataOutsideCustomRangeChanged(flag);
196 WidgetPresentationParameters::
197 onCheckboxCustomScaleFactorChanged(int flag) {
198 if (!_blockSig) emit checkboxCustomScaleFactorChanged(flag);
202 WidgetPresentationParameters::onSpinBoxEditingFinished()
204 if (!_blockSig) emit spinBoxValueChanged(_ui.spinBox->value());
208 WidgetPresentationParameters::onSpinNormalEditingFinished()
210 if (!_blockSig) emit spinNormalValuesChanged(_ui.spinNormalX->value(),
211 _ui.spinNormalY->value(),
212 _ui.spinNormalZ->value());
216 WidgetPresentationParameters::onSpinCutPoint1EditingFinished()
218 if (!_blockSig) emit spinCutPoint1ValuesChanged(_ui.spinPoint1_X->value(),
219 _ui.spinPoint1_Y->value(),
220 _ui.spinPoint1_Z->value());
224 WidgetPresentationParameters::onSpinCutPoint2EditingFinished()
226 if (!_blockSig) emit spinCutPoint2ValuesChanged(_ui.spinPoint2_X->value(),
227 _ui.spinPoint2_Y->value(),
228 _ui.spinPoint2_Z->value());
232 WidgetPresentationParameters::onSpinPlanePosEditingFinished()
234 if (!_blockSig) emit spinPlanePosValueChanged(_ui.spinPlanePos->value());
238 WidgetPresentationParameters::hidePlot3D()
240 _ui.labelCutPlanePosition->hide();
241 _ui.spinPlanePos->hide();
245 WidgetPresentationParameters::hideContourComponent()
247 _ui.labelContourComp->hide();
248 _ui.comboBoxContComp->hide();
252 WidgetPresentationParameters::toggleCommonFieldWidget(bool show)
255 _ui.commonWidget->setEnabled(show);
260 WidgetPresentationParameters::toggleWidget(bool show)
262 toggleCommonFieldWidget(true);
266 _ui.widgetDynamic->hide();
267 setPresName(tr("LAB_DEFAULT_DYN_TITLE").toStdString());
268 // reset colorMap and scalarBarRange:
269 setColorMap(MEDCALC::COLOR_MAP_DEFAULT);
270 setScalarBarRange(MEDCALC::SCALAR_BAR_RANGE_DEFAULT);
274 _ui.widgetDynamic->show();
275 // It is the WidgetHelper responsibility to re-show the widgets it needs
276 _ui.labelCompo->hide();
277 _ui.comboBoxCompo->hide();
278 _ui.labelMeshMode->hide();
279 _ui.comboBoxMesh->hide();
280 _ui.labelSpinBox->hide();
282 _ui.labelSliceOrient->hide();
283 _ui.comboBoxSliceOrient->hide();
284 _ui.labelCutPlaneNormal->hide();
285 _ui.labelCutPlanePosition->hide();
286 _ui.spinNormalX->hide();
287 _ui.spinNormalY->hide();
288 _ui.spinNormalZ->hide();
289 _ui.spinPlanePos->hide();
290 _ui.labelIntegrDir->hide();
291 _ui.comboBoxIntegrDir->hide();
292 _ui.labelPoint1->hide();
293 _ui.spinPoint1_X->hide();
294 _ui.spinPoint1_Y->hide();
295 _ui.spinPoint1_Z->hide();
296 _ui.labelPoint2->hide();
297 _ui.spinPoint2_X->hide();
298 _ui.spinPoint2_Y->hide();
299 _ui.spinPoint2_Z->hide();
300 _ui.labelContourComp->hide();
301 _ui.comboBoxContComp->hide();
302 _ui.checkBoxScaleFactor->hide();
303 _ui.spinScaleFactor->hide();
309 WidgetPresentationParameters::isShown() const
311 return _ui.widgetDynamic->isVisible();
315 WidgetPresentationParameters::getComponent() const
317 if (_ui.comboBoxCompo->count() > 1 && _ui.comboBoxCompo->count() <= 4)
318 if (_ui.comboBoxCompo->currentIndex() == 0) // Euclidean norm
321 return _ui.comboBoxCompo->currentText().toStdString();
325 WidgetPresentationParameters::setComponents(vector<string> compos, int selecIndex)
330 _ui.labelCompo->show();
331 _ui.comboBoxCompo->show();
333 _ui.comboBoxCompo->clear();
334 bool vectorField = (compos.size() > 1 && compos.size() <= 3);
336 _ui.comboBoxCompo->addItem(tr("LAB_EUCLIDEAN_NORM"));
337 for(vector<string>::const_iterator it = compos.begin(); it != compos.end(); ++it)
338 _ui.comboBoxCompo->addItem(QString::fromStdString(*it));
340 _ui.comboBoxCompo->setCurrentIndex(std::max(0, selecIndex-1));
342 _ui.comboBoxCompo->setCurrentIndex(selecIndex);
348 WidgetPresentationParameters::setNbContour(int nbContour)
355 STDLOG("WidgetPresentationParameters::setNbContour(): invalid number of contours!");
359 _ui.labelSpinBox->setText(tr("LAB_NB_CONTOURS").arg(MEDCALC::NB_CONTOURS_MAX));
361 _ui.labelSpinBox->show();
363 _ui.spinBox->setRange(1, MEDCALC::NB_CONTOURS_MAX);
364 _ui.spinBox->setValue(nbContour);
370 WidgetPresentationParameters::setNbSlices(int nbSlices)
377 STDLOG("WidgetPresentationParameters::setNbSlices(): invalid number of slices!");
381 _ui.labelSpinBox->setText(tr("LAB_NB_SLICES").arg(MEDCALC::NB_SLICES_MAX));
382 _ui.labelSpinBox->show();
384 _ui.spinBox->setRange(1, MEDCALC::NB_SLICES_MAX);
385 _ui.spinBox->setValue(nbSlices);
390 int WidgetPresentationParameters::getNbContour() const
392 return _ui.spinBox->value();
395 int WidgetPresentationParameters::getNbSlices() const
397 return _ui.spinBox->value();
402 WidgetPresentationParameters::setScalarBarRange(MEDCALC::ScalarBarRangeType sbrange)
407 if (sbrange == MEDCALC::SCALAR_BAR_ALL_TIMESTEPS)
408 idx = _ui.comboBoxScalarBarRange->findText(tr("LAB_ALL_TIMESTEPS"));
409 else if (sbrange == MEDCALC::SCALAR_BAR_CURRENT_TIMESTEP)
410 idx = _ui.comboBoxScalarBarRange->findText(tr("LAB_CURRENT_TIMESTEP"));
413 _ui.comboBoxScalarBarRange->setCurrentIndex(idx);
414 _ui.checkBoxCustomRange->setChecked(false);
417 if (sbrange == MEDCALC::SCALAR_BAR_CUSTOM_RANGE) {
418 _ui.checkBoxCustomRange->setChecked(true);
420 STDLOG("Strange!! No matching found - unable to set scalar bar range in GUI.");
427 WidgetPresentationParameters::setColorMap(MEDCALC::ColorMapType colorMap)
432 if (colorMap == MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW)
433 idx = _ui.comboBoxColorMap->findText(tr("LAB_BLUE_TO_RED"));
434 else if (colorMap == MEDCALC::COLOR_MAP_COOL_TO_WARM)
435 idx = _ui.comboBoxColorMap->findText(tr("LAB_COOL_TO_WARM"));
439 _ui.comboBoxColorMap->setCurrentIndex(idx);
443 STDLOG("Strange!! No matching found - unable to set color map in GUI.");
450 WidgetPresentationParameters::setMeshMode(MEDCALC::MeshModeType mode)
455 _ui.labelMeshMode->show();
456 _ui.comboBoxMesh->show();
461 case MEDCALC::MESH_MODE_WIREFRAME:
462 idx = _ui.comboBoxMesh->findText(tr("LAB_MESH_WIREFRAME"));
464 case MEDCALC::MESH_MODE_SURFACE:
465 idx = _ui.comboBoxMesh->findText(tr("LAB_MESH_SURFACE"));
467 case MEDCALC::MESH_MODE_SURFACE_EDGES:
468 idx = _ui.comboBoxMesh->findText(tr("LAB_MESH_SURF_EDGES"));
475 _ui.comboBoxMesh->setCurrentIndex(idx);
479 STDLOG("Strange!! No matching found - unable to set mesh mode in GUI.");
486 WidgetPresentationParameters::setIntegrationDir(MEDCALC::IntegrationDirType iDir)
491 _ui.labelIntegrDir->show();
492 _ui.comboBoxIntegrDir->show();
497 case MEDCALC::INTEGRATION_DIR_BOTH:
498 idx = _ui.comboBoxIntegrDir->findText(tr("LAB_INTEGR_DIR_BOTH"));
500 case MEDCALC::INTEGRATION_DIR_FORWARD:
501 idx = _ui.comboBoxIntegrDir->findText(tr("LAB_INTEGR_DIR_FORWARD"));
503 case MEDCALC::INTEGRATION_DIR_BACKWARD:
504 idx = _ui.comboBoxIntegrDir->findText(tr("LAB_INTEGR_DIR_BACKWARD"));
511 _ui.comboBoxIntegrDir->setCurrentIndex(idx);
515 STDLOG("Strange!! No matching found - unable to set integration direction in GUI.");
522 WidgetPresentationParameters::setContourComponents(std::vector<std::string> compos, int selecIndex)
527 _ui.labelContourComp->show();
528 _ui.comboBoxContComp->show();
530 _ui.comboBoxContComp->clear();
531 bool vectorField = (compos.size() > 1 && compos.size() <= 3);
533 _ui.comboBoxContComp->addItem(tr("LAB_EUCLIDEAN_NORM"));
534 for (vector<string>::const_iterator it = compos.begin(); it != compos.end(); ++it)
535 _ui.comboBoxContComp->addItem(QString::fromStdString(*it));
537 _ui.comboBoxContComp->setCurrentIndex(std::max(0, selecIndex - 1));
539 _ui.comboBoxContComp->setCurrentIndex(selecIndex);
545 WidgetPresentationParameters::setSliceOrientation(MEDCALC::SliceOrientationType orient)
550 _ui.labelSliceOrient->show();
551 _ui.comboBoxSliceOrient->show();
556 case MEDCALC::SLICE_NORMAL_TO_X:
557 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_X"));
559 case MEDCALC::SLICE_NORMAL_TO_Y:
560 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_Y"));
562 case MEDCALC::SLICE_NORMAL_TO_Z:
563 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_Z"));
565 case MEDCALC::SLICE_NORMAL_TO_XY:
566 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_XY"));
568 case MEDCALC::SLICE_NORMAL_TO_XZ:
569 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_XZ"));
571 case MEDCALC::SLICE_NORMAL_TO_YZ:
572 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_YZ"));
574 case MEDCALC::SLICE_NORMAL_TO_XYZ:
575 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_XYZ"));
582 _ui.comboBoxSliceOrient->setCurrentIndex(idx);
586 STDLOG("Strange!! No matching found - unable to set slice orientation in GUI.");
593 MEDCALC::SliceOrientationType
594 WidgetPresentationParameters::getSliceOrientation() const
596 QString sbrange = _ui.comboBoxSliceOrient->currentText();
597 if (sbrange == tr("LAB_SLICE_NORMAL_TO_X")) {
598 return MEDCALC::SLICE_NORMAL_TO_X;
600 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_Y")) {
601 return MEDCALC::SLICE_NORMAL_TO_Y;
603 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_Z")) {
604 return MEDCALC::SLICE_NORMAL_TO_Z;
606 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_XY")) {
607 return MEDCALC::SLICE_NORMAL_TO_XY;
609 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_XZ")) {
610 return MEDCALC::SLICE_NORMAL_TO_XZ;
612 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_YZ")) {
613 return MEDCALC::SLICE_NORMAL_TO_YZ;
615 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_XYZ")) {
616 return MEDCALC::SLICE_NORMAL_TO_XYZ;
619 STDLOG("Strange!! No matching found - returning SLICE_NORMAL_TO_X.");
620 return MEDCALC::SLICE_NORMAL_TO_X;
623 MEDCALC::MeshModeType
624 WidgetPresentationParameters::getMeshMode() const
626 QString mesm = _ui.comboBoxMesh->currentText();
627 if (mesm == tr("LAB_MESH_WIREFRAME")) {
628 return MEDCALC::MESH_MODE_WIREFRAME;
630 else if (mesm == tr("LAB_MESH_SURFACE")) {
631 return MEDCALC::MESH_MODE_SURFACE;
633 else if (mesm == tr("LAB_MESH_SURF_EDGES")) {
634 return MEDCALC::MESH_MODE_SURFACE_EDGES;
637 STDLOG("Strange!! No matching found - returning MESH_MODE_WIREFRAME.");
638 return MEDCALC::MESH_MODE_WIREFRAME;
641 MEDCALC::IntegrationDirType
642 WidgetPresentationParameters::getIntegrationDir() const
644 QString iDir = _ui.comboBoxIntegrDir->currentText();
645 if (iDir == tr("LAB_INTEGR_DIR_BOTH")) {
646 return MEDCALC::INTEGRATION_DIR_BOTH;
648 else if (iDir == tr("LAB_INTEGR_DIR_FORWARD")) {
649 return MEDCALC::INTEGRATION_DIR_FORWARD;
651 else if (iDir == tr("LAB_INTEGR_DIR_BACKWARD")) {
652 return MEDCALC::INTEGRATION_DIR_BACKWARD;
655 STDLOG("Strange!! No matching found - returning LAB_INTEGR_DIR_BOTH.");
656 return MEDCALC::INTEGRATION_DIR_BOTH;
660 WidgetPresentationParameters::getContourComponent() const
662 if (_ui.comboBoxContComp->count() > 1 && _ui.comboBoxContComp->count() <= 4)
663 if (_ui.comboBoxContComp->currentIndex() == 0) // Euclidean norm
665 return _ui.comboBoxContComp->currentText().toStdString();
668 MEDCALC::ScalarBarRangeType
669 WidgetPresentationParameters::getScalarBarRange() const
671 if (_ui.checkBoxCustomRange->isChecked()) {
672 return MEDCALC::SCALAR_BAR_CUSTOM_RANGE;
674 QString sbrange = _ui.comboBoxScalarBarRange->currentText();
675 if (sbrange == tr("LAB_ALL_TIMESTEPS")) {
676 return MEDCALC::SCALAR_BAR_ALL_TIMESTEPS;
678 else if (sbrange == tr("LAB_CURRENT_TIMESTEP")) {
679 return MEDCALC::SCALAR_BAR_CURRENT_TIMESTEP;
682 STDLOG("Strange!! No matching found - returning SCALAR_BAR_ALL_TIMESTEPS.");
683 return MEDCALC::SCALAR_BAR_ALL_TIMESTEPS;
687 //WidgetPresentationParameters::getScalarBarTimestep() const
689 // return _ui.doubleSpinBoxTimeStep->value();
693 //WidgetPresentationParameters::getScalarBarMinVal() const
695 // return _ui.doubleSpinBoxMinVal->value();
699 //WidgetPresentationParameters::getScalarBarMaxVal() const
701 // return _ui.doubleSpinBoxMaxVal->value();
704 MEDCALC::ColorMapType
705 WidgetPresentationParameters::getColorMap() const
707 QString colorMap = _ui.comboBoxColorMap->currentText();
708 if (colorMap == tr("LAB_BLUE_TO_RED")) {
709 return MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW;
711 else if (colorMap == tr("LAB_COOL_TO_WARM")) {
712 return MEDCALC::COLOR_MAP_COOL_TO_WARM;
715 STDLOG("Strange!! No matching color map found - returning blue to red.");
716 return MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW;
720 WidgetPresentationParameters::setPresName(const std::string& name)
722 _ui.labelPresName->setText(QString::fromStdString(name));
723 QFont f(_ui.labelPresName->font());
725 _ui.labelPresName->setFont(f);
730 WidgetPresentationParameters::getScalarBarRangeValue(double* arr) const
732 arr[0] = _ui.spinCustomRangeMin->value();
733 arr[1] = _ui.spinCustomRangeMax->value();
736 void WidgetPresentationParameters::setScalarBarRangeValue(double aMin, double aMax) {
738 _ui.spinCustomRangeMin->setValue(aMin);
739 _ui.spinCustomRangeMax->setValue(aMax);
743 void WidgetPresentationParameters::setScaleFactor(double scale) {
747 _ui.checkBoxScaleFactor->show();
748 _ui.spinScaleFactor->show();
750 _ui.spinScaleFactor->setValue(scale);
754 void WidgetPresentationParameters::getNormal(double* arr) const
756 arr[0] = _ui.spinNormalX->value();
757 arr[1] = _ui.spinNormalY->value();
758 arr[2] = _ui.spinNormalZ->value();
762 WidgetPresentationParameters::setNormal(const double normX, const double normY, const double normZ)
765 _ui.labelCutPlaneNormal->show();
766 _ui.spinNormalX->show();
767 _ui.spinNormalY->show();
768 _ui.spinNormalZ->show();
769 _ui.spinNormalX->setValue(normX);
770 _ui.spinNormalY->setValue(normY);
771 _ui.spinNormalZ->setValue(normZ);
775 void WidgetPresentationParameters::getCutPoint1(double* arr) const
777 arr[0] = _ui.spinPoint1_X->value();
778 arr[1] = _ui.spinPoint1_Y->value();
779 arr[2] = _ui.spinPoint1_Z->value();
783 WidgetPresentationParameters::setCutPoint1(const double x, const double y, const double z)
786 _ui.labelPoint1->show();
787 _ui.spinPoint1_X->show();
788 _ui.spinPoint1_Y->show();
789 _ui.spinPoint1_Z->show();
790 _ui.spinPoint1_X->setValue(x);
791 _ui.spinPoint1_Y->setValue(y);
792 _ui.spinPoint1_Z->setValue(z);
796 void WidgetPresentationParameters::getCutPoint2(double* arr) const
798 arr[0] = _ui.spinPoint2_X->value();
799 arr[1] = _ui.spinPoint2_Y->value();
800 arr[2] = _ui.spinPoint2_Z->value();
804 WidgetPresentationParameters::setCutPoint2(const double x, const double y, const double z)
807 _ui.labelPoint2->show();
808 _ui.spinPoint2_X->show();
809 _ui.spinPoint2_Y->show();
810 _ui.spinPoint2_Z->show();
811 _ui.spinPoint2_X->setValue(x);
812 _ui.spinPoint2_Y->setValue(y);
813 _ui.spinPoint2_Z->setValue(z);
817 double WidgetPresentationParameters::getPlanePosition() const
819 return _ui.spinPlanePos->value();
822 void WidgetPresentationParameters::setPlanePosition(double pos)
825 _ui.labelCutPlanePosition->show();
826 _ui.spinPlanePos->show();
827 _ui.spinPlanePos->setValue(pos);
831 bool WidgetPresentationParameters::getScalarBarVisibility() const {
832 return _ui.checkBoxShowScalarBar->isChecked();
835 void WidgetPresentationParameters::setScalarBarVisibility(const bool visibility) {
837 _ui.checkBoxShowScalarBar->setChecked(visibility);
841 bool WidgetPresentationParameters::getHideDataOutsideCustomRange() const {
842 return _ui.checkBoxHideDataOutsideCR->isChecked();
845 void WidgetPresentationParameters::setHideDataOutsideCustomRange(const bool flag) {
847 _ui.checkBoxHideDataOutsideCR->setChecked(flag);
851 void WidgetPresentationParameters::setScaleFactorFlag(const bool flag) {
853 _ui.checkBoxScaleFactor->setChecked(flag);