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 // sphinx doc: begin of normal and plane connections
70 QObject::connect(_ui.spinNormalX, SIGNAL(editingFinished()),
71 this, SLOT(onSpinNormalEditingFinished()) );
72 QObject::connect(_ui.spinNormalY, SIGNAL(editingFinished()),
73 this, SLOT(onSpinNormalEditingFinished()) );
74 QObject::connect(_ui.spinNormalZ, SIGNAL(editingFinished()),
75 this, SLOT(onSpinNormalEditingFinished()) );
76 QObject::connect(_ui.spinPlanePos, SIGNAL(editingFinished()),
77 this, SLOT(onSpinPlanePosEditingFinished()) );
78 // sphinx doc: end of normal and plane connections
79 QObject::connect(_ui.spinPoint1_X, SIGNAL(editingFinished()),
80 this, SLOT(onSpinCutPoint1EditingFinished()) );
81 QObject::connect(_ui.spinPoint1_Y, SIGNAL(editingFinished()),
82 this, SLOT(onSpinCutPoint1EditingFinished()) );
83 QObject::connect(_ui.spinPoint1_Z, SIGNAL(editingFinished()),
84 this, SLOT(onSpinCutPoint1EditingFinished()) );
85 QObject::connect(_ui.spinPoint2_X, SIGNAL(editingFinished()),
86 this, SLOT(onSpinCutPoint2EditingFinished()) );
87 QObject::connect(_ui.spinPoint2_Y, SIGNAL(editingFinished()),
88 this, SLOT(onSpinCutPoint2EditingFinished()) );
89 QObject::connect(_ui.spinPoint2_Z, SIGNAL(editingFinished()),
90 this, SLOT(onSpinCutPoint2EditingFinished()) );
92 // Disable Custom Range Spin boxes
93 _ui.spinCustomRangeMax->setEnabled(false);
94 _ui.spinCustomRangeMin->setEnabled(false);
95 _ui.spinScaleFactor->setEnabled(false);
96 _ui.checkBoxHideDataOutsideCR->setEnabled(false);
99 _ui.spinCustomRangeMin->setRange(std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
100 _ui.spinCustomRangeMax->setRange(std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
102 _ui.spinCustomRangeMin->setDecimals(6);
103 _ui.spinCustomRangeMax->setDecimals(6);
105 _ui.spinNormalX->setRange(0.0, 1.0);
106 _ui.spinNormalY->setRange(0.0, 1.0);
107 _ui.spinNormalZ->setRange(0.0, 1.0);
108 _ui.spinPlanePos->setRange(0.0, 1.0);
111 // for sphinx doc: start of onComboCompoIndexChanged
113 WidgetPresentationParameters::onComboCompoIndexChanged(int idx)
115 if (!_blockSig) emit comboCompoIndexChanged(idx);
117 // for sphinx doc: end of onComboCompoIndexChanged
120 WidgetPresentationParameters::onComboOrientIndexChanged(int idx)
122 if (!_blockSig) emit comboOrientIndexChanged(idx);
127 WidgetPresentationParameters::onComboMeshIndexChanged(int idx)
129 if (!_blockSig) emit comboMeshIndexChanged(idx);
133 WidgetPresentationParameters::onComboColorMapIndexChanged(int idx)
135 if (!_blockSig) emit comboColorMapIndexChanged(idx);
139 WidgetPresentationParameters::onComboScalarBarRangeIndexChanged(int idx)
141 if (!_blockSig) emit comboScalarBarRangeIndexChanged(idx);
145 WidgetPresentationParameters::onComboIntegrDirIndexChanged(int idx)
147 if (!_blockSig) emit comboIntegrDirIndexChanged(idx);
151 WidgetPresentationParameters::onComboContCompIndexChanged(int idx)
153 if (!_blockSig) emit comboContCompIndexChanged(idx);
157 WidgetPresentationParameters::onCheckboxScalarBarVisibilityChanged(int flag)
159 if (!_blockSig) emit checkboxScalarBarVisibilityChanged(flag);
163 WidgetPresentationParameters::onCheckboxCustomRangeChanged(int flag)
165 _ui.spinCustomRangeMin->setEnabled(flag);
166 _ui.spinCustomRangeMax->setEnabled(flag);
167 _ui.checkBoxHideDataOutsideCR->setEnabled(flag);
168 _ui.comboBoxScalarBarRange->setEnabled(!flag);
169 if (!_blockSig) emit checkboxCustomRangeChanged(flag);
173 WidgetPresentationParameters::onCheckboxScaleFactorChanged(int flag)
175 _ui.spinScaleFactor->setEnabled(flag);
176 if (!_blockSig) emit checkboxScaleFactorChanged(flag);
180 WidgetPresentationParameters::onSpinboxCustomRangeChanged()
182 if (!_blockSig) emit spinboxCustomRangeChanged(_ui.spinCustomRangeMin->value(),
183 _ui.spinCustomRangeMax->value());
187 WidgetPresentationParameters::onSpinboxScaleFactorChanged()
189 if (!_blockSig) emit spinboxScaleFactorChaged(_ui.spinScaleFactor->value());
193 WidgetPresentationParameters::
194 onCheckboxHideDataOutsideCustomRangeChanged(int flag)
196 if (!_blockSig) emit checkboxHideDataOutsideCustomRangeChanged(flag);
200 WidgetPresentationParameters::
201 onCheckboxCustomScaleFactorChanged(int flag) {
202 if (!_blockSig) emit checkboxCustomScaleFactorChanged(flag);
206 WidgetPresentationParameters::onSpinBoxEditingFinished()
208 if (!_blockSig) emit spinBoxValueChanged(_ui.spinBox->value());
212 WidgetPresentationParameters::onSpinNormalEditingFinished()
214 if (!_blockSig) emit spinNormalValuesChanged(_ui.spinNormalX->value(),
215 _ui.spinNormalY->value(),
216 _ui.spinNormalZ->value());
220 WidgetPresentationParameters::onSpinCutPoint1EditingFinished()
222 if (!_blockSig) emit spinCutPoint1ValuesChanged(_ui.spinPoint1_X->value(),
223 _ui.spinPoint1_Y->value(),
224 _ui.spinPoint1_Z->value());
228 WidgetPresentationParameters::onSpinCutPoint2EditingFinished()
230 if (!_blockSig) emit spinCutPoint2ValuesChanged(_ui.spinPoint2_X->value(),
231 _ui.spinPoint2_Y->value(),
232 _ui.spinPoint2_Z->value());
236 WidgetPresentationParameters::onSpinPlanePosEditingFinished()
238 if (!_blockSig) emit spinPlanePosValueChanged(_ui.spinPlanePos->value());
242 WidgetPresentationParameters::hidePlot3D()
244 _ui.labelCutPlanePosition->hide();
245 _ui.spinPlanePos->hide();
249 WidgetPresentationParameters::hideContourComponent()
251 _ui.labelContourComp->hide();
252 _ui.comboBoxContComp->hide();
256 WidgetPresentationParameters::toggleCommonFieldWidget(bool show)
259 _ui.commonWidget->setEnabled(show);
264 WidgetPresentationParameters::toggleWidget(bool show)
266 toggleCommonFieldWidget(true);
270 _ui.widgetDynamic->hide();
271 setPresName(tr("LAB_DEFAULT_DYN_TITLE").toStdString());
272 // reset colorMap and scalarBarRange:
273 setColorMap(MEDCALC::COLOR_MAP_DEFAULT);
274 setScalarBarRange(MEDCALC::SCALAR_BAR_RANGE_DEFAULT);
278 _ui.widgetDynamic->show();
279 // It is the WidgetHelper responsibility to re-show the widgets it needs
280 _ui.labelCompo->hide();
281 _ui.comboBoxCompo->hide();
282 _ui.labelMeshMode->hide();
283 _ui.comboBoxMesh->hide();
284 _ui.labelSpinBox->hide();
286 _ui.labelSliceOrient->hide();
287 _ui.comboBoxSliceOrient->hide();
288 _ui.labelCutPlaneNormal->hide();
289 _ui.labelCutPlanePosition->hide();
290 _ui.spinNormalX->hide();
291 _ui.spinNormalY->hide();
292 _ui.spinNormalZ->hide();
293 _ui.spinPlanePos->hide();
294 _ui.labelIntegrDir->hide();
295 _ui.comboBoxIntegrDir->hide();
296 _ui.labelPoint1->hide();
297 _ui.spinPoint1_X->hide();
298 _ui.spinPoint1_Y->hide();
299 _ui.spinPoint1_Z->hide();
300 _ui.labelPoint2->hide();
301 _ui.spinPoint2_X->hide();
302 _ui.spinPoint2_Y->hide();
303 _ui.spinPoint2_Z->hide();
304 _ui.labelContourComp->hide();
305 _ui.comboBoxContComp->hide();
306 _ui.checkBoxScaleFactor->hide();
307 _ui.spinScaleFactor->hide();
313 WidgetPresentationParameters::isShown() const
315 return _ui.widgetDynamic->isVisible();
319 WidgetPresentationParameters::getComponent() const
321 if (_ui.comboBoxCompo->count() > 1 && _ui.comboBoxCompo->count() <= 4)
322 if (_ui.comboBoxCompo->currentIndex() == 0) // Euclidean norm
325 return _ui.comboBoxCompo->currentText().toStdString();
329 WidgetPresentationParameters::setComponents(vector<string> compos, int selecIndex)
334 _ui.labelCompo->show();
335 _ui.comboBoxCompo->show();
337 _ui.comboBoxCompo->clear();
338 bool vectorField = (compos.size() > 1 && compos.size() <= 3);
340 _ui.comboBoxCompo->addItem(tr("LAB_EUCLIDEAN_NORM"));
341 for(vector<string>::const_iterator it = compos.begin(); it != compos.end(); ++it)
342 _ui.comboBoxCompo->addItem(QString::fromStdString(*it));
344 _ui.comboBoxCompo->setCurrentIndex(std::max(0, selecIndex-1));
346 _ui.comboBoxCompo->setCurrentIndex(selecIndex);
352 WidgetPresentationParameters::setNbContour(int nbContour)
359 STDLOG("WidgetPresentationParameters::setNbContour(): invalid number of contours!");
363 _ui.labelSpinBox->setText(tr("LAB_NB_CONTOURS").arg(MEDCALC::NB_CONTOURS_MAX));
365 _ui.labelSpinBox->show();
367 _ui.spinBox->setRange(1, MEDCALC::NB_CONTOURS_MAX);
368 _ui.spinBox->setValue(nbContour);
374 WidgetPresentationParameters::setNbSlices(int nbSlices)
381 STDLOG("WidgetPresentationParameters::setNbSlices(): invalid number of slices!");
385 _ui.labelSpinBox->setText(tr("LAB_NB_SLICES").arg(MEDCALC::NB_SLICES_MAX));
386 _ui.labelSpinBox->show();
388 _ui.spinBox->setRange(1, MEDCALC::NB_SLICES_MAX);
389 _ui.spinBox->setValue(nbSlices);
394 int WidgetPresentationParameters::getNbContour() const
396 return _ui.spinBox->value();
399 int WidgetPresentationParameters::getNbSlices() const
401 return _ui.spinBox->value();
406 WidgetPresentationParameters::setScalarBarRange(MEDCALC::ScalarBarRangeType sbrange)
411 if (sbrange == MEDCALC::SCALAR_BAR_ALL_TIMESTEPS)
412 idx = _ui.comboBoxScalarBarRange->findText(tr("LAB_ALL_TIMESTEPS"));
413 else if (sbrange == MEDCALC::SCALAR_BAR_CURRENT_TIMESTEP)
414 idx = _ui.comboBoxScalarBarRange->findText(tr("LAB_CURRENT_TIMESTEP"));
417 _ui.comboBoxScalarBarRange->setCurrentIndex(idx);
418 _ui.checkBoxCustomRange->setChecked(false);
421 if (sbrange == MEDCALC::SCALAR_BAR_CUSTOM_RANGE) {
422 _ui.checkBoxCustomRange->setChecked(true);
424 STDLOG("Strange!! No matching found - unable to set scalar bar range in GUI.");
431 WidgetPresentationParameters::setColorMap(MEDCALC::ColorMapType colorMap)
436 if (colorMap == MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW)
437 idx = _ui.comboBoxColorMap->findText(tr("LAB_BLUE_TO_RED"));
438 else if (colorMap == MEDCALC::COLOR_MAP_COOL_TO_WARM)
439 idx = _ui.comboBoxColorMap->findText(tr("LAB_COOL_TO_WARM"));
443 _ui.comboBoxColorMap->setCurrentIndex(idx);
447 STDLOG("Strange!! No matching found - unable to set color map in GUI.");
454 WidgetPresentationParameters::setMeshMode(MEDCALC::MeshModeType mode)
459 _ui.labelMeshMode->show();
460 _ui.comboBoxMesh->show();
465 case MEDCALC::MESH_MODE_WIREFRAME:
466 idx = _ui.comboBoxMesh->findText(tr("LAB_MESH_WIREFRAME"));
468 case MEDCALC::MESH_MODE_SURFACE:
469 idx = _ui.comboBoxMesh->findText(tr("LAB_MESH_SURFACE"));
471 case MEDCALC::MESH_MODE_SURFACE_EDGES:
472 idx = _ui.comboBoxMesh->findText(tr("LAB_MESH_SURF_EDGES"));
479 _ui.comboBoxMesh->setCurrentIndex(idx);
483 STDLOG("Strange!! No matching found - unable to set mesh mode in GUI.");
490 WidgetPresentationParameters::setIntegrationDir(MEDCALC::IntegrationDirType iDir)
495 _ui.labelIntegrDir->show();
496 _ui.comboBoxIntegrDir->show();
501 case MEDCALC::INTEGRATION_DIR_BOTH:
502 idx = _ui.comboBoxIntegrDir->findText(tr("LAB_INTEGR_DIR_BOTH"));
504 case MEDCALC::INTEGRATION_DIR_FORWARD:
505 idx = _ui.comboBoxIntegrDir->findText(tr("LAB_INTEGR_DIR_FORWARD"));
507 case MEDCALC::INTEGRATION_DIR_BACKWARD:
508 idx = _ui.comboBoxIntegrDir->findText(tr("LAB_INTEGR_DIR_BACKWARD"));
515 _ui.comboBoxIntegrDir->setCurrentIndex(idx);
519 STDLOG("Strange!! No matching found - unable to set integration direction in GUI.");
526 WidgetPresentationParameters::setContourComponents(std::vector<std::string> compos, int selecIndex)
531 _ui.labelContourComp->show();
532 _ui.comboBoxContComp->show();
534 _ui.comboBoxContComp->clear();
535 bool vectorField = (compos.size() > 1 && compos.size() <= 3);
537 _ui.comboBoxContComp->addItem(tr("LAB_EUCLIDEAN_NORM"));
538 for (vector<string>::const_iterator it = compos.begin(); it != compos.end(); ++it)
539 _ui.comboBoxContComp->addItem(QString::fromStdString(*it));
541 _ui.comboBoxContComp->setCurrentIndex(std::max(0, selecIndex - 1));
543 _ui.comboBoxContComp->setCurrentIndex(selecIndex);
549 WidgetPresentationParameters::setSliceOrientation(MEDCALC::SliceOrientationType orient)
554 _ui.labelSliceOrient->show();
555 _ui.comboBoxSliceOrient->show();
560 case MEDCALC::SLICE_NORMAL_TO_X:
561 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_X"));
563 case MEDCALC::SLICE_NORMAL_TO_Y:
564 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_Y"));
566 case MEDCALC::SLICE_NORMAL_TO_Z:
567 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_Z"));
569 case MEDCALC::SLICE_NORMAL_TO_XY:
570 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_XY"));
572 case MEDCALC::SLICE_NORMAL_TO_XZ:
573 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_XZ"));
575 case MEDCALC::SLICE_NORMAL_TO_YZ:
576 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_YZ"));
578 case MEDCALC::SLICE_NORMAL_TO_XYZ:
579 idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_XYZ"));
586 _ui.comboBoxSliceOrient->setCurrentIndex(idx);
590 STDLOG("Strange!! No matching found - unable to set slice orientation in GUI.");
597 MEDCALC::SliceOrientationType
598 WidgetPresentationParameters::getSliceOrientation() const
600 QString sbrange = _ui.comboBoxSliceOrient->currentText();
601 if (sbrange == tr("LAB_SLICE_NORMAL_TO_X")) {
602 return MEDCALC::SLICE_NORMAL_TO_X;
604 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_Y")) {
605 return MEDCALC::SLICE_NORMAL_TO_Y;
607 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_Z")) {
608 return MEDCALC::SLICE_NORMAL_TO_Z;
610 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_XY")) {
611 return MEDCALC::SLICE_NORMAL_TO_XY;
613 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_XZ")) {
614 return MEDCALC::SLICE_NORMAL_TO_XZ;
616 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_YZ")) {
617 return MEDCALC::SLICE_NORMAL_TO_YZ;
619 else if (sbrange == tr("LAB_SLICE_NORMAL_TO_XYZ")) {
620 return MEDCALC::SLICE_NORMAL_TO_XYZ;
623 STDLOG("Strange!! No matching found - returning SLICE_NORMAL_TO_X.");
624 return MEDCALC::SLICE_NORMAL_TO_X;
627 MEDCALC::MeshModeType
628 WidgetPresentationParameters::getMeshMode() const
630 QString mesm = _ui.comboBoxMesh->currentText();
631 if (mesm == tr("LAB_MESH_WIREFRAME")) {
632 return MEDCALC::MESH_MODE_WIREFRAME;
634 else if (mesm == tr("LAB_MESH_SURFACE")) {
635 return MEDCALC::MESH_MODE_SURFACE;
637 else if (mesm == tr("LAB_MESH_SURF_EDGES")) {
638 return MEDCALC::MESH_MODE_SURFACE_EDGES;
641 STDLOG("Strange!! No matching found - returning MESH_MODE_WIREFRAME.");
642 return MEDCALC::MESH_MODE_WIREFRAME;
645 MEDCALC::IntegrationDirType
646 WidgetPresentationParameters::getIntegrationDir() const
648 QString iDir = _ui.comboBoxIntegrDir->currentText();
649 if (iDir == tr("LAB_INTEGR_DIR_BOTH")) {
650 return MEDCALC::INTEGRATION_DIR_BOTH;
652 else if (iDir == tr("LAB_INTEGR_DIR_FORWARD")) {
653 return MEDCALC::INTEGRATION_DIR_FORWARD;
655 else if (iDir == tr("LAB_INTEGR_DIR_BACKWARD")) {
656 return MEDCALC::INTEGRATION_DIR_BACKWARD;
659 STDLOG("Strange!! No matching found - returning LAB_INTEGR_DIR_BOTH.");
660 return MEDCALC::INTEGRATION_DIR_BOTH;
664 WidgetPresentationParameters::getContourComponent() const
666 if (_ui.comboBoxContComp->count() > 1 && _ui.comboBoxContComp->count() <= 4)
667 if (_ui.comboBoxContComp->currentIndex() == 0) // Euclidean norm
669 return _ui.comboBoxContComp->currentText().toStdString();
672 MEDCALC::ScalarBarRangeType
673 WidgetPresentationParameters::getScalarBarRange() const
675 if (_ui.checkBoxCustomRange->isChecked()) {
676 return MEDCALC::SCALAR_BAR_CUSTOM_RANGE;
678 QString sbrange = _ui.comboBoxScalarBarRange->currentText();
679 if (sbrange == tr("LAB_ALL_TIMESTEPS")) {
680 return MEDCALC::SCALAR_BAR_ALL_TIMESTEPS;
682 else if (sbrange == tr("LAB_CURRENT_TIMESTEP")) {
683 return MEDCALC::SCALAR_BAR_CURRENT_TIMESTEP;
686 STDLOG("Strange!! No matching found - returning SCALAR_BAR_ALL_TIMESTEPS.");
687 return MEDCALC::SCALAR_BAR_ALL_TIMESTEPS;
691 //WidgetPresentationParameters::getScalarBarTimestep() const
693 // return _ui.doubleSpinBoxTimeStep->value();
697 //WidgetPresentationParameters::getScalarBarMinVal() const
699 // return _ui.doubleSpinBoxMinVal->value();
703 //WidgetPresentationParameters::getScalarBarMaxVal() const
705 // return _ui.doubleSpinBoxMaxVal->value();
708 MEDCALC::ColorMapType
709 WidgetPresentationParameters::getColorMap() const
711 QString colorMap = _ui.comboBoxColorMap->currentText();
712 if (colorMap == tr("LAB_BLUE_TO_RED")) {
713 return MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW;
715 else if (colorMap == tr("LAB_COOL_TO_WARM")) {
716 return MEDCALC::COLOR_MAP_COOL_TO_WARM;
719 STDLOG("Strange!! No matching color map found - returning blue to red.");
720 return MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW;
724 WidgetPresentationParameters::setPresName(const std::string& name)
726 _ui.labelPresName->setText(QString::fromStdString(name));
727 QFont f(_ui.labelPresName->font());
729 _ui.labelPresName->setFont(f);
734 WidgetPresentationParameters::getScalarBarRangeValue(double* arr) const
736 arr[0] = _ui.spinCustomRangeMin->value();
737 arr[1] = _ui.spinCustomRangeMax->value();
740 void WidgetPresentationParameters::setScalarBarRangeValue(double aMin, double aMax) {
742 _ui.spinCustomRangeMin->setValue(aMin);
743 _ui.spinCustomRangeMax->setValue(aMax);
747 void WidgetPresentationParameters::setScaleFactor(double scale) {
751 _ui.checkBoxScaleFactor->show();
752 _ui.spinScaleFactor->show();
754 _ui.spinScaleFactor->setValue(scale);
758 // sphinx doc: begin of getNormal
759 void WidgetPresentationParameters::getNormal(double* arr) const
761 arr[0] = _ui.spinNormalX->value();
762 arr[1] = _ui.spinNormalY->value();
763 arr[2] = _ui.spinNormalZ->value();
765 // sphinx doc: end of getNormal
767 // sphinx doc: begin of setNormal
769 WidgetPresentationParameters::setNormal(const double normX, const double normY, const double normZ)
772 _ui.labelCutPlaneNormal->show();
773 _ui.spinNormalX->show();
774 _ui.spinNormalY->show();
775 _ui.spinNormalZ->show();
776 _ui.spinNormalX->setValue(normX);
777 _ui.spinNormalY->setValue(normY);
778 _ui.spinNormalZ->setValue(normZ);
781 // sphinx doc: end of setNormal
783 void WidgetPresentationParameters::getCutPoint1(double* arr) const
785 arr[0] = _ui.spinPoint1_X->value();
786 arr[1] = _ui.spinPoint1_Y->value();
787 arr[2] = _ui.spinPoint1_Z->value();
791 WidgetPresentationParameters::setCutPoint1(const double x, const double y, const double z)
794 _ui.labelPoint1->show();
795 _ui.spinPoint1_X->show();
796 _ui.spinPoint1_Y->show();
797 _ui.spinPoint1_Z->show();
798 _ui.spinPoint1_X->setValue(x);
799 _ui.spinPoint1_Y->setValue(y);
800 _ui.spinPoint1_Z->setValue(z);
804 void WidgetPresentationParameters::getCutPoint2(double* arr) const
806 arr[0] = _ui.spinPoint2_X->value();
807 arr[1] = _ui.spinPoint2_Y->value();
808 arr[2] = _ui.spinPoint2_Z->value();
812 WidgetPresentationParameters::setCutPoint2(const double x, const double y, const double z)
815 _ui.labelPoint2->show();
816 _ui.spinPoint2_X->show();
817 _ui.spinPoint2_Y->show();
818 _ui.spinPoint2_Z->show();
819 _ui.spinPoint2_X->setValue(x);
820 _ui.spinPoint2_Y->setValue(y);
821 _ui.spinPoint2_Z->setValue(z);
825 // sphinx doc: begin of getPlanePosition
826 double WidgetPresentationParameters::getPlanePosition() const
828 return _ui.spinPlanePos->value();
830 // sphinx doc: begin of getPlanePosition
832 // sphinx doc: begin of setPlanePosition
833 void WidgetPresentationParameters::setPlanePosition(double pos)
836 _ui.labelCutPlanePosition->show();
837 _ui.spinPlanePos->show();
838 _ui.spinPlanePos->setValue(pos);
841 // sphinx doc: begin of setPlanePosition
843 bool WidgetPresentationParameters::getScalarBarVisibility() const {
844 return _ui.checkBoxShowScalarBar->isChecked();
847 void WidgetPresentationParameters::setScalarBarVisibility(const bool visibility) {
849 _ui.checkBoxShowScalarBar->setChecked(visibility);
853 bool WidgetPresentationParameters::getHideDataOutsideCustomRange() const {
854 return _ui.checkBoxHideDataOutsideCR->isChecked();
857 void WidgetPresentationParameters::setHideDataOutsideCustomRange(const bool flag) {
859 _ui.checkBoxHideDataOutsideCR->setChecked(flag);
863 void WidgetPresentationParameters::setScaleFactorFlag(const bool flag) {
865 _ui.checkBoxScaleFactor->setChecked(flag);