-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2019 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
#include "SMESHGUI_DuplicateNodesDlg.h"
#include "SMESHGUI_ExtrusionAlongPathDlg.h"
#include "SMESHGUI_ExtrusionDlg.h"
+#include "SMESHGUI_FaceGroupsSeparatedByEdgesDlg.h"
#include "SMESHGUI_FieldSelectorWdg.h"
#include "SMESHGUI_FileInfoDlg.h"
#include "SMESHGUI_FileValidator.h"
#include <SUIT_OverrideCursor.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
+#include <SVTK_Renderer.h>
#include <SVTK_ViewManager.h>
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <SALOMEDS_Study.hxx>
#include <SALOMEDS_SObject.hxx>
#include "utilities.h"
+#include <SALOME_LifeCycleCORBA.hxx>
// OCCT includes
#include <Standard_ErrorHandler.hxx>
zTolLayout->setMargin( 0 );
zTolSpin->RangeStepAndValidator( 0, 1e+100, 1., "length_precision" );
zTolSpin->setValue( zTol );
- //QObject::connect( zTolCheck, SIGNAL( stateChanged(int)), zTolSpin, SLOT( setEnabled(bool)));
+ QObject::connect( zTolCheck, SIGNAL( toggled(bool)), zTolSpin, SLOT( setEnabled(bool)));
zTolCheck->setChecked( resMgr->booleanValue( "SMESH", "enable_ztolerance", false ));
+ zTolSpin ->setEnabled( zTolCheck->isChecked() );
wdgList.append( zTolWdg );
SalomeApp_CheckFileDlg* fd =
}
}
+ // Break link with Shaper model
+ void breakShaperLink()
+ {
+ LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
+ SALOME_ListIO selected;
+ if (aSel) {
+ aSel->selectedObjects(selected);
+ if (selected.Extent()) {
+ Handle(SALOME_InteractiveObject) anIObject = selected.First();
+ _PTR(Study) aStudy = SMESH::getStudy();
+ std::string aEntry = anIObject->getEntry();
+ _PTR(SObject) aSObj = aStudy->FindObjectID(aEntry);
+ if (aSObj) {
+ std::string aName = aSObj->GetName();
+ QMessageBox::StandardButton aRes = SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("MSG_BREAK_SHAPER_LINK").arg(aName.c_str()),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No);
+ if (aRes == SUIT_MessageBox::Yes) {
+ SUIT_DataOwnerPtrList aList;
+ aSel->selected(aList, "ObjectBrowser", true);
+ SUIT_DataOwner* aOwn = aList.first();
+ LightApp_DataOwner* sowner = dynamic_cast<LightApp_DataOwner*>(aOwn);
+ QString aREntry = sowner->entry();
+
+ static GEOM::GEOM_Gen_var geomGen;
+ if (CORBA::is_nil(geomGen)) {
+ SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
+ (SUIT_Session::session()->activeApplication());
+ if (app) {
+ SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA(app->namingService());
+ Engines::EngineComponent_var comp =
+ ls->FindOrLoad_Component("FactoryServer", "SHAPERSTUDY");
+ geomGen = GEOM::GEOM_Gen::_narrow(comp);
+ }
+ }
+ if (!CORBA::is_nil(geomGen)) {
+ geomGen->BreakLink(aREntry.toStdString().c_str());
+ SMESHGUI::GetSMESHGUI()->updateObjBrowser();
+ }
+ }
+ }
+ }
+ }
+ }
+
void SetDisplayMode(int theCommandID, VTK::MarkerMap& theMarkerMap)
{
SALOME_ListIO selected;
int anEntitiesCount = anActor->GetNumberControlEntities();
if (anEntitiesCount >= 0)
functorName = functorName + ": " + QString::number(anEntitiesCount);
- anActor->GetScalarBarActor()->SetTitle( functorName.toLatin1().constData() );
+ anActor->GetScalarBarActor()->SetTitle( functorName.toUtf8().constData() );
SMESH::RepaintCurrentView();
#ifndef DISABLE_PLOT2DVIEWER
if ( anActor->GetPlot2Histogram() ) {
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
- // Put the whole hierarchy of sub-objects of the selected SO's into a list and
- // then treat them all starting from the deepest objects (at list back)
+ // Put one level of sub-objects of the selected SO's into a list
+ // in order to get objects inside folders like "Assigned Algorithms"
std::list< _PTR(SObject) > listSO;
SALOME_ListIteratorOfListIO It(selected);
for( ; It.More(); It.Next()) // loop on selected IO's
aSO = aRefSObject; // Delete main Object instead of reference
listSO.push_back( aSO );
- std::list< _PTR(SObject) >::iterator itSO = --listSO.end();
- for ( ; itSO != listSO.end(); ++itSO ) {
- _PTR(ChildIterator) it = aStudy->NewChildIterator( *itSO );
- for (it->InitEx(false); it->More(); it->Next())
- listSO.push_back( it->Value() );
- }
+
+ _PTR(ChildIterator) it = aStudy->NewChildIterator( aSO );
+ for (it->InitEx(false); it->More(); it->Next())
+ listSO.push_back( it->Value() );
}
}
// Check if none of objects to delete is referred from outside
std::list< _PTR(SObject) >::reverse_iterator ritSO;
+ std::vector< _PTR(SObject) > subSO;
for ( ritSO = listSO.rbegin(); ritSO != listSO.rend(); ++ritSO )
{
_PTR(SObject) SO = *ritSO;
if ( !SO ) continue;
- std::vector<_PTR(SObject)> aReferences = aStudy->FindDependances( *ritSO );
- for (size_t i = 0; i < aReferences.size(); i++) {
- _PTR(SComponent) aComponent = aReferences[i]->GetFatherComponent();
- std::string type = aComponent->ComponentDataType();
- if ( type != "SMESH" )
- {
- SUIT_MessageBox::warning( anApp->desktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("DEP_OBJECT") );
- return; // outside SMESH, there is an object depending on a SMESH object
+
+ int nbChildren = SO->GetLastChildTag();
+ subSO.clear();
+ subSO.reserve( 1 + nbChildren );
+ subSO.push_back( SO );
+ if ( nbChildren > 0 )
+ {
+ _PTR(ChildIterator) it = aStudy->NewChildIterator( SO );
+ for ( it->InitEx( true ); it->More(); it->Next() )
+ subSO.push_back( it->Value() );
+ }
+ for ( size_t i = 0; i < subSO.size(); ++i )
+ {
+ std::vector<_PTR(SObject)> aReferences = aStudy->FindDependances( subSO[i] );
+ for ( size_t j = 0; j < aReferences.size(); j++ ) {
+ _PTR(SComponent) aComponent = aReferences[j]->GetFatherComponent();
+ std::string type = aComponent->ComponentDataType();
+ if ( type != "SMESH" )
+ {
+ SUIT_MessageBox::warning( anApp->desktop(),
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("DEP_OBJECT") );
+ return; // outside SMESH, there is an object depending on a SMESH object
+ }
}
}
}
- // Call mesh->Clear() to prevent loading mesh from file caused by hypotheses removal
- for( It.Initialize( selected ); It.More(); It.Next()) // loop on selected IO's
- {
- Handle(SALOME_InteractiveObject) IObject = It.Value();
- SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface< SMESH::SMESH_Mesh >( IObject );
- if ( !mesh->_is_nil() )
- mesh->Clear();
- }
-
// Treat SO's in the list starting from the back
aStudyBuilder->NewCommand(); // There is a transaction
for ( ritSO = listSO.rbegin(); ritSO != listSO.rend(); ++ritSO )
std::string anEntry = SO->GetID();
/** Erase graphical object and remove all its data **/
- if(SO->FindAttribute(anAttr, "AttributeIOR")) {
+ if ( SO->FindAttribute( anAttr, "AttributeIOR" )) {
SMESH::RemoveVisualObjectWithActors( anEntry.c_str(), true);
}
/** Remove an object from data structures **/
#ifndef DISABLE_PLOT2DVIEWER
SMESH::ProcessIn2DViewers(anActor,SMESH::RemoveFrom2dViewer);
#endif
+ anActor->UpdateFilter();
}
}
}
else
aSel->setSelectedObjects( to_process );
+ if ( vtkwnd && vtkwnd->GetRenderer() && !isStudyLocked() &&
+ ( theCommandID==SMESHOp::OpShow || theCommandID==SMESHOp::OpShowOnly ) )
+ vtkwnd->GetRenderer()->AdjustActors();
+
break;
}
break;
}
+ case SMESHOp::OpFaceGroupsByEdges: // Create face groups separated by sharp edges
+ {
+ if ( isStudyLocked() )
+ break;
+
+ EmitSignalDeactivateDialog();
+ SMESHGUI_FaceGroupsSeparatedByEdgesDlg* aDlg = new SMESHGUI_FaceGroupsSeparatedByEdgesDlg( this );
+ aDlg->show();
+
+ break;
+ }
+
case SMESHOp::OpDeleteGroup: // Delete groups with their contents
{
if ( !vtkwnd )
case SMESHOp::OpPropertiesVolume:
case SMESHOp::OpMinimumDistance:
case SMESHOp::OpBoundingBox:
+ case SMESHOp::OpAngle:
{
int page = SMESHGUI_MeasureDlg::MinDistance;
if ( theCommandID == SMESHOp::OpBoundingBox )
page = SMESHGUI_MeasureDlg::Area;
else if ( theCommandID == SMESHOp::OpPropertiesVolume )
page = SMESHGUI_MeasureDlg::Volume;
+ else if ( theCommandID == SMESHOp::OpAngle )
+ page = SMESHGUI_MeasureDlg::Angle;
EmitSignalDeactivateDialog();
SMESHGUI_MeasureDlg* dlg = new SMESHGUI_MeasureDlg( SMESHGUI::desktop(), page );
case SMESHOp::OpSortChild:
::sortChildren();
break;
+ case SMESHOp::OpBreakLink:
+ ::breakShaperLink();
+ break;
}
createSMESHAction( SMESHOp::OpIntersectGroups, "INT_GROUP", "ICON_INTERSECT" );
createSMESHAction( SMESHOp::OpCutGroups, "CUT_GROUP", "ICON_CUT" );
createSMESHAction( SMESHOp::OpGroupUnderlyingElem, "UNDERLYING_ELEMS", "ICON_UNDERLYING_ELEMS" );
+ createSMESHAction( SMESHOp::OpFaceGroupsByEdges, "FACE_GROUPS_BY_EDGES", "ICON_FACE_GROUPS_BY_EDGES" );
createSMESHAction( SMESHOp::OpAddElemGroupPopup, "ADD_TO_GROUP" );
createSMESHAction( SMESHOp::OpRemoveElemGroupPopup, "REMOVE_FROM_GROUP" );
createSMESHAction( SMESHOp::OpDeleteGroup, "DEL_GROUP", "ICON_DEL_GROUP" );
createSMESHAction( SMESHOp::OpPropertiesLength, "MEASURE_LENGTH", "ICON_MEASURE_LENGTH" );
createSMESHAction( SMESHOp::OpPropertiesArea, "MEASURE_AREA", "ICON_MEASURE_AREA" );
createSMESHAction( SMESHOp::OpPropertiesVolume, "MEASURE_VOLUME", "ICON_MEASURE_VOLUME" );
+ createSMESHAction( SMESHOp::OpAngle, "MEASURE_ANGLE", "ICON_MEASURE_ANGLE" );
createSMESHAction( SMESHOp::OpHide, "HIDE", "ICON_HIDE" );
createSMESHAction( SMESHOp::OpShow, "SHOW", "ICON_SHOW" );
createSMESHAction( SMESHOp::OpSortChild, "SORT_CHILD_ITEMS" );
+ createSMESHAction( SMESHOp::OpBreakLink, "BREAK_SHAPER_LINK" );
+
QList<int> aCtrlActions;
aCtrlActions << SMESHOp::OpFreeNode << SMESHOp::OpEqualNode
<< SMESHOp::OpNodeConnectivityNb // node controls
createMenu( SMESHOp::OpCutGroups, meshId, -1 );
createMenu( separator(), meshId, -1 );
createMenu( SMESHOp::OpGroupUnderlyingElem, meshId, -1 );
+ createMenu( SMESHOp::OpFaceGroupsByEdges, meshId, -1 );
createMenu( separator(), meshId, -1 );
createMenu( SMESHOp::OpMeshInformation, meshId, -1 );
//createMenu( SMESHOp::OpStdInfo, meshId, -1 );
createMenu( SMESHOp::OpMinimumDistance, measureId, -1 );
createMenu( SMESHOp::OpBoundingBox, measureId, -1 );
+ createMenu( SMESHOp::OpAngle, measureId, -1 );
createMenu( SMESHOp::OpPropertiesLength, basicPropId, -1 );
createMenu( SMESHOp::OpPropertiesArea, basicPropId, -1 );
createMenu( SMESHOp::OpPropertiesVolume, basicPropId, -1 );
popupMgr()->setRule( action( SMESHOp::OpSortChild ), "$component={'SMESH'} and client='ObjectBrowser' and isContainer and nbChildren>1", QtxPopupMgr::VisibleRule );
popupMgr()->insert( separator(), -1, -1 );
+ popupMgr()->insert( action( SMESHOp::OpBreakLink), -1, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpBreakLink), "$component={'SHAPERSTUDY'} and client='ObjectBrowser' and canBreakLink", QtxPopupMgr::VisibleRule );
+
connect( application(), SIGNAL( viewManagerActivated( SUIT_ViewManager* ) ),
this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) );
if ( aDesk ) {
QList<SUIT_ViewWindow*> wndList = aDesk->windows();
SUIT_ViewWindow* wnd;
- foreach ( wnd, wndList )
- connectView( wnd );
+ foreach(wnd, wndList) {
+ connectView(wnd);
+ wnd->update();
+ }
}
Py_XDECREF(pluginsmanager);
_PTR(Study) study = appStudy->studyDS();
_PTR(SObject) obj = study->FindObjectID( io->getEntry() );
if ( obj ) {
- QString aName = QString( SMESH::fromUtf8(obj->GetName()) );
- while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of Popup
- aName.remove( (aName.length() - 1), 1 );
+ QString aName = SMESH::fromUtf8( obj->GetName());
+ while ( !aName.isEmpty() && aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of Popup
+ aName.remove(( aName.length() - 1 ), 1 );
title = aName;
}
}
int dispgroup = addPreference( tr( "PREF_DISPLAY_MODE_GROUP" ), genTab );
setPreferenceProperty( dispgroup, "columns", 2 );
+
+ addPreference( tr( "PREF_FITALL_ON_DISPLAYONLY" ), dispgroup, LightApp_Preferences::Bool, "SMESH", "fitall_on_displayonly" );
+
int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), dispgroup, LightApp_Preferences::Selector, "SMESH", "display_mode" );
QStringList modes;
modes.append( tr("MEN_WIRE") );
std::string aWarning;
SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);
- if ( name== "selection_object_color" ||
- name=="selection_element_color" ||
- name== "highlight_color" ||
- name=="selection_precision_node" ||
- name=="selection_precision_element" ||
- name=="selection_precision_object" ||
- name=="selection_increment")
+ if ( name == "selection_object_color" ||
+ name == "selection_element_color" ||
+ name == "highlight_color" ||
+ name == "selection_precision_node" ||
+ name == "selection_precision_element" ||
+ name == "selection_precision_object" ||
+ name == "selection_increment")
{
SMESH::UpdateSelectionProp( this );
}