-// Copyright (C) 2016 CEA/DEN, EDF R&D
+// Copyright (C) 2016-2021 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
setIntProperty(MEDPresentationContour::PROP_NB_CONTOUR, params.nbContours);
}
+void
+MEDPresentationContour::initFieldMeshInfos()
+{
+ MEDPresentation::initFieldMeshInfos();
+ _colorByType = "POINTS";
+}
+
void
MEDPresentationContour::setNumberContours()
{
MEDPyLockWrapper lock;
createSource();
+ setTimestamp();
// Populate internal array of available components:
fillAvailableFieldComponents();
STDLOG(msg);
throw KERNEL::createSalomeException(msg);
}
+ if (_params.nbContours < 1)
+ {
+ const char * mes = "Invalid number of contours!";
+ STDLOG(mes);
+ throw KERNEL::createSalomeException(mes);
+ }
- setOrCreateRenderView(); // instanciate __viewXXX
+ setOrCreateRenderView(); // instantiate __viewXXX, needs to be after the exception above otherwise previous elements in the view will be hidden.
// Contour needs point data:
applyCellToPointIfNeeded();
oss << _objVar << ".ContourBy = ['POINTS', '" << _fieldName << "'];";
pushAndExecPyLine(oss.str()); oss.str("");
+ // Colorize contour
+ oss << _objVar << ".ComputeScalars = 1;";
+ pushAndExecPyLine(oss.str()); oss.str("");
+
// Set number of contours
setNumberContours();
- colorBy("POINTS"); // necessarily POINTS because of the conversion above
+ colorBy(); // see initFieldInfo() - necessarily POINTS because of the conversion above
showScalarBar();
selectColorMap();
rescaleTransferFunction();
updateColorMap<MEDPresentationContour, MEDCALC::ContourParameters>(params.colorMap);
if (params.nbContours != _params.nbContours)
- updateNbContours(params.nbContours);
+ {
+ if (params.nbContours < 1)
+ {
+ const char * mes = "Invalid number of contours!";
+ STDLOG(mes);
+ throw KERNEL::createSalomeException(mes);
+ }
+ updateNbContours(params.nbContours);
+ }
}
void