X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_MergeDlg.cxx;h=428fe0cdad26d0902d03e7c60fba4143a09cc0b9;hb=8a13383ac082f8df68dcde67792c30c10d97b449;hp=dfb2de764751b266be8c8bdbecbd562edde4a4b7;hpb=bd8f1aee7c78f7d2eb82bd4fec5e08c9e3d280ce;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_MergeDlg.cxx b/src/SMESHGUI/SMESHGUI_MergeDlg.cxx index dfb2de764..428fe0cda 100644 --- a/src/SMESHGUI/SMESHGUI_MergeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MergeDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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 @@ -74,10 +74,6 @@ #include #include #include -#include -#if !defined(VTK_XVERSION) -#define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION) -#endif // Qt includes #include @@ -150,9 +146,6 @@ namespace SMESH myPtsLabeledDataMapper = vtkLabeledDataMapper::New(); myPtsLabeledDataMapper->SetInputConnection(myPtsSelectVisiblePoints->GetOutputPort()); -#if (VTK_XVERSION < 0x050200) - myPtsLabeledDataMapper->SetLabelFormat("%g"); -#endif myPtsLabeledDataMapper->SetLabelModeToLabelScalars(); vtkTextProperty* aPtsTextProp = vtkTextProperty::New(); @@ -437,12 +430,14 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction) RemoveGroupButton = new QPushButton(tr("SMESH_BUT_REMOVE"), GroupCoincidentWidget); SelectAllCB = new QCheckBox(tr("SELECT_ALL"), GroupCoincidentWidget); + ShowIDs = new QCheckBox(myAction == 1 ? tr("SHOW_ELEMS_IDS") : tr("SHOW_NODES_IDS"), GroupCoincidentWidget); GroupCoincidentLayout->addWidget(ListCoincident, 0, 0, 4, 2); GroupCoincidentLayout->addWidget(DetectButton, 0, 2); GroupCoincidentLayout->addWidget(AddGroupButton, 2, 2); GroupCoincidentLayout->addWidget(RemoveGroupButton, 3, 2); - GroupCoincidentLayout->addWidget(SelectAllCB, 4, 0, 1, 3); + GroupCoincidentLayout->addWidget(SelectAllCB, 4, 0); + GroupCoincidentLayout->addWidget(ShowIDs, 4, 1); GroupCoincidentLayout->setRowMinimumHeight(1, 10); GroupCoincidentLayout->setRowStretch(1, 5); @@ -513,6 +508,8 @@ SMESHGUI_MergeDlg::SMESHGUI_MergeDlg (SMESHGUI* theModule, int theAction) this->resize(10,10); + ShowIDs->setChecked( true ); + Init(); // Initialisations } @@ -562,6 +559,7 @@ void SMESHGUI_MergeDlg::Init() connect(AddGroupButton, SIGNAL (clicked()), this, SLOT(onAddGroup())); connect(RemoveGroupButton, SIGNAL (clicked()), this, SLOT(onRemoveGroup())); connect(SelectAllCB, SIGNAL(toggled(bool)), this, SLOT(onSelectAll(bool))); + connect(ShowIDs, SIGNAL(toggled(bool)), this, SLOT(onSelectGroup())); connect(ListEdit, SIGNAL (itemSelectionChanged()), this, SLOT(onSelectElementFromGroup())); connect(AddElemButton, SIGNAL (clicked()), this, SLOT(onAddElement())); connect(RemoveElemButton, SIGNAL (clicked()), this, SLOT(onRemoveElement())); @@ -684,6 +682,8 @@ bool SMESHGUI_MergeDlg::ClickOnApply() ListCoincident->clear(); + myEditCurrentArgument = (QWidget*)LineEditMesh; + SMESH::UpdateView(); SMESHGUI::Modified(); @@ -835,6 +835,7 @@ void SMESHGUI_MergeDlg::onDetect() ListCoincident->selectAll(); updateControls(); + SMESH::UpdateView(); } //================================================================================= @@ -845,8 +846,13 @@ void SMESHGUI_MergeDlg::onSelectGroup() { if (myIsBusy || !myActor) return; + + if( ListCoincident->count() != ListCoincident->selectedItems().count() ) + SelectAllCB->setChecked( false ); + myEditCurrentArgument = (QWidget*)ListCoincident; + myIsBusy = true; ListEdit->clear(); TColStd_MapOfInteger anIndices; @@ -856,7 +862,7 @@ void SMESHGUI_MergeDlg::onSelectGroup() ListEdit->clear(); - foreach(anItem, selItems) { + Q_FOREACH(anItem, selItems) { aListIds = anItem->text().split(" ", QString::SkipEmptyParts); for (int i = 0; i < aListIds.count(); i++) anIndices.Add(aListIds[i].toInt()); @@ -872,18 +878,22 @@ void SMESHGUI_MergeDlg::onSelectGroup() aList.Append(myActor->getIO()); mySelectionMgr->setSelectedObjects(aList,false); - if (myAction == 0) { - myIdPreview->SetPointsData(myActor->GetObject()->GetMesh(), anIndices); - myIdPreview->SetPointsLabeled(!anIndices.IsEmpty(), myActor->GetVisibility()); - } - else { - std::list< gp_XYZ > aGrCentersXYZ; - FindGravityCenter(anIndices, aGrCentersXYZ); - myIdPreview->SetElemsData( anIndices, aGrCentersXYZ); - myIdPreview->SetPointsLabeled(!anIndices.IsEmpty(), myActor->GetVisibility()); - } + if (ShowIDs->isChecked()) + if (myAction == 0) { + myIdPreview->SetPointsData(myActor->GetObject()->GetMesh(), anIndices); + myIdPreview->SetPointsLabeled(!anIndices.IsEmpty(), myActor->GetVisibility()); + } + else { + std::list< gp_XYZ > aGrCentersXYZ; + FindGravityCenter(anIndices, aGrCentersXYZ); + myIdPreview->SetElemsData( anIndices, aGrCentersXYZ); + myIdPreview->SetPointsLabeled(!anIndices.IsEmpty(), myActor->GetVisibility()); + } + else + myIdPreview->SetPointsLabeled(false); updateControls(); + myIsBusy = false; } //================================================================================= @@ -911,7 +921,7 @@ void SMESHGUI_MergeDlg::onSelectElementFromGroup() QList selItems = ListEdit->selectedItems(); QListWidgetItem* anItem; - foreach(anItem, selItems) + Q_FOREACH(anItem, selItems) anIndices.Add(anItem->text().toInt()); SetFirstButton->setEnabled(selItems.count() == 1); @@ -920,17 +930,20 @@ void SMESHGUI_MergeDlg::onSelectElementFromGroup() SALOME_ListIO aList; aList.Append(myActor->getIO()); mySelectionMgr->setSelectedObjects(aList); - - if (myAction == 0) { - myIdPreview->SetPointsData(myActor->GetObject()->GetMesh(), anIndices); - myIdPreview->SetPointsLabeled(!anIndices.IsEmpty(), myActor->GetVisibility()); - } - else { - std::list< gp_XYZ > aGrCentersXYZ; - FindGravityCenter(anIndices, aGrCentersXYZ); - myIdPreview->SetElemsData(anIndices, aGrCentersXYZ); - myIdPreview->SetPointsLabeled(!anIndices.IsEmpty(), myActor->GetVisibility()); - } + + if (ShowIDs->isChecked()) + if (myAction == 0) { + myIdPreview->SetPointsData(myActor->GetObject()->GetMesh(), anIndices); + myIdPreview->SetPointsLabeled(!anIndices.IsEmpty(), myActor->GetVisibility()); + } + else { + std::list< gp_XYZ > aGrCentersXYZ; + FindGravityCenter(anIndices, aGrCentersXYZ); + myIdPreview->SetElemsData(anIndices, aGrCentersXYZ); + myIdPreview->SetPointsLabeled(!anIndices.IsEmpty(), myActor->GetVisibility()); + } + else + myIdPreview->SetPointsLabeled(false); } //================================================================================= @@ -978,13 +991,19 @@ void SMESHGUI_MergeDlg::onRemoveGroup() QList selItems = ListCoincident->selectedItems(); QListWidgetItem* anItem; - foreach(anItem, selItems) + Q_FOREACH(anItem, selItems) delete anItem; ListEdit->clear(); + myIdPreview->SetPointsLabeled(false); updateControls(); - + SMESH::UpdateView(); myIsBusy = false; + + if( ListCoincident->count() == 0 ) { + myEditCurrentArgument = (QWidget*)LineEditMesh; + SelectAllCB->setChecked( false ); + } } //================================================================================= @@ -1015,7 +1034,7 @@ void SMESHGUI_MergeDlg::onAddElement() } else { QListWidgetItem* anItem; - foreach(anItem, found) anItem->setSelected(true); + Q_FOREACH(anItem, found) anItem->setSelected(true); } } @@ -1036,11 +1055,16 @@ void SMESHGUI_MergeDlg::onRemoveElement() QList selItems = ListEdit->selectedItems(); QListWidgetItem* anItem; - foreach(anItem, selItems) + Q_FOREACH(anItem, selItems) delete anItem; myIsBusy = false; onEditGroup(); + + if( ListCoincident->count() == 0 ) { + myEditCurrentArgument = (QWidget*)LineEditMesh; + SelectAllCB->setChecked( false ); + } } //================================================================================= @@ -1056,7 +1080,7 @@ void SMESHGUI_MergeDlg::onSetFirst() QList selItems = ListEdit->selectedItems(); QListWidgetItem* anItem; - foreach(anItem, selItems) { + Q_FOREACH(anItem, selItems) { ListEdit->takeItem(ListEdit->row(anItem)); ListEdit->insertItem(0, anItem); } @@ -1132,7 +1156,7 @@ void SMESHGUI_MergeDlg::SelectionIntoArgument() if (!myActor) myActor = SMESH::FindActorByObject(myMesh); - if ( myActor && myTypeId ==1 ) { + if ( myActor && myTypeId == 1 && mySelector->IsSelectionEnabled() ) { mySubMeshOrGroup = SMESH::SMESH_IDSource::_nil(); mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); @@ -1285,12 +1309,14 @@ void SMESHGUI_MergeDlg::onTypeChanged (int id) GroupCoincidentWidget->show(); SMESH::SetPointRepresentation(true); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(NodeSelection); + if( mySelector->IsSelectionEnabled() ) + aViewWindow->SetSelectionMode(NodeSelection); } else { GroupCoincident->show(); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(CellSelection); + if( mySelector->IsSelectionEnabled() ) + aViewWindow->SetSelectionMode(CellSelection); } GroupEdit->show(); break;