X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_MeshPatternDlg.cxx;h=205b5b3463539608e70d41bcd577e0dadaa850d3;hb=7d9ae6b54f5ec98fff137636f7ad2a60d10ce6b6;hp=2093f8ae1c5db39e0d5eb11670a7cdc4e7cdea67;hpb=c38c10811a065cf5b13e8807ed71864d92ca7d80;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx index 2093f8ae1..205b5b346 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx @@ -47,7 +47,7 @@ #include "SUIT_Desktop.h" #include "SUIT_FileDlg.h" -#include "SalomeApp_SelectionMgr.h" +#include "LightApp_SelectionMgr.h" #include "SalomeApp_Tools.h" #include "SalomeApp_Study.h" @@ -110,9 +110,7 @@ SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI* theModule, WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myBusy(false), mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), - myViewWindow( SMESH::GetViewWindow( theModule ) ), - mySelector( myViewWindow->GetSelector() ) + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { setCaption(tr("CAPTION")); @@ -127,6 +125,9 @@ SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI* theModule, aDlgLay->setStretchFactor(aMainFrame, 1); myCreationDlg = 0; + + mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); + Init(); } @@ -136,13 +137,14 @@ SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI* theModule, //======================================================================= QFrame* SMESHGUI_MeshPatternDlg::createMainFrame (QWidget* theParent) { - QPixmap iconSlct (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT"))); - QPixmap icon2d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_2d"))); - QPixmap icon3d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_3d"))); - QPixmap iconOpen (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_FILE_OPEN"))); + SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI ); + QPixmap iconSlct ( mgr->loadPixmap("SMESH", tr("ICON_SELECT"))); + QPixmap icon2d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_2d"))); + QPixmap icon3d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_3d"))); + QPixmap iconOpen ( mgr->loadPixmap("STD", tr("ICON_FILE_OPEN"))); - QPixmap iconSample2d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D"))); - QPixmap iconSample3d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_3D"))); + QPixmap iconSample2d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D"))); + QPixmap iconSample3d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_3D"))); QGroupBox* aMainGrp = new QGroupBox (1, Qt::Horizontal, theParent); aMainGrp->setFrameStyle(QFrame::NoFrame); @@ -412,11 +414,8 @@ bool SMESHGUI_MeshPatternDlg::onApply() bool toCreatePolygons = myCreatePolygonsChk->isChecked(); bool toCreatePolyedrs = myCreatePolyedrsChk->isChecked(); if ( myPattern->MakeMesh( myMesh, toCreatePolygons, toCreatePolyedrs ) ) { - mySelectionMgr->clearSelected(); - SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr(); - bool autoUpdate = false; - if (mgr && mgr->stringValue("SMESH", "AutomaticUpdate").compare("true") == 0) - autoUpdate = true; + //mySelectionMgr->clearSelected(); + bool autoUpdate = SMESHGUI::automaticUpdate(); if (!isRefine() && autoUpdate) { _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in()); SMESH_Actor* anActor = SMESH::FindActorByEntry(aSO->GetID().c_str()); @@ -429,7 +428,7 @@ bool SMESHGUI_MeshPatternDlg::onApply() } } SMESH::UpdateView(); - + mySMESHGUI->updateObjBrowser(true); return true; } else { @@ -463,7 +462,8 @@ void SMESHGUI_MeshPatternDlg::onClose() { mySelectionMgr->clearFilters(); SMESH::SetPickable(); - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); disconnect(mySelectionMgr, 0, this, 0); disconnect(mySMESHGUI, 0, this, 0); mySMESHGUI->ResetState(); @@ -515,6 +515,8 @@ void SMESHGUI_MeshPatternDlg::onSelectionDone() } else if (mySelInput == Ids) { SALOME_ListIO aList; mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type()); + if (aList.Extent() != 1) + return; QString anIds; if (!SMESH::GetNameOfSelectedElements(mySelector, aList.First(), anIds)) @@ -737,7 +739,10 @@ void SMESHGUI_MeshPatternDlg::onOkCreationDlg() { myPattern = SMESH::SMESH_Pattern::_duplicate(myCreationDlg->GetPattern()); myName->setText(myCreationDlg->GetPatternName()); + + updateWgState(); displayPreview(); + setEnabled(true); myIsCreateDlgOpen = false; } @@ -852,7 +857,7 @@ void SMESHGUI_MeshPatternDlg::displayPreview() aProp->SetRepresentationToWireframe(); aProp->SetColor(250, 0, 250); if (SMESH::FindActorByObject(myMesh)) - aProp->SetLineWidth(SMESH::GetFloat("SMESH:SettingsWidth", 1) +1); + aProp->SetLineWidth( SMESH::GetFloat( "SMESH:element_width", 1 ) + 1 ); else aProp->SetLineWidth(1); myPreviewActor->SetProperty(aProp); @@ -931,7 +936,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); @@ -962,14 +967,21 @@ void SMESHGUI_MeshPatternDlg::activateSelection() SMESH::SetPickable(anActor); if (myType == Type_2d) - myViewWindow->SetSelectionMode(FaceSelection); + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(FaceSelection); + } else - myViewWindow->SetSelectionMode(CellSelection); + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(CellSelection); + } } else { SMESH::SetPickable(); //mySelectionMgr->setSelectionModes(ActorSelection); - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); } if (mySelInput == Object && !myMeshShape->_is_nil()) { @@ -1256,30 +1268,21 @@ void SMESHGUI_MeshPatternDlg::onTextChanged (const QString& theNewText) if (aMesh) { QStringList aListId = QStringList::split(" ", theNewText, false); - SALOME_ListIO aList; - aList.Append(anActor->getIO()); - mySelectionMgr->setSelectedObjects(aList, false); - - TColStd_IndexedMapOfInteger selectedIndices; TColStd_MapOfInteger newIndices; - mySelector->GetIndex(anActor->getIO(), selectedIndices); 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)) { - if (selectedIndices.Add(e->GetID())) { - newIndices.Add(e->GetID()); - } - } - } - if (newIndices.Extent() > 0) - { - mySelector->AddOrRemoveIndex( anActor->getIO(), newIndices, true); - myViewWindow->highlight( anActor->getIO(), true, true ); + if (e && e->GetType() == (myType == Type_2d ? SMDSAbs_Face : SMDSAbs_Volume)) + newIndices.Add(e->GetID()); } + mySelector->AddOrRemoveIndex( anActor->getIO(), newIndices, false); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->highlight( anActor->getIO(), true, true ); } myBusy = false; + + displayPreview(); } //=======================================================================