_ui.setupUi(this); // To be done first
toggleWidget(false);
- QObject::connect(_ui.comboBoxCompo, SIGNAL(currentIndexChanged(int)),
+ QObject::connect(_ui.comboBoxCompo, SIGNAL(activated(int)),
this, SLOT(onComboCompoIndexChanged(int)) );
- QObject::connect(_ui.comboBoxScalarBarRange, SIGNAL(currentIndexChanged(int)),
+ QObject::connect(_ui.comboBoxMesh, SIGNAL(activated(int)),
+ this, SLOT(onComboMeshIndexChanged(int)) );
+ QObject::connect(_ui.comboBoxScalarBarRange, SIGNAL(activated(int)),
this, SLOT(onComboScalarBarRangeIndexChanged(int)) );
- QObject::connect(_ui.comboBoxColorMap, SIGNAL(currentIndexChanged(int)),
+ QObject::connect(_ui.comboBoxColorMap, SIGNAL(activated(int)),
this, SLOT(onComboColorMapIndexChanged(int)) );
+ QObject::connect(_ui.comboBoxSliceOrient, SIGNAL(activated(int)),
+ this, SLOT(onComboOrientIndexChanged(int)) );
+ QObject::connect(_ui.spinBox, SIGNAL(valueChanged(int)),
+ this, SLOT(onSpinBoxValueChanged(int)) );
}
void
if (!_blockSig) emit comboCompoIndexChanged(idx);
}
+void
+WidgetPresentationParameters::onComboOrientIndexChanged(int idx)
+{
+ if (!_blockSig) emit comboOrientIndexChanged(idx);
+}
+
+
+void
+WidgetPresentationParameters::onComboMeshIndexChanged(int idx)
+{
+ if (!_blockSig) emit comboMeshIndexChanged(idx);
+}
+
void
WidgetPresentationParameters::onComboColorMapIndexChanged(int idx)
{
if (!_blockSig) emit comboScalarBarRangeIndexChanged(idx);
}
+void
+WidgetPresentationParameters::onSpinBoxValueChanged(int val)
+{
+ if (!_blockSig) emit spinBoxValueChanged(val);
+}
+
+void
+WidgetPresentationParameters::toggleCommonFieldWidget(bool show)
+{
+ _blockSig = true;
+ _ui.commonWidget->setEnabled(show);
+ _blockSig = false;
+}
void
WidgetPresentationParameters::toggleWidget(bool show)
{
+ toggleCommonFieldWidget(true);
if (!show)
{
_blockSig = true;
_ui.widgetDynamic->hide();
- setPresName("Choose a presentation");
+ setPresName(tr("LAB_DEFAULT_DYN_TITLE").toStdString());
// reset colorMap and scalarBarRange:
setColorMap(MEDCALC::COLOR_MAP_DEFAULT);
setScalarBarRange(MEDCALC::SCALAR_BAR_RANGE_DEFAULT);
// It is the WidgetHelper responsability to re-show the widgets it needs
_ui.labelCompo->hide();
_ui.comboBoxCompo->hide();
+ _ui.labelMeshMode->hide();
+ _ui.comboBoxMesh->hide();
_ui.labelSpinBox->hide();
_ui.spinBox->hide();
_ui.labelSliceOrient->hide();
void
WidgetPresentationParameters::setComponents(vector<string> compos, int selecIndex)
{
+ _blockSig = true;
+
// Show the widget:
_ui.labelCompo->show();
_ui.comboBoxCompo->show();
- _blockSig = true;
_ui.comboBoxCompo->clear();
_ui.comboBoxCompo->addItem(tr("LAB_EUCLIDEAN_NORM"));
for(vector<string>::const_iterator it = compos.begin(); it != compos.end(); ++it)
_ui.comboBoxCompo->addItem(QString::fromStdString(*it));
_ui.comboBoxCompo->setCurrentIndex(selecIndex);
+
_blockSig = false;
}
void
-WidgetPresentationParameters::setScalarBarRange(MEDCALC::MEDPresentationScalarBarRange sbrange)
+WidgetPresentationParameters::setNbContour(int nbContour)
{
+ _blockSig = true;
+
+ if (nbContour <= 0)
+ {
+ //TODO throw?
+ STDLOG("WidgetPresentationParameters::setNbContour(): invalid number of contours!");
+ }
+
+ // Show the widget:
+ _ui.labelSpinBox->setText(tr("LAB_NB_CONTOURS"));
+ _ui.labelSpinBox->show();
+ _ui.spinBox->show();
+ _ui.spinBox->setValue(nbContour);
+
+ _blockSig = false;
+}
+
+void
+WidgetPresentationParameters::setNbSlices(int nbSlices)
+{
+ _blockSig = true;
+
+ if (nbSlices <= 0)
+ {
+ //TODO throw?
+ STDLOG("WidgetPresentationParameters::setNbSlices(): invalid number of slices!");
+ }
+
+ // Show the widget:
+ _ui.labelSpinBox->setText(tr("LAB_NB_SLICES"));
+ _ui.labelSpinBox->show();
+ _ui.spinBox->show();
+ _ui.spinBox->setValue(nbSlices);
+
+ _blockSig = false;
+}
+
+int WidgetPresentationParameters::getNbContour() const
+{
+ return _ui.spinBox->value();
+}
+
+int WidgetPresentationParameters::getNbSlices() const
+{
+ return _ui.spinBox->value();
+}
+
+
+void
+WidgetPresentationParameters::setScalarBarRange(MEDCALC::ScalarBarRangeType sbrange)
+{
+ _blockSig = true;
+
int idx;
if (sbrange == MEDCALC::SCALAR_BAR_ALL_TIMESTEPS)
idx = _ui.comboBoxScalarBarRange->findText(tr("LAB_ALL_TIMESTEPS"));
idx = _ui.comboBoxScalarBarRange->findText(tr("LAB_CURRENT_TIMESTEP"));
if (idx >= 0)
- {
- _blockSig = true;
_ui.comboBoxScalarBarRange->setCurrentIndex(idx);
- _blockSig = false;
- }
else
STDLOG("Strange!! No matching found - unable to set scalar bar range in GUI.");
+
+ _blockSig = false;
}
void
-WidgetPresentationParameters::setColorMap(MEDCALC::MEDPresentationColorMap colorMap)
+WidgetPresentationParameters::setColorMap(MEDCALC::ColorMapType colorMap)
{
- int idx;
+ _blockSig = true;
+
+ int idx = -1;
if (colorMap == MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW)
idx = _ui.comboBoxColorMap->findText(tr("LAB_BLUE_TO_RED"));
else if (colorMap == MEDCALC::COLOR_MAP_COOL_TO_WARM)
idx = _ui.comboBoxColorMap->findText(tr("LAB_COOL_TO_WARM"));
if (idx >= 0)
- {
- _blockSig = true;
_ui.comboBoxColorMap->setCurrentIndex(idx);
- _blockSig = false;
- }
-
else
STDLOG("Strange!! No matching found - unable to set color map in GUI.");
+
+ _blockSig = false;
+}
+
+void
+WidgetPresentationParameters::setMeshMode(MEDCALC::MeshModeType mode)
+{
+ _blockSig = true;
+
+ // Show the widget:
+ _ui.labelMeshMode->show();
+ _ui.comboBoxMesh->show();
+
+ int idx;
+ switch(mode)
+ {
+ case MEDCALC::MESH_MODE_WIREFRAME:
+ idx = _ui.comboBoxMesh->findText(tr("LAB_MESH_WIREFRAME"));
+ break;
+ case MEDCALC::MESH_MODE_SURFACE:
+ idx = _ui.comboBoxMesh->findText(tr("LAB_MESH_SURFACE"));
+ break;
+ case MEDCALC::MESH_MODE_SURFACE_EDGES:
+ idx = _ui.comboBoxMesh->findText(tr("LAB_MESH_SURF_EDGES"));
+ break;
+ default:
+ idx = -1;
+ }
+ if (idx >= 0)
+ _ui.comboBoxMesh->setCurrentIndex(idx);
+ else
+ STDLOG("Strange!! No matching found - unable to set mesh mode in GUI.");
+
+ _blockSig = false;
+}
+
+void
+WidgetPresentationParameters::setSliceOrientation(MEDCALC::SliceOrientationType orient)
+{
+ _blockSig = true;
+
+ // Show the widget:
+ _ui.labelSliceOrient->show();
+ _ui.comboBoxSliceOrient->show();
+
+ int idx;
+ switch(orient)
+ {
+ case MEDCALC::SLICE_NORMAL_TO_X:
+ idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_X"));
+ break;
+ case MEDCALC::SLICE_NORMAL_TO_Y:
+ idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_Y"));
+ break;
+ case MEDCALC::SLICE_NORMAL_TO_Z:
+ idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_Z"));
+ break;
+ case MEDCALC::SLICE_NORMAL_TO_XY:
+ idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_XY"));
+ break;
+ case MEDCALC::SLICE_NORMAL_TO_XZ:
+ idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_XZ"));
+ break;
+ case MEDCALC::SLICE_NORMAL_TO_YZ:
+ idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_YZ"));
+ break;
+ case MEDCALC::SLICE_NORMAL_TO_XYZ:
+ idx = _ui.comboBoxSliceOrient->findText(tr("LAB_SLICE_NORMAL_TO_XYZ"));
+ break;
+ default:
+ idx = -1;
+ }
+ if (idx >= 0)
+ _ui.comboBoxSliceOrient->setCurrentIndex(idx);
+ else
+ STDLOG("Strange!! No matching found - unable to set slice orientation in GUI.");
+
+ _blockSig = false;
+}
+
+
+MEDCALC::SliceOrientationType
+WidgetPresentationParameters::getSliceOrientation() const
+{
+ QString sbrange = _ui.comboBoxSliceOrient->currentText();
+ if (sbrange == tr("LAB_SLICE_NORMAL_TO_X")) {
+ return MEDCALC::SLICE_NORMAL_TO_X;
+ }
+ else if (sbrange == tr("LAB_SLICE_NORMAL_TO_Y")) {
+ return MEDCALC::SLICE_NORMAL_TO_Y;
+ }
+ else if (sbrange == tr("LAB_SLICE_NORMAL_TO_Z")) {
+ return MEDCALC::SLICE_NORMAL_TO_Z;
+ }
+ else if (sbrange == tr("LAB_SLICE_NORMAL_TO_XY")) {
+ return MEDCALC::SLICE_NORMAL_TO_XY;
+ }
+ else if (sbrange == tr("LAB_SLICE_NORMAL_TO_XZ")) {
+ return MEDCALC::SLICE_NORMAL_TO_XZ;
+ }
+ else if (sbrange == tr("LAB_SLICE_NORMAL_TO_YZ")) {
+ return MEDCALC::SLICE_NORMAL_TO_YZ;
+ }
+ else if (sbrange == tr("LAB_SLICE_NORMAL_TO_XYZ")) {
+ return MEDCALC::SLICE_NORMAL_TO_XYZ;
+ }
+ // Should not happen
+ STDLOG("Strange!! No matching found - returning SLICE_NORMAL_TO_X.");
+ return MEDCALC::SLICE_NORMAL_TO_X;
+}
+
+MEDCALC::MeshModeType
+WidgetPresentationParameters::getMeshMode() const
+{
+ QString mesm = _ui.comboBoxMesh->currentText();
+ if (mesm == tr("LAB_MESH_WIREFRAME")) {
+ return MEDCALC::MESH_MODE_WIREFRAME;
+ }
+ else if (mesm == tr("LAB_MESH_SURFACE")) {
+ return MEDCALC::MESH_MODE_SURFACE;
+ }
+ else if (mesm == tr("LAB_MESH_SURF_EDGES")) {
+ return MEDCALC::MESH_MODE_SURFACE_EDGES;
+ }
+ // Should not happen
+ STDLOG("Strange!! No matching found - returning MESH_MODE_WIREFRAME.");
+ return MEDCALC::MESH_MODE_WIREFRAME;
}
-MEDCALC::MEDPresentationScalarBarRange
+MEDCALC::ScalarBarRangeType
WidgetPresentationParameters::getScalarBarRange() const
{
QString sbrange = _ui.comboBoxScalarBarRange->currentText();
// return _ui.doubleSpinBoxMaxVal->value();
//}
-MEDCALC::MEDPresentationColorMap
+MEDCALC::ColorMapType
WidgetPresentationParameters::getColorMap() const
{
QString colorMap = _ui.comboBoxColorMap->currentText();
return MEDCALC::COLOR_MAP_BLUE_TO_RED_RAINBOW;
}
-QComboBox *
-WidgetPresentationParameters::getComboBoxCompo()
-{
- return _ui.comboBoxCompo;
-}
-
void
WidgetPresentationParameters::setPresName(const std::string& name)
{