X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_FindElemByPointDlg.cxx;h=719b8ebb99d9929e348d592edbe88fae049a4337;hp=89515cad680d0f4f2ac47ea4e9d91b8e547251cf;hb=5ec2574399111a48b08c6e765466efc7fa175587;hpb=bd4e115a78b52e3fbc016e5e30bb0e19b2a9e7d6 diff --git a/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx b/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx index 89515cad6..719b8ebb9 100644 --- a/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FindElemByPointDlg.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -101,7 +101,7 @@ void SMESHGUI_FindElemByPointDlg::setTypes(SMESH::array_of_ElementType_var & typ myElemTypeCombo->blockSignals(true); myElemTypeCombo->clear(); int nbTypes = 0, hasNodes = 0; - for ( int i = 0; i < types->length(); ++i ) + for ( int i = 0; i < (int) types->length(); ++i ) { switch ( types[i] ) { case SMESH::NODE: @@ -238,12 +238,13 @@ SMESHGUI_FindElemByPointOp::SMESHGUI_FindElemByPointOp() :SMESHGUI_SelectionOp() { mySimulation = 0; + mySMESHGUI = 0; myDlg = new SMESHGUI_FindElemByPointDlg; - myHelpFileName = "find_element_by_point_page.html"; + myHelpFileName = "find_element_by_point.html"; QList filters; - filters.append( new SMESH_TypeFilter( MESH ) ); - filters.append( new SMESH_TypeFilter( GROUP ) ); + filters.append( new SMESH_TypeFilter( SMESH::MESH ) ); + filters.append( new SMESH_TypeFilter( SMESH::GROUP ) ); myFilter = new SMESH_LogicalFilter( filters, SMESH_LogicalFilter::LO_OR ); myPreview = new SMESH::MeshPreviewStruct(); @@ -279,7 +280,10 @@ void SMESHGUI_FindElemByPointOp::startOperation() { // init simulation with a current View if ( mySimulation ) delete mySimulation; - mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( getSMESHGUI() )); + mySMESHGUI = getSMESHGUI(); + mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ) ); + connect(mySMESHGUI, SIGNAL (SignalActivatedViewManager()), this, SLOT(onOpenView())); + connect(mySMESHGUI, SIGNAL (SignalCloseView()), this, SLOT(onCloseView())); vtkProperty* aProp = vtkProperty::New(); aProp->SetRepresentationToWireframe(); aProp->SetColor(250, 0, 250); @@ -309,13 +313,40 @@ void SMESHGUI_FindElemByPointOp::stopOperation() delete mySimulation; mySimulation = 0; } + disconnect(mySMESHGUI, SIGNAL (SignalActivatedViewManager()), this, SLOT(onOpenView())); + disconnect(mySMESHGUI, SIGNAL (SignalCloseView()), this, SLOT(onCloseView())); selectionMgr()->removeFilter( myFilter ); SMESHGUI_SelectionOp::stopOperation(); } +//================================================================================= +/*! + * \brief SLOT called when the viewer opened + */ +//================================================================================= +void SMESHGUI_FindElemByPointOp::onOpenView() +{ + if ( mySimulation ) { + mySimulation->SetVisibility(false); + } + else { + mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI )); + } +} + +//================================================================================= +/*! + * \brief SLOT called when the viewer closed + */ +//================================================================================= +void SMESHGUI_FindElemByPointOp::onCloseView() +{ + delete mySimulation; + mySimulation = 0; +} //================================================================================ /*! - * \brief hilight found selected elements + * \brief highlight found selected elements */ //================================================================================ @@ -324,7 +355,7 @@ void SMESHGUI_FindElemByPointOp::onElemSelected() if ( !myMeshIO.IsNull() ) { Selection_Mode selMode = - myDlg->myElemTypeCombo->currentId() == int(SMESH::NODE) ? NodeSelection : CellSelection; + myDlg->myElemTypeCombo->currentId().toInt() == int(SMESH::NODE) ? NodeSelection : CellSelection; if ( selectionMode() != selMode ) setSelectionMode( selMode ); @@ -409,16 +440,16 @@ void SMESHGUI_FindElemByPointOp::onFind() aMeshEditor->FindElementsByPoint( myDlg->myX->GetValue(), myDlg->myY->GetValue(), myDlg->myZ->GetValue(), - SMESH::ElementType( myDlg->myElemTypeCombo->currentId())); + SMESH::ElementType( myDlg->myElemTypeCombo->currentId().toInt())); else foundIds = aMeshEditor->FindAmongElementsByPoint( myMeshOrPart, myDlg->myX->GetValue(), myDlg->myY->GetValue(), myDlg->myZ->GetValue(), - SMESH::ElementType( myDlg->myElemTypeCombo->currentId())); + SMESH::ElementType( myDlg->myElemTypeCombo->currentId().toInt())); myDlg->myFoundList->clear(); - for ( int i = 0; i < foundIds->length(); ++i ) + for ( int i = 0; i < (int) foundIds->length(); ++i ) myDlg->myFoundList->addItem( QString::number( foundIds[i] )); if ( foundIds->length() > 0 ) @@ -464,7 +495,7 @@ void SMESHGUI_FindElemByPointOp::onSelectionDone() if (aList.Extent() == 1 && aList.First()->hasEntry()) { Handle(SALOME_InteractiveObject) anIO = aList.First(); - _PTR(SObject) pObj = studyDS()->FindObjectID(anIO->getEntry()); + _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID(anIO->getEntry()); CORBA::Object_var anObj = SMESH::IObjectToObject( anIO ); newMeshEntry = anIO->getEntry(); SMESH::SMESH_IDSource_var aMeshOrPart = SMESH::SMESH_IDSource::_narrow(anObj); @@ -503,8 +534,9 @@ void SMESHGUI_FindElemByPointOp::redisplayPreview() myPreview->nodesXYZ[0].x = myDlg->myX->GetValue(); myPreview->nodesXYZ[0].y = myDlg->myY->GetValue(); myPreview->nodesXYZ[0].z = myDlg->myZ->GetValue(); - - mySimulation->SetData(&myPreview.in()); + if (!mySimulation) + mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI )); + mySimulation->SetData( myPreview.in()); } //================================================================================