X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_MakeNodeAtPointDlg.cxx;h=f578c1c2f504ded1d79b6efeaab9f82d2c9c0031;hb=7f46c31f2b6e0073d9235615d6fdfc9c017e74c8;hp=3b8ffef6514829c822f274c022c9d3f8eb0ea98a;hpb=5c19bc1e1684ec6a466423361949ed7b60556968;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx index 3b8ffef65..f578c1c2f 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx @@ -84,6 +84,11 @@ #define SPACING 6 #define MARGIN 11 +namespace +{ + enum { MANUAL_MODE = 0, SEARCH_MODE }; // how a node to move is specified +} + /*! * \brief Dialog to publish a sub-shape of the mesh main shape * by selecting mesh elements @@ -326,7 +331,8 @@ void SMESHGUI_MakeNodeAtPointDlg::ConstructorsClicked (int constructorId) myDestDX->hide(); myDestDY->hide(); myDestDZ->hide(); - if (myNodeToMoveGrp->isVisible()) {myNodeToMoveGrp->hide();} + if (myNodeToMoveGrp->isVisible()) myNodeToMoveGrp->hide(); + myDestBtn->setChecked( true ); break; } } @@ -356,14 +362,15 @@ SMESHGUI_MakeNodeAtPointOp::SMESHGUI_MakeNodeAtPointOp() myDestCoordChanged = true; // connect signals and slots - connect(myDlg->myDestinationX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); - connect(myDlg->myDestinationY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); - connect(myDlg->myDestinationZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); - connect(myDlg->myDestDX, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged())); - connect(myDlg->myDestDY, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged())); - connect(myDlg->myDestDZ, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged())); - connect(myDlg->myId,SIGNAL (textChanged(const QString&)),SLOT(redisplayPreview())); - connect(myDlg->myPreviewChkBox, SIGNAL (toggled(bool)),SLOT(redisplayPreview())); + connect(myDlg->myDestinationX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); + connect(myDlg->myDestinationY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); + connect(myDlg->myDestinationZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); + connect(myDlg->myDestDX, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged())); + connect(myDlg->myDestDY, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged())); + connect(myDlg->myDestDZ, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged())); + connect(myDlg->myId, SIGNAL (textChanged(const QString&)),SLOT(redisplayPreview())); + connect(myDlg->myPreviewChkBox, SIGNAL (toggled(bool)), SLOT(redisplayPreview())); + connect(myDlg->myButtonGroup, SIGNAL (buttonClicked(int)), SLOT(redisplayPreview())); // IPAL22913: TC6.5.0: selected in "Move node" dialog box node is not highlighted // note: this slot seems to be lost together with removed obsolete SMESHGUI_MoveNodesDlg class @@ -435,18 +442,11 @@ void SMESHGUI_MakeNodeAtPointOp::startOperation() myDlg->myDestDZ->setReadOnly(true); myDlg->myRButNodeToMove->setChecked(true); - myDlg->ConstructorsClicked(GetConstructorId()); + myDlg->ConstructorsClicked( GetConstructorId() ); myDlg->show(); onSelectionDone(); // init myMeshActor - - if ( myMeshActor ) { -// myMeshActor->SetRepresentation( VTK_WIREFRAME ); - myMeshActor->SetPointRepresentation(true); - SMESH::RepaintCurrentView(); - redisplayPreview(); - } } //================================================================================= @@ -474,12 +474,13 @@ void SMESHGUI_MakeNodeAtPointOp::stopOperation() mySimulation = 0; } if ( myMeshActor ) { - myMeshActor->SetPointRepresentation(false); - SMESH::RepaintCurrentView(); myMeshActor = 0; } + SMESH::SetPointRepresentation( false ); + SMESH::RepaintCurrentView(); + disconnect(mySMESHGUI, SIGNAL (SignalActivatedViewManager()), this, SLOT(onOpenView())); - disconnect(mySMESHGUI, SIGNAL (SignalCloseView()), this, SLOT(onCloseView())); + disconnect(mySMESHGUI, SIGNAL (SignalCloseView()), this, SLOT(onCloseView())); selectionMgr()->removeFilter( myFilter ); SMESHGUI_SelectionOp::stopOperation(); } @@ -604,6 +605,8 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone() { if ( !myDlg->isVisible() || !myDlg->isEnabled() ) return; + + myNoPreview = true; try { SALOME_ListIO aList; selectionMgr()->selectedObjects(aList, SVTK_Viewer::Type()); @@ -612,6 +615,10 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone() Handle(SALOME_InteractiveObject) anIO = aList.First(); SMESH_Actor* aMeshActor = SMESH::FindActorByEntry(anIO->getEntry()); + if (( myDlg->myIdBtn->isChecked() && myDlg->myIdBtn->isEnabled() ) || + ( !myDlg->myNodeToMoveGrp->isVisible() )) + myMeshActor = aMeshActor; + if (!aMeshActor) { // coord by geom if ( myDlg->myDestBtn->isChecked() ) { GEOM::GEOM_Object_var geom = SMESH::IObjectToInterface(anIO); @@ -620,63 +627,56 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone() if ( GEOMBase::GetShape(geom, aShape) && aShape.ShapeType() == TopAbs_VERTEX ) { gp_Pnt P = BRep_Tool::Pnt(aShape); - myNoPreview = true; myDlg->myDestinationX->SetValue(P.X()); myDlg->myDestinationY->SetValue(P.Y()); myDlg->myDestinationZ->SetValue(P.Z()); - myNoPreview = false; - redisplayPreview(); } } + myNoPreview = false; + redisplayPreview(); return; } } - if ( !myMeshActor ) - myMeshActor = aMeshActor; - QString aString; int nbElems = SMESH::GetNameOfSelectedElements(selector(),anIO, aString); if (nbElems == 1) { if (SMDS_Mesh* aMesh = aMeshActor->GetObject()->GetMesh()) { if (const SMDS_MeshNode* aNode = aMesh->FindNode(aString.toInt())) { - myNoPreview = true; if ( myDlg->myDestBtn->isChecked() ) { // set coord myDlg->myDestinationX->SetValue(aNode->X()); myDlg->myDestinationY->SetValue(aNode->Y()); myDlg->myDestinationZ->SetValue(aNode->Z()); - myNoPreview = false; - redisplayPreview(); } else if ( myDlg->myIdBtn->isChecked() && myDlg->myIdBtn->isEnabled() ) { // set node to move myDlg->myId->setText(aString); - myNoPreview = false; + myDlg->myCurrentX->SetValue( aNode->X() ); + myDlg->myCurrentY->SetValue( aNode->Y() ); + myDlg->myCurrentZ->SetValue( aNode->Z() ); redisplayPreview(); } - if (const SMDS_MeshNode* aCurrentNode = aMesh->FindNode(myDlg->myId->text().toInt())) { - double x = aCurrentNode->X(); - double y = aCurrentNode->Y(); - double z = aCurrentNode->Z(); - double dx = myDlg->myDestinationX->GetValue() - x; - double dy = myDlg->myDestinationY->GetValue() - y; - double dz = myDlg->myDestinationZ->GetValue() - z; - myDlg->myCurrentX->SetValue(x); - myDlg->myCurrentY->SetValue(y); - myDlg->myCurrentZ->SetValue(z); - myDlg->myDestDX->SetValue(dx); - myDlg->myDestDY->SetValue(dy); - myDlg->myDestDZ->SetValue(dz); - myDlg->myDestDX->setReadOnly(false); - myDlg->myDestDY->setReadOnly(false); - myDlg->myDestDZ->setReadOnly(false); - } + double x = myDlg->myCurrentX->GetValue(); + double y = myDlg->myCurrentY->GetValue(); + double z = myDlg->myCurrentZ->GetValue(); + double dx = myDlg->myDestinationX->GetValue() - x; + double dy = myDlg->myDestinationY->GetValue() - y; + double dz = myDlg->myDestinationZ->GetValue() - z; + myDlg->myDestDX->SetValue(dx); + myDlg->myDestDY->SetValue(dy); + myDlg->myDestDZ->SetValue(dz); + myDlg->myDestDX->setReadOnly(false); + myDlg->myDestDY->setReadOnly(false); + myDlg->myDestDZ->setReadOnly(false); } } } } catch (...) { } + + myNoPreview = false; + redisplayPreview(); } //================================================================================ @@ -691,12 +691,15 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview() return; myNoPreview = true; + if ( !myMeshActor && GetConstructorId() == SEARCH_MODE ) + onSelectionDone(); + SMESH::MeshPreviewStruct_var aMeshPreviewStruct; bool moveShown = false; if ( myMeshActor) { - const bool isPreview = myDlg->myPreviewChkBox->isChecked(); + const bool isPreview = myDlg->myPreviewChkBox->isChecked(); const bool isMoveNode = myDlg->myRButMoveWithoutNode->isChecked(); QString msg; if ( isValid( msg ) ) @@ -725,22 +728,28 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview() myDlg->myDestinationX->SetValue(x); myDlg->myDestinationY->SetValue(y); myDlg->myDestinationZ->SetValue(z); - } - if ( myDestCoordChanged ) { - dx = myDlg->myDestinationX->GetValue() - x; - dy = myDlg->myDestinationY->GetValue() - y; - dz = myDlg->myDestinationZ->GetValue() - z; myDlg->myDestDX->SetValue(dx); myDlg->myDestDY->SetValue(dy); myDlg->myDestDZ->SetValue(dz); } - else { - dx = myDlg->myDestDX->GetValue() + x; - dy = myDlg->myDestDY->GetValue() + y; - dz = myDlg->myDestDZ->GetValue() + z; - myDlg->myDestinationX->SetValue(dx); - myDlg->myDestinationY->SetValue(dy); - myDlg->myDestinationZ->SetValue(dz); + else + { + if ( myDestCoordChanged ) { + dx = myDlg->myDestinationX->GetValue() - x; + dy = myDlg->myDestinationY->GetValue() - y; + dz = myDlg->myDestinationZ->GetValue() - z; + myDlg->myDestDX->SetValue(dx); + myDlg->myDestDY->SetValue(dy); + myDlg->myDestDZ->SetValue(dz); + } + else { + dx = myDlg->myDestDX->GetValue() + x; + dy = myDlg->myDestDY->GetValue() + y; + dz = myDlg->myDestDZ->GetValue() + z; + myDlg->myDestinationX->SetValue(dx); + myDlg->myDestinationY->SetValue(dy); + myDlg->myDestinationZ->SetValue(dz); + } } myDlg->myCurrentX->SetValue(x); myDlg->myCurrentY->SetValue(y); @@ -776,7 +785,8 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview() } } } - }catch (...) { + } + catch (...) { } } } @@ -878,7 +888,7 @@ void SMESHGUI_MakeNodeAtPointOp::onTextChange( const QString& theText ) void SMESHGUI_MakeNodeAtPointOp::activateSelection() { selectionMgr()->clearFilters(); - SMESH::SetPointRepresentation(false); + SMESH::SetPointRepresentation( true ); selectionMgr()->installFilter( myFilter ); setSelectionMode( NodeSelection ); }