Salome HOME
VolumeTool has been partially adapted for PolyhedralVolumes processing
[modules/smesh.git] / src / OBJECT / SMESH_Actor.cxx
index dc35fcda2aa9bba3850ce2767a0bc69933183e44..8940c0fc3a706f1118ab06d27481e792dadad84e 100644 (file)
@@ -160,6 +160,7 @@ SMESH_ActorDef::SMESH_ActorDef(){
   aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
   aFilter->RegisterCellsWithType(VTK_WEDGE);
   aFilter->RegisterCellsWithType(VTK_PYRAMID);
+  aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
 
 
   //Definition 1D divice of the actor
@@ -239,6 +240,7 @@ SMESH_ActorDef::SMESH_ActorDef(){
   myBaseActor->SetUserMatrix(aMatrix);
   myBaseActor->SetStoreMapping(true);
   myBaseActor->GetProperty()->SetOpacity(0.0);
+  myBaseActor->myGeomFilter->SetInside(true);
 
   myPickableActor = myBaseActor;
 
@@ -734,8 +736,6 @@ void SMESH_ActorDef::SetControlMode(eControl theMode){
        my1DExtActor->SetExtControlMode(aFunctor,myControlActor);
        break;
       case eLength2D:
-       my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable);
-       break;
       case eMultiConnection2D:
        my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable);
        break;
@@ -1038,7 +1038,6 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
        my1DExtActor->VisibilityOn();
        break;
       case eLength2D:
-       my1DExtActor->VisibilityOn();
       case eMultiConnection2D:
        my1DExtActor->VisibilityOn();
       default:
@@ -1049,18 +1048,26 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
 
     if(myRepresentation != ePoint)
       myPickableActor->VisibilityOn();
+    else {
+      myNodeActor->VisibilityOn();
+    }
 
-    if(myEntityMode & eEdges)
+    if(myEntityMode & eEdges){
       my1DActor->VisibilityOn();
+    }
     
-    if(myEntityMode & eFaces)
+    if(myEntityMode & eFaces){
       my2DActor->VisibilityOn();
+    }
     
-    if(myEntityMode & eVolumes)
+    if(myEntityMode & eVolumes){
       my3DActor->VisibilityOn();
+    }
     
-    if(myIsPointsLabeled) 
+    if(myIsPointsLabeled){
       myPointLabels->VisibilityOn();
+      myNodeActor->VisibilityOn();
+    }
 
     if(myIsCellsLabeled) 
       myCellsLabels->VisibilityOn();
@@ -1080,11 +1087,46 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
   if(!myVisualObj->GetNbEntities(SMDSAbs_Volume))
     theMode &= ~eVolumes;
 
-  if(!theMode)
-    return;
+  if(!theMode){
+    if(myVisualObj->GetNbEntities(SMDSAbs_Edge))
+      theMode |= eEdges;
+
+    if(myVisualObj->GetNbEntities(SMDSAbs_Face))
+      theMode |= eFaces;
+
+    if(myVisualObj->GetNbEntities(SMDSAbs_Volume))
+      theMode |= eVolumes;
+  }
 
   myEntityMode = theMode;
+  SALOME_ExtractUnstructuredGrid* aFilter = NULL;
+  aFilter = myBaseActor->GetExtractUnstructuredGrid();
+  aFilter->ClearRegisteredCellsWithType();
+  aFilter->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
+  
+  if(myEntityMode & eEdges){
+    if (MYDEBUG) MESSAGE("EDGES");
+    aFilter->RegisterCellsWithType(VTK_LINE);
+  }
 
+  if(myEntityMode & eFaces){
+    if (MYDEBUG) MESSAGE("FACES");
+    aFilter->RegisterCellsWithType(VTK_TRIANGLE);
+    aFilter->RegisterCellsWithType(VTK_POLYGON);
+    aFilter->RegisterCellsWithType(VTK_QUAD);
+  }
+
+  if(myEntityMode & eVolumes){
+    if (MYDEBUG) MESSAGE("VOLUMES");
+    aFilter->RegisterCellsWithType(VTK_TETRA);
+    aFilter->RegisterCellsWithType(VTK_VOXEL);
+    aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
+    aFilter->RegisterCellsWithType(VTK_WEDGE);
+    aFilter->RegisterCellsWithType(VTK_PYRAMID);
+    aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
+  }
+  aFilter->Update();
+  if (MYDEBUG) MESSAGE(aFilter->GetOutput()->GetNumberOfCells());
   SetVisibility(GetVisibility(),false);
 }
 
@@ -1128,7 +1170,7 @@ void SMESH_ActorDef::SetRepresentation(int theMode){
   vtkProperty *aProp = NULL, *aBackProp = NULL;
   SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1);
   switch(myRepresentation){
-  case ePoint: 
+  case ePoint:
     myPickableActor = myNodeActor;
     myNodeActor->SetVisibility(true);
 
@@ -1173,7 +1215,6 @@ void SMESH_ActorDef::SetRepresentation(int theMode){
   
   if(myIsPointsVisible)
     myPickableActor = myNodeActor;
-
   if(GetPointRepresentation())
     myNodeActor->SetVisibility(true);
 
@@ -1286,6 +1327,7 @@ void SMESH_ActorDef::Update(){
   if(myIsCellsLabeled){
     SetCellsLabeled(myIsCellsLabeled);
   }
+  SetEntityMode(GetEntityMode());
   SetVisibility(GetVisibility());
   
   myTimeStamp->Modified();