X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_MakeNodeAtPointDlg.cxx;h=4f076c55145e8b629f1667a8f4ff56e3e92c2f8c;hb=5dc951b4bf0ce0a9ac7a6097317e09357530813f;hp=796a0f6b7204c7b188e0d89bff34e9f82b79e566;hpb=170a5c71653cae5fb75f0baadfdf559c139081fc;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx index 796a0f6b7..4f076c551 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx @@ -40,6 +40,8 @@ #include "SMDS_MeshNode.hxx" #include "SMESH_Actor.h" #include "SMESH_ActorUtils.h" +#include "SMESH_NumberFilter.hxx" +#include "SMESH_LogicalFilter.hxx" #include "GEOMBase.h" #include "GeometryGUI.h" @@ -53,14 +55,15 @@ #include "SVTK_ViewWindow.h" #include "SVTK_ViewModel.h" #include "SalomeApp_Tools.h" +#include "SalomeApp_TypeFilter.h" #include "SUIT_ResourceMgr.h" #include "SUIT_OverrideCursor.h" #include "SUIT_MessageBox.h" // OCCT Includes #include -#include -#include +#include +#include // QT Includes #include @@ -254,6 +257,7 @@ SMESHGUI_MakeNodeAtPointOp::SMESHGUI_MakeNodeAtPointOp() { mySimulation = 0; myDlg = new SMESHGUI_MakeNodeAtPointDlg; + myFilter = 0; // connect signals and slots connect(myDlg->myX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); @@ -288,6 +292,15 @@ void SMESHGUI_MakeNodeAtPointOp::startOperation() SMESHGUI_SelectionOp::startOperation(); + // SalomeApp_TypeFilter depends on a current study + if ( myFilter ) delete myFilter; + QPtrList filters; + filters.append( new SalomeApp_TypeFilter((SalomeApp_Study*)study(), "SMESH" )); + TColStd_MapOfInteger vertexType; + vertexType.Add( TopAbs_VERTEX ); + filters.append( new SMESH_NumberFilter("GEOM", TopAbs_VERTEX, 1, vertexType )); + myFilter = new SMESH_LogicalFilter( filters, SMESH_LogicalFilter::LO_OR ); + activateSelection(); // set filters myDlg->myX->SetValue(0); @@ -323,6 +336,7 @@ void SMESHGUI_MakeNodeAtPointOp::stopOperation() SMESH::RepaintCurrentView(); myMeshActor = 0; } + selectionMgr()->removeFilter( myFilter ); SMESHGUI_SelectionOp::stopOperation(); } @@ -378,8 +392,9 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply() if (aResult) { myDlg->myId->setText(""); - + SALOME_ListIO aList; + selectionMgr()->setSelectedObjects(aList,false); aList.Append(myMeshActor->getIO()); selectionMgr()->setSelectedObjects(aList,false); SMESH::UpdateView(); @@ -434,10 +449,30 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone() return; Handle(SALOME_InteractiveObject) anIO = aList.First(); SMESH_Actor* aMeshActor = SMESH::FindActorByEntry(anIO->getEntry()); - if (!aMeshActor) - return; + + if (!aMeshActor) { // coord by geom + if ( myDlg->myCoordBtn->isOn() ) { + GEOM::GEOM_Object_var geom = SMESH::IObjectToInterface(anIO); + if ( !geom->_is_nil() ) { + TopoDS_Vertex aShape; + if ( GEOMBase::GetShape(geom, aShape) && + aShape.ShapeType() == TopAbs_VERTEX ) { + gp_Pnt P = BRep_Tool::Pnt(aShape); + myNoPreview = true; + myDlg->myX->SetValue(P.X()); + myDlg->myY->SetValue(P.Y()); + myDlg->myZ->SetValue(P.Z()); + myNoPreview = false; + redisplayPreview(); + } + } + return; + } + } + if ( !myMeshActor ) myMeshActor = aMeshActor; + QString aString; int nbElems = SMESH::GetNameOfSelectedElements(selector(),anIO, aString); if (nbElems == 1) { @@ -544,7 +579,7 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview() mySimulation->SetData(aMeshPreviewStruct._retn()); } else - { +{ mySimulation->SetVisibility(false); } @@ -561,6 +596,7 @@ void SMESHGUI_MakeNodeAtPointOp::activateSelection() { selectionMgr()->clearFilters(); SMESH::SetPointRepresentation(false); + selectionMgr()->installFilter( myFilter ); setSelectionMode( NodeSelection ); } @@ -572,9 +608,9 @@ void SMESHGUI_MakeNodeAtPointOp::activateSelection() SMESHGUI_MakeNodeAtPointOp::~SMESHGUI_MakeNodeAtPointOp() { - if ( myDlg ) - delete myDlg; - delete mySimulation; + if ( myDlg ) delete myDlg; + if ( mySimulation ) delete mySimulation; + if ( myFilter ) delete myFilter; } //================================================================================