X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_AddMeshElementDlg.cxx;h=28eba22e9b073334e862ee200bc06cb13f1e2bb9;hb=7cab0901cbf9895ce79a5af2390f310136a94802;hp=823716a853bb6cd4f69b87c496538c69aba2e665;hpb=b33324fe602b1fe1158c14a866c3802df12370fa;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx index 823716a85..28eba22e9 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx @@ -39,6 +39,8 @@ #include "SMESH_Actor.h" #include "SUIT_Session.h" +#include "SUIT_MessageBox.h" +#include "LightApp_Application.h" #include "SVTK_Selection.h" #include "SVTK_Selector.h" @@ -65,6 +67,7 @@ #include #include #include +#include // QT Includes #include @@ -118,7 +121,7 @@ namespace SMESH { myPreviewActor->VisibilityOff(); myPreviewActor->SetMapper(myMapper); - float anRGB[3]; + vtkFloatingPointType anRGB[3]; vtkProperty* aProp = vtkProperty::New(); GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) ); aProp->SetColor( anRGB[0], anRGB[1], anRGB[2] ); @@ -242,20 +245,34 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule, } QString elemName; - if (myNbNodes == 2) + if (myNbNodes == 2) { elemName = "EDGE"; - else if (myNbNodes == 3) + myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_edges"; + } + else if (myNbNodes == 3) { elemName = "TRIANGLE"; + myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_triangles"; + } else if (myNbNodes == 4) - if (myElementType == SMDSAbs_Face) + if (myElementType == SMDSAbs_Face) { elemName = "QUADRANGLE"; - else + myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_quadrangles"; + } + else { elemName = "TETRAS"; - else if (myNbNodes == 8) + myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_tetrahedrons"; + } + else if (myNbNodes == 8) { elemName = "HEXAS"; - else if (myElementType == SMDSAbs_Face){ + myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_hexahedrons"; + } + else if (myElementType == SMDSAbs_Face) { elemName = "POLYGON"; myIsPoly = true; + myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_polygons"; + } + else if (myElementType == SMDSAbs_Volume) { + myHelpFileName = "/files/adding_nodes_and_elements.htm#Adding_polyhedrons"; } QString iconName = tr(QString("ICON_DLG_%1").arg(elemName)); @@ -325,6 +342,11 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule, buttonOk->setAutoDefault(TRUE); buttonOk->setDefault(TRUE); GroupButtonsLayout->addWidget(buttonOk, 0, 0); + buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); + buttonHelp->setText(tr("SMESH_BUT_HELP" )); + buttonHelp->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonHelp, 0, 4); + SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupButtons, 2, 0); /***************************************************************/ @@ -399,6 +421,7 @@ void SMESHGUI_AddMeshElementDlg::Init() connect(buttonOk, SIGNAL(clicked()), SLOT(ClickOnOk())); connect(buttonCancel, SIGNAL(clicked()), SLOT(ClickOnCancel())); connect(buttonApply, SIGNAL(clicked()), SLOT(ClickOnApply())); + connect(buttonHelp, SIGNAL(clicked()), SLOT(ClickOnHelp())); connect(SelectButtonC1A1, SIGNAL(clicked()), SLOT(SetEditCurrentArgument())); connect(LineEditC1A1, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); @@ -410,10 +433,6 @@ void SMESHGUI_AddMeshElementDlg::Init() if (Reverse) connect(Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int))); - // Move widget on the botton right corner of main widget - int x, y; - mySMESHGUI->DefineDlgPosition(this, x, y); - this->move(x, y); this->show(); // displays Dialog // set selection mode @@ -449,14 +468,21 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply() switch (myElementType) { case SMDSAbs_Edge: aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break; - case SMDSAbs_Face: - aMeshEditor->AddFace(anArrayOfIdeces.inout()); break; + case SMDSAbs_Face:{ + if(myIsPoly) + aMeshEditor->AddPolygonalFace(anArrayOfIdeces.inout()); + else + aMeshEditor->AddFace(anArrayOfIdeces.inout()); + break; + + } case SMDSAbs_Volume: aMeshEditor->AddVolume(anArrayOfIdeces.inout()); break; default:; } SALOME_ListIO aList; aList.Append( myActor->getIO() ); + mySelector->ClearIndex(); mySelectionMgr->setSelectedObjects( aList, false ); SMESH::UpdateView(); @@ -488,7 +514,7 @@ void SMESHGUI_AddMeshElementDlg::ClickOnOk() //================================================================================= void SMESHGUI_AddMeshElementDlg::ClickOnCancel() { - mySelectionMgr->clearSelected(); + //mySelectionMgr->clearSelected(); mySimulation->SetVisibility(false); SMESH::SetPointRepresentation(false); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) @@ -499,6 +525,23 @@ void SMESHGUI_AddMeshElementDlg::ClickOnCancel() return; } +//================================================================================= +// function : ClickOnHelp() +// purpose : +//================================================================================= +void SMESHGUI_AddMeshElementDlg::ClickOnHelp() +{ + 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")); + } +} + //================================================================================= // function : onTextChange() // purpose : @@ -524,23 +567,30 @@ void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText) TColStd_MapOfInteger newIndices; QStringList aListId = QStringList::split(" ", theNewText, false); + bool allOk = true; for (int i = 0; i < aListId.count(); i++) { if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) ) { newIndices.Add( n->GetID() ); myNbOkNodes++; } + else + allOk = false; } mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false ); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->highlight( myActor->getIO(), true, true ); - bool aNodesOK = false; - if (myIsPoly && myElementType == SMDSAbs_Face && aListId.count() >=3 ){ - myNbOkNodes = aListId.count(); - aNodesOK = true; - } + myNbOkNodes = ( allOk && myNbNodes == aListId.count() ); + + if (myIsPoly) + { + if ( !allOk || myElementType != SMDSAbs_Face || aListId.count() < 3 ) + myNbOkNodes = 0; + else + myNbOkNodes = aListId.count(); + } } if(myNbOkNodes) {