+
+void
+MEDPresentationContour::updateContourComponent(const std::string& newCompo)
+{
+ _params.contourComponent = newCompo.c_str();
+
+ int id = getContourComponentId();
+
+ // GUI helper:
+ setIntProperty(MEDPresentationContour::PROB_CONTOUR_COMPONENT_ID, id);
+
+ // Update the pipeline:
+ {
+ MEDPyLockWrapper lock;
+ std::ostringstream oss;
+ oss << _objVar << ".ContourBy = ['POINTS', '" << getContourComponentName() << "'];";
+ pushAndExecPyLine(oss.str()); oss.str("");
+ scalarBarTitle();
+ pushAndExecPyLine("pvs.Render();");
+ }
+}
+
+
+int MEDPresentationContour::getContourComponentId() const {
+ int result = -1;
+ if (std::string(_params.contourComponent) == "") { // Magnitude
+ result = 0;
+ }
+ for (std::vector<std::string>::size_type i = 0; i < _nbComponents; i++) {
+ std::ostringstream oss_p;
+ oss_p << MEDPresentation::PROP_COMPONENT << i;
+ std::string compo = getStringProperty(oss_p.str());
+ if (std::string(_params.contourComponent) == compo) {
+ result = i + 1;
+ break;
+ }
+ }
+ if (result == -1) {
+ std::ostringstream oss;
+ oss << "MEDPresentationContour::getContourComponentId(): unknown component '" <<_params.contourComponent
+ << "' !\n";
+ STDLOG(oss.str());
+ throw KERNEL::createSalomeException(oss.str().c_str());
+ }
+ return result;
+}
+
+std::string MEDPresentationContour::getContourComponentName() const {
+ std::ostringstream result;
+ result << _fieldName;
+ if (_nbComponents > 1) {
+ int id = getContourComponentId();
+ switch (id) {
+ case 0: result << "_magnitude"; break;
+ default: result << "_" << id; break;
+ }
+ }
+ return result.str();
+}
+
+std::string MEDPresentationContour::getFieldName() const {
+ return getContourComponentName();
+}
+
+void
+MEDPresentationContour::scalarBarTitle()
+{
+ if (_nbComponents > 1) {
+ // get selected component name:
+ int id = getContourComponentId();
+ std::string compoName;
+ if (id != 0)
+ {
+ std::ostringstream oss1;
+ oss1 << MEDPresentation::PROP_COMPONENT << id - 1;
+ compoName = getStringProperty(oss1.str());
+ }
+ else
+ {
+ compoName = "Magnitude";
+ }
+ std::ostringstream oss;
+ oss << "pvs.GetScalarBar(" << getLutVar() << ").Title = '" << _fieldName << "';";
+ oss << "pvs.GetScalarBar(" << getLutVar() << ").ComponentTitle = '" << compoName << "';";
+ pushAndExecPyLine(oss.str()); oss.str("");
+ }
+ else {
+ MEDPresentation::scalarBarTitle();
+ }
+}
\ No newline at end of file