mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-12 12:47:28 +05:00
IPAL53091: 'Scale of Marker' lists are different in Preferences and Properties dialogs
fix SMESHGUI::createPreferences() + cosmetic changes
This commit is contained in:
parent
7eda9ca931
commit
cc935c7f60
@ -178,11 +178,6 @@
|
|||||||
|
|
||||||
#include <Basics_Utils.hxx>
|
#include <Basics_Utils.hxx>
|
||||||
|
|
||||||
//To disable automatic genericobj management, the following line should be commented.
|
|
||||||
//Otherwise, it should be uncommented.
|
|
||||||
//Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
|
|
||||||
#define WITHGENERICOBJ
|
|
||||||
|
|
||||||
// Below macro, when uncommented, switches on simplified (more performant) algorithm
|
// Below macro, when uncommented, switches on simplified (more performant) algorithm
|
||||||
// of auto-color picking up
|
// of auto-color picking up
|
||||||
#define SIMPLE_AUTOCOLOR
|
#define SIMPLE_AUTOCOLOR
|
||||||
@ -192,7 +187,7 @@ namespace
|
|||||||
// Declarations
|
// Declarations
|
||||||
//=============================================================
|
//=============================================================
|
||||||
void ImportMeshesFromFile(SMESH::SMESH_Gen_ptr theComponentMesh,
|
void ImportMeshesFromFile(SMESH::SMESH_Gen_ptr theComponentMesh,
|
||||||
int theCommandID);
|
int theCommandID);
|
||||||
|
|
||||||
void ExportMeshToFile(int theCommandID);
|
void ExportMeshToFile(int theCommandID);
|
||||||
|
|
||||||
@ -212,7 +207,7 @@ namespace
|
|||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
void ImportMeshesFromFile( SMESH::SMESH_Gen_ptr theComponentMesh,
|
void ImportMeshesFromFile( SMESH::SMESH_Gen_ptr theComponentMesh,
|
||||||
int theCommandID )
|
int theCommandID )
|
||||||
{
|
{
|
||||||
QStringList filter;
|
QStringList filter;
|
||||||
std::string myExtension;
|
std::string myExtension;
|
||||||
@ -424,17 +419,24 @@ namespace
|
|||||||
if( aSel )
|
if( aSel )
|
||||||
aSel->selectedObjects( selected );
|
aSel->selectedObjects( selected );
|
||||||
|
|
||||||
const bool isDAT = ( theCommandID == SMESHOp::OpExportDAT || theCommandID == SMESHOp::OpPopupExportDAT );
|
const bool isDAT = ( theCommandID == SMESHOp::OpExportDAT ||
|
||||||
const bool isMED = ( theCommandID == SMESHOp::OpExportMED || theCommandID == SMESHOp::OpPopupExportMED );
|
theCommandID == SMESHOp::OpPopupExportDAT );
|
||||||
const bool isUNV = ( theCommandID == SMESHOp::OpExportUNV || theCommandID == SMESHOp::OpPopupExportUNV );
|
const bool isMED = ( theCommandID == SMESHOp::OpExportMED ||
|
||||||
const bool isSTL = ( theCommandID == SMESHOp::OpExportSTL || theCommandID == SMESHOp::OpPopupExportSTL );
|
theCommandID == SMESHOp::OpPopupExportMED );
|
||||||
|
const bool isUNV = ( theCommandID == SMESHOp::OpExportUNV ||
|
||||||
|
theCommandID == SMESHOp::OpPopupExportUNV );
|
||||||
|
const bool isSTL = ( theCommandID == SMESHOp::OpExportSTL ||
|
||||||
|
theCommandID == SMESHOp::OpPopupExportSTL );
|
||||||
#ifdef WITH_CGNS
|
#ifdef WITH_CGNS
|
||||||
const bool isCGNS= ( theCommandID == SMESHOp::OpExportCGNS || theCommandID == SMESHOp::OpPopupExportCGNS );
|
const bool isCGNS= ( theCommandID == SMESHOp::OpExportCGNS ||
|
||||||
|
theCommandID == SMESHOp::OpPopupExportCGNS );
|
||||||
#else
|
#else
|
||||||
const bool isCGNS= false;
|
const bool isCGNS= false;
|
||||||
#endif
|
#endif
|
||||||
const bool isSAUV= ( theCommandID == SMESHOp::OpExportSAUV || theCommandID == SMESHOp::OpPopupExportSAUV );
|
const bool isSAUV= ( theCommandID == SMESHOp::OpExportSAUV ||
|
||||||
const bool isGMF = ( theCommandID == SMESHOp::OpExportGMF || theCommandID == SMESHOp::OpPopupExportGMF );
|
theCommandID == SMESHOp::OpPopupExportSAUV );
|
||||||
|
const bool isGMF = ( theCommandID == SMESHOp::OpExportGMF ||
|
||||||
|
theCommandID == SMESHOp::OpPopupExportGMF );
|
||||||
|
|
||||||
const bool multiMeshSupported = ( isMED || isCGNS ); // file can hold several meshes
|
const bool multiMeshSupported = ( isMED || isCGNS ); // file can hold several meshes
|
||||||
if ( selected.Extent() == 0 || ( selected.Extent() > 1 && !multiMeshSupported ))
|
if ( selected.Extent() == 0 || ( selected.Extent() > 1 && !multiMeshSupported ))
|
||||||
@ -442,13 +444,14 @@ namespace
|
|||||||
|
|
||||||
// get mesh object from selection and check duplication of their names
|
// get mesh object from selection and check duplication of their names
|
||||||
bool hasDuplicatedMeshNames = false;
|
bool hasDuplicatedMeshNames = false;
|
||||||
QList< QPair< SMESH::SMESH_IDSource_var, QString > > aMeshList;
|
QList< QPair< SMESH::SMESH_IDSource_var, QString > > aMeshList;
|
||||||
QList< QPair< SMESH::SMESH_IDSource_var, QString > >::iterator aMeshIter;
|
QList< QPair< SMESH::SMESH_IDSource_var, QString > >::iterator aMeshIter;
|
||||||
SALOME_ListIteratorOfListIO It( selected );
|
SALOME_ListIteratorOfListIO It( selected );
|
||||||
for( ; It.More(); It.Next() )
|
for( ; It.More(); It.Next() )
|
||||||
{
|
{
|
||||||
Handle(SALOME_InteractiveObject) anIObject = It.Value();
|
Handle(SALOME_InteractiveObject) anIObject = It.Value();
|
||||||
SMESH::SMESH_IDSource_var aMeshItem = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(anIObject);
|
SMESH::SMESH_IDSource_var aMeshItem =
|
||||||
|
SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(anIObject);
|
||||||
if ( aMeshItem->_is_nil() ) {
|
if ( aMeshItem->_is_nil() ) {
|
||||||
SUIT_MessageBox::warning( SMESHGUI::desktop(),
|
SUIT_MessageBox::warning( SMESHGUI::desktop(),
|
||||||
QObject::tr( "SMESH_WRN_WARNING" ),
|
QObject::tr( "SMESH_WRN_WARNING" ),
|
||||||
@ -572,7 +575,7 @@ namespace
|
|||||||
if ( !presentNotSupported.empty() )
|
if ( !presentNotSupported.empty() )
|
||||||
{
|
{
|
||||||
QString typeNames;
|
QString typeNames;
|
||||||
const char* typeMsg[SMESH::Entity_Last] = {
|
const char* typeMsg[] = {
|
||||||
"SMESH_NODES", "SMESH_ELEMS0D","SMESH_EDGES","SMESH_QUADRATIC_EDGES",
|
"SMESH_NODES", "SMESH_ELEMS0D","SMESH_EDGES","SMESH_QUADRATIC_EDGES",
|
||||||
"SMESH_TRIANGLES", "SMESH_QUADRATIC_TRIANGLES", "SMESH_BIQUADRATIC_TRIANGLES",
|
"SMESH_TRIANGLES", "SMESH_QUADRATIC_TRIANGLES", "SMESH_BIQUADRATIC_TRIANGLES",
|
||||||
"SMESH_QUADRANGLES","SMESH_QUADRATIC_QUADRANGLES", "SMESH_BIQUADRATIC_QUADRANGLES",
|
"SMESH_QUADRANGLES","SMESH_QUADRATIC_QUADRANGLES", "SMESH_BIQUADRATIC_QUADRANGLES",
|
||||||
@ -582,6 +585,10 @@ namespace
|
|||||||
"SMESH_TRIQUADRATIC_HEXAHEDRONS","SMESH_PENTAHEDRA","SMESH_QUADRATIC_PENTAHEDRONS",
|
"SMESH_TRIQUADRATIC_HEXAHEDRONS","SMESH_PENTAHEDRA","SMESH_QUADRATIC_PENTAHEDRONS",
|
||||||
"SMESH_OCTAHEDRA","SMESH_POLYEDRONS","SMESH_QUADRATIC_POLYEDRONS","SMESH_BALLS"
|
"SMESH_OCTAHEDRA","SMESH_POLYEDRONS","SMESH_QUADRATIC_POLYEDRONS","SMESH_BALLS"
|
||||||
};
|
};
|
||||||
|
// is typeMsg complete? (compilation failure mains that enum SMDSAbs_EntityType changed)
|
||||||
|
int nbTypes = sizeof( typeMsg ) / sizeof( const char* );
|
||||||
|
int _assert[( nbTypes == SMESH::Entity_Last ) ? 1 : -1 ]; _assert[0]=1;
|
||||||
|
|
||||||
QString andStr = " " + QObject::tr("SMESH_AND") + " ", comma(", ");
|
QString andStr = " " + QObject::tr("SMESH_AND") + " ", comma(", ");
|
||||||
for ( size_t iType = 0; iType < presentNotSupported.size(); ++iType ) {
|
for ( size_t iType = 0; iType < presentNotSupported.size(); ++iType ) {
|
||||||
typeNames += QObject::tr( typeMsg[ presentNotSupported[ iType ]]);
|
typeNames += QObject::tr( typeMsg[ presentNotSupported[ iType ]]);
|
||||||
@ -608,7 +615,7 @@ namespace
|
|||||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||||
if ( resMgr )
|
if ( resMgr )
|
||||||
toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
|
toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
|
||||||
bool toOverwrite = true;
|
bool toOverwrite = true;
|
||||||
bool toFindOutDim = true;
|
bool toFindOutDim = true;
|
||||||
|
|
||||||
QString aFilter, aTitle = QObject::tr("SMESH_EXPORT_MESH");
|
QString aFilter, aTitle = QObject::tr("SMESH_EXPORT_MESH");
|
||||||
@ -919,7 +926,7 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void InverseEntityMode(unsigned int& theOutputMode,
|
inline void InverseEntityMode(unsigned int& theOutputMode,
|
||||||
unsigned int theMode)
|
unsigned int theMode)
|
||||||
{
|
{
|
||||||
bool anIsNotPresent = ~theOutputMode & theMode;
|
bool anIsNotPresent = ~theOutputMode & theMode;
|
||||||
if(anIsNotPresent)
|
if(anIsNotPresent)
|
||||||
@ -928,13 +935,14 @@ namespace
|
|||||||
theOutputMode &= ~theMode;
|
theOutputMode &= ~theMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDisplayEntity(int theCommandID){
|
void SetDisplayEntity(int theCommandID)
|
||||||
|
{
|
||||||
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||||
SALOME_ListIO selected;
|
SALOME_ListIO selected;
|
||||||
if( aSel )
|
if ( aSel )
|
||||||
aSel->selectedObjects( selected );
|
aSel->selectedObjects( selected );
|
||||||
|
|
||||||
if(selected.Extent() >= 1){
|
if ( selected.Extent() >= 1 ) {
|
||||||
SALOME_ListIteratorOfListIO It( selected );
|
SALOME_ListIteratorOfListIO It( selected );
|
||||||
for( ; It.More(); It.Next()){
|
for( ; It.More(); It.Next()){
|
||||||
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
||||||
@ -942,24 +950,12 @@ namespace
|
|||||||
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
|
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
|
||||||
unsigned int aMode = anActor->GetEntityMode();
|
unsigned int aMode = anActor->GetEntityMode();
|
||||||
switch(theCommandID){
|
switch(theCommandID){
|
||||||
case SMESHOp::OpDE0DElements:
|
case SMESHOp::OpDE0DElements: InverseEntityMode(aMode,SMESH_Actor::e0DElements); break;
|
||||||
InverseEntityMode(aMode,SMESH_Actor::e0DElements);
|
case SMESHOp::OpDEEdges: InverseEntityMode(aMode,SMESH_Actor::eEdges); break;
|
||||||
break;
|
case SMESHOp::OpDEFaces: InverseEntityMode(aMode,SMESH_Actor::eFaces); break;
|
||||||
case SMESHOp::OpDEEdges:
|
case SMESHOp::OpDEVolumes: InverseEntityMode(aMode,SMESH_Actor::eVolumes); break;
|
||||||
InverseEntityMode(aMode,SMESH_Actor::eEdges);
|
case SMESHOp::OpDEBalls: InverseEntityMode(aMode,SMESH_Actor::eBallElem); break;
|
||||||
break;
|
case SMESHOp::OpDEAllEntity: aMode = SMESH_Actor::eAllEntity; break;
|
||||||
case SMESHOp::OpDEFaces:
|
|
||||||
InverseEntityMode(aMode,SMESH_Actor::eFaces);
|
|
||||||
break;
|
|
||||||
case SMESHOp::OpDEVolumes:
|
|
||||||
InverseEntityMode(aMode,SMESH_Actor::eVolumes);
|
|
||||||
break;
|
|
||||||
case SMESHOp::OpDEBalls:
|
|
||||||
InverseEntityMode(aMode,SMESH_Actor::eBallElem);
|
|
||||||
break;
|
|
||||||
case SMESHOp::OpDEAllEntity:
|
|
||||||
aMode = SMESH_Actor::eAllEntity;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if(aMode)
|
if(aMode)
|
||||||
anActor->SetEntityMode(aMode);
|
anActor->SetEntityMode(aMode);
|
||||||
@ -971,26 +967,27 @@ namespace
|
|||||||
|
|
||||||
void AutoColor()
|
void AutoColor()
|
||||||
{
|
{
|
||||||
SALOME_ListIO selected;
|
SalomeApp_Application* app =
|
||||||
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||||
if( !app )
|
if ( !app )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LightApp_SelectionMgr* aSel = app->selectionMgr();
|
LightApp_SelectionMgr* aSel = app->selectionMgr();
|
||||||
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
|
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
|
||||||
if( !aSel || !appStudy )
|
if ( !aSel || !appStudy )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
SALOME_ListIO selected;
|
||||||
aSel->selectedObjects( selected );
|
aSel->selectedObjects( selected );
|
||||||
if( selected.IsEmpty() )
|
if ( selected.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Handle(SALOME_InteractiveObject) anIObject = selected.First();
|
Handle(SALOME_InteractiveObject) anIObject = selected.First();
|
||||||
|
|
||||||
_PTR(Study) aStudy = appStudy->studyDS();
|
_PTR(Study) aStudy = appStudy->studyDS();
|
||||||
_PTR(SObject) aMainSObject( aStudy->FindObjectID( anIObject->getEntry() ) );
|
_PTR(SObject) aMainSObject = aStudy->FindObjectID( anIObject->getEntry() );
|
||||||
SMESH::SMESH_Mesh_var aMainObject = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
|
SMESH::SMESH_Mesh_var aMainObject = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
|
||||||
if( aMainObject->_is_nil() )
|
if ( aMainObject->_is_nil() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SUIT_OverrideCursor wc;
|
SUIT_OverrideCursor wc;
|
||||||
@ -1000,10 +997,9 @@ namespace
|
|||||||
QList<SALOMEDS::Color> aReservedColors;
|
QList<SALOMEDS::Color> aReservedColors;
|
||||||
|
|
||||||
SMESH::ListOfGroups aListOfGroups = *aMainObject->GetGroups();
|
SMESH::ListOfGroups aListOfGroups = *aMainObject->GetGroups();
|
||||||
for( int i = 0, n = aListOfGroups.length(); i < n; i++ )
|
for ( int i = 0, n = aListOfGroups.length(); i < n; i++ )
|
||||||
{
|
{
|
||||||
SMESH::SMESH_GroupBase_var aGroupObject = aListOfGroups[i];
|
SMESH::SMESH_GroupBase_var aGroupObject = aListOfGroups[i];
|
||||||
//SALOMEDS::Color aColor = aGroupObject->GetColor();
|
|
||||||
|
|
||||||
#ifdef SIMPLE_AUTOCOLOR // simplified algorithm for auto-colors
|
#ifdef SIMPLE_AUTOCOLOR // simplified algorithm for auto-colors
|
||||||
SALOMEDS::Color aColor = SMESHGUI::getPredefinedUniqueColor();
|
SALOMEDS::Color aColor = SMESHGUI::getPredefinedUniqueColor();
|
||||||
@ -1014,10 +1010,10 @@ namespace
|
|||||||
aGroupObject->SetColor( aColor );
|
aGroupObject->SetColor( aColor );
|
||||||
|
|
||||||
_PTR(SObject) aGroupSObject = SMESH::FindSObject(aGroupObject);
|
_PTR(SObject) aGroupSObject = SMESH::FindSObject(aGroupObject);
|
||||||
if (aGroupSObject) {
|
if ( aGroupSObject ) {
|
||||||
QColor c;
|
QColor c;
|
||||||
int delta;
|
int delta;
|
||||||
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aGroupSObject->GetID().c_str())) {
|
if ( SMESH_Actor *anActor = SMESH::FindActorByEntry(aGroupSObject->GetID().c_str())) {
|
||||||
switch ( aGroupObject->GetType ()) {
|
switch ( aGroupObject->GetType ()) {
|
||||||
case SMESH::NODE:
|
case SMESH::NODE:
|
||||||
anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break;
|
anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break;
|
||||||
@ -1042,7 +1038,8 @@ namespace
|
|||||||
SMESH::RepaintCurrentView();
|
SMESH::RepaintCurrentView();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverallMeshQuality() {
|
void OverallMeshQuality()
|
||||||
|
{
|
||||||
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
|
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
|
||||||
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||||
SALOME_ListIO selected;
|
SALOME_ListIO selected;
|
||||||
@ -1127,11 +1124,15 @@ namespace
|
|||||||
Handle(SALOME_InteractiveObject) anIO = selected.First();
|
Handle(SALOME_InteractiveObject) anIO = selected.First();
|
||||||
if ( anIO->hasEntry() ) {
|
if ( anIO->hasEntry() ) {
|
||||||
SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() );
|
SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() );
|
||||||
if ( anActor && anActor->GetScalarBarActor() && anActor->GetControlMode() != SMESH_Actor::eNone ) {
|
if ( anActor &&
|
||||||
|
anActor->GetScalarBarActor() &&
|
||||||
|
anActor->GetControlMode() != SMESH_Actor::eNone )
|
||||||
|
{
|
||||||
SMESH_ScalarBarActor* aScalarBarActor = anActor->GetScalarBarActor();
|
SMESH_ScalarBarActor* aScalarBarActor = anActor->GetScalarBarActor();
|
||||||
SMESH::Controls::FunctorPtr aFunctor = anActor->GetFunctor();
|
SMESH::Controls::FunctorPtr aFunctor = anActor->GetFunctor();
|
||||||
if ( aScalarBarActor && aFunctor ) {
|
if ( aScalarBarActor && aFunctor ) {
|
||||||
SMESH::Controls::NumericalFunctor* aNumFun = dynamic_cast<SMESH::Controls::NumericalFunctor*>( aFunctor.get() );
|
SMESH::Controls::NumericalFunctor* aNumFun =
|
||||||
|
dynamic_cast<SMESH::Controls::NumericalFunctor*>( aFunctor.get() );
|
||||||
if ( aNumFun ) {
|
if ( aNumFun ) {
|
||||||
std::vector<int> elements;
|
std::vector<int> elements;
|
||||||
SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);
|
SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);
|
||||||
@ -1153,7 +1154,8 @@ namespace
|
|||||||
bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
|
bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
|
||||||
std::vector<int> nbEvents;
|
std::vector<int> nbEvents;
|
||||||
std::vector<double> funValues;
|
std::vector<double> funValues;
|
||||||
aNumFun->GetHistogram( nbIntervals, nbEvents, funValues, elements, minmax, isLogarithmic );
|
aNumFun->GetHistogram( nbIntervals, nbEvents, funValues,
|
||||||
|
elements, minmax, isLogarithmic );
|
||||||
QString anInitialPath = "";
|
QString anInitialPath = "";
|
||||||
if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
|
if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
|
||||||
anInitialPath = QDir::currentPath();
|
anInitialPath = QDir::currentPath();
|
||||||
@ -1161,7 +1163,7 @@ namespace
|
|||||||
QStringList filter;
|
QStringList filter;
|
||||||
filter.append( QObject::tr( "TEXT_FILES_FILTER" ) + " (*.txt)" );
|
filter.append( QObject::tr( "TEXT_FILES_FILTER" ) + " (*.txt)" );
|
||||||
filter.append( QObject::tr( "ALL_FILES_FILTER" ) + " (*)" );
|
filter.append( QObject::tr( "ALL_FILES_FILTER" ) + " (*)" );
|
||||||
QString aFilename = anInitialPath + "/" + aMeshName + "_" +
|
QString aFilename = anInitialPath + "/" + aMeshName + "_" +
|
||||||
functorToString( aFunctor ).toLower().simplified().replace( QRegExp( " |-" ), "_" ) + ".txt";
|
functorToString( aFunctor ).toLower().simplified().replace( QRegExp( " |-" ), "_" ) + ".txt";
|
||||||
aFilename = SUIT_FileDlg::getFileName( SMESHGUI::desktop(),
|
aFilename = SUIT_FileDlg::getFileName( SMESHGUI::desktop(),
|
||||||
aFilename,
|
aFilename,
|
||||||
@ -1188,17 +1190,21 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowElement(int theCommandID ) {
|
void ShowElement( int theCommandID )
|
||||||
|
{
|
||||||
LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
|
LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
|
||||||
SALOME_ListIO selected;
|
SALOME_ListIO selected;
|
||||||
if ( aSel )
|
if ( aSel )
|
||||||
aSel->selectedObjects( selected );
|
aSel->selectedObjects( selected );
|
||||||
|
|
||||||
if ( selected.Extent() == 1 ) {
|
if ( selected.Extent() == 1 ) {
|
||||||
Handle(SALOME_InteractiveObject) anIO = selected.First();
|
Handle(SALOME_InteractiveObject) anIO = selected.First();
|
||||||
if ( anIO->hasEntry() ) {
|
if ( anIO->hasEntry() ) {
|
||||||
SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() );
|
SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() );
|
||||||
if ( anActor && anActor->GetScalarBarActor() && anActor->GetControlMode() != SMESH_Actor::eNone ) {
|
if ( anActor &&
|
||||||
|
anActor->GetScalarBarActor() &&
|
||||||
|
anActor->GetControlMode() != SMESH_Actor::eNone )
|
||||||
|
{
|
||||||
SMESH_ScalarBarActor *aScalarBarActor = anActor->GetScalarBarActor();
|
SMESH_ScalarBarActor *aScalarBarActor = anActor->GetScalarBarActor();
|
||||||
if ( theCommandID == SMESHOp::OpShowDistribution ) {
|
if ( theCommandID == SMESHOp::OpShowDistribution ) {
|
||||||
aScalarBarActor->SetDistributionVisibility(!aScalarBarActor->GetDistributionVisibility());
|
aScalarBarActor->SetDistributionVisibility(!aScalarBarActor->GetDistributionVisibility());
|
||||||
@ -1212,58 +1218,62 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_PLOT2DVIEWER
|
#ifndef DISABLE_PLOT2DVIEWER
|
||||||
void PlotDistribution() {
|
void PlotDistribution()
|
||||||
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
{
|
||||||
if( !app )
|
SalomeApp_Application* app =
|
||||||
return;
|
dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||||
|
if( !app )
|
||||||
|
return;
|
||||||
|
|
||||||
LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
|
LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
|
||||||
SALOME_ListIO selected;
|
|
||||||
if ( aSel )
|
|
||||||
aSel->selectedObjects( selected );
|
|
||||||
|
|
||||||
if ( selected.Extent() == 1 ) {
|
|
||||||
Handle(SALOME_InteractiveObject) anIO = selected.First();
|
|
||||||
if ( anIO->hasEntry() ) {
|
|
||||||
//Find Actor by entry before getting Plot2d viewer,
|
|
||||||
//because after call getViewManager( Plot2d_Viewer::Type(), true ) active window is Plot2d Viewer
|
|
||||||
SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() );
|
|
||||||
|
|
||||||
SUIT_ViewManager* aViewManager = app->getViewManager( Plot2d_Viewer::Type(), true ); // create if necessary
|
|
||||||
|
|
||||||
if( !aViewManager )
|
|
||||||
return;
|
|
||||||
|
|
||||||
SPlot2d_Viewer* aView = dynamic_cast<SPlot2d_Viewer*>(aViewManager->getViewModel());
|
|
||||||
if ( !aView )
|
|
||||||
return;
|
|
||||||
|
|
||||||
Plot2d_ViewFrame* aPlot = aView->getActiveViewFrame();
|
|
||||||
if ( !aPlot )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ( anActor && anActor->GetControlMode() != SMESH_Actor::eNone ) {
|
|
||||||
SPlot2d_Histogram* aHistogram = anActor->UpdatePlot2Histogram();
|
|
||||||
QString functorName = functorToString( anActor->GetFunctor());
|
|
||||||
QString aHistogramName("%1 : %2");
|
|
||||||
aHistogramName = aHistogramName.arg(anIO->getName()).arg(functorName);
|
|
||||||
aHistogram->setName(aHistogramName);
|
|
||||||
aHistogram->setHorTitle(functorName);
|
|
||||||
aHistogram->setVerTitle(QObject::tr("DISTRIBUTION_NB_ENT"));
|
|
||||||
aPlot->displayObject(aHistogram, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif //DISABLE_PLOT2DVIEWER
|
|
||||||
|
|
||||||
void DisableAutoColor(){
|
|
||||||
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
|
||||||
SALOME_ListIO selected;
|
SALOME_ListIO selected;
|
||||||
if( aSel )
|
if ( aSel )
|
||||||
aSel->selectedObjects( selected );
|
aSel->selectedObjects( selected );
|
||||||
|
|
||||||
if(selected.Extent()){
|
if ( selected.Extent() == 1 ) {
|
||||||
|
Handle(SALOME_InteractiveObject) anIO = selected.First();
|
||||||
|
if ( anIO->hasEntry() ) {
|
||||||
|
//Find Actor by entry before getting Plot2d viewer,
|
||||||
|
//because after call getViewManager( Plot2d_Viewer::Type(), true ) active window is Plot2d Viewer
|
||||||
|
SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() );
|
||||||
|
|
||||||
|
SUIT_ViewManager* aViewManager =
|
||||||
|
app->getViewManager( Plot2d_Viewer::Type(), true ); // create if necessary
|
||||||
|
if( !aViewManager )
|
||||||
|
return;
|
||||||
|
|
||||||
|
SPlot2d_Viewer* aView = dynamic_cast<SPlot2d_Viewer*>(aViewManager->getViewModel());
|
||||||
|
if ( !aView )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Plot2d_ViewFrame* aPlot = aView->getActiveViewFrame();
|
||||||
|
if ( !aPlot )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( anActor && anActor->GetControlMode() != SMESH_Actor::eNone )
|
||||||
|
{
|
||||||
|
SPlot2d_Histogram* aHistogram = anActor->UpdatePlot2Histogram();
|
||||||
|
QString functorName = functorToString( anActor->GetFunctor());
|
||||||
|
QString aHistogramName("%1 : %2");
|
||||||
|
aHistogramName = aHistogramName.arg(anIO->getName()).arg(functorName);
|
||||||
|
aHistogram->setName(aHistogramName);
|
||||||
|
aHistogram->setHorTitle(functorName);
|
||||||
|
aHistogram->setVerTitle(QObject::tr("DISTRIBUTION_NB_ENT"));
|
||||||
|
aPlot->displayObject(aHistogram, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //DISABLE_PLOT2DVIEWER
|
||||||
|
|
||||||
|
void DisableAutoColor()
|
||||||
|
{
|
||||||
|
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||||
|
SALOME_ListIO selected;
|
||||||
|
if ( aSel )
|
||||||
|
aSel->selectedObjects( selected );
|
||||||
|
|
||||||
|
if ( selected.Extent() ) {
|
||||||
Handle(SALOME_InteractiveObject) anIObject = selected.First();
|
Handle(SALOME_InteractiveObject) anIObject = selected.First();
|
||||||
SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
|
SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
|
||||||
if ( !aMesh->_is_nil() ) {
|
if ( !aMesh->_is_nil() ) {
|
||||||
@ -1272,13 +1282,14 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sortChildren(){
|
void sortChildren()
|
||||||
|
{
|
||||||
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||||
SALOME_ListIO selected;
|
SALOME_ListIO selected;
|
||||||
if( aSel ) {
|
if ( aSel ) {
|
||||||
aSel->selectedObjects( selected );
|
aSel->selectedObjects( selected );
|
||||||
|
if ( selected.Extent() )
|
||||||
if(selected.Extent()){
|
{
|
||||||
Handle(SALOME_InteractiveObject) anIObject = selected.First();
|
Handle(SALOME_InteractiveObject) anIObject = selected.First();
|
||||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
_PTR(SObject) aSObj = aStudy->FindObjectID(anIObject->getEntry());
|
_PTR(SObject) aSObj = aStudy->FindObjectID(anIObject->getEntry());
|
||||||
@ -1294,17 +1305,18 @@ namespace
|
|||||||
void SetDisplayMode(int theCommandID, SMESHGUI_StudyId2MarkerMap& theMarkerMap)
|
void SetDisplayMode(int theCommandID, SMESHGUI_StudyId2MarkerMap& theMarkerMap)
|
||||||
{
|
{
|
||||||
SALOME_ListIO selected;
|
SALOME_ListIO selected;
|
||||||
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
SalomeApp_Application* app =
|
||||||
if( !app )
|
dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||||
|
if ( !app )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||||
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
|
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
|
||||||
if( !aSel || !appStudy )
|
if ( !aSel || !appStudy )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( theCommandID == SMESHOp::OpClipping ) { // Clipping dialog can be activated without selection
|
if ( theCommandID == SMESHOp::OpClipping ) { // Clipping dialog can be activated without selection
|
||||||
if( SMESHGUI* aModule = SMESHGUI::GetSMESHGUI() ) {
|
if ( SMESHGUI* aModule = SMESHGUI::GetSMESHGUI() ) {
|
||||||
aModule->EmitSignalDeactivateDialog();
|
aModule->EmitSignalDeactivateDialog();
|
||||||
if( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( aModule ) )
|
if( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( aModule ) )
|
||||||
(new SMESHGUI_ClippingDlg( aModule, aViewWindow ))->show();
|
(new SMESHGUI_ClippingDlg( aModule, aViewWindow ))->show();
|
||||||
@ -1316,14 +1328,17 @@ namespace
|
|||||||
|
|
||||||
aSel->selectedObjects( selected );
|
aSel->selectedObjects( selected );
|
||||||
|
|
||||||
if(selected.Extent() >= 1){
|
if ( selected.Extent() >= 1 )
|
||||||
switch(theCommandID){
|
{
|
||||||
case SMESHOp::OpTransparency:{
|
switch ( theCommandID ) {
|
||||||
|
case SMESHOp::OpTransparency:
|
||||||
|
{
|
||||||
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
|
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
|
||||||
(new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI() ))->show();
|
(new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI() ))->show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case SMESHOp::OpProperties: {
|
case SMESHOp::OpProperties:
|
||||||
|
{
|
||||||
double color[3];
|
double color[3];
|
||||||
QColor faceColor, edgeColor, nodeColor, elem0dColor, ballColor;
|
QColor faceColor, edgeColor, nodeColor, elem0dColor, ballColor;
|
||||||
QColor orientationColor, outlineColor, volumeColor;
|
QColor orientationColor, outlineColor, volumeColor;
|
||||||
@ -1623,10 +1638,10 @@ namespace
|
|||||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||||
SALOME_ListIO selected;
|
SALOME_ListIO selected;
|
||||||
if( aSel )
|
if ( aSel )
|
||||||
aSel->selectedObjects( selected );
|
aSel->selectedObjects( selected );
|
||||||
|
|
||||||
if( !selected.IsEmpty() ){
|
if ( !selected.IsEmpty() ) {
|
||||||
SALOME_ListIteratorOfListIO It(selected);
|
SALOME_ListIteratorOfListIO It(selected);
|
||||||
for ( ; It.More(); It.Next())
|
for ( ; It.More(); It.Next())
|
||||||
{
|
{
|
||||||
@ -1634,24 +1649,24 @@ namespace
|
|||||||
if(!anIO.IsNull()){
|
if(!anIO.IsNull()){
|
||||||
_PTR(SObject) SO = aStudy->FindObjectID( It.Value()->getEntry() );
|
_PTR(SObject) SO = aStudy->FindObjectID( It.Value()->getEntry() );
|
||||||
if ( SO ) {
|
if ( SO ) {
|
||||||
CORBA::Object_var aObject = SMESH::SObjectToObject( SO );
|
CORBA::Object_var aObject = SMESH::SObjectToObject( SO );
|
||||||
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( aObject );
|
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( aObject );
|
||||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( aObject );
|
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( aObject );
|
||||||
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( aObject );
|
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( aObject );
|
||||||
if ( !aMesh->_is_nil() || !aSubMesh->_is_nil() || !aGroup->_is_nil() ) {
|
if ( !aMesh->_is_nil() || !aSubMesh->_is_nil() || !aGroup->_is_nil() ) {
|
||||||
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIO->getEntry())) {
|
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();
|
||||||
#ifndef DISABLE_PLOT2DVIEWER
|
#ifndef DISABLE_PLOT2DVIEWER
|
||||||
if(anActor->GetPlot2Histogram()) {
|
if ( anActor->GetPlot2Histogram() ) {
|
||||||
SPlot2d_Histogram* aHistogram = anActor->UpdatePlot2Histogram();
|
SPlot2d_Histogram* aHistogram = anActor->UpdatePlot2Histogram();
|
||||||
QString functorName = functorToString( anActor->GetFunctor());
|
QString functorName = functorToString( anActor->GetFunctor() );
|
||||||
QString aHistogramName("%1 : %2");
|
QString aHistogramName("%1 : %2");
|
||||||
aHistogramName = aHistogramName.arg(anIO->getName()).arg(functorName);
|
aHistogramName = aHistogramName.arg( anIO->getName() ).arg( functorName );
|
||||||
aHistogram->setName(aHistogramName);
|
aHistogram->setName( aHistogramName );
|
||||||
aHistogram->setHorTitle(functorName);
|
aHistogram->setHorTitle( functorName );
|
||||||
SMESH::ProcessIn2DViewers(anActor);
|
SMESH::ProcessIn2DViewers( anActor );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1664,13 +1679,13 @@ namespace
|
|||||||
|
|
||||||
|
|
||||||
bool CheckOIType(const Handle(SALOME_InteractiveObject) & theIO,
|
bool CheckOIType(const Handle(SALOME_InteractiveObject) & theIO,
|
||||||
SMESH::MeshObjectType theType,
|
SMESH::MeshObjectType theType,
|
||||||
const QString theInTypeName,
|
const QString theInTypeName,
|
||||||
QString & theOutTypeName)
|
QString & theOutTypeName)
|
||||||
{
|
{
|
||||||
SMESH_TypeFilter aTypeFilter( theType );
|
SMESH_TypeFilter aTypeFilter( theType );
|
||||||
QString entry;
|
QString entry;
|
||||||
if( !theIO.IsNull() )
|
if ( !theIO.IsNull() )
|
||||||
{
|
{
|
||||||
entry = theIO->getEntry();
|
entry = theIO->getEntry();
|
||||||
LightApp_DataOwner owner( entry );
|
LightApp_DataOwner owner( entry );
|
||||||
@ -1685,12 +1700,12 @@ namespace
|
|||||||
|
|
||||||
QString CheckTypeObject(const Handle(SALOME_InteractiveObject) & theIO)
|
QString CheckTypeObject(const Handle(SALOME_InteractiveObject) & theIO)
|
||||||
{
|
{
|
||||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
_PTR(SObject) aSObj = aStudy->FindObjectID(theIO->getEntry());
|
_PTR(SObject) aSObj = aStudy->FindObjectID(theIO->getEntry());
|
||||||
if (aSObj) {
|
if (aSObj) {
|
||||||
_PTR(SComponent) aSComp = aSObj->GetFatherComponent();
|
_PTR(SComponent) aSComp = aSObj->GetFatherComponent();
|
||||||
CORBA::String_var anID = aSComp->GetID().c_str();
|
CORBA::String_var anID = aSComp->GetID().c_str();
|
||||||
if (!strcmp(anID.in(),theIO->getEntry()))
|
if ( !strcmp(anID.in(),theIO->getEntry()) )
|
||||||
return "Component";
|
return "Component";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1710,10 +1725,9 @@ namespace
|
|||||||
|
|
||||||
QString CheckHomogeneousSelection()
|
QString CheckHomogeneousSelection()
|
||||||
{
|
{
|
||||||
//SUIT_Study* aStudy = SMESH::GetActiveStudy();
|
|
||||||
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||||
SALOME_ListIO selected;
|
SALOME_ListIO selected;
|
||||||
if( aSel )
|
if ( aSel )
|
||||||
aSel->selectedObjects( selected );
|
aSel->selectedObjects( selected );
|
||||||
|
|
||||||
QString RefType = CheckTypeObject(selected.First());
|
QString RefType = CheckTypeObject(selected.First());
|
||||||
@ -1722,7 +1736,7 @@ namespace
|
|||||||
{
|
{
|
||||||
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
||||||
QString Type = CheckTypeObject(IObject);
|
QString Type = CheckTypeObject(IObject);
|
||||||
if (Type.compare(RefType) != 0)
|
if ( Type.compare(RefType) != 0 )
|
||||||
return "Heterogeneous Selection";
|
return "Heterogeneous Selection";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5112,7 +5126,8 @@ void SMESHGUI::createPreferences()
|
|||||||
QStringList aMarkerScaleValuesList;
|
QStringList aMarkerScaleValuesList;
|
||||||
for ( int i = VTK::MS_10; i <= VTK::MS_70; i++ ) {
|
for ( int i = VTK::MS_10; i <= VTK::MS_70; i++ ) {
|
||||||
aMarkerScaleIndicesList << i;
|
aMarkerScaleIndicesList << i;
|
||||||
aMarkerScaleValuesList << QString::number( (i-(int)VTK::MS_10)*0.5 + 1.0 );
|
//aMarkerScaleValuesList << QString::number( (i-(int)VTK::MS_10)*0.5 + 1.0 );
|
||||||
|
aMarkerScaleValuesList << QString::number( i );
|
||||||
}
|
}
|
||||||
setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
|
setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
|
||||||
setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
|
setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user