IPAL53091: 'Scale of Marker' lists are different in Preferences and Properties dialogs

fix SMESHGUI::createPreferences()

+ cosmetic changes
This commit is contained in:
eap 2016-03-21 14:58:20 +03:00
parent 7eda9ca931
commit cc935c7f60

View File

@ -178,11 +178,6 @@
#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
// of auto-color picking up
#define SIMPLE_AUTOCOLOR
@ -424,17 +419,24 @@ namespace
if( aSel )
aSel->selectedObjects( selected );
const bool isDAT = ( theCommandID == SMESHOp::OpExportDAT || theCommandID == SMESHOp::OpPopupExportDAT );
const bool isMED = ( theCommandID == SMESHOp::OpExportMED || theCommandID == SMESHOp::OpPopupExportMED );
const bool isUNV = ( theCommandID == SMESHOp::OpExportUNV || theCommandID == SMESHOp::OpPopupExportUNV );
const bool isSTL = ( theCommandID == SMESHOp::OpExportSTL || theCommandID == SMESHOp::OpPopupExportSTL );
const bool isDAT = ( theCommandID == SMESHOp::OpExportDAT ||
theCommandID == SMESHOp::OpPopupExportDAT );
const bool isMED = ( theCommandID == SMESHOp::OpExportMED ||
theCommandID == SMESHOp::OpPopupExportMED );
const bool isUNV = ( theCommandID == SMESHOp::OpExportUNV ||
theCommandID == SMESHOp::OpPopupExportUNV );
const bool isSTL = ( theCommandID == SMESHOp::OpExportSTL ||
theCommandID == SMESHOp::OpPopupExportSTL );
#ifdef WITH_CGNS
const bool isCGNS= ( theCommandID == SMESHOp::OpExportCGNS || theCommandID == SMESHOp::OpPopupExportCGNS );
const bool isCGNS= ( theCommandID == SMESHOp::OpExportCGNS ||
theCommandID == SMESHOp::OpPopupExportCGNS );
#else
const bool isCGNS= false;
#endif
const bool isSAUV= ( theCommandID == SMESHOp::OpExportSAUV || theCommandID == SMESHOp::OpPopupExportSAUV );
const bool isGMF = ( theCommandID == SMESHOp::OpExportGMF || theCommandID == SMESHOp::OpPopupExportGMF );
const bool isSAUV= ( theCommandID == SMESHOp::OpExportSAUV ||
theCommandID == SMESHOp::OpPopupExportSAUV );
const bool isGMF = ( theCommandID == SMESHOp::OpExportGMF ||
theCommandID == SMESHOp::OpPopupExportGMF );
const bool multiMeshSupported = ( isMED || isCGNS ); // file can hold several meshes
if ( selected.Extent() == 0 || ( selected.Extent() > 1 && !multiMeshSupported ))
@ -448,7 +450,8 @@ namespace
for( ; It.More(); It.Next() )
{
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() ) {
SUIT_MessageBox::warning( SMESHGUI::desktop(),
QObject::tr( "SMESH_WRN_WARNING" ),
@ -572,7 +575,7 @@ namespace
if ( !presentNotSupported.empty() )
{
QString typeNames;
const char* typeMsg[SMESH::Entity_Last] = {
const char* typeMsg[] = {
"SMESH_NODES", "SMESH_ELEMS0D","SMESH_EDGES","SMESH_QUADRATIC_EDGES",
"SMESH_TRIANGLES", "SMESH_QUADRATIC_TRIANGLES", "SMESH_BIQUADRATIC_TRIANGLES",
"SMESH_QUADRANGLES","SMESH_QUADRATIC_QUADRANGLES", "SMESH_BIQUADRATIC_QUADRANGLES",
@ -582,6 +585,10 @@ namespace
"SMESH_TRIQUADRATIC_HEXAHEDRONS","SMESH_PENTAHEDRA","SMESH_QUADRATIC_PENTAHEDRONS",
"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(", ");
for ( size_t iType = 0; iType < presentNotSupported.size(); ++iType ) {
typeNames += QObject::tr( typeMsg[ presentNotSupported[ iType ]]);
@ -928,7 +935,8 @@ namespace
theOutputMode &= ~theMode;
}
void SetDisplayEntity(int theCommandID){
void SetDisplayEntity(int theCommandID)
{
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if ( aSel )
@ -942,24 +950,12 @@ namespace
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
unsigned int aMode = anActor->GetEntityMode();
switch(theCommandID){
case SMESHOp::OpDE0DElements:
InverseEntityMode(aMode,SMESH_Actor::e0DElements);
break;
case SMESHOp::OpDEEdges:
InverseEntityMode(aMode,SMESH_Actor::eEdges);
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;
case SMESHOp::OpDE0DElements: InverseEntityMode(aMode,SMESH_Actor::e0DElements); break;
case SMESHOp::OpDEEdges: InverseEntityMode(aMode,SMESH_Actor::eEdges); 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)
anActor->SetEntityMode(aMode);
@ -971,8 +967,8 @@ namespace
void AutoColor()
{
SALOME_ListIO selected;
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
SalomeApp_Application* app =
dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if ( !app )
return;
@ -981,6 +977,7 @@ namespace
if ( !aSel || !appStudy )
return;
SALOME_ListIO selected;
aSel->selectedObjects( selected );
if ( selected.IsEmpty() )
return;
@ -988,7 +985,7 @@ namespace
Handle(SALOME_InteractiveObject) anIObject = selected.First();
_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);
if ( aMainObject->_is_nil() )
return;
@ -1003,7 +1000,6 @@ namespace
for ( int i = 0, n = aListOfGroups.length(); i < n; i++ )
{
SMESH::SMESH_GroupBase_var aGroupObject = aListOfGroups[i];
//SALOMEDS::Color aColor = aGroupObject->GetColor();
#ifdef SIMPLE_AUTOCOLOR // simplified algorithm for auto-colors
SALOMEDS::Color aColor = SMESHGUI::getPredefinedUniqueColor();
@ -1042,7 +1038,8 @@ namespace
SMESH::RepaintCurrentView();
}
void OverallMeshQuality() {
void OverallMeshQuality()
{
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
@ -1127,11 +1124,15 @@ namespace
Handle(SALOME_InteractiveObject) anIO = selected.First();
if ( anIO->hasEntry() ) {
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::Controls::FunctorPtr aFunctor = anActor->GetFunctor();
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 ) {
std::vector<int> elements;
SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);
@ -1153,7 +1154,8 @@ namespace
bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
std::vector<int> nbEvents;
std::vector<double> funValues;
aNumFun->GetHistogram( nbIntervals, nbEvents, funValues, elements, minmax, isLogarithmic );
aNumFun->GetHistogram( nbIntervals, nbEvents, funValues,
elements, minmax, isLogarithmic );
QString anInitialPath = "";
if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
anInitialPath = QDir::currentPath();
@ -1188,7 +1190,8 @@ namespace
}
}
void ShowElement(int theCommandID ) {
void ShowElement( int theCommandID )
{
LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if ( aSel )
@ -1198,7 +1201,10 @@ namespace
Handle(SALOME_InteractiveObject) anIO = selected.First();
if ( anIO->hasEntry() ) {
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();
if ( theCommandID == SMESHOp::OpShowDistribution ) {
aScalarBarActor->SetDistributionVisibility(!aScalarBarActor->GetDistributionVisibility());
@ -1212,8 +1218,10 @@ namespace
}
#ifndef DISABLE_PLOT2DVIEWER
void PlotDistribution() {
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
void PlotDistribution()
{
SalomeApp_Application* app =
dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if( !app )
return;
@ -1229,8 +1237,8 @@ namespace
//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
SUIT_ViewManager* aViewManager =
app->getViewManager( Plot2d_Viewer::Type(), true ); // create if necessary
if( !aViewManager )
return;
@ -1242,7 +1250,8 @@ namespace
if ( !aPlot )
return;
if ( anActor && anActor->GetControlMode() != SMESH_Actor::eNone ) {
if ( anActor && anActor->GetControlMode() != SMESH_Actor::eNone )
{
SPlot2d_Histogram* aHistogram = anActor->UpdatePlot2Histogram();
QString functorName = functorToString( anActor->GetFunctor());
QString aHistogramName("%1 : %2");
@ -1257,7 +1266,8 @@ namespace
}
#endif //DISABLE_PLOT2DVIEWER
void DisableAutoColor(){
void DisableAutoColor()
{
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if ( aSel )
@ -1272,13 +1282,14 @@ namespace
}
}
void sortChildren(){
void sortChildren()
{
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if ( aSel ) {
aSel->selectedObjects( selected );
if(selected.Extent()){
if ( selected.Extent() )
{
Handle(SALOME_InteractiveObject) anIObject = selected.First();
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
_PTR(SObject) aSObj = aStudy->FindObjectID(anIObject->getEntry());
@ -1294,7 +1305,8 @@ namespace
void SetDisplayMode(int theCommandID, SMESHGUI_StudyId2MarkerMap& theMarkerMap)
{
SALOME_ListIO selected;
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
SalomeApp_Application* app =
dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if ( !app )
return;
@ -1316,14 +1328,17 @@ namespace
aSel->selectedObjects( selected );
if(selected.Extent() >= 1){
if ( selected.Extent() >= 1 )
{
switch ( theCommandID ) {
case SMESHOp::OpTransparency:{
case SMESHOp::OpTransparency:
{
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
(new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI() ))->show();
return;
}
case SMESHOp::OpProperties: {
case SMESHOp::OpProperties:
{
double color[3];
QColor faceColor, edgeColor, nodeColor, elem0dColor, ballColor;
QColor orientationColor, outlineColor, volumeColor;
@ -1710,7 +1725,6 @@ namespace
QString CheckHomogeneousSelection()
{
//SUIT_Study* aStudy = SMESH::GetActiveStudy();
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if ( aSel )
@ -5112,7 +5126,8 @@ void SMESHGUI::createPreferences()
QStringList aMarkerScaleValuesList;
for ( int i = VTK::MS_10; i <= VTK::MS_70; 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, "indexes", aMarkerScaleIndicesList );