mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-15 21:21:21 +05:00
0022672: SMESH: Add a "Reset" in the "Controls" menu of smesh
This commit is contained in:
parent
9230651287
commit
d0cb9e8d04
@ -1566,16 +1566,7 @@ namespace
|
|||||||
|
|
||||||
void Control( int theCommandID )
|
void Control( int theCommandID )
|
||||||
{
|
{
|
||||||
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
|
||||||
SALOME_ListIO selected;
|
|
||||||
if( aSel )
|
|
||||||
aSel->selectedObjects( selected );
|
|
||||||
|
|
||||||
if( !selected.IsEmpty() ){
|
|
||||||
Handle(SALOME_InteractiveObject) anIO = selected.First();
|
|
||||||
if(!anIO.IsNull()){
|
|
||||||
SMESH_Actor::eControl aControl = SMESH_Actor::eNone;
|
SMESH_Actor::eControl aControl = SMESH_Actor::eNone;
|
||||||
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIO->getEntry())) {
|
|
||||||
switch ( theCommandID ){
|
switch ( theCommandID ){
|
||||||
case SMESHOp::OpFreeNode:
|
case SMESHOp::OpFreeNode:
|
||||||
aControl = SMESH_Actor::eFreeNodes;
|
aControl = SMESH_Actor::eFreeNodes;
|
||||||
@ -1656,7 +1647,26 @@ namespace
|
|||||||
aControl = SMESH_Actor::eCoincidentElems3D;
|
aControl = SMESH_Actor::eCoincidentElems3D;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
|
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||||
|
SALOME_ListIO selected;
|
||||||
|
if( aSel )
|
||||||
|
aSel->selectedObjects( selected );
|
||||||
|
|
||||||
|
if( !selected.IsEmpty() ){
|
||||||
|
SALOME_ListIteratorOfListIO It(selected);
|
||||||
|
for ( ; It.More(); It.Next())
|
||||||
|
{
|
||||||
|
Handle(SALOME_InteractiveObject) anIO = It.Value();
|
||||||
|
if(!anIO.IsNull()){
|
||||||
|
_PTR(SObject) SO = aStudy->FindObjectID( It.Value()->getEntry() );
|
||||||
|
if ( SO ) {
|
||||||
|
CORBA::Object_var aObject = SMESH::SObjectToObject( SO );
|
||||||
|
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( aObject );
|
||||||
|
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( aObject );
|
||||||
|
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( aObject );
|
||||||
|
if ( !aMesh->_is_nil() || !aSubMesh->_is_nil() || !aGroup->_is_nil() ) {
|
||||||
|
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIO->getEntry())) {
|
||||||
anActor->SetControlMode(aControl);
|
anActor->SetControlMode(aControl);
|
||||||
anActor->GetScalarBarActor()->SetTitle( functorToString( anActor->GetFunctor() ).toLatin1().constData() );
|
anActor->GetScalarBarActor()->SetTitle( functorToString( anActor->GetFunctor() ).toLatin1().constData() );
|
||||||
SMESH::RepaintCurrentView();
|
SMESH::RepaintCurrentView();
|
||||||
@ -1675,6 +1685,9 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CheckOIType(const Handle(SALOME_InteractiveObject) & theIO,
|
bool CheckOIType(const Handle(SALOME_InteractiveObject) & theIO,
|
||||||
@ -3530,20 +3543,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
LightApp_SelectionMgr* mgr = selectionMgr();
|
LightApp_SelectionMgr* mgr = selectionMgr();
|
||||||
SALOME_ListIO selected; mgr->selectedObjects( selected );
|
SALOME_ListIO selected; mgr->selectedObjects( selected );
|
||||||
|
|
||||||
if ( selected.Extent() == 1 && selected.First()->hasEntry() ) {
|
if( !selected.IsEmpty() ) {
|
||||||
_PTR(SObject) SO = aStudy->FindObjectID( selected.First()->getEntry() );
|
|
||||||
if ( SO ) {
|
|
||||||
CORBA::Object_var aObject = SMESH::SObjectToObject( SO );
|
|
||||||
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( aObject );
|
|
||||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( aObject );
|
|
||||||
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( aObject );
|
|
||||||
if ( !aMesh->_is_nil() || !aSubMesh->_is_nil() || !aGroup->_is_nil() ) {
|
|
||||||
SUIT_OverrideCursor wc;
|
SUIT_OverrideCursor wc;
|
||||||
::Control( theCommandID );
|
::Control( theCommandID );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
SUIT_MessageBox::warning(desktop(),
|
SUIT_MessageBox::warning(desktop(),
|
||||||
tr( "SMESH_WRN_WARNING" ),
|
tr( "SMESH_WRN_WARNING" ),
|
||||||
tr( "SMESH_BAD_SELECTION" ) );
|
tr( "SMESH_BAD_SELECTION" ) );
|
||||||
@ -3927,6 +3931,23 @@ void SMESHGUI::initialize( CAM_Application* app )
|
|||||||
|
|
||||||
createSMESHAction( SMESHOp::OpSortChild, "SORT_CHILD_ITEMS" );
|
createSMESHAction( SMESHOp::OpSortChild, "SORT_CHILD_ITEMS" );
|
||||||
|
|
||||||
|
QList<int> aCtrlActions;
|
||||||
|
aCtrlActions << SMESHOp::OpFreeNode << SMESHOp::OpEqualNode // node controls
|
||||||
|
<< SMESHOp::OpFreeEdge << SMESHOp::OpFreeBorder
|
||||||
|
<< SMESHOp::OpLength << SMESHOp::OpConnection << SMESHOp::OpEqualEdge // edge controls
|
||||||
|
<< SMESHOp::OpFreeFace << SMESHOp::OpLength2D << SMESHOp::OpConnection2D
|
||||||
|
<< SMESHOp::OpArea << SMESHOp::OpTaper << SMESHOp::OpAspectRatio
|
||||||
|
<< SMESHOp::OpMinimumAngle << SMESHOp::OpWarpingAngle << SMESHOp::OpSkew
|
||||||
|
<< SMESHOp::OpMaxElementLength2D << SMESHOp::OpBareBorderFace
|
||||||
|
<< SMESHOp::OpOverConstrainedFace << SMESHOp::OpEqualFace // face controls
|
||||||
|
<< SMESHOp::OpAspectRatio3D << SMESHOp::OpVolume
|
||||||
|
<< SMESHOp::OpMaxElementLength3D << SMESHOp::OpBareBorderVolume
|
||||||
|
<< SMESHOp::OpOverConstrainedVolume << SMESHOp::OpEqualVolume; // volume controls
|
||||||
|
QActionGroup* aCtrlGroup = new QActionGroup( application()->desktop() );
|
||||||
|
aCtrlGroup->setExclusive( true );
|
||||||
|
for( int i = 0; i < aCtrlActions.size(); i++ )
|
||||||
|
aCtrlGroup->addAction( action( aCtrlActions[i] ) );
|
||||||
|
|
||||||
// ----- create menu --------------
|
// ----- create menu --------------
|
||||||
int fileId = createMenu( tr( "MEN_FILE" ), -1, 1 ),
|
int fileId = createMenu( tr( "MEN_FILE" ), -1, 1 ),
|
||||||
editId = createMenu( tr( "MEN_EDIT" ), -1, 3 ),
|
editId = createMenu( tr( "MEN_EDIT" ), -1, 3 ),
|
||||||
@ -4031,6 +4052,8 @@ void SMESHGUI::initialize( CAM_Application* app )
|
|||||||
createMenu( SMESHOp::OpOverConstrainedVolume, volumeId, -1 );
|
createMenu( SMESHOp::OpOverConstrainedVolume, volumeId, -1 );
|
||||||
createMenu( SMESHOp::OpEqualVolume, volumeId, -1 );
|
createMenu( SMESHOp::OpEqualVolume, volumeId, -1 );
|
||||||
createMenu( separator(), ctrlId, -1 );
|
createMenu( separator(), ctrlId, -1 );
|
||||||
|
createMenu( SMESHOp::OpReset, ctrlId, -1 );
|
||||||
|
createMenu( separator(), ctrlId, -1 );
|
||||||
createMenu( SMESHOp::OpOverallMeshQuality, ctrlId, -1 );
|
createMenu( SMESHOp::OpOverallMeshQuality, ctrlId, -1 );
|
||||||
|
|
||||||
createMenu( SMESHOp::OpNode, addId, -1 );
|
createMenu( SMESHOp::OpNode, addId, -1 );
|
||||||
|
@ -80,8 +80,10 @@ void SMESHGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr
|
|||||||
return;
|
return;
|
||||||
_PTR(Study) aStudy = aSStudy->studyDS();
|
_PTR(Study) aStudy = aSStudy->studyDS();
|
||||||
|
|
||||||
for( int i=0, n=count(); i<n; i++ )
|
for( int i=0, n=count(); i<n; i++ ) {
|
||||||
myTypes.append( typeName( type( entry( i ), aStudy ) ) );
|
myTypes.append( typeName( type( entry( i ), aStudy ) ) );
|
||||||
|
myControls.append( controlMode( i ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +124,6 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
|
|||||||
else if ( p=="labeledTypes" ) val = QVariant( labeledTypes( ind ) );
|
else if ( p=="labeledTypes" ) val = QVariant( labeledTypes( ind ) );
|
||||||
else if ( p=="shrinkMode" ) val = QVariant( shrinkMode( ind ) );
|
else if ( p=="shrinkMode" ) val = QVariant( shrinkMode( ind ) );
|
||||||
else if ( p=="entityMode" ) val = QVariant( entityMode( ind ) );
|
else if ( p=="entityMode" ) val = QVariant( entityMode( ind ) );
|
||||||
else if ( p=="controlMode" ) val = QVariant( controlMode( ind ) );
|
|
||||||
else if ( p=="isNumFunctor" ) val = QVariant( isNumFunctor( ind ) );
|
else if ( p=="isNumFunctor" ) val = QVariant( isNumFunctor( ind ) );
|
||||||
else if ( p=="displayMode" ) val = QVariant( displayMode( ind ) );
|
else if ( p=="displayMode" ) val = QVariant( displayMode( ind ) );
|
||||||
else if ( p=="isComputable" ) val = QVariant( isComputable( ind ) );
|
else if ( p=="isComputable" ) val = QVariant( isComputable( ind ) );
|
||||||
@ -143,6 +144,21 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
|
|||||||
return LightApp_Selection::parameter( ind, p );
|
return LightApp_Selection::parameter( ind, p );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : parameter
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
QVariant SMESHGUI_Selection::parameter( const QString& p ) const
|
||||||
|
{
|
||||||
|
QVariant val;
|
||||||
|
if ( p=="controlMode" ) val = QVariant( controlMode() );
|
||||||
|
|
||||||
|
if ( val.isValid() )
|
||||||
|
return val;
|
||||||
|
else
|
||||||
|
return LightApp_Selection::parameter( p );
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : getVtkOwner
|
//function : getVtkOwner
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -318,6 +334,23 @@ QString SMESHGUI_Selection::controlMode( int ind ) const
|
|||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : controlMode
|
||||||
|
//purpose : gets global control mode; return SMESH_Actor::eControl
|
||||||
|
//=======================================================================
|
||||||
|
QString SMESHGUI_Selection::controlMode() const
|
||||||
|
{
|
||||||
|
if( myControls.count() > 0 ) {
|
||||||
|
QString mode = myControls[0];
|
||||||
|
for( int ind = 1; ind < myControls.count(); ind++ ) {
|
||||||
|
if( mode != myControls[ind] )
|
||||||
|
return "eNone";
|
||||||
|
}
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
return "eNone";
|
||||||
|
}
|
||||||
|
|
||||||
bool SMESHGUI_Selection::isNumFunctor( int ind ) const
|
bool SMESHGUI_Selection::isNumFunctor( int ind ) const
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
@ -49,6 +49,7 @@ public:
|
|||||||
|
|
||||||
virtual void init( const QString&, LightApp_SelectionMgr* );
|
virtual void init( const QString&, LightApp_SelectionMgr* );
|
||||||
virtual QVariant parameter( const int, const QString& ) const;
|
virtual QVariant parameter( const int, const QString& ) const;
|
||||||
|
virtual QVariant parameter( const QString& ) const;
|
||||||
virtual bool processOwner( const LightApp_DataOwner* );
|
virtual bool processOwner( const LightApp_DataOwner* );
|
||||||
|
|
||||||
// got from object, not from actor
|
// got from object, not from actor
|
||||||
@ -74,6 +75,7 @@ public:
|
|||||||
virtual QString shrinkMode( int ) const;
|
virtual QString shrinkMode( int ) const;
|
||||||
virtual QList<QVariant> entityMode( int ) const;
|
virtual QList<QVariant> entityMode( int ) const;
|
||||||
virtual QString controlMode( int ) const;
|
virtual QString controlMode( int ) const;
|
||||||
|
virtual QString controlMode() const;
|
||||||
virtual bool isNumFunctor( int ) const;
|
virtual bool isNumFunctor( int ) const;
|
||||||
virtual QString facesOrientationMode( int ) const;
|
virtual QString facesOrientationMode( int ) const;
|
||||||
virtual QString groupType( int ) const;
|
virtual QString groupType( int ) const;
|
||||||
@ -87,6 +89,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList myTypes;
|
QStringList myTypes;
|
||||||
|
QStringList myControls;
|
||||||
QList<SMESH_Actor*> myActors;
|
QList<SMESH_Actor*> myActors;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user