Salome HOME
Merge branch 'V8_2_BR' into pre/V8_2_BR
[modules/smesh.git] / src / OBJECT / SMESH_CellLabelActor.cxx
index afd31449ec82617b6ba99c647c4033c9e3aa0fc8..7b5e7aec6d6f37a866cf54ef7c93e4d1714530b7 100644 (file)
@@ -140,18 +140,19 @@ void SMESH_CellLabelActor::SetFontProperties( SMESH::LabelFont family, int size,
   myClsTextProp->SetBold( bold );
   myClsTextProp->SetItalic( italic );
   myClsTextProp->SetShadow( shadow );
-  myClsTextProp->SetColor( r, g, b ); 
+  myClsTextProp->SetColor( r, g, b );
 }
 
 void SMESH_CellLabelActor::SetCellsLabeled(bool theIsCellsLabeled)
 {
+  myIsCellsLabeled = theIsCellsLabeled;
+
+  myCellsLabels->SetVisibility(false);
+
   myTransformFilter->Update();
   vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::SafeDownCast(myTransformFilter->GetOutput());
-  if ( !aGrid )
-    return;
 
-  myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints();
-  if ( myIsCellsLabeled )
+  if ( myIsCellsLabeled && aGrid )
   {
     myCellsNumDataSet->ShallowCopy(aGrid);
     vtkUnstructuredGrid *aDataSet = myCellsNumDataSet;
@@ -172,8 +173,6 @@ void SMESH_CellLabelActor::SetCellsLabeled(bool theIsCellsLabeled)
     aDataSet->GetCellData()->SetScalars(anArray);
     myCellCenters->SetInputData(aDataSet);
     myCellsLabels->SetVisibility(GetVisibility());
-  }else{
-    myCellsLabels->SetVisibility(false);
   }
 }
 
@@ -198,7 +197,8 @@ void SMESH_CellLabelActor::RemoveFromRender(vtkRenderer* theRenderer)
   SMESH_DeviceActor::RemoveFromRender(theRenderer);
 }
 
-void SMESH_CellLabelActor::UpdateLabels() {
+void SMESH_CellLabelActor::UpdateLabels()
+{
   if(myIsCellsLabeled)
     SetCellsLabeled(myIsCellsLabeled);
 }
@@ -207,7 +207,8 @@ void SMESH_CellLabelActor::UpdateLabels() {
 void SMESH_CellLabelActor::ProcessEvents(vtkObject* vtkNotUsed(theObject),
                                          unsigned long theEvent,
                                          void* theClientData,
-                                         void* vtkNotUsed(theCallData)) {
+                                         void* vtkNotUsed(theCallData))
+{
   SMESH_CellLabelActor* self = reinterpret_cast<SMESH_CellLabelActor*>(theClientData);
   if(self)
     self->UpdateLabels();