Commit 78956437 authored by Emmanuel Promayon's avatar Emmanuel Promayon

FIXED crash in explorer when deleting a mesh

parent 8fe6ff06
......@@ -820,6 +820,11 @@ bool MeshComponent::getDataRepresentationVisibility(FieldType field, const QStri
// -------------------- setDataRepresentationOff --------------------
void MeshComponent::setDataRepresentationOff(int dataType) {
// if nothing is displayed, nothing to do
if (dataRepresentationVisibility.size() == 0) {
return;
}
//-- update the visibility flags for the given dataType
for (auto it = dataRepresentationVisibility.constBegin(); it != dataRepresentationVisibility.constEnd(); ++it) {
if (getDataType(it.key()) & dataType) {
......@@ -836,9 +841,11 @@ void MeshComponent::setDataRepresentationOff(int dataType) {
cellDataSet->SetActiveScalars(nullptr);
// remove all color bar
if (Application::getViewer("3D Viewer") != nullptr) {
dynamic_cast<InteractiveViewer*>(Application::getViewer("3D Viewer"))->setColorScaleTitle("");
dynamic_cast<InteractiveViewer*>(Application::getViewer("3D Viewer"))->setColorScale(false);
InteractiveViewer* default3DViewer = dynamic_cast<InteractiveViewer*>(Application::getViewer("3D Viewer"));
if (default3DViewer != nullptr) {
default3DViewer->setColorScaleTitle("");
default3DViewer->setColorScale(false);
}
}
......@@ -888,10 +895,12 @@ void MeshComponent::setScalarDataRepresentationOn(vtkSmartPointer<vtkDataArray>
setMapperScalarRange(range[0], range[1]);
//-- show the color scale in 3D
if (Application::getViewer("3D Viewer") != nullptr) {
dynamic_cast<InteractiveViewer*>(Application::getViewer("3D Viewer"))->setColorScale(true);
dynamic_cast<InteractiveViewer*>(Application::getViewer("3D Viewer"))->setColorScaleTitle(dataArray->GetName());
dynamic_cast<InteractiveViewer*>(Application::getViewer("3D Viewer"))->setColorScaleMinMax(range[0], range[1]);
InteractiveViewer* default3DViewer = dynamic_cast<InteractiveViewer*>(Application::getViewer("3D Viewer"));
if (default3DViewer != nullptr) {
default3DViewer->setColorScale(true);
default3DViewer->setColorScaleTitle(dataArray->GetName());
default3DViewer->setColorScaleMinMax(range[0], range[1]);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment