]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix for Bug GVIEW11261
authorapo <apo@opencascade.com>
Mon, 16 Jan 2006 13:17:47 +0000 (13:17 +0000)
committerapo <apo@opencascade.com>
Mon, 16 Jan 2006 13:17:47 +0000 (13:17 +0000)
  SMESH: Diagonal Inversion, Union of two triangles - exception and selection problems

src/SVTK/SALOME_Actor.cxx
src/SVTK/SVTK_Actor.cxx

index 44c00fe8b888d94e672f0d6db32ac9c1b56fdca8..692b350dff9af4c3814e8df4f72b1e9c091028eb 100644 (file)
@@ -886,13 +886,13 @@ SALOME_Actor
          if(myIsPreselected){
            const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
            int anExtent = aMapIndex.Extent();
-           anIsChanged |= (anExtent != 2);
-           anIsChanged |= (anExtent == 0 && (anObjId != aMapIndex(1) || anEdgeId != aMapIndex(2)));
+           anIsChanged |= (anExtent == 0);
+           anIsChanged |= (anExtent == 2 && (anObjId != aMapIndex(1) || anEdgeId != aMapIndex(2)));
            if(anIsChanged){
              TColStd_IndexedMapOfInteger aMapIndex;
              aMapIndex.Add( anObjId );
              aMapIndex.Add( anEdgeId );
-       
+
              myPreHighlightActor->GetProperty()->SetRepresentationToWireframe();
              myPreHighlightActor->MapEdge( this, aMapIndex );
            }
@@ -1008,9 +1008,9 @@ SALOME_Actor
            mySelector->ClearIObjects();
          }
          int anEdgeId = GetEdgeId(this,myCellPicker.GetPointer(),anObjId);
-         if( anEdgeId >= 0 ) {
+         if( anEdgeId < 0 ) {
            mySelector->AddOrRemoveIndex( myIO, anObjId, false );
-           mySelector->AddOrRemoveIndex( myIO, -anEdgeId-1, true );
+           mySelector->AddOrRemoveIndex( myIO, anEdgeId, true );
            mySelector->AddIObject( this );
          } 
        }
index f4331a4c9501e2fdacb610920516b91bcd044ae8..3a6b6fc05db944bce6f4d74eb291ba9f0929aff5 100644 (file)
@@ -178,45 +178,20 @@ SVTK_Actor
   vtkDataSet *aSourceDataSet = theMapActor->GetInput();
   CopyPoints(GetSource(),aSourceDataSet);
 
-  int iEnd = theMapIndex.Extent();
-  int aCellId = -1, aCellCounter = 0;
-  for(int i = 1; i <= iEnd; i++){
-    int anId = theMapIndex( i );
-    if(anId > 0) {
-      aCellCounter++;
-      aCellId = anId;
-    }
-  }
-
-  if(aCellCounter == 1){
-    if(vtkCell* aCell = theMapActor->GetElemCell(aCellId)){
-      if(aCell->GetCellType() <= VTK_LINE){
-       myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
-      }else{
-       int aNbOfParts = aCell->GetNumberOfEdges();
-       for(int i = 1; i <= iEnd; i++){
-         int aPartId = theMapIndex(i);
-         if( aPartId < 0){
-           aPartId = -aPartId-1;
-           if(0 > aPartId || aPartId >= aNbOfParts) break;
-           if(vtkCell* anEdgeCell = aCell->GetEdge(aPartId))
-             myUnstructuredGrid->InsertNextCell(VTK_LINE,anEdgeCell->GetPointIds());
-         }
+  if(theMapIndex.Extent() == 2){
+    if(vtkCell* aCell = theMapActor->GetElemCell(theMapIndex(1))){
+      int anEdgeId = theMapIndex(2);
+      if(anEdgeId < 0){
+       int anEdgeId = -theMapIndex(2) - 1;
+       int aNbOfEdges = aCell->GetNumberOfEdges();
+       if(0 <= anEdgeId || anEdgeId < aNbOfEdges){
+         if(vtkCell* anEdge = aCell->GetEdge(anEdgeId))
+           myUnstructuredGrid->InsertNextCell(VTK_LINE,anEdge->GetPointIds());
        }
       }
     }
-  }else{
-    int aNbOfParts = aSourceDataSet->GetNumberOfCells();
-    for(int i = 1; i <= iEnd; i++){
-      int aPartId = theMapIndex( i );
-      if(aPartId > 0){
-       if(aPartId >= aNbOfParts) break;
-       vtkCell* aCell = aSourceDataSet->GetCell(aPartId);
-       myUnstructuredGrid->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
-      }
-    }
   }
-
+  
   UnShrink();
   if(theMapActor->IsShrunk()){
     SetShrinkFactor(theMapActor->GetShrinkFactor());