-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 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
// 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
#include <vtkIntArray.h>
#include <vtkProperty2D.h>
#include <vtkPointData.h>
-#include <vtkConfigure.h>
-#if !defined(VTK_XVERSION)
-#define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION)
-#endif
// Qt includes
#include <QApplication>
// Create and display actor
vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
- aMapper->SetInput( myIdGrid );
+ aMapper->SetInputData( myIdGrid );
myIdActor = SALOME_Actor::New();
myIdActor->SetInfinitive(true);
myPointsNumDataSet = vtkUnstructuredGrid::New();
myPtsMaskPoints = vtkMaskPoints::New();
- myPtsMaskPoints->SetInput(myPointsNumDataSet);
+ myPtsMaskPoints->SetInputData(myPointsNumDataSet);
myPtsMaskPoints->SetOnRatio(1);
myPtsSelectVisiblePoints = vtkSelectVisiblePoints::New();
- myPtsSelectVisiblePoints->SetInput(myPtsMaskPoints->GetOutput());
+ myPtsSelectVisiblePoints->SetInputConnection(myPtsMaskPoints->GetOutputPort());
myPtsSelectVisiblePoints->SelectInvisibleOff();
myPtsSelectVisiblePoints->SetTolerance(0.1);
myPtsLabeledDataMapper = vtkLabeledDataMapper::New();
- myPtsLabeledDataMapper->SetInput(myPtsSelectVisiblePoints->GetOutput());
-#if (VTK_XVERSION < 0x050200)
- myPtsLabeledDataMapper->SetLabelFormat("%g");
-#endif
+ myPtsLabeledDataMapper->SetInputConnection(myPtsSelectVisiblePoints->GetOutputPort());
myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
vtkTextProperty* aPtsTextProp = vtkTextProperty::New();
anArray->SetValue( i, myIDs[i] );
aDataSet->GetPointData()->SetScalars( anArray );
anArray->Delete();
- myPtsMaskPoints->SetInput( aDataSet );
+ myPtsMaskPoints->SetInputData( aDataSet );
myPointLabels->SetVisibility( theIsActorVisible );
}
else {
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);
this->resize(10,10);
+ ShowIDs->setChecked( true );
+
Init(); // Initialisations
}
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
- connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
+ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
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()));
connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
/* to close dialog if study change */
- connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+ connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(reject()));
// Init Mesh field from selection
SelectionIntoArgument();
aMeshEditor->MergeElements (aGroupsOfElements.inout());
if ( myTypeId == 0 ) {
- if (myAction ==0)
+ if (myAction == 0 )
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INFORMATION"),
tr("SMESH_MERGED_NODES").arg(QString::number(ListCoincident->count()).toLatin1().data()));
else
ListCoincident->clear();
+ myEditCurrentArgument = (QWidget*)LineEditMesh;
+
SMESH::UpdateView();
SMESHGUI::Modified();
void SMESHGUI_MergeDlg::ClickOnOk()
{
if (ClickOnApply())
- ClickOnCancel();
+ reject();
}
//=================================================================================
-// function : ClickOnCancel()
+// function : reject()
// purpose :
//=================================================================================
-void SMESHGUI_MergeDlg::ClickOnCancel()
+void SMESHGUI_MergeDlg::reject()
{
myIdPreview->SetPointsLabeled(false);
SMESH::SetPointRepresentation(false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
- reject();
+ QDialog::reject();
}
//=================================================================================
bool enable = !(myMesh->_is_nil()) && (ListCoincident->count() || (myTypeId == 0));
buttonOk->setEnabled(enable);
buttonApply->setEnabled(enable);
+ DetectButton->setEnabled( !myMesh->_is_nil() );
}
//=================================================================================
ListCoincident->selectAll();
updateControls();
+ SMESH::UpdateView();
}
//=================================================================================
{
if (myIsBusy || !myActor)
return;
+
+ if( ListCoincident->count() != ListCoincident->selectedItems().count() )
+ SelectAllCB->setChecked( false );
+
myEditCurrentArgument = (QWidget*)ListCoincident;
+ myIsBusy = true;
ListEdit->clear();
TColStd_MapOfInteger anIndices;
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;
}
//=================================================================================
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);
}
//=================================================================================
delete anItem;
ListEdit->clear();
+ myIdPreview->SetPointsLabeled(false);
updateControls();
-
+ SMESH::UpdateView();
myIsBusy = false;
+
+ if( ListCoincident->count() == 0 ) {
+ myEditCurrentArgument = (QWidget*)LineEditMesh;
+ SelectAllCB->setChecked( false );
+ }
}
//=================================================================================
myIsBusy = false;
onEditGroup();
+
+ if( ListCoincident->count() == 0 ) {
+ myEditCurrentArgument = (QWidget*)LineEditMesh;
+ SelectAllCB->setChecked( false );
+ }
}
//=================================================================================
if (myEditCurrentArgument == (QWidget*)LineEditMesh) {
QString aString = "";
LineEditMesh->setText(aString);
-
+
ListCoincident->clear();
ListEdit->clear();
myActor = 0;
+ myMesh = SMESH::SMESH_Mesh::_nil();
QString aCurrentEntry = myEntry;
-
+
int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
if (nbSel != 1) {
myIdPreview->SetPointsLabeled(false);
SALOME_ListIO aList;
mySelectionMgr->selectedObjects(aList);
-
+
Handle(SALOME_InteractiveObject) IO = aList.First();
myEntry = IO->getEntry();
myMesh = SMESH::GetMeshByIO(IO);
-
+
if (myMesh->_is_nil())
return;
LineEditMesh->setText(aString);
-
+
myActor = SMESH::FindActorByEntry(IO->getEntry());
if (!myActor)
myActor = SMESH::FindActorByObject(myMesh);
-
- if ( myActor && myTypeId ==1 ) {
+
+ if ( myActor && myTypeId == 1 && mySelector->IsSelectionEnabled() ) {
mySubMeshOrGroup = SMESH::SMESH_IDSource::_nil();
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
ActivateThisDialog();
}
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_MergeDlg::closeEvent(QCloseEvent*)
-{
- /* same than click on cancel button */
- ClickOnCancel();
-}
-
-//=======================================================================
-//function : hideEvent
-//purpose : caused by ESC key
-//=======================================================================
-void SMESHGUI_MergeDlg::hideEvent (QHideEvent *)
-{
- if (!isMinimized())
- ClickOnCancel();
-}
-
//=================================================================================
// function : keyPressEvent()
// purpose :
SMESH::UpdateView();
// Costruction of the logical filter
- SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
- SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP);
+ SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (SMESH::MESHorSUBMESH);
+ SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (SMESH::GROUP);
QList<SUIT_SelectionFilter*> aListOfFilters;
if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
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;