#include "SMESHGUI_SingleEditDlg.h"
#include "SMESHGUI_MultiEditDlg.h"
#include "SMESHGUI_GroupOpDlg.h"
+#include "SMESHGUI_GroupOnShapeDlg.h"
#include "SMESHGUI_DeleteGroupDlg.h"
#include "SMESHGUI_SmoothingDlg.h"
#include "SMESHGUI_RenumberingDlg.h"
// VTK includes
#include <vtkScalarBarActor.h>
+#include <vtkCamera.h>
+#include <vtkRenderer.h>
+#include <vtkPlane.h>
// SALOME KERNEL includes
#include <SALOMEDS_Study.hxx>
#include <SALOMEDSClient_StudyBuilder.hxx>
#include <SALOMEDSClient_SComponent.hxx>
+#include <SALOMEDSClient_ClientFactory.hxx>
+#include <SALOMEDSClient_IParameters.hxx>
// OCCT includes
#include <Standard_ErrorHandler.hxx>
+#include <NCollection_DataMap.hxx>
//namespace{
// Declarations
// update Object browser
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
-
+
// show Error message box if there were errors
if ( errors.count() > 0 ) {
SUIT_MessageBox::critical( SMESHGUI::desktop(),
QObject::tr( "SMESH_ERROR" ),
QObject::tr( "SMESH_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
}
-
+
// show warning message box, if some imported mesh is empty
if ( isEmpty ) {
SUIT_MessageBox::warning( SMESHGUI::desktop(),
if( aSel )
aSel->selectedObjects( selected );
- if(selected.Extent()){
- Handle(SALOME_InteractiveObject) anIObject = selected.First();
- SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
- if ( !aMesh->_is_nil() ) {
- QString aFilter, aTitle = QObject::tr("Export mesh");
- QMap<QString, SMESH::MED_VERSION> aFilterMap;
- QMap<QString, int> aFilterMapSTL;
- switch ( theCommandID ) {
- case 125:
- case 122:
- {
- if (aMesh->HasDuplicatedGroupNamesMED()) {
- int aRet = SUIT_MessageBox::warning
- (SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_EXPORT_MED_DUPLICATED_GRP").arg(anIObject->getName()),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
- if (aRet != SUIT_MessageBox::Yes)
- return;
- }
- // PAL18696
- QString v21 (aMesh->GetVersionString(SMESH::MED_V2_1, 2));
- QString v22 (aMesh->GetVersionString(SMESH::MED_V2_2, 2));
- aFilterMap.insert( QString("MED ") + v21 + " (*.med)", SMESH::MED_V2_1 );
- aFilterMap.insert( QString("MED ") + v22 + " (*.med)", SMESH::MED_V2_2 );
- }
- break;
- case 124:
- case 121:
- aFilter = QObject::tr("DAT files (*.dat)");
- break;
- case 126:
- case 123:
- {
- if (aMesh->NbPyramids()) {
- int aRet = SUIT_MessageBox::warning
- (SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_EXPORT_UNV").arg(anIObject->getName()),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
- if (aRet != SUIT_MessageBox::Yes)
- return;
- }
- aFilter = QObject::tr("IDEAS files (*.unv)");
- }
- break;
- case 140:
- case 141:
- {
- // export STL
- /*
- there must be check on others mesh elements not equal triangles
- */
- if (aMesh->NbTriangles() < 1) {
- SUIT_MessageBox::warning
- (SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_EXPORT_STL1").arg(anIObject->getName()));
- return;
- }
- if (!(aMesh->NbElements() - aMesh->NbTriangles())) {
- int aRet = SUIT_MessageBox::warning
- (SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_EXPORT_STL2").arg(anIObject->getName()),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
- if (aRet != SUIT_MessageBox::Yes)
- return;
- }
+ SMESH::SMESH_Mesh_var aMesh;
+ if(selected.Extent() == 1)
+ aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(selected.First());
+ if ( aMesh->_is_nil() ) {
+ SUIT_MessageBox::warning( SMESHGUI::desktop(),
+ QObject::tr( "SMESH_WRN_WARNING" ),
+ QObject::tr( "SMESH_BAD_MESH_SELECTION" ));
+ return;
+ }
- aFilterMapSTL.insert( QObject::tr("STL ASCII (*.stl)"), 1 ); // 1 - ASCII mode
- aFilterMapSTL.insert( QObject::tr("STL Binary (*.stl)"), 0 ); // 0 - Binary mode
- }
- break;
- default:
- return;
- }
+ Handle(SALOME_InteractiveObject) anIObject = selected.First();
+ QString aFilter, aTitle = QObject::tr("Export mesh");
+ QMap<QString, SMESH::MED_VERSION> aFilterMap;
+ QMap<QString, int> aFilterMapSTL;
+ switch ( theCommandID ) {
+ case 125:
+ case 122:
+ {
+ if (aMesh->HasDuplicatedGroupNamesMED()) {
+ int aRet = SUIT_MessageBox::warning
+ (SMESHGUI::desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_EXPORT_MED_DUPLICATED_GRP").arg(anIObject->getName()),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
+ if (aRet != SUIT_MessageBox::Yes)
+ return;
+ }
+ // PAL18696
+ QString v21 (aMesh->GetVersionString(SMESH::MED_V2_1, 2));
+ QString v22 (aMesh->GetVersionString(SMESH::MED_V2_2, 2));
+ aFilterMap.insert( QString("MED ") + v21 + " (*.med)", SMESH::MED_V2_1 );
+ aFilterMap.insert( QString("MED ") + v22 + " (*.med)", SMESH::MED_V2_2 );
+ }
+ break;
+ case 124:
+ case 121:
+ aFilter = QObject::tr("DAT files (*.dat)");
+ break;
+ case 126:
+ case 123:
+ {
+ if (aMesh->NbPyramids()) {
+ int aRet = SUIT_MessageBox::warning
+ (SMESHGUI::desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_EXPORT_UNV").arg(anIObject->getName()),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
+ if (aRet != SUIT_MessageBox::Yes)
+ return;
+ }
+ aFilter = QObject::tr("IDEAS files (*.unv)");
+ }
+ break;
+ case 140:
+ case 141:
+ {
+ // export STL
+ /*
+ there must be check on others mesh elements not equal triangles
+ */
+ if (aMesh->NbTriangles() < 1) {
+ SUIT_MessageBox::warning
+ (SMESHGUI::desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_EXPORT_STL1").arg(anIObject->getName()));
+ return;
+ }
+ if (!(aMesh->NbElements() - aMesh->NbTriangles())) {
+ int aRet = SUIT_MessageBox::warning
+ (SMESHGUI::desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_EXPORT_STL2").arg(anIObject->getName()),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
+ if (aRet != SUIT_MessageBox::Yes)
+ return;
+ }
- QString aFilename;
- SMESH::MED_VERSION aFormat;
- // Init the parameter with the default value
- bool aIsASCII_STL = true;
- bool toCreateGroups = false;
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- if ( resMgr )
- toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
-
- QString anInitialPath = "";
- if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
- anInitialPath = QDir::currentPath();
-
- if ( theCommandID != 122 && theCommandID != 125 && theCommandID != 140 && theCommandID != 141) {
- if ( anInitialPath.isEmpty() ) anInitialPath = SUIT_FileDlg::getLastVisitedPath();
- aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), anInitialPath + QString("/") + anIObject->getName(),
- aFilter, aTitle, false);
- }
- else if(theCommandID == 140 || theCommandID == 141) { // Export to STL
- QStringList filters;
- QMap<QString, int>::const_iterator it = aFilterMapSTL.begin();
- for ( ; it != aFilterMapSTL.end(); ++it )
- filters.push_back( it.key() );
-
- SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
- fd->setWindowTitle( aTitle );
- fd->setFilters( filters );
- fd->selectFilter( QObject::tr("STL ASCII (*.stl)") );
- if ( !anInitialPath.isEmpty() )
- fd->setDirectory( anInitialPath );
- fd->selectFile(anIObject->getName());
- bool is_ok = false;
- while (!is_ok) {
- if ( fd->exec() )
- aFilename = fd->selectedFile();
- aIsASCII_STL = (aFilterMapSTL[fd->selectedFilter()]) == 1 ? true: false;
- is_ok = true;
- }
- delete fd;
- }
- else { // Export to MED
- QStringList filters;
- QString aDefaultFilter;
- QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin();
- for ( ; it != aFilterMap.end(); ++it ) {
- filters.push_back( it.key() );
- if (it.value() == SMESH::MED_V2_2)
- aDefaultFilter = it.key();
- }
+ aFilterMapSTL.insert( QObject::tr("STL ASCII (*.stl)"), 1 ); // 1 - ASCII mode
+ aFilterMapSTL.insert( QObject::tr("STL Binary (*.stl)"), 0 ); // 0 - Binary mode
+ }
+ break;
+ default:
+ return;
+ }
- //SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
- SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
- ( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS"), true, true );
- fd->setWindowTitle( aTitle );
- fd->setFilters( filters );
- //fd->setSelectedFilter( QObject::tr("MED 2.2 (*.med)") );
- fd->selectFilter(aDefaultFilter);
- fd->SetChecked(toCreateGroups);
- if ( !anInitialPath.isEmpty() )
- fd->setDirectory( anInitialPath );
- fd->selectFile(anIObject->getName());
- bool is_ok = false;
- while (!is_ok) {
- if ( fd->exec() )
- aFilename = fd->selectedFile();
- aFormat = aFilterMap[fd->selectedFilter()];
- is_ok = true;
- if ( !aFilename.isEmpty()
- && (aMesh->NbPolygons()>0 || aMesh->NbPolyhedrons()>0)
- && aFormat==SMESH::MED_V2_1) {
- int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_EXPORT_MED_V2_1").arg(anIObject->getName()),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
- if (aRet != SUIT_MessageBox::Yes) {
- is_ok = false;
- }
- }
+ QString aFilename;
+ SMESH::MED_VERSION aFormat;
+ // Init the parameter with the default value
+ bool aIsASCII_STL = true;
+ bool toCreateGroups = false;
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ if ( resMgr )
+ toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
+
+ QString anInitialPath = "";
+ if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
+ anInitialPath = QDir::currentPath();
+
+ if ( theCommandID != 122 && theCommandID != 125 && theCommandID != 140 && theCommandID != 141) {
+ if ( anInitialPath.isEmpty() ) anInitialPath = SUIT_FileDlg::getLastVisitedPath();
+ aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), anInitialPath + QString("/") + anIObject->getName(),
+ aFilter, aTitle, false);
+ }
+ else if(theCommandID == 140 || theCommandID == 141) { // Export to STL
+ QStringList filters;
+ QMap<QString, int>::const_iterator it = aFilterMapSTL.begin();
+ for ( ; it != aFilterMapSTL.end(); ++it )
+ filters.push_back( it.key() );
+
+ SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
+ fd->setWindowTitle( aTitle );
+ fd->setFilters( filters );
+ fd->selectFilter( QObject::tr("STL ASCII (*.stl)") );
+ if ( !anInitialPath.isEmpty() )
+ fd->setDirectory( anInitialPath );
+ fd->selectFile(anIObject->getName());
+ bool is_ok = false;
+ while (!is_ok) {
+ if ( fd->exec() )
+ aFilename = fd->selectedFile();
+ aIsASCII_STL = (aFilterMapSTL[fd->selectedFilter()]) == 1 ? true: false;
+ is_ok = true;
+ }
+ delete fd;
+ }
+ else { // Export to MED
+ QStringList filters;
+ QString aDefaultFilter;
+ QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin();
+ for ( ; it != aFilterMap.end(); ++it ) {
+ filters.push_back( it.key() );
+ if (it.value() == SMESH::MED_V2_2)
+ aDefaultFilter = it.key();
+ }
+
+ //SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
+ SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
+ ( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS"), true, true );
+ fd->setWindowTitle( aTitle );
+ fd->setFilters( filters );
+ //fd->setSelectedFilter( QObject::tr("MED 2.2 (*.med)") );
+ fd->selectFilter(aDefaultFilter);
+ fd->SetChecked(toCreateGroups);
+ if ( !anInitialPath.isEmpty() )
+ fd->setDirectory( anInitialPath );
+ fd->selectFile(anIObject->getName());
+ bool is_ok = false;
+ while (!is_ok) {
+ if ( fd->exec() )
+ aFilename = fd->selectedFile();
+ aFormat = aFilterMap[fd->selectedFilter()];
+ is_ok = true;
+ if ( !aFilename.isEmpty()
+ && (aMesh->NbPolygons()>0 || aMesh->NbPolyhedrons()>0)
+ && aFormat==SMESH::MED_V2_1) {
+ int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_EXPORT_MED_V2_1").arg(anIObject->getName()),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
+ if (aRet != SUIT_MessageBox::Yes) {
+ is_ok = false;
}
- toCreateGroups = fd->IsChecked();
- delete fd;
}
- if ( !aFilename.isEmpty() ) {
- // Check whether the file already exists and delete it if yes
- QFile aFile( aFilename );
- if ( aFile.exists() )
- aFile.remove();
- SUIT_OverrideCursor wc;
-
- try {
- bool Renumber = false;
- // PAL 14172 : Check of we have to renumber or not from the preferences before export
- if (resMgr)
- Renumber= resMgr->booleanValue("SMESH","renumbering");
- if (Renumber){
- SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
- aMeshEditor->RenumberNodes();
- aMeshEditor->RenumberElements();
- if ( SMESHGUI::automaticUpdate() )
- SMESH::UpdateView();
- }
- switch ( theCommandID ) {
- case 125:
- case 122:
- aMesh->ExportToMED( aFilename.toLatin1().data(), toCreateGroups, aFormat );
- break;
- case 124:
- case 121:
- aMesh->ExportDAT( aFilename.toLatin1().data() );
- break;
- case 126:
- case 123:
- aMesh->ExportUNV( aFilename.toLatin1().data() );
- break;
- case 140:
- case 141:
- aMesh->ExportSTL( aFilename.toLatin1().data(), aIsASCII_STL );
- break;
- default:
- break;
- }
- }
- catch (const SALOME::SALOME_Exception& S_ex){
- wc.suspend();
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_EXPORT_FAILED"));
- wc.resume();
- }
- }
+ }
+ toCreateGroups = fd->IsChecked();
+ delete fd;
+ }
+ if ( !aFilename.isEmpty() ) {
+ // Check whether the file already exists and delete it if yes
+ QFile aFile( aFilename );
+ if ( aFile.exists() )
+ aFile.remove();
+ SUIT_OverrideCursor wc;
+
+ try {
+ bool Renumber = false;
+ // PAL 14172 : Check of we have to renumber or not from the preferences before export
+ if (resMgr)
+ Renumber= resMgr->booleanValue("SMESH","renumbering");
+ if (Renumber){
+ SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
+ aMeshEditor->RenumberNodes();
+ aMeshEditor->RenumberElements();
+ if ( SMESHGUI::automaticUpdate() )
+ SMESH::UpdateView();
+ }
+ switch ( theCommandID ) {
+ case 125:
+ case 122:
+ aMesh->ExportToMED( aFilename.toLatin1().data(), toCreateGroups, aFormat );
+ break;
+ case 124:
+ case 121:
+ aMesh->ExportDAT( aFilename.toLatin1().data() );
+ break;
+ case 126:
+ case 123:
+ aMesh->ExportUNV( aFilename.toLatin1().data() );
+ break;
+ case 140:
+ case 141:
+ aMesh->ExportSTL( aFilename.toLatin1().data(), aIsASCII_STL );
+ break;
+ default:
+ break;
+ }
+ }
+ catch (const SALOME::SALOME_Exception& S_ex){
+ wc.suspend();
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_EXPORT_FAILED"));
+ wc.resume();
}
}
}
_PTR(AttributeIOR) anIOR;
int objectCount = 0;
+ QString aNameList;
QString aParentComponent = QString::null;
+ Handle(SALOME_InteractiveObject) anIO;
for( SALOME_ListIteratorOfListIO anIt( selected ); anIt.More(); anIt.Next() )
{
- _PTR(SObject) aSO = aStudy->FindObjectID(anIt.Value()->getEntry());
+ anIO = anIt.Value();
+ QString cur = anIO->getComponentDataType();
+ _PTR(SObject) aSO = aStudy->FindObjectID(anIO->getEntry());
if (aSO) {
- // check if object is not reference
- _PTR(SObject) refobj;
- if ( !aSO->ReferencedObject( refobj ) )
- objectCount++;
+ // check if object is reference
+ _PTR(SObject) aRefSObj;
+ aNameList.append("\n - ");
+ if ( aSO->ReferencedObject( aRefSObj ) ) {
+ QString aRefName = QString::fromStdString ( aRefSObj->GetName() );
+ aNameList.append( aRefName );
+ cur = QString::fromStdString ( aRefSObj->GetFatherComponent()->ComponentDataType() );
+ }
+ else
+ aNameList.append(anIO->getName());
+ objectCount++;
}
- QString cur = anIt.Value()->getComponentDataType();
if( aParentComponent.isNull() )
aParentComponent = cur;
else if( !aParentComponent.isEmpty() && aParentComponent!=cur )
if (SUIT_MessageBox::warning
(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_REALLY_DELETE"),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No,
+ QObject::tr("SMESH_REALLY_DELETE").arg( objectCount ).arg( aNameList ),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No,
SUIT_MessageBox::Yes) != SUIT_MessageBox::Yes)
return;
if ( engineIOR() == anIOR->Value().c_str() )
continue;
}
-
- _PTR(SObject) refobj;
- if ( aSO && aSO->ReferencedObject( refobj ) )
- continue; // skip references
+ //Check the referenced object
+ _PTR(SObject) aRefSObject;
+ if ( aSO && aSO->ReferencedObject( aRefSObject ) )
+ aSO = aRefSObject; // Delete main Object instead of reference
// put the whole hierarchy of sub-objects of the selected SO into a list and
// then treat them all starting from the deepest objects (at list back)
}
case 701: // COMPUTE MESH
+ case 711: // PRECOMPUTE MESH
{
if (checkLock(aStudy)) break;
-
- startOperation( 701 );
+ startOperation( theCommandID );
}
break;
- case 702: // Create mesh
- startOperation( 702 );
- break;
- case 703: // Create sub-mesh
- startOperation( 703 );
- break;
+ case 702: // Create mesh
+ case 703: // Create sub-mesh
case 704: // Edit mesh/sub-mesh
- startOperation( 704 );
+ startOperation( theCommandID );
break;
case 710: // Build compound mesh
{
}*/
break;
}
+ case 806: // CREATE GEO GROUP
+ {
+ startOperation( 806 );
+ break;
+ }
case 801: // CREATE GROUP
{
if ( !vtkwnd )
break;
}
+ case 815: // Edit GEOM GROUP as standalone
+ {
+ if ( !vtkwnd )
+ {
+ SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
+ tr( "NOT_A_VTK_VIEWER" ) );
+ break;
+ }
+
+ if(checkLock(aStudy)) break;
+ EmitSignalDeactivateDialog();
+
+ LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+ SALOME_ListIO selected;
+ if( aSel )
+ aSel->selectedObjects( selected );
+
+ SALOME_ListIteratorOfListIO It (selected);
+ for ( ; It.More(); It.Next() )
+ {
+ SMESH::SMESH_GroupOnGeom_var aGroup =
+ SMESH::IObjectToInterface<SMESH::SMESH_GroupOnGeom>(It.Value());
+ if (!aGroup->_is_nil()) {
+ SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, aGroup, true );
+ aDlg->show();
+ }
+ }
+ break;
+ }
+
case 810: // Union Groups
case 811: // Intersect groups
case 812: // Cut groups
EmitSignalDeactivateDialog();
- int aMode;
- if ( theCommandID == 810 ) aMode = SMESHGUI_GroupOpDlg::UNION;
- else if ( theCommandID == 811 ) aMode = SMESHGUI_GroupOpDlg::INTERSECT;
- else aMode = SMESHGUI_GroupOpDlg::CUT;
+ SMESHGUI_GroupOpDlg* aDlg = 0;
+ if ( theCommandID == 810 )
+ aDlg = new SMESHGUI_UnionGroupsDlg( this );
+ else if ( theCommandID == 811 )
+ aDlg = new SMESHGUI_IntersectGroupsDlg( this );
+ else
+ aDlg = new SMESHGUI_CutGroupsDlg( this );
+
+ aDlg->show();
+
+ break;
+ }
+
+ case 814: // Create groups of entities from existing groups of superior dimensions
+ {
+ if ( checkLock( aStudy ) )
+ break;
+
+ EmitSignalDeactivateDialog();
+ SMESHGUI_GroupOpDlg* aDlg = new SMESHGUI_DimGroupDlg( this );
+ aDlg->show();
- ( new SMESHGUI_GroupOpDlg( this, aMode ) )->show();
break;
}
if( aSel )
aSel->selectedObjects( selected );
- bool isAny = false; // iss there any appropriate object selected
+ bool isAny = false; // is there any appropriate object selected
SALOME_ListIteratorOfListIO It( selected );
for ( ; It.More(); It.Next() )
newName = LightApp_NameDlg::getName(desktop(), newName);
if ( !newName.isEmpty() )
{
- //old source: aStudy->renameIObject( IObject, newName );
- aName->SetValue( newName.toLatin1().constData() );
-
- // if current object is group update group's name
- SMESH::SMESH_GroupBase_var aGroup =
- SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
- if (!aGroup->_is_nil() )
- aGroup->SetName( newName.toLatin1().constData() );
+ SMESHGUI::GetSMESHGen()->SetName(obj->GetIOR().c_str(), newName.toLatin1().data());
updateObjBrowser();
}
case 4043: { // CLEAR_MESH
if(checkLock(aStudy)) break;
-
+
SALOME_ListIO selected;
if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
aSel->selectedObjects( selected );
createSMESHAction( 703, "CREATE_SUBMESH", "ICON_DLG_ADD_SUBMESH" );
createSMESHAction( 704, "EDIT_MESHSUBMESH","ICON_DLG_EDIT_MESH" );
createSMESHAction( 710, "BUILD_COMPOUND", "ICON_BUILD_COMPOUND" );
+ createSMESHAction( 711, "PRECOMPUTE", "ICON_PRECOMPUTE" );
+ createSMESHAction( 806, "CREATE_GEO_GROUP","ICON_CREATE_GEO_GROUP" );
createSMESHAction( 801, "CREATE_GROUP", "ICON_CREATE_GROUP" );
createSMESHAction( 802, "CONSTRUCT_GROUP", "ICON_CONSTRUCT_GROUP" );
createSMESHAction( 803, "EDIT_GROUP", "ICON_EDIT_GROUP" );
+ createSMESHAction( 815, "EDIT_GEOMGROUP_AS_GROUP", "ICON_EDIT_GROUP" );
createSMESHAction( 804, "ADD" );
createSMESHAction( 805, "REMOVE" );
createSMESHAction( 810, "UN_GROUP", "ICON_UNION" );
createSMESHAction( 811, "INT_GROUP", "ICON_INTERSECT" );
createSMESHAction( 812, "CUT_GROUP", "ICON_CUT" );
+ createSMESHAction( 814, "UNDERLYING_ELEMS","ICON_UNDERLYING_ELEMS" );
createSMESHAction( 813, "DEL_GROUP", "ICON_DEL_GROUP" );
createSMESHAction( 900, "ADV_INFO", "ICON_ADV_INFO" );
createSMESHAction( 902, "STD_INFO", "ICON_STD_INFO" );
createMenu( separator(), fileId );
- int importId = createMenu( tr( "MEN_IMPORT" ), fileId, 11, 10 ),
- exportId = createMenu( tr( "MEN_EXPORT" ), fileId, 12, 10 ),
+ int importId = createMenu( tr( "MEN_IMPORT" ), fileId, -1, 10 ),
+ exportId = createMenu( tr( "MEN_EXPORT" ), fileId, -1, 10 ),
addId = createMenu( tr( "MEN_ADD" ), modifyId, 402 ),
removeId = createMenu( tr( "MEN_REMOVE" ), modifyId, 403 ),
renumId = createMenu( tr( "MEN_RENUM" ), modifyId, 404 ),
createMenu( 710, meshId, -1 );
createMenu( separator(), meshId, -1 );
createMenu( 701, meshId, -1 );
+ createMenu( 711, meshId, -1 );
createMenu( separator(), meshId, -1 );
createMenu( 801, meshId, -1 );
+ createMenu( 806, meshId, -1 );
createMenu( 802, meshId, -1 );
createMenu( 803, meshId, -1 );
+ createMenu( 815, meshId, -1 );
createMenu( separator(), meshId, -1 );
createMenu( 810, meshId, -1 );
createMenu( 811, meshId, -1 );
createMenu( 812, meshId, -1 );
createMenu( separator(), meshId, -1 );
+ createMenu( 814, meshId, -1 );
+ createMenu( separator(), meshId, -1 );
createMenu( 813, meshId, -1 );
createMenu( separator(), meshId, -1 );
createMenu( 900, meshId, -1 );
createTool( 710, meshTb );
createTool( separator(), meshTb );
createTool( 701, meshTb );
+ createTool( 711, meshTb );
createTool( separator(), meshTb );
createTool( 801, meshTb );
+ createTool( 806, meshTb );
createTool( 802, meshTb );
createTool( 803, meshTb );
+ //createTool( 815, meshTb );
createTool( separator(), meshTb );
createTool( 900, meshTb );
createTool( 902, meshTb );
// popup for object browser
createPopupItem( 150, OB, mesh, "&& selcount=1 && isImported" ); // FILE INFORMATION
+ createPopupItem( 703, OB, mesh, "&& isComputable"); // CREATE_SUBMESH
+ //createPopupItem( 703, OB, subMesh, "&& isComputable" ); // CREATE_SUBMESH
createPopupItem( 704, OB, mesh, "&& isComputable"); // EDIT_MESHSUBMESH
createPopupItem( 704, OB, subMesh, "&& isComputable" ); // EDIT_MESHSUBMESH
createPopupItem( 803, OB, group ); // EDIT_GROUP
+ createPopupItem( 815, OB, group, "&& groupType = 'GroupOnGeom'" ); // EDIT_GROUP
+
popupMgr()->insert( separator(), -1, 0 );
createPopupItem( 701, OB, mesh, "&& isComputable" ); // COMPUTE
+ createPopupItem( 711, OB, mesh, "&& isComputable" ); // PRECOMPUTE
createPopupItem( 214, OB, mesh_group ); // UPDATE
createPopupItem( 900, OB, mesh_group ); // ADV_INFO
createPopupItem( 902, OB, mesh ); // STD_INFO
createPopupItem( 903, OB, mesh_group ); // WHAT_IS
popupMgr()->insert( separator(), -1, 0 );
createPopupItem( 801, OB, mesh ); // CREATE_GROUP
+ createPopupItem( 806, OB, mesh ); // CREATE_GEO_GROUP
createPopupItem( 802, OB, subMesh ); // CONSTRUCT_GROUP
popupMgr()->insert( separator(), -1, 0 );
createPopupItem( 1100, OB, hypo); // EDIT HYPOTHESIS
createPopupItem( 803, View, group ); // EDIT_GROUP
createPopupItem( 804, View, elems ); // ADD
createPopupItem( 805, View, elems ); // REMOVE
+
popupMgr()->insert( separator(), -1, 0 );
createPopupItem( 214, View, mesh_group ); // UPDATE
createPopupItem( 900, View, mesh_group ); // ADV_INFO
addPreference( tr( "PREF_ORIENTATION_COLOR" ), orientGroup, LightApp_Preferences::Color, "SMESH", "orientation_color" );
int orientScale = addPreference( tr( "PREF_ORIENTATION_SCALE" ), orientGroup, LightApp_Preferences::DblSpin, "SMESH", "orientation_scale" );
- setPreferenceProperty( orientScale, "min", 0 );
- setPreferenceProperty( orientScale, "max", 1 );
- setPreferenceProperty( orientScale, "step", 0.1 );
+ setPreferenceProperty( orientScale, "min", 0.05 );
+ setPreferenceProperty( orientScale, "max", 0.5 );
+ setPreferenceProperty( orientScale, "step", 0.05 );
addPreference( tr( "PREF_ORIENTATION_3D_VECTORS" ), orientGroup, LightApp_Preferences::Bool, "SMESH", "orientation_3d_vectors" );
int fontGr = addPreference( tr( "SMESH_FONT_SCALARBAR" ), sbarTab );
setPreferenceProperty( fontGr, "columns", 2 );
- int tfont = addPreference( tr( "SMESH_TITLE" ), fontGr, LightApp_Preferences::Font, "SMESH", "scalar_bar_title_font" );
+ addVtkFontPref( tr( "SMESH_TITLE" ), fontGr, "scalar_bar_title_font" );
addPreference( tr( "PREF_TITLE_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_title_color" );
- int lfont = addPreference( tr( "SMESH_LABELS" ), fontGr, LightApp_Preferences::Font, "SMESH", "scalar_bar_label_font" );
- addPreference( tr( "PREF_LABELS_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_label_color" );
- QStringList fam;
- fam.append( tr( "SMESH_FONT_ARIAL" ) );
- fam.append( tr( "SMESH_FONT_COURIER" ) );
- fam.append( tr( "SMESH_FONT_TIMES" ) );
- int wflag = ( QtxFontEdit::Family | QtxFontEdit::Scripting );
-
- setPreferenceProperty( tfont, "families", fam );
- setPreferenceProperty( tfont, "system", false );
- setPreferenceProperty( tfont, "widget_flags", wflag );
- setPreferenceProperty( lfont, "families", fam );
- setPreferenceProperty( lfont, "system", false );
- setPreferenceProperty( lfont, "widget_flags", wflag );
+ addVtkFontPref( tr( "SMESH_LABELS" ), fontGr, "scalar_bar_label_font" );
+ addPreference( tr( "PREF_LABELS_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_label_color" );
int colorsLabelsGr = addPreference( tr( "SMESH_LABELS_COLORS_SCALARBAR" ), sbarTab );
setPreferenceProperty( colorsLabelsGr, "columns", 2 );
case 704: // Edit mesh/sub-mesh
op = new SMESHGUI_MeshOp( false );
break;
+ case 711: // Precompute mesh
+ op = new SMESHGUI_PrecomputeOp();
+ break;
+ case 806: // Create group on geom
+ op = new SMESHGUI_GroupOnShapeOp();
+ break;
case 417: //convert to quadratic
op = new SMESHGUI_ConvToQuadOp();
break;
return aSColor;
}
+
+const char gSeparator = '_'; // character used to separate parameter names
+const char gDigitsSep = ':'; // character used to separate numeric parameter values (color = r:g:b)
+
+/*!
+ * \brief Store visual parameters
+ *
+ * This method is called just before the study document is saved.
+ * Store visual parameters in AttributeParameter attribue(s)
+ */
+void SMESHGUI::storeVisualParameters (int savePoint)
+{
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
+ if (!appStudy || !appStudy->studyDS())
+ return;
+ _PTR(Study) studyDS = appStudy->studyDS();
+
+ // componentName is used for encoding of entries when storing them in IParameters
+ std::string componentName = myComponentSMESH->ComponentDataType();
+ //_PTR(SComponent) aSComponent = studyDS->FindComponent("SMESH");
+ //if (!aSComponent) return;
+
+ // IParameters
+ _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative",
+ componentName.c_str(),
+ savePoint);
+ _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
+
+ // viewers counters are used for storing view_numbers in IParameters
+ int vtkViewers = 0;
+
+ // main cycle to store parameters of displayed objects
+ QList<SUIT_ViewManager*> lst;
+ QList<SUIT_ViewManager*>::Iterator it;
+ getApp()->viewManagers(lst);
+ for (it = lst.begin(); it != lst.end(); it++)
+ {
+ SUIT_ViewManager* vman = *it;
+ QString vType = vman->getType();
+
+ // saving VTK actors properties
+ if (vType == SVTK_Viewer::Type())
+ {
+ QVector<SUIT_ViewWindow*> views = vman->getViews();
+ for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++)
+ {
+ if (SVTK_ViewWindow* vtkView = dynamic_cast<SVTK_ViewWindow*>(views[i]))
+ {
+ vtkActorCollection* allActors = vtkView->getRenderer()->GetActors();
+ allActors->InitTraversal();
+ while (vtkActor* actor = allActors->GetNextActor())
+ {
+ if (actor->GetVisibility()) // store only visible actors
+ {
+ SMESH_Actor* aSmeshActor = 0;
+ if (actor->IsA("SMESH_Actor"))
+ aSmeshActor = SMESH_Actor::SafeDownCast(actor);
+ if (aSmeshActor && aSmeshActor->hasIO())
+ {
+ Handle(SALOME_InteractiveObject) io = aSmeshActor->getIO();
+ if (io->hasEntry())
+ {
+ // entry is "encoded" = it does NOT contain component adress,
+ // since it is a subject to change on next component loading
+ std::string entry = ip->encodeEntry(io->getEntry(), componentName);
+
+ std::string param, vtkParam = vType.toLatin1().data();
+ vtkParam += gSeparator;
+ vtkParam += QString::number(vtkViewers).toLatin1().data();
+ vtkParam += gSeparator;
+
+ // Visibility
+ param = vtkParam + "Visibility";
+ ip->setParameter(entry, param, "On");
+
+ // Representation
+ param = vtkParam + "Representation";
+ ip->setParameter(entry, param, QString::number
+ ((int)aSmeshActor->GetRepresentation()).toLatin1().data());
+
+ // IsShrunk
+ param = vtkParam + "IsShrunk";
+ ip->setParameter(entry, param, QString::number
+ ((int)aSmeshActor->IsShrunk()).toLatin1().data());
+
+ // Displayed entities
+ unsigned int aMode = aSmeshActor->GetEntityMode();
+ bool isE = aMode & SMESH_Actor::eEdges;
+ bool isF = aMode & SMESH_Actor::eFaces;
+ bool isV = aMode & SMESH_Actor::eVolumes;
+
+ QString modeStr ("e");
+ modeStr += gDigitsSep; modeStr += QString::number(isE);
+ modeStr += gDigitsSep; modeStr += "f";
+ modeStr += gDigitsSep; modeStr += QString::number(isF);
+ modeStr += gDigitsSep; modeStr += "v";
+ modeStr += gDigitsSep; modeStr += QString::number(isV);
+
+ param = vtkParam + "Entities";
+ ip->setParameter(entry, param, modeStr.toLatin1().data());
+
+ // Colors (surface:edge:)
+ vtkFloatingPointType r, g, b;
+
+ aSmeshActor->GetSufaceColor(r, g, b);
+ QString colorStr ("surface");
+ colorStr += gDigitsSep; colorStr += QString::number(r);
+ colorStr += gDigitsSep; colorStr += QString::number(g);
+ colorStr += gDigitsSep; colorStr += QString::number(b);
+
+ aSmeshActor->GetBackSufaceColor(r, g, b);
+ colorStr += gDigitsSep; colorStr += "backsurface";
+ colorStr += gDigitsSep; colorStr += QString::number(r);
+ colorStr += gDigitsSep; colorStr += QString::number(g);
+ colorStr += gDigitsSep; colorStr += QString::number(b);
+
+ aSmeshActor->GetEdgeColor(r, g, b);
+ colorStr += gDigitsSep; colorStr += "edge";
+ colorStr += gDigitsSep; colorStr += QString::number(r);
+ colorStr += gDigitsSep; colorStr += QString::number(g);
+ colorStr += gDigitsSep; colorStr += QString::number(b);
+
+ aSmeshActor->GetNodeColor(r, g, b);
+ colorStr += gDigitsSep; colorStr += "node";
+ colorStr += gDigitsSep; colorStr += QString::number(r);
+ colorStr += gDigitsSep; colorStr += QString::number(g);
+ colorStr += gDigitsSep; colorStr += QString::number(b);
+
+ param = vtkParam + "Colors";
+ ip->setParameter(entry, param, colorStr.toLatin1().data());
+
+ // Sizes of lines and points
+ QString sizeStr ("line");
+ sizeStr += gDigitsSep; sizeStr += QString::number((int)aSmeshActor->GetLineWidth());
+ sizeStr += gDigitsSep; sizeStr += "node";
+ sizeStr += gDigitsSep; sizeStr += QString::number((int)aSmeshActor->GetNodeSize());
+ sizeStr += gDigitsSep; sizeStr += "shrink";
+ sizeStr += gDigitsSep; sizeStr += QString::number(aSmeshActor->GetShrinkFactor());
+
+ param = vtkParam + "Sizes";
+ ip->setParameter(entry, param, sizeStr.toLatin1().data());
+
+ // Opacity
+ param = vtkParam + "Opacity";
+ ip->setParameter(entry, param,
+ QString::number(aSmeshActor->GetOpacity()).toLatin1().data());
+
+ // Clipping
+ param = vtkParam + "ClippingPlane";
+ int nPlanes = aSmeshActor->GetNumberOfClippingPlanes();
+ if (!nPlanes)
+ ip->setParameter(entry, param, "Off");
+ for (int ipl = 0; ipl < nPlanes; ipl++) {
+ //vtkPlane* plane = aSmeshActor->GetClippingPlane(ipl);
+ SMESH::Orientation anOrientation;
+ double aDistance;
+ vtkFloatingPointType anAngle[2];
+ SMESHGUI_ClippingDlg::GetPlaneParam(aSmeshActor, ipl, anOrientation, aDistance, anAngle);
+ std::string planeValue = QString::number((int)anOrientation).toLatin1().data();
+ planeValue += gDigitsSep; planeValue += QString::number(aDistance).toLatin1().data();
+ planeValue += gDigitsSep; planeValue += QString::number(anAngle[0]).toLatin1().data();
+ planeValue += gDigitsSep; planeValue += QString::number(anAngle[1]).toLatin1().data();
+
+ ip->setParameter(entry, param + QString::number(ipl+1).toLatin1().data(), planeValue);
+ }
+ } // if (io->hasEntry())
+ } // SMESH_Actor && hasIO
+ } // isVisible
+ } // while.. actors traversal
+ } // if (vtkView)
+ } // for (views)
+ vtkViewers++;
+ } // if (SVTK view model)
+ } // for (viewManagers)
+}
+
+/*!
+ * \brief Restore visual parameters
+ *
+ * This method is called after the study document is opened.
+ * Restore visual parameters from AttributeParameter attribue(s)
+ */
+void SMESHGUI::restoreVisualParameters (int savePoint)
+{
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
+ if (!appStudy || !appStudy->studyDS())
+ return;
+ _PTR(Study) studyDS = appStudy->studyDS();
+
+ // componentName is used for encoding of entries when storing them in IParameters
+ std::string componentName = myComponentSMESH->ComponentDataType();
+ //_PTR(SComponent) aSComponent = studyDS->FindComponent("GEOM");
+ //if (!aSComponent) return;
+
+ // IParameters
+ _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative",
+ componentName.c_str(),
+ savePoint);
+ _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
+
+ std::vector<std::string> entries = ip->getEntries();
+
+ for (std::vector<std::string>::iterator entIt = entries.begin(); entIt != entries.end(); ++entIt)
+ {
+ // entry is a normal entry - it should be "decoded" (setting base adress of component)
+ QString entry (ip->decodeEntry(*entIt).c_str());
+
+ // Check that the entry corresponds to a real object in the Study
+ // as the object may be deleted or modified after the visual state is saved.
+ _PTR(SObject) so = studyDS->FindObjectID(entry.toLatin1().data());
+ if (!so) continue; //Skip the not existent entry
+
+ std::vector<std::string> paramNames = ip->getAllParameterNames( *entIt );
+ std::vector<std::string> paramValues = ip->getAllParameterValues( *entIt );
+
+ std::vector<std::string>::iterator namesIt = paramNames.begin();
+ std::vector<std::string>::iterator valuesIt = paramValues.begin();
+
+ // actors are stored in a map after displaying of them for
+ // quicker access in the future: map < viewID to actor >
+ NCollection_DataMap<int, SMESH_Actor*> vtkActors;
+
+ for (; namesIt != paramNames.end(); ++namesIt, ++valuesIt)
+ {
+ // visual parameters are stored in strings as follows: ViewerType_ViewIndex_ParamName.
+ // '_' is used as separator and should not be used in viewer type or parameter names.
+ QStringList lst = QString((*namesIt).c_str()).split(gSeparator, QString::SkipEmptyParts);
+ if (lst.size() != 3)
+ continue;
+
+ QString viewerTypStr = lst[0];
+ QString viewIndexStr = lst[1];
+ QString paramNameStr = lst[2];
+
+ bool ok;
+ int viewIndex = viewIndexStr.toUInt(&ok);
+ if (!ok) // bad conversion of view index to integer
+ continue;
+
+ // viewers
+ if (viewerTypStr == SVTK_Viewer::Type())
+ {
+ SMESH_Actor* aSmeshActor = 0;
+ if (vtkActors.IsBound(viewIndex))
+ aSmeshActor = vtkActors.Find(viewIndex);
+
+ if (paramNameStr == "Visibility")
+ {
+ if (!aSmeshActor && displayer())
+ {
+ QList<SUIT_ViewManager*> lst;
+ getApp()->viewManagers(viewerTypStr, lst);
+
+ // SVTK ViewManager always has 1 ViewWindow, so view index is index of view manager
+ if (viewIndex >= 0 && viewIndex < lst.count()) {
+ SUIT_ViewManager* vman = lst.at(viewIndex);
+ SUIT_ViewModel* vmodel = vman->getViewModel();
+ // SVTK view model can be casted to SALOME_View
+ displayer()->Display(entry, true, dynamic_cast<SALOME_View*>(vmodel));
+
+ // store displayed actor in a temporary map for quicker
+ // access later when restoring other parameters
+ SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView();
+ vtkRenderer* Renderer = vtkView->getRenderer();
+ vtkActorCollection* theActors = Renderer->GetActors();
+ theActors->InitTraversal();
+ bool isFound = false;
+ vtkActor *ac = theActors->GetNextActor();
+ for (; ac != NULL && !isFound; ac = theActors->GetNextActor()) {
+ if (ac->IsA("SMESH_Actor")) {
+ SMESH_Actor* aGeomAc = SMESH_Actor::SafeDownCast(ac);
+ if (aGeomAc->hasIO()) {
+ Handle(SALOME_InteractiveObject) io =
+ Handle(SALOME_InteractiveObject)::DownCast(aGeomAc->getIO());
+ if (io->hasEntry() && strcmp(io->getEntry(), entry.toLatin1().data()) == 0) {
+ isFound = true;
+ vtkActors.Bind(viewIndex, aGeomAc);
+ }
+ }
+ }
+ }
+ }
+ }
+ } // if (paramNameStr == "Visibility")
+ else
+ {
+ // the rest properties "work" with SMESH_Actor
+ if (aSmeshActor)
+ {
+ QString val ((*valuesIt).c_str());
+
+ // Representation
+ if (paramNameStr == "Representation") {
+ aSmeshActor->SetRepresentation((SMESH_Actor::EReperesent)val.toInt());
+ }
+ // IsShrunk
+ else if (paramNameStr == "IsShrunk") {
+ if (val.toInt()) {
+ if (!aSmeshActor->IsShrunk())
+ aSmeshActor->SetShrink();
+ }
+ else {
+ if (aSmeshActor->IsShrunk())
+ aSmeshActor->UnShrink();
+ }
+ }
+ // Displayed entities
+ else if (paramNameStr == "Entities") {
+ QStringList mode = val.split(gDigitsSep, QString::SkipEmptyParts);
+ if (mode.count() == 6) {
+ if (mode[0] != "e" || mode[2] != "f" || mode[4] != "v") {
+ MESSAGE("Invalid order of data in Entities, must be: "
+ "e:0/1:f:0/1:v:0/1");
+ }
+ else {
+ unsigned int aMode = aSmeshActor->GetEntityMode();
+ unsigned int aNewMode =
+ (int(SMESH_Actor::eEdges ) * mode[1].toInt()) |
+ (int(SMESH_Actor::eFaces ) * mode[3].toInt()) |
+ (int(SMESH_Actor::eVolumes) * mode[5].toInt());
+ if (aNewMode != aMode)
+ aSmeshActor->SetEntityMode(aNewMode);
+ }
+ }
+ }
+ // Colors
+ else if (paramNameStr == "Colors") {
+ QStringList colors = val.split(gDigitsSep, QString::SkipEmptyParts);
+ if (colors.count() == 16) {
+ if (colors[0] != "surface" || colors[4] != "backsurface" ||
+ colors[8] != "edge" || colors[12] != "node") {
+ MESSAGE("Invalid order of data in Colors, must be: "
+ "surface:r:g:b:backsurface:r:g:b:edge:r:g:b:node:r:g:b");
+ }
+ else {
+ aSmeshActor->SetSufaceColor(colors[1].toFloat(), colors[2].toFloat(), colors[3].toFloat());
+ aSmeshActor->SetBackSufaceColor(colors[5].toFloat(), colors[6].toFloat(), colors[7].toFloat());
+ aSmeshActor->SetEdgeColor(colors[9].toFloat(), colors[10].toFloat(), colors[11].toFloat());
+ aSmeshActor->SetNodeColor(colors[13].toFloat(), colors[14].toFloat(), colors[15].toFloat());
+ }
+ }
+ }
+ // Sizes of lines and points
+ else if (paramNameStr == "Sizes") {
+ QStringList sizes = val.split(gDigitsSep, QString::SkipEmptyParts);
+ if (sizes.count() == 6) {
+ if (sizes[0] != "line" || sizes[2] != "node" || sizes[4] != "shrink") {
+ MESSAGE("Invalid order of data in Sizes, must be: "
+ "line:int:node:int:shrink:float");
+ }
+ else {
+ aSmeshActor->SetLineWidth(sizes[1].toInt());
+ aSmeshActor->SetNodeSize(sizes[3].toInt());
+ aSmeshActor->SetShrinkFactor(sizes[5].toFloat());
+ }
+ }
+ }
+ // Opacity
+ else if (paramNameStr == "Opacity") {
+ aSmeshActor->SetOpacity(val.toFloat());
+ }
+ // Clipping
+ else if (paramNameStr.startsWith("ClippingPlane")) {
+ cout << "$$$ ClippingPlane 1" << endl;
+ if (paramNameStr == "ClippingPlane1" || val == "Off")
+ aSmeshActor->RemoveAllClippingPlanes();
+ if (val != "Off") {
+ cout << "$$$ ClippingPlane 2" << endl;
+ QStringList vals = val.split(gDigitsSep, QString::SkipEmptyParts);
+ if (vals.count() == 4) { // format check: 4 values
+ cout << "$$$ ClippingPlane 3" << endl;
+ SMESH::Orientation anOrientation = (SMESH::Orientation)vals[0].toInt();
+ double aDistance = vals[1].toFloat();
+ vtkFloatingPointType anAngle[2];
+ anAngle[0] = vals[2].toFloat();
+ anAngle[1] = vals[3].toFloat();
+
+ QList<SUIT_ViewManager*> lst;
+ getApp()->viewManagers(viewerTypStr, lst);
+ // SVTK ViewManager always has 1 ViewWindow, so view index is index of view manager
+ if (viewIndex >= 0 && viewIndex < lst.count()) {
+ SUIT_ViewManager* vman = lst.at(viewIndex);
+ SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView();
+ SMESHGUI_ClippingDlg::AddPlane(aSmeshActor, vtkView,
+ anOrientation, aDistance, anAngle);
+ }
+ }
+ }
+ }
+ } // if (aSmeshActor)
+ } // other parameters than Visibility
+ }
+ } // for names/parameters iterator
+ } // for entries iterator
+
+ // update all VTK views
+ QList<SUIT_ViewManager*> lst;
+ getApp()->viewManagers(lst);
+ for (QList<SUIT_ViewManager*>::Iterator it = lst.begin(); it != lst.end(); it++) {
+ SUIT_ViewModel* vmodel = (*it)->getViewModel();
+ if (vmodel && vmodel->getType() == SVTK_Viewer::Type()) {
+ SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) (*it)->getActiveView();
+ vtkView->getRenderer()->ResetCameraClippingRange();
+ vtkView->Repaint();
+ }
+ }
+}
+
+/*!
+ \brief Adds preferences for dfont of VTK viewer
+ \param label label
+ \param pIf group identifier
+ \param param parameter
+ \return identifier of preferences
+*/
+int SMESHGUI::addVtkFontPref( const QString& label, const int pId, const QString& param )
+{
+ int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
+
+ setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
+
+ QStringList fam;
+ fam.append( tr( "SMESH_FONT_ARIAL" ) );
+ fam.append( tr( "SMESH_FONT_COURIER" ) );
+ fam.append( tr( "SMESH_FONT_TIMES" ) );
+
+ setPreferenceProperty( tfont, "fonts", fam );
+
+ int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
+ setPreferenceProperty( tfont, "features", f );
+
+ return tfont;
+}
+
+
+
+
+
+