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());
99 _ui.spinNormalX->setRange(0.0, 1.0);
100 _ui.spinNormalY->setRange(0.0, 1.0);
101 _ui.spinNormalZ->setRange(0.0, 1.0);
102 _ui.spinPlanePos->setRange(0.0, 1.0);
106 WidgetPresentationParameters::onComboCompoIndexChanged(int idx)
108 if (!_blockSig) emit comboCompoIndexChanged(idx);
112 WidgetPresentationParameters::onComboOrientIndexChanged(int idx)
114 if (!_blockSig) emit comboOrientIndexChanged(idx);
119 WidgetPresentationParameters::onComboMeshIndexChanged(int idx)
121 if (!_blockSig) emit comboMeshIndexChanged(idx);
125 WidgetPresentationParameters::onComboColorMapIndexChanged(int idx)
127 if (!_blockSig) emit comboColorMapIndexChanged(idx);
131 WidgetPresentationParameters::onComboScalarBarRangeIndexChanged(int idx)
133 if (!_blockSig) emit comboScalarBarRangeIndexChanged(idx);
137 WidgetPresentationParameters::onComboIntegrDirIndexChanged(int idx)
139 if (!_blockSig) emit comboIntegrDirIndexChanged(idx);
143 WidgetPresentationParameters::onComboContCompIndexChanged(int idx)
145 if (!_blockSig) emit comboContCompIndexChanged(idx);
149 WidgetPresentationParameters::onCheckboxScalarBarVisibilityChanged(int flag)
151 if (!_blockSig) emit checkboxScalarBarVisibilityChanged(flag);
155 WidgetPresentationParameters::onCheckboxCustomRangeChanged(int flag)
157 _ui.spinCustomRangeMin->setEnabled(flag);
158 _ui.spinCustomRangeMax->setEnabled(flag);
159 _ui.checkBoxHideDataOutsideCR->setEnabled(flag);
160 _ui.comboBoxScalarBarRange->setEnabled(!flag);
161 if (!_blockSig) emit checkboxCustomRangeChanged(flag);
165 WidgetPresentationParameters::onCheckboxScaleFactorChanged(int flag)
167 _ui.spinScaleFactor->setEnabled(flag);
168 if (!_blockSig) emit checkboxScaleFactorChanged(flag);
172 WidgetPresentationParameters::onSpinboxCustomRangeChanged()
174 if (!_blockSig) emit spinboxCustomRangeChanged(_ui.spinCustomRangeMin->value(),
175 _ui.spinCustomRangeMax->value());
179 WidgetPresentationParameters::onSpinboxScaleFactorChanged()
181 if (!_blockSig) emit spinboxScaleFactorChaged(_ui.spinScaleFactor->value());
185 WidgetPresentationParameters::
186 onCheckboxHideDataOutsideCustomRangeChanged(int flag)
188 if (!_blockSig) emit checkboxHideDataOutsideCustomRangeChanged(flag);
192 WidgetPresentationParameters::
193 onCheckboxCustomScaleFactorChanged(int flag) {
194 if (!_blockSig) emit checkboxCustomScaleFactorChanged(flag);
198 WidgetPresentationParameters::onSpinBoxEditingFinished()
200 if (!_blockSig) emit spinBoxValueChanged(_ui.spinBox->value());
204 WidgetPresentationParameters::onSpinNormalEditingFinished()
206 if (!_blockSig) emit spinNormalValuesChanged(_ui.spinNormalX->value(),
207 _ui.spinNormalY->value(),
208 _ui.spinNormalZ->value());
212 WidgetPresentationParameters::onSpinCutPoint1EditingFinished()
214 if (!_blockSig) emit spinCutPoint1ValuesChanged(_ui.spinPoint1_X->value(),
215 _ui.spinPoint1_Y->value(),
216 _ui.spinPoint1_Z->value());
220 WidgetPresentationParameters::onSpinCutPoint2EditingFinished()
222 if (!_blockSig) emit spinCutPoint2ValuesChanged(_ui.spinPoint2_X->value(),
223 _ui.spinPoint2_Y->value(),
224 _ui.spinPoint2_Z->value());
228 WidgetPresentationParameters::onSpinPlanePosEditingFinished()
230 if (!_blockSig) emit spinPlanePosValueChanged(_ui.spinPlanePos->value());
234 WidgetPresentationParameters::hidePlot3D()
236 _ui.labelCutPlanePosition->hide();
237 _ui.spinPlanePos->hide();
241 WidgetPresentationParameters::hideContourComponent()
243 _ui.labelContourComp->hide();
244 _ui.comboBoxContComp->hide();
248 WidgetPresentationParameters::toggleCommonFieldWidget(bool show)
251 _ui.commonWidget->setEnabled(show);
256 WidgetPresentationParameters::toggleWidget(bool show)
258 toggleCommonFieldWidget(true);
262 _ui.widgetDynamic->hide();
263 setPresName(tr("LAB_DEFAULT_DYN_TITLE").toStdString());
264 // reset colorMap and scalarBarRange:
265 setColorMap(MEDCALC::COLOR_MAP_DEFAULT);
266 setScalarBarRange(MEDCALC::SCALAR_BAR_RANGE_DEFAULT);
270 _ui.widgetDynamic->show();
271 // It is the WidgetHelper responsibility to re-show the widgets it needs
272 _ui.labelCompo->hide();
273 _ui.comboBoxCompo->hide();
274 _ui.labelMeshMode->hide();
275 _ui.comboBoxMesh->hide();
276 _ui.labelSpinBox->hide();
278 _ui.labelSliceOrient->hide();
279 _ui.comboBoxSliceOrient->hide();
280 _ui.labelCutPlaneNormal->hide();
281 _ui.labelCutPlanePosition->hide();
282 _ui.spinNormalX->hide();
283 _ui.spinNormalY->hide();
284 _ui.spinNormalZ->hide();
285 _ui.spinPlanePos->hide();
286 _ui.labelIntegrDir->hide();
287 _ui.comboBoxIntegrDir->hide();
288 _ui.labelPoint1->hide();
289 _ui.spinPoint1_X->hide();
290 _ui.spinPoint1_Y->hide();
291 _ui.spinPoint1_Z->hide();
292 _ui.labelPoint2->hide();
293 _ui.spinPoint2_X->hide();
294 _ui.spinPoint2_Y->hide();
295 _ui.spinPoint2_Z->hide();
296 _ui.labelContourComp->hide();
297 _ui.comboBoxContComp->hide();
298 _ui.checkBoxScaleFactor->hide();
299 _ui.spinScaleFactor->hide();
305 WidgetPresentationParameters::isShown() const
307 return _ui.widgetDynamic->isVisible();
311 WidgetPresentationParameters::getComponent() const
313 if (_ui.comboBoxCompo->count() > 1 && _ui.comboBoxCompo->count() <= 4)
314 if (_ui.comboBoxCompo->currentIndex() == 0) // Euclidean norm
317 return _ui.comboBoxCompo->currentText().toStdString();
321 WidgetPresentationParameters::setComponents(vector<string> compos, int selecIndex)
326 _ui.labelCompo->show();
327 _ui.comboBoxCompo->show();
329 _ui.comboBoxCompo->clear();
330 bool vectorField = (compos.size() > 1 && compos.size() <= 3);
332 _ui.comboBoxCompo->addItem(tr("LAB_EUCLIDEAN_NORM"));
333 for(vector<string>::const_iterator it = compos.begin(); it != compos.end(); ++it)
334 _ui.comboBoxCompo->addItem(QString::fromStdString(*it));
336 _ui.comboBoxCompo->setCurrentIndex(std::max(0, selecIndex-1));
338 _ui.comboBoxCompo->setCurrentIndex(selecIndex);
344 WidgetPresentationParameters::setNbContour(int nbContour)
351 STDLOG("WidgetPresentationParameters::setNbContour(): invalid number of contours!");
355 _ui.labelSpinBox->setText(tr("LAB_NB_CONTOURS").arg(MEDCALC::NB_CONTOURS_MAX));
357 _ui.labelSpinBox->show();
359 _ui.spinBox->setRange(1, MEDCALC::NB_CONTOURS_MAX);
360 _ui.spinBox->setValue(nbContour);
366 WidgetPresentationParameters::setNbSlices(int nbSlices)
373 STDLOG("WidgetPresentationParameters::setNbSlices(): invalid number of slices!");
377 _ui.labelSpinBox->setText(tr("LAB_NB_SLICES").arg(MEDCALC::NB_SLICES_MAX));
378 _ui.labelSpinBox->show();
380 _ui.spinBox->setRange(1, MEDCALC::NB_SLICES_MAX);
381 _ui.spinBox->setValue(nbSlices);
386 int WidgetPresentationParameters::getNbContour() const
388 return _ui.spinBox->value();
391 int WidgetPresentationParameters::getNbSlices() const
393 return _ui.spinBox->value();
398 WidgetPresentationParameters::setScalarBarRange(MEDCALC::ScalarBarRangeType sbrange)
403 if (sbrange == MEDCALC::SCALAR_BAR_ALL_TIMESTEPS)
404 idx = _ui.comboBoxScalarBarRange->findText(tr("LAB_ALL_TIMESTEPS"));
405 else if (sbrange == MEDCALC::SCALAR_BAR_CURRENT_TIMESTEP)
406 idx = _ui.comboBoxScalarBarRange->findText(tr("LAB_CURRENT_TIMESTEP"));
409 _ui.comboBoxScalarBarRange->setCurrentIndex(idx);
410 _ui.checkBoxCustomRange->setChecked(false);
413 if (sbrange == MEDCALC::SCALAR_BAR_CUSTOM_RANGE) {
414 _ui.checkBoxCustomRange->setChecked(true);
416 STDLOG("Strange!! No matching found - unable to set scalar bar range in GUI.");
423 WidgetPresentationParameters::setColorMap(MEDCALC::ColorMapType colorMap)
428 if (colorMap == MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW)
429 idx = _ui.comboBoxColorMap->findText(tr("LAB_BLUE_TO_RED"));
430 else if (colorMap == MEDCALC::COLOR_MAP_COOL_TO_WARM)
431 idx = _ui.comboBoxColorMap->findText(tr("LAB_COOL_TO_WARM"));
435 _ui.comboBoxColorMap->setCurrentIndex(idx);
439 STDLOG("Strange!! No matching found - unable to set color map in GUI.");
446 WidgetPresentationParameters::setMeshMode(MEDCALC::MeshModeType mode)
451 _ui.labelMeshMode->show();
452 _ui.comboBoxMesh->show();
457 case MEDCALC::MESH_MODE_WIREFRAME:
458 idx = _ui.comboBoxMesh->findText(tr("LAB_MESH_WIREFRAME"));
460 case MEDCALC::MESH_MODE_SURFACE:
461 idx = _ui.comboBoxMesh->findText(tr("LAB_MESH_SURFACE"));
463 case MEDCALC::MESH_MODE_SURFACE_EDGES:
464 idx = _ui.comboBoxMesh->findText(tr("LAB_MESH_SURF_EDGES"));
471 _ui.comboBoxMesh->setCurrentIndex(idx);
475 STDLOG("Strange!! No matching found - unable to set mesh mode in GUI.");
482 WidgetPresentationParameters::setIntegrationDir(MEDCALC::IntegrationDirType iDir)
487 _ui.labelIntegrDir->show();
488 _ui.comboBoxIntegrDir->show();
493 case MEDCALC::INTEGRATION_DIR_BOTH:
494 idx = _ui.comboBoxIntegrDir->findText(tr("LAB_INTEGR_DIR_BOTH"));
496 case MEDCALC::INTEGRATION_DIR_FORWARD:
497 idx = _ui.comboBoxIntegrDir->findText(tr("LAB_INTEGR_DIR_FORWARD"));
499 case MEDCALC::INTEGRATION_DIR_BACKWARD:
500 idx = _ui.comboBoxIntegrDir->findText(tr("LAB_INTEGR_DIR_BACKWARD"));
507 _ui.comboBoxIntegrDir->setCurrentIndex(idx);
511 STDLOG("Strange!! No matching found - unable to set integration direction in GUI.");
518 WidgetPresentationParameters::setContourComponents(std::vector<std::string> compos, int selecIndex)
523 _ui.labelContourComp->show();
524 _ui.comboBoxContComp->show();
526 _ui.comboBoxContComp->clear();
527 bool vectorField = (compos.size() > 1 && compos.size() <= 3);
529 _ui.comboBoxContComp->addItem(tr("LAB_EUCLIDEAN_NORM"));
530 for (vector<string>::const_iterator it = compos.begin(); it != compos.end(); ++it)
531 _ui.comboBoxContComp->addItem(QString::fromStdString(*it));
533 _ui.comboBoxContComp->setCurrentIndex(std::max(0, selecIndex - 1));
535 _ui.comboBoxContComp->setCurrentIndex(selecIndex);
541 WidgetPresentationParameters::setSliceOrientation(MEDCALC::SliceOrientationType orient)
546 _ui.labelSliceOrient->show();
547 _ui.comboBoxSliceOrient->show();
552 case MEDCALC::SLICE_NORMAL_TO_X:
553 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_X"));
555 case MEDCALC::SLICE_NORMAL_TO_Y:
556 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_Y"));
558 case MEDCALC::SLICE_NORMAL_TO_Z:
559 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_Z"));
561 case MEDCALC::SLICE_NORMAL_TO_XY:
562 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_XY"));
564 case MEDCALC::SLICE_NORMAL_TO_XZ:
565 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_XZ"));
567 case MEDCALC::SLICE_NORMAL_TO_YZ:
568 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_YZ"));
570 case MEDCALC::SLICE_NORMAL_TO_XYZ:
571 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_XYZ"));
578 _ui.comboBoxSliceOrient->setCurrentIndex(idx);
582 STDLOG("Strange!! No matching found - unable to set slice orientation in GUI.");
589 MEDCALC::SliceOrientationType
590 WidgetPresentationParameters::getSliceOrientation() const
592 QString sbrange = _ui.comboBoxSliceOrient->currentText();
593 if (sbrange == tr("LAB_SLICE_NORMAL_TO_X")) {
594 return MEDCALC::SLICE_NORMAL_TO_X;
596 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_Y")) {
597 return MEDCALC::SLICE_NORMAL_TO_Y;
599 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_Z")) {
600 return MEDCALC::SLICE_NORMAL_TO_Z;
602 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_XY")) {
603 return MEDCALC::SLICE_NORMAL_TO_XY;
605 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_XZ")) {
606 return MEDCALC::SLICE_NORMAL_TO_XZ;
608 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_YZ")) {
609 return MEDCALC::SLICE_NORMAL_TO_YZ;
611 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_XYZ")) {
612 return MEDCALC::SLICE_NORMAL_TO_XYZ;
615 STDLOG("Strange!! No matching found - returning SLICE_NORMAL_TO_X.");
616 return MEDCALC::SLICE_NORMAL_TO_X;
619 MEDCALC::MeshModeType
620 WidgetPresentationParameters::getMeshMode() const
622 QString mesm = _ui.comboBoxMesh->currentText();
623 if (mesm == tr("LAB_MESH_WIREFRAME")) {
624 return MEDCALC::MESH_MODE_WIREFRAME;
626 else if (mesm == tr("LAB_MESH_SURFACE")) {
627 return MEDCALC::MESH_MODE_SURFACE;
629 else if (mesm == tr("LAB_MESH_SURF_EDGES")) {
630 return MEDCALC::MESH_MODE_SURFACE_EDGES;
633 STDLOG("Strange!! No matching found - returning MESH_MODE_WIREFRAME.");
634 return MEDCALC::MESH_MODE_WIREFRAME;
637 MEDCALC::IntegrationDirType
638 WidgetPresentationParameters::getIntegrationDir() const
640 QString iDir = _ui.comboBoxIntegrDir->currentText();
641 if (iDir == tr("LAB_INTEGR_DIR_BOTH")) {
642 return MEDCALC::INTEGRATION_DIR_BOTH;
644 else if (iDir == tr("LAB_INTEGR_DIR_FORWARD")) {
645 return MEDCALC::INTEGRATION_DIR_FORWARD;
647 else if (iDir == tr("LAB_INTEGR_DIR_BACKWARD")) {
648 return MEDCALC::INTEGRATION_DIR_BACKWARD;
651 STDLOG("Strange!! No matching found - returning LAB_INTEGR_DIR_BOTH.");
652 return MEDCALC::INTEGRATION_DIR_BOTH;
656 WidgetPresentationParameters::getContourComponent() const
658 if (_ui.comboBoxContComp->count() > 1 && _ui.comboBoxContComp->count() <= 4)
659 if (_ui.comboBoxContComp->currentIndex() == 0) // Euclidean norm
661 return _ui.comboBoxContComp->currentText().toStdString();
664 MEDCALC::ScalarBarRangeType
665 WidgetPresentationParameters::getScalarBarRange() const
667 if (_ui.checkBoxCustomRange->isChecked()) {
668 return MEDCALC::SCALAR_BAR_CUSTOM_RANGE;
670 QString sbrange = _ui.comboBoxScalarBarRange->currentText();
671 if (sbrange == tr("LAB_ALL_TIMESTEPS")) {
672 return MEDCALC::SCALAR_BAR_ALL_TIMESTEPS;
674 else if (sbrange == tr("LAB_CURRENT_TIMESTEP")) {
675 return MEDCALC::SCALAR_BAR_CURRENT_TIMESTEP;
678 STDLOG("Strange!! No matching found - returning SCALAR_BAR_ALL_TIMESTEPS.");
679 return MEDCALC::SCALAR_BAR_ALL_TIMESTEPS;
683 //WidgetPresentationParameters::getScalarBarTimestep() const
685 // return _ui.doubleSpinBoxTimeStep->value();
689 //WidgetPresentationParameters::getScalarBarMinVal() const
691 // return _ui.doubleSpinBoxMinVal->value();
695 //WidgetPresentationParameters::getScalarBarMaxVal() const
697 // return _ui.doubleSpinBoxMaxVal->value();
700 MEDCALC::ColorMapType
701 WidgetPresentationParameters::getColorMap() const
703 QString colorMap = _ui.comboBoxColorMap->currentText();
704 if (colorMap == tr("LAB_BLUE_TO_RED")) {
705 return MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW;
707 else if (colorMap == tr("LAB_COOL_TO_WARM")) {
708 return MEDCALC::COLOR_MAP_COOL_TO_WARM;
711 STDLOG("Strange!! No matching color map found - returning blue to red.");
712 return MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW;
716 WidgetPresentationParameters::setPresName(const std::string& name)
718 _ui.labelPresName->setText(QString::fromStdString(name));
719 QFont f(_ui.labelPresName->font());
721 _ui.labelPresName->setFont(f);
726 WidgetPresentationParameters::getScalarBarRangeValue(double* arr) const
728 arr[0] = _ui.spinCustomRangeMin->value();
729 arr[1] = _ui.spinCustomRangeMax->value();
732 void WidgetPresentationParameters::setScalarBarRangeValue(double aMin, double aMax) {
734 _ui.spinCustomRangeMin->setValue(aMin);
735 _ui.spinCustomRangeMax->setValue(aMax);
739 void WidgetPresentationParameters::setScaleFactor(double scale) {
743 _ui.checkBoxScaleFactor->show();
744 _ui.spinScaleFactor->show();
746 _ui.spinScaleFactor->setValue(scale);
750 void WidgetPresentationParameters::getNormal(double* arr) const
752 arr[0] = _ui.spinNormalX->value();
753 arr[1] = _ui.spinNormalY->value();
754 arr[2] = _ui.spinNormalZ->value();
758 WidgetPresentationParameters::setNormal(const double normX, const double normY, const double normZ)
761 _ui.labelCutPlaneNormal->show();
762 _ui.spinNormalX->show();
763 _ui.spinNormalY->show();
764 _ui.spinNormalZ->show();
765 _ui.spinNormalX->setValue(normX);
766 _ui.spinNormalY->setValue(normY);
767 _ui.spinNormalZ->setValue(normZ);
771 void WidgetPresentationParameters::getCutPoint1(double* arr) const
773 arr[0] = _ui.spinPoint1_X->value();
774 arr[1] = _ui.spinPoint1_Y->value();
775 arr[2] = _ui.spinPoint1_Z->value();
779 WidgetPresentationParameters::setCutPoint1(const double x, const double y, const double z)
782 _ui.labelPoint1->show();
783 _ui.spinPoint1_X->show();
784 _ui.spinPoint1_Y->show();
785 _ui.spinPoint1_Z->show();
786 _ui.spinPoint1_X->setValue(x);
787 _ui.spinPoint1_Y->setValue(y);
788 _ui.spinPoint1_Z->setValue(z);
792 void WidgetPresentationParameters::getCutPoint2(double* arr) const
794 arr[0] = _ui.spinPoint2_X->value();
795 arr[1] = _ui.spinPoint2_Y->value();
796 arr[2] = _ui.spinPoint2_Z->value();
800 WidgetPresentationParameters::setCutPoint2(const double x, const double y, const double z)
803 _ui.labelPoint2->show();
804 _ui.spinPoint2_X->show();
805 _ui.spinPoint2_Y->show();
806 _ui.spinPoint2_Z->show();
807 _ui.spinPoint2_X->setValue(x);
808 _ui.spinPoint2_Y->setValue(y);
809 _ui.spinPoint2_Z->setValue(z);
813 double WidgetPresentationParameters::getPlanePosition() const
815 return _ui.spinPlanePos->value();
818 void WidgetPresentationParameters::setPlanePosition(double pos)
821 _ui.labelCutPlanePosition->show();
822 _ui.spinPlanePos->show();
823 _ui.spinPlanePos->setValue(pos);
827 bool WidgetPresentationParameters::getScalarBarVisibility() const {
828 return _ui.checkBoxShowScalarBar->isChecked();
831 void WidgetPresentationParameters::setScalarBarVisibility(const bool visibility) {
833 _ui.checkBoxShowScalarBar->setChecked(visibility);
837 bool WidgetPresentationParameters::getHideDataOutsideCustomRange() const {
838 return _ui.checkBoxHideDataOutsideCR->isChecked();
841 void WidgetPresentationParameters::setHideDataOutsideCustomRange(const bool flag) {
843 _ui.checkBoxHideDataOutsideCR->setChecked(flag);
847 void WidgetPresentationParameters::setScaleFactorFlag(const bool flag) {
849 _ui.checkBoxScaleFactor->setChecked(flag);