- SMDS_Mesh* aMesh = 0;
- if ( myActor )
- aMesh = myActor->GetObject()->GetMesh();
- if ( aMesh ) {
-
- myBusy = true; // block onSelectionDone()
- mySelection->ClearIObjects();
- mySelection->AddIObject( myActor->getIO() );
- myBusy = false;
-
- QStringList aListId = QStringList::split( "-", theNewText, false);
- if ( aListId.count() != 2 )
- return;
- const SMDS_MeshNode* a2Nodes[2];
- bool allOk = true;
- int i;
- for ( i = 0; i < aListId.count(); i++ ) {
- const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
- if ( n )
- a2Nodes[ i ] = n;
- else
- allOk = false;
- }
-
- // find a triangle and an edge nb
- const SMDS_MeshElement* tria[2];
- if (allOk &&
- a2Nodes[0] != a2Nodes[1] &&
- findTriangles( a2Nodes[0],
- a2Nodes[1],
- tria[0],
- tria[1])) {
- myBusy = true; // block onSelectionDone()
- mySelection->AddOrRemoveIndex (myActor->getIO(), tria[0]->GetID(), true, false);
-
- const SMDS_MeshNode* a3Nodes [3];
- SMDS_ElemIteratorPtr it;
- int edgeInd = 2;
- for (i = 0, it = tria[0]->nodesIterator(); it->more(); i++ ) {
- a3Nodes[ i ] = static_cast<const SMDS_MeshNode*>( it->next() );
- if ( i > 0 )
- if (( a3Nodes[ i ] == a2Nodes[ 0 ] && a3Nodes[ i - 1] == a2Nodes[ 1 ] ) ||
- ( a3Nodes[ i ] == a2Nodes[ 1 ] && a3Nodes[ i - 1] == a2Nodes[ 0 ] ) ) {
- edgeInd = i - 1;
- break;
- }
+ if(myActor){
+ if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
+ Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
+ SALOME_ListIO aList;
+ aList.Append(anIO);
+ mySelectionMgr->setSelectedObjects(aList,false);
+
+ TColStd_IndexedMapOfInteger selectedIndices;
+ TColStd_MapOfInteger newIndices;
+ mySelector->GetIndex(anIO,selectedIndices);
+
+ int id1, id2;
+ if ( !getNodeIds(myEdge->text(), id1, id2) )
+ return;
+
+ const SMDS_MeshNode* aNode1 = aMesh->FindNode( id1 );
+ const SMDS_MeshNode* aNode2 = aMesh->FindNode( id2 );
+
+ if ( !aNode1 || !aNode2 || aNode1 == aNode2 )
+ return;
+
+ // find a triangle and an edge index
+ const SMDS_MeshElement* tria1;
+ const SMDS_MeshElement* tria2;
+
+ if ( findTriangles(aNode1,aNode2,tria1,tria2) )
+ {
+ newIndices.Add(tria1->GetID());
+
+ const SMDS_MeshNode* a3Nodes[3];
+ SMDS_ElemIteratorPtr it;
+ int edgeInd = 2, i;
+ for (i = 0, it = tria1->nodesIterator(); it->more(); i++) {
+ a3Nodes[ i ] = static_cast<const SMDS_MeshNode*>(it->next());
+ if (i > 0 && ( a3Nodes[ i ] == aNode1 && a3Nodes[ i - 1] == aNode2 ||
+ a3Nodes[ i ] == aNode2 && a3Nodes[ i - 1] == aNode1 ) ) {
+ edgeInd = i - 1;
+ break;
+ }
+ }
+ newIndices.Add(-edgeInd-1);
+
+ myOkBtn->setEnabled(true);
+ myApplyBtn->setEnabled(true);