From 68e62040d960c974d2a772fb5ddcf3f784abbe20 Mon Sep 17 00:00:00 2001 From: apo Date: Mon, 16 Jan 2006 13:17:47 +0000 Subject: [PATCH] Fix for Bug GVIEW11261 SMESH: Diagonal Inversion, Union of two triangles - exception and selection problems --- src/SVTK/SALOME_Actor.cxx | 10 ++++----- src/SVTK/SVTK_Actor.cxx | 45 +++++++++------------------------------ 2 files changed, 15 insertions(+), 40 deletions(-) diff --git a/src/SVTK/SALOME_Actor.cxx b/src/SVTK/SALOME_Actor.cxx index 44c00fe8b..692b350df 100644 --- a/src/SVTK/SALOME_Actor.cxx +++ b/src/SVTK/SALOME_Actor.cxx @@ -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 ); } } diff --git a/src/SVTK/SVTK_Actor.cxx b/src/SVTK/SVTK_Actor.cxx index f4331a4c9..3a6b6fc05 100644 --- a/src/SVTK/SVTK_Actor.cxx +++ b/src/SVTK/SVTK_Actor.cxx @@ -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()); -- 2.39.2