-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020 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 <LightApp_SelectionMgr.h>
#include <LightApp_Application.h>
#include <SALOME_ListIO.hxx>
-#include <SALOME_ListIteratorOfListIO.hxx>
#include <SalomeApp_Tools.h>
#include <SVTK_Selector.h>
#include <SVTK_ViewWindow.h>
-#include <VTKViewer_CellLocationsArray.h>
+//#include <VTKViewer_CellLocationsArray.h>
// OCCT includes
#include <Bnd_B3d.hxx>
const bool the3d2d,
bool theDoInit):
SMESHGUI_PreviewDlg(theModule),
- mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
+ mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySMESHGUI(theModule)
{
setModal(false);
aNF = aFilterMgr->CreateMultiConnection2D();
else if (myComboBoxFunctor->currentText() == tr("MIN_DIAG_ELEMENTS"))
aNF = aFilterMgr->CreateMaxElementLength2D();
- else;
return aNF._retn();
}
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(reject()));
+ connect(mySMESHGUI, SIGNAL(SignalActivatedViewManager()), SLOT( onOpenView()));
+ connect(mySMESHGUI, SIGNAL(SignalCloseView()), SLOT( onCloseView()));
// dialog controls
connect(myFilterBtn, SIGNAL(clicked()), SLOT(onFilterBtn() ));
//=======================================================================
// name : SMESHGUI_MultiEditDlg::getIds
-// Purpose : Retrive identifiers from list box or the whole object
+// Purpose : Retrieve identifiers from list box or the whole object
//=======================================================================
-SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds(SMESH::SMESH_IDSource_var& obj)
+SMESH::smIdType_array_var SMESHGUI_MultiEditDlg::getIds(SMESH::SMESH_IDSource_var& obj)
{
- SMESH::long_array_var anIds = new SMESH::long_array;
+ SMESH::smIdType_array_var anIds = new SMESH::smIdType_array;
if (myToAllChk->isChecked())
{
QDialog::reject();
}
+//=================================================================================
+// function : onOpenView()
+// purpose :
+//=================================================================================
+void SMESHGUI_MultiEditDlg::onOpenView()
+{
+ if(!mySelector) {
+ mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector();
+ mySMESHGUI->EmitSignalDeactivateDialog();
+ setEnabled(true);
+ }
+}
+
+//=================================================================================
+// function : onCloseView()
+// purpose :
+//=================================================================================
+void SMESHGUI_MultiEditDlg::onCloseView()
+{
+ onDeactivate();
+ mySelector = 0;
+}
+
+
//=================================================================================
// function : onHelp()
// purpose :
//=======================================================================
// name : SMESHGUI_MultiEditDlg::onDeactivate
-// Purpose : SLOT called when dialog must be deativated
+// Purpose : SLOT called when dialog must be deactivated
//=======================================================================
void SMESHGUI_MultiEditDlg::onDeactivate()
{
void SMESHGUI_MultiEditDlg::enterEvent (QEvent*)
{
if (!isEnabled()) {
+ SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
+ if ( aViewWindow && !mySelector) {
+ mySelector = aViewWindow->GetSelector();
+ }
mySMESHGUI->EmitSignalDeactivateDialog();
setEnabled(true);
setSelectionMode();
//=======================================================================
bool SMESHGUI_MultiEditDlg::isIdValid (const int theId) const
{
+ if ( !myActor )
+ return true; // filter can't work w/o actor
+
SVTK_Selector* aSelector = SMESH::GetSelector();
Handle(SMESHGUI_Filter) aFilter =
Handle(SMESHGUI_Filter)::DownCast(aSelector->GetFilter(myFilterType));
SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIter.Value());
if (!aSubMesh->_is_nil()) {
if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
- SMESH::long_array_var anIds = aSubMesh->GetElementsId();
+ SMESH::smIdType_array_var anIds = aSubMesh->GetElementsId();
for (int i = 0, n = anIds->length(); i < n; i++) {
- if (isIdValid(anIds[ i ]))
- toBeAdded.Add(anIds[ i ]);
+ if (isIdValid(FromIdType<int>(anIds[ i ])))
+ toBeAdded.Add(FromIdType<int>(anIds[ i ]));
}
}
}
if (!aGroup->_is_nil() && ((aGroup->GetType() == SMESH::FACE && entityType() == 0) ||
(aGroup->GetType() == SMESH::VOLUME && entityType() == 1))) {
if (aGroup->GetMesh()->GetId() == myMesh->GetId()) {
- SMESH::long_array_var anIds = aGroup->GetListOfID();
+ SMESH::smIdType_array_var anIds = aGroup->GetListOfID();
for (int i = 0, n = anIds->length(); i < n; i++) {
- if (isIdValid(anIds[ i ]))
- toBeAdded.Add(anIds[ i ]);
+ if (isIdValid(FromIdType<int>(anIds[ i ])))
+ toBeAdded.Add(FromIdType<int>(anIds[ i ]));
}
}
}
bool isListBoxNonEmpty = myListBox->count() > 0;
bool isToAll = myToAllChk->isChecked();
myFilterBtn->setEnabled(!isToAll);
- myRemoveBtn->setEnabled(isListBoxNonEmpty && !isToAll);
+ myRemoveBtn->setEnabled(myListBox->selectedItems().count() && !isToAll);
mySortBtn->setEnabled(isListBoxNonEmpty &&!isToAll);
const SALOME_ListIO& aList = mySelector->StoredIObjects();
if (myListBox->item(i)->isSelected())
{
int anId = myListBox->item(i)->text().toInt();
- if (anObj->GetElemVTKId(anId) >= 0) // avoid exception in hilight
+ if (anObj->GetElemVTKId(anId) >= 0) // avoid exception in highlight
anIndexes.Add(anId);
}
}
mySelector->AddOrRemoveIndex(anActor->getIO(),anIndexes,false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->highlight(anActor->getIO(),true,true);
+
+ myRemoveBtn->setEnabled( anIndexes.Extent() );
}
//=======================================================================
}
if (entityType()) {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(VolumeSelection);
SMESH::SetFilter(new SMESHGUI_VolumesFilter());
- } else {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
+ aViewWindow->SetSelectionMode(VolumeSelection); // here myActor set to a filter
+ } else {
if (myFilterType == SMESH::TriaFilter)
SMESH::SetFilter(new SMESHGUI_TriangleFilter());
else if (myFilterType == SMESH::QuadFilter)
SMESH::SetFilter(new SMESHGUI_QuadrangleFilter());
else
SMESH::SetFilter(new SMESHGUI_FacesFilter());
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(FaceSelection); // here myActor set to a filter
}
}
//=======================================================================
bool SMESHGUI_MultiEditDlg::onApply()
{
- if (mySMESHGUI->isActiveStudyLocked())
+ if (SMESHGUI::isStudyLocked())
return false;
if (!isValid(true))
return false;
SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_IDSource_var obj;
- SMESH::long_array_var anIds = getIds(obj);
+ SMESH::smIdType_array_var anIds = getIds(obj);
bool aResult = process(aMeshEditor, anIds.inout(), obj);
if (aResult) {
SMESHGUI_MultiEditDlg(theModule, SMESH::FaceFilter, true)
{
setWindowTitle(tr("CAPTION"));
- myHelpFileName = "changing_orientation_of_elements_page.html";
+ myHelpFileName = "changing_orientation_of_elements.html";
}
SMESHGUI_ChangeOrientationDlg::~SMESHGUI_ChangeOrientationDlg()
{
}
-bool SMESHGUI_ChangeOrientationDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
- const SMESH::long_array& theIds,
- SMESH::SMESH_IDSource_ptr obj)
+bool SMESHGUI_ChangeOrientationDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
+ const SMESH::smIdType_array& theIds,
+ SMESH::SMESH_IDSource_ptr obj)
{
if ( CORBA::is_nil( obj ))
return theEditor->Reorient(theIds);
int SMESHGUI_ChangeOrientationDlg::nbElemsInMesh()
{
- return ( myFilterType = SMESH::FaceFilter ) ? myMesh->NbFaces() : myMesh->NbVolumes();
+ return ( myFilterType == SMESH::FaceFilter ) ? FromIdType<int>(myMesh->NbFaces()) : FromIdType<int>(myMesh->NbVolumes());
}
/*!
myPreviewCheckBox->setChecked(false);
onDisplaySimulation(false);
- myHelpFileName = "uniting_set_of_triangles_page.html";
+ myHelpFileName = "uniting_set_of_triangles.html";
}
SMESHGUI_UnionOfTrianglesDlg::~SMESHGUI_UnionOfTrianglesDlg()
}
bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
- const SMESH::long_array& theIds,
+ const SMESH::smIdType_array& theIds,
SMESH::SMESH_IDSource_ptr obj)
{
{
QStringList aParameters;
aParameters << myMaxAngleSpin->text();
- myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
+ myMesh->SetParameters( aParameters.join(":").toUtf8().constData() );
}
SMESH::NumericalFunctor_var aCriterion = getNumericalFunctor();
double aMaxAngle = myMaxAngleSpin->GetValue() * M_PI / 180.0;
int SMESHGUI_UnionOfTrianglesDlg::nbElemsInMesh()
{
- return myMesh->NbTriangles();
+ return FromIdType<int>(myMesh->NbTriangles());
}
void SMESHGUI_UnionOfTrianglesDlg::onDisplaySimulation( bool toDisplayPreview )
SUIT_OverrideCursor aWaitCursor;
// get Ids of elements
SMESH::SMESH_IDSource_var obj;
- SMESH::long_array_var anElemIds = getIds( obj );
+ SMESH::smIdType_array_var anElemIds = getIds( obj );
SMESH::NumericalFunctor_var aCriterion = getNumericalFunctor();
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
mySimulation->GetActor()->SetProperty( aProp );
aProp->Delete();
- mySimulation->SetData( aMeshPreviewStruct._retn() );
+ mySimulation->SetData( aMeshPreviewStruct.in() );
} catch ( ... ) {
hidePreview();
}
connect(myComboBoxFunctor, SIGNAL(activated(int)), this, SLOT(onPreviewChk()));
connect(this, SIGNAL(ListContensChanged()), this, SLOT(onPreviewChk()));
- myHelpFileName = "cutting_quadrangles_page.html";
+ myHelpFileName = "cutting_quadrangles.html";
}
SMESHGUI_CuttingOfQuadsDlg::~SMESHGUI_CuttingOfQuadsDlg()
}
bool SMESHGUI_CuttingOfQuadsDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
- const SMESH::long_array& theIds,
+ const SMESH::smIdType_array& theIds,
SMESH::SMESH_IDSource_ptr obj)
{
bool hasObj = (! CORBA::is_nil( obj ));
{
if ( hasObj )
return theEditor->QuadTo4Tri( obj ), true;
- SMESH::SMESH_IDSource_wrap elems = theEditor->MakeIDSource( theIds, SMESH::FACE );
+ SMESH::IDSource_wrap elems = theEditor->MakeIDSource( theIds, SMESH::FACE );
theEditor->QuadTo4Tri( elems );
return true;
}
int SMESHGUI_CuttingOfQuadsDlg::nbElemsInMesh()
{
- return myMesh->NbQuadrangles();
+ return FromIdType<int>(myMesh->NbQuadrangles());
}
SUIT_OverrideCursor aWaitCursor;
// get Ids of elements
SMESH::SMESH_IDSource_var obj;
- SMESH::long_array_var anElemIds = getIds(obj);
+ SMESH::smIdType_array_var anElemIds = getIds(obj);
if (anElemIds->length() == 0 && obj->_is_nil() )
return;
const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(anIter->next());
if (aNode)
{
- if (!anIdToVtk.IsBound(aNode->GetID()))
+ if (!anIdToVtk.IsBound(FromIdType<int>(aNode->GetID())))
{
aPoints->SetPoint(++nbPoints, aNode->X(), aNode->Y(), aNode->Z());
- anIdToVtk.Bind(aNode->GetID(), nbPoints);
+ anIdToVtk.Bind(FromIdType<int>(aNode->GetID()), nbPoints);
}
- aNodes[ k++ ] = aNode->GetID();
+ aNodes[ k++ ] = FromIdType<int>(aNode->GetID());
}
}
else // use numerical functor
{
// compare two sets of possible triangles
- int diag = aMeshEditor->BestSplit(anElemIds[i], aCriterion);
+ smIdType diag = aMeshEditor->BestSplit(anElemIds[i], aCriterion);
if (diag == 1) // 1-3
isDiag13 = true;
else if (diag == 2) // 2-4
}
}
- VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
+ vtkIdTypeArray* aCellLocationsArray = vtkIdTypeArray::New();
aCellLocationsArray->SetNumberOfComponents(1);
aCellLocationsArray->SetNumberOfTuples(aNbCells);
aConnectivity->InitTraversal();
- for(vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell(npts, pts); idType++)
+ vtkIdType const *pts(nullptr);
+ for(vtkIdType idType = 0, npts; aConnectivity->GetNextCell(npts, pts); idType++)
aCellLocationsArray->SetValue(idType, aConnectivity->GetTraversalLocation(npts));
aGrid->SetPoints(aPoints);
: SMESHGUI_MultiEditDlg(theModule, SMESH::VolumeFilter, /*the3d2d=*/true, /*doInit=*/false)
{
setWindowTitle(tr("CAPTION"));
- myHelpFileName = "split_to_tetra_page.html";
+ myHelpFileName = "split_to_tetra.html";
myEntityType = 1;
myCellSize = -1.;
QLabel* dXLbl = new QLabel( tr("SMESH_DX"), myFacetSelGrp);
QLabel* dYLbl = new QLabel( tr("SMESH_DY"), myFacetSelGrp);
QLabel* dZLbl = new QLabel( tr("SMESH_DZ"), myFacetSelGrp);
- QPushButton* axisBtn[3];
for ( int i = 0; i < 3; ++i )
{
myPointSpin[i] = new SMESHGUI_SpinBox( myFacetSelGrp );
}
if ( myEntityTypeGrp )
{
- myEntityTypeGrp->button(0)->setText( tr("SMESH_TETRAS"));
+ myEntityTypeGrp->button(0)->setText( tr("SMESH_TETRAHEDRON"));
myEntityTypeGrp->button(1)->setText( tr("SMESH_PRISM"));
if ( QGroupBox* gb = qobject_cast< QGroupBox* >( myEntityTypeGrp->button(0)->parent() ))
gb->setTitle( tr("TARGET_ELEM_TYPE"));
}
- myToAllChk->setChecked( true ); //aplly to the whole mesh by default
+ myToAllChk->setChecked( true ); //apply to the whole mesh by default
bool hasHexa = true;//myMesh->_is_nil() ? false : myMesh->NbHexas();
if ( hasHexa )
}
bool SMESHGUI_SplitVolumesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
- const SMESH::long_array& theIds,
+ const SMESH::smIdType_array& theIds,
SMESH::SMESH_IDSource_ptr theObj)
{
- SMESH::SMESH_IDSource_wrap obj = theObj;
+ SMESH::IDSource_wrap obj = theObj;
if ( CORBA::is_nil( obj ))
obj = theEditor->MakeIDSource( theIds, SMESH::VOLUME );
else
aParameters << myDirSpin[0]->text();
aParameters << myDirSpin[1]->text();
aParameters << myDirSpin[2]->text();
- myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
-
- SMESH::AxisStruct_var axis = new SMESH::AxisStruct;
- axis->x = myPointSpin[0]->GetValue();
- axis->y = myPointSpin[1]->GetValue();
- axis->z = myPointSpin[2]->GetValue();
- axis->vx = myDirSpin[0]->GetValue();
- axis->vy = myDirSpin[1]->GetValue();
- axis->vz = myDirSpin[2]->GetValue();
-
- theEditor->SplitHexahedraIntoPrisms( obj, myGroupChoice->checkedId()+1,
- axis, myAllDomainsChk->isChecked() );
+ myMesh->SetParameters( aParameters.join(":").toUtf8().constData() );
+
+ SMESH::PointStruct_var point = new SMESH::PointStruct;
+ point->x = myPointSpin[0]->GetValue();
+ point->y = myPointSpin[1]->GetValue();
+ point->z = myPointSpin[2]->GetValue();
+ SMESH::DirStruct_var norm = new SMESH::DirStruct;
+ norm->PS.x = myDirSpin[0]->GetValue();
+ norm->PS.y = myDirSpin[1]->GetValue();
+ norm->PS.z = myDirSpin[2]->GetValue();
+
+ theEditor->SplitHexahedraIntoPrisms( obj, point, norm,
+ myGroupChoice->checkedId()+1,
+ myAllDomainsChk->isChecked() );
}
else
{
int SMESHGUI_SplitVolumesDlg::nbElemsInMesh()
{
- return isIntoPrisms() ? myMesh->NbHexas() : myMesh->NbVolumes() - myMesh->NbTetras();
+ return isIntoPrisms() ? FromIdType<int>(myMesh->NbHexas()) : FromIdType<int>(myMesh->NbVolumes() - myMesh->NbTetras());
}
bool SMESHGUI_SplitVolumesDlg::isIntoPrisms()
}
SMESHGUI_MultiEditDlg::on3d2dChanged( !myEntityType );
myEntityType = 1; // == VOLUME
+ myChoiceWidget->hide();
+ myChoiceWidget->show();
+ resize(minimumSizeHint());
+ onSelectionDone();
}
//================================================================================
}
updateButtons();
}
+
+ myCriterionGrp->setEnabled( !myMesh->_is_nil() && nbElemsInMesh() > 0 );
}
//================================================================================
gp_XYZ bc( 0,0,0 );
Bnd_B3d bbox;
SMDS_NodeIteratorPtr nIt = elem->nodeIterator();
- vector< const SMDS_MeshNode* > nodes;
+ std::vector< const SMDS_MeshNode* > nodes;
nodes.reserve( elem->NbNodes() );
while ( nIt->more() )
{
if ( sender() == myAxisBtn[i] )
break;
if ( i == 3 )
- i == 0;
+ i = 0;
myDirSpin[i]->SetValue(1.);
if ( myActor && !myMesh->_is_nil() && myMesh->NbNodes() > 0 )