-// Copyright (C) 2016 CEA/DEN, EDF R&D
+// Copyright (C) 2016-2020 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
{
}
+void
+MEDPresentationDeflectionShape::initFieldMeshInfos()
+{
+ MEDPresentation::initFieldMeshInfos();
+ _colorByType = "POINTS";
+}
+
void
MEDPresentationDeflectionShape::autoScale()
{
std::ostringstream oss;
oss << "import medcalc;";
pushAndExecPyLine(oss.str()); oss.str("");
- oss << _objVar << ".ScaleFactor = 3.0*medcalc.ComputeCellAverageSize(__srcObj0)/(" << _rangeVar
+ oss << _objVar << ".ScaleFactor = 3.0*medcalc.ComputeCellAverageSize(" << _srcObjVar << ")/(" << _rangeVar
<< "[1]-" << _rangeVar << "[0]);";
pushAndExecPyLine(oss.str()); oss.str("");
}
MEDPyLockWrapper lock;
- setOrCreateRenderView();
createSource();
+ setTimestamp();
// Populate internal array of available components:
fillAvailableFieldComponents();
- if (getIntProperty(MEDPresentation::PROP_NB_COMPONENTS) <= 1)
+ int nbCompo = getIntProperty(MEDPresentation::PROP_NB_COMPONENTS);
+ if (nbCompo <= 1)
{
const char * msg = "Deflection shape presentation does not work for scalar field!"; // this message will appear in GUI too
STDLOG(msg);
throw KERNEL::createSalomeException(msg);
}
+ setOrCreateRenderView(); // needs to be after the exception above otherwise previous elements in the view will be hidden.
+
// Warp needs point data:
applyCellToPointIfNeeded();
showObject(); // to be done first so that the scale factor computation properly works
- oss << _objVar << ".Vectors = ['POINTS', '" << _fieldName << "'];";
+ std::string fieldName = nbCompo <= 2 ? _fieldName + "_Vector" : _fieldName;
+ oss << _objVar << ".Vectors = ['POINTS', '" << fieldName << "'];";
pushAndExecPyLine(oss.str()); oss.str("");
- colorBy("POINTS");
+ colorBy(); // see initFieldInfo() - necessarily POINTS
showScalarBar();
selectColorMap();
rescaleTransferFunction();