]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
IPAL53819: Mesh edition clears Numbering
authoreap <eap@opencascade.com>
Tue, 22 Nov 2016 11:34:16 +0000 (14:34 +0300)
committereap <eap@opencascade.com>
Tue, 22 Nov 2016 11:34:16 +0000 (14:34 +0300)
  Keep numbering when a mesh is cleared

src/OBJECT/SMESH_Actor.cxx
src/OBJECT/SMESH_CellLabelActor.cxx
src/OBJECT/SMESH_NodeLabelActor.cxx

index 0c876a190bb5af1e370c97851154f28ebbc246a8..d33d2b181ad0ff1f8947a9c02c76e15cf29224ac 100644 (file)
@@ -1529,10 +1529,10 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation)
       }
     }
 
-    if(myNodeActor->GetPointsLabeled()){
+    if(myNodeActor->GetPointsLabeled()) {
+      myNodeActor->UpdateLabels();
       myNodeActor->VisibilityOn();
     }
-
     if(my0DActor)
       my0DActor->UpdateLabels();
 
index 0172da00b49ebf2a048accfd735cf504e61fa84d..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);
   }
 }
 
index c023dfe8f389348c82c42bb35852d90107b0f0af..a1ed15ad7db9e5388c1111ae2486bd0838710bde 100644 (file)
@@ -44,7 +44,8 @@ vtkStandardNewMacro(SMESH_NodeLabelActor);
 /*!
   Constructor.
 */
-SMESH_NodeLabelActor::SMESH_NodeLabelActor() {
+SMESH_NodeLabelActor::SMESH_NodeLabelActor()
+{
   //Definition of points numbering pipeline
   //---------------------------------------
   myPointsNumDataSet = vtkUnstructuredGrid::New();
@@ -57,12 +58,12 @@ SMESH_NodeLabelActor::SMESH_NodeLabelActor() {
   myPtsSelectVisiblePoints->SetInputConnection(myPtsMaskPoints->GetOutputPort());
   myPtsSelectVisiblePoints->SelectInvisibleOff();
   myPtsSelectVisiblePoints->SetTolerance(0.1);
-    
+
   myPtsLabeledDataMapper = vtkLabeledDataMapper::New();
   myPtsLabeledDataMapper->SetInputConnection(myPtsSelectVisiblePoints->GetOutputPort());
   myPtsLabeledDataMapper->SetLabelFormat("%d");
   myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
-    
+
   myPtsTextProp = vtkTextProperty::New();
   myPtsTextProp->SetFontFamilyToTimes();
   myPtsTextProp->SetFontSize(10);
@@ -90,19 +91,20 @@ SMESH_NodeLabelActor::SMESH_NodeLabelActor() {
 /*!
   Destructor
 */
-SMESH_NodeLabelActor::~SMESH_NodeLabelActor() {
+SMESH_NodeLabelActor::~SMESH_NodeLabelActor()
+{
   //Deleting of points numbering pipeline
   //---------------------------------------
   myPointsNumDataSet->Delete();
-  
+
   // commented: porting to vtk 5.0
   //  myPtsLabeledDataMapper->RemoveAllInputs();
   myPtsLabeledDataMapper->Delete();
-  
+
   // commented: porting to vtk 5.0
   //  myPtsSelectVisiblePoints->UnRegisterAllOutputs();
   myPtsSelectVisiblePoints->Delete();
-  
+
   // commented: porting to vtk 5.0
   //  myPtsMaskPoints->UnRegisterAllOutputs();
   myPtsMaskPoints->Delete();
@@ -130,16 +132,16 @@ void SMESH_NodeLabelActor::SetFontProperties( SMESH::LabelFont family, int size,
   myPtsTextProp->SetColor( r, g, b ); 
 }
 
-void SMESH_NodeLabelActor::SetPointsLabeled(bool theIsPointsLabeled) {
+void SMESH_NodeLabelActor::SetPointsLabeled(bool theIsPointsLabeled)
+{
+  myIsPointsLabeled = theIsPointsLabeled;
+
+  myPointLabels->SetVisibility( false );
+
   myTransformFilter->Update();
   vtkDataSet* aGrid = vtkUnstructuredGrid::SafeDownCast(myTransformFilter->GetOutput());
 
-  if(!aGrid)
-    return;
-    
-  myIsPointsLabeled = theIsPointsLabeled && aGrid->GetNumberOfPoints();
-
-  if ( myIsPointsLabeled )
+  if ( myIsPointsLabeled && aGrid )
   {
     myPointsNumDataSet->ShallowCopy(aGrid);
     vtkUnstructuredGrid *aDataSet = myPointsNumDataSet;
@@ -160,10 +162,6 @@ void SMESH_NodeLabelActor::SetPointsLabeled(bool theIsPointsLabeled) {
     myPointLabels->SetVisibility( GetVisibility() );
     anArray->Delete();
   }
-  else
-  {
-    myPointLabels->SetVisibility( false );
-  } 
 }
 
 
@@ -189,7 +187,8 @@ void SMESH_NodeLabelActor::RemoveFromRender(vtkRenderer* theRenderer)
   SMESH_DeviceActor::RemoveFromRender(theRenderer);
 }
 
-void SMESH_NodeLabelActor::UpdateLabels() {
+void SMESH_NodeLabelActor::UpdateLabels()
+{
   if(myIsPointsLabeled)
     SetPointsLabeled(myIsPointsLabeled);
 }
@@ -198,8 +197,9 @@ void SMESH_NodeLabelActor::UpdateLabels() {
 void SMESH_NodeLabelActor::ProcessEvents(vtkObject* vtkNotUsed(theObject),
                                          unsigned long theEvent,
                                          void* theClientData,
-                                         void* vtkNotUsed(theCallData)) {
-  SMESH_NodeLabelActor* self = reinterpret_cast<SMESH_NodeLabelActor*>(theClientData);    
+                                         void* vtkNotUsed(theCallData))
+{
+  SMESH_NodeLabelActor* self = reinterpret_cast<SMESH_NodeLabelActor*>(theClientData);
   if(self)
     self->UpdateLabels();
 }