X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_MeshPatternDlg.cxx;h=0022b3f5ca89445412257cce6b4862d69dbb730a;hp=f040d82a14c2c26aac834714173a6aa1c7a12c60;hb=57b43b4d010e2d0a1529d3c131bbb9d416e63258;hpb=b33324fe602b1fe1158c14a866c3802df12370fa diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx index f040d82a1..0022b3f5c 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx @@ -46,10 +46,13 @@ #include "SUIT_ResourceMgr.h" #include "SUIT_Desktop.h" #include "SUIT_FileDlg.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" -#include "SalomeApp_SelectionMgr.h" +#include "LightApp_SelectionMgr.h" #include "SalomeApp_Tools.h" #include "SalomeApp_Study.h" +#include "LightApp_Application.h" #include "SALOMEDS_SObject.hxx" @@ -59,6 +62,7 @@ #include "SVTK_ViewModel.h" #include "SVTK_Selector.h" #include "SVTK_ViewWindow.h" +#include "VTKViewer_CellLocationsArray.h" // OCCT Includes #include @@ -86,11 +90,11 @@ // VTK Includes #include #include -#include #include #include #include #include +#include #define SPACING 5 #define MARGIN 10 @@ -127,7 +131,9 @@ SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI* theModule, myCreationDlg = 0; mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); - + + myHelpFileName = "pattern_mapping.htm"; + Init(); } @@ -289,6 +295,7 @@ QFrame* SMESHGUI_MeshPatternDlg::createButtonFrame (QWidget* theParent) myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame); myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame); myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame); + myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); @@ -298,10 +305,12 @@ QFrame* SMESHGUI_MeshPatternDlg::createButtonFrame (QWidget* theParent) aLay->addWidget(myApplyBtn); aLay->addItem(aSpacer); aLay->addWidget(myCloseBtn); + aLay->addWidget(myHelpBtn); connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk())); connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose())); connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply())); + connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp())); return aFrame; } @@ -350,9 +359,6 @@ void SMESHGUI_MeshPatternDlg::Init() activateSelection(); onSelectionDone(); - int x, y; - mySMESHGUI->DefineDlgPosition(this, x, y); - this->move(x, y); this->show(); } @@ -414,8 +420,7 @@ bool SMESHGUI_MeshPatternDlg::onApply() bool toCreatePolygons = myCreatePolygonsChk->isChecked(); bool toCreatePolyedrs = myCreatePolyedrsChk->isChecked(); if ( myPattern->MakeMesh( myMesh, toCreatePolygons, toCreatePolyedrs ) ) { - mySelectionMgr->clearSelected(); - SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI ); + //mySelectionMgr->clearSelected(); bool autoUpdate = SMESHGUI::automaticUpdate(); if (!isRefine() && autoUpdate) { _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in()); @@ -428,9 +433,13 @@ bool SMESHGUI_MeshPatternDlg::onApply() } } } + mySelectionMgr->clearSelected(); SMESH::UpdateView(); - + mySMESHGUI->updateObjBrowser(true); + + mySelEdit[ Ids ]->setText(""); + return true; } else { QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), @@ -472,6 +481,23 @@ void SMESHGUI_MeshPatternDlg::onClose() reject(); } +//================================================================================= +// function : onHelp() +// purpose : +//================================================================================= +void SMESHGUI_MeshPatternDlg::onHelp() +{ + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(myHelpFileName), + QObject::tr("BUT_OK")); + } +} + //======================================================================= // name : SMESHGUI_MeshPatternDlg::onSelectionDone // Purpose : SLOT called when selection changed @@ -740,7 +766,10 @@ void SMESHGUI_MeshPatternDlg::onOkCreationDlg() { myPattern = SMESH::SMESH_Pattern::_duplicate(myCreationDlg->GetPattern()); myName->setText(myCreationDlg->GetPatternName()); + + updateWgState(); displayPreview(); + setEnabled(true); myIsCreateDlgOpen = false; } @@ -934,7 +963,7 @@ void SMESHGUI_MeshPatternDlg::updateWgState() } QValueList ids; - if (!CORBA::is_nil(myPattern) && getIds(ids)) { + if (!CORBA::is_nil(myPattern)/* && getIds(ids)*/) { SMESH::long_array_var keyPoints = myPattern->GetKeyPoints(); if (keyPoints->length()) { myNode1->setEnabled(true); @@ -1197,7 +1226,7 @@ vtkUnstructuredGrid* SMESHGUI_MeshPatternDlg::getGrid() else aCellTypesArray->InsertNextValue(VTK_EMPTY_CELL); } - vtkIntArray* aCellLocationsArray = vtkIntArray::New(); + VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); aCellLocationsArray->SetNumberOfComponents(1); aCellLocationsArray->SetNumberOfTuples(aNbCells); @@ -1265,9 +1294,9 @@ void SMESHGUI_MeshPatternDlg::onTextChanged (const QString& theNewText) if (aMesh) { QStringList aListId = QStringList::split(" ", theNewText, false); - + TColStd_MapOfInteger newIndices; - + for (int i = 0; i < aListId.count(); i++) { const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt()); if (e && e->GetType() == (myType == Type_2d ? SMDSAbs_Face : SMDSAbs_Volume)) @@ -1279,6 +1308,8 @@ void SMESHGUI_MeshPatternDlg::onTextChanged (const QString& theNewText) } myBusy = false; + + displayPreview(); } //=======================================================================