IPAL52933: Selection disappears in the "Move node" dialog

Fix SMESHGUI_MakeNodeAtPointDlg.cxx

Eliminate compilation warnings from SMESHGUI.cxx
This commit is contained in:
eap 2015-10-28 19:04:54 +03:00
parent 8301b1e71a
commit 219f1c3410
2 changed files with 66 additions and 43 deletions

View File

@ -1176,7 +1176,7 @@ namespace
out << "# Control: " << functorToString( aFunctor ) << endl; out << "# Control: " << functorToString( aFunctor ) << endl;
out << "#" << endl; out << "#" << endl;
out.setFieldWidth( 10 ); out.setFieldWidth( 10 );
for ( int i = 0; i < qMin( nbEvents.size(), funValues.size()-1 ); i++ ) for ( int i = 0; i < (int)qMin( nbEvents.size(), funValues.size()-1 ); i++ )
out << funValues[i] << "\t" << funValues[i+1] << "\t" << nbEvents[i] << endl; out << funValues[i] << "\t" << funValues[i+1] << "\t" << nbEvents[i] << endl;
f.close(); f.close();
} }
@ -4901,7 +4901,7 @@ void SMESHGUI::ProcessEvents( vtkObject* theObject,
void* theCallData ) void* theCallData )
{ {
if( SMESHGUI* aSMESHGUI = reinterpret_cast<SMESHGUI*>( theClientData ) ) { if( SMESHGUI* aSMESHGUI = reinterpret_cast<SMESHGUI*>( theClientData ) ) {
if( theObject && theEvent == SMESH::DeleteActorEvent ) { if( theObject && (int) theEvent == SMESH::DeleteActorEvent ) {
if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( theObject ) ) { if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( theObject ) ) {
SMESHGUI_ClippingPlaneInfoMap& aClippingPlaneInfoMap = aSMESHGUI->getClippingPlaneInfoMap(); SMESHGUI_ClippingPlaneInfoMap& aClippingPlaneInfoMap = aSMESHGUI->getClippingPlaneInfoMap();
SMESHGUI_ClippingPlaneInfoMap::iterator anIter1 = aClippingPlaneInfoMap.begin(); SMESHGUI_ClippingPlaneInfoMap::iterator anIter1 = aClippingPlaneInfoMap.begin();
@ -5305,79 +5305,92 @@ void SMESHGUI::createPreferences()
void SMESHGUI::preferencesChanged( const QString& sect, const QString& name ) void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
{ {
if( sect=="SMESH" ) { if ( sect=="SMESH" ) {
float sbX1,sbY1,sbW,sbH; float sbX1 = 0.01, sbY1 = 0.01, sbW = 0.08, sbH = 0.08;
float aTol = 1.00000009999999; float aTol = 1.00000009999999;
std::string aWarning; std::string aWarning;
SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this); SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);
if( name=="selection_object_color" || name=="selection_element_color" ||
name=="highlight_color" || if ( name== "selection_object_color" ||
name=="selection_precision_node" || name=="selection_precision_element" || name=="selection_element_color" ||
name=="selection_precision_object") name== "highlight_color" ||
name=="selection_precision_node" ||
name=="selection_precision_element" ||
name=="selection_precision_object" )
{
SMESH::UpdateSelectionProp( this ); SMESH::UpdateSelectionProp( this );
else if (name == QString("scalar_bar_vertical_x") || name == QString("scalar_bar_vertical_width")){ }
else if (name == "scalar_bar_vertical_x" || name == "scalar_bar_vertical_width")
{
sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_x", sbX1); sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_x", sbX1);
sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_width", sbW); sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_width", sbW);
if(sbX1+sbW > aTol){ if ( sbX1+sbW > aTol ) {
aWarning = "Origin and Size Vertical: X+Width > 1\n"; aWarning = "Origin and Size Vertical: X+Width > 1\n";
sbX1=0.01; sbX1 = 0.01;
sbW=0.08; sbW = 0.08;
aResourceMgr->setValue("SMESH", "scalar_bar_vertical_x", sbX1); aResourceMgr->setValue("SMESH", "scalar_bar_vertical_x", sbX1);
aResourceMgr->setValue("SMESH", "scalar_bar_vertical_width", sbW); aResourceMgr->setValue("SMESH", "scalar_bar_vertical_width", sbW);
} }
} }
else if(name == QString("scalar_bar_vertical_y") || name == QString("scalar_bar_vertical_height")){ else if (name == "scalar_bar_vertical_y" || name == "scalar_bar_vertical_height" )
{
sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_y", sbY1); sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_y", sbY1);
sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_height",sbH); sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_height",sbH);
if(sbY1+sbH > aTol){ if ( sbY1 + sbH > aTol ) {
aWarning = "Origin and Size Vertical: Y+Height > 1\n"; aWarning = "Origin and Size Vertical: Y+Height > 1\n";
aResourceMgr->setValue("SMESH", "scalar_bar_vertical_y", sbY1); aResourceMgr->setValue("SMESH", "scalar_bar_vertical_y", sbY1);
aResourceMgr->setValue("SMESH", "scalar_bar_vertical_height",sbH); aResourceMgr->setValue("SMESH", "scalar_bar_vertical_height",sbH);
} }
} }
else if(name == QString("scalar_bar_horizontal_x") || name == QString("scalar_bar_horizontal_width")){ else if (name == "scalar_bar_horizontal_x" || name == "scalar_bar_horizontal_width")
{
sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_x", sbX1); sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_x", sbX1);
sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_width", sbW); sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_width", sbW);
if(sbX1+sbW > aTol){ if ( sbX1 + sbW > aTol ) {
aWarning = "Origin and Size Horizontal: X+Width > 1\n"; aWarning = "Origin and Size Horizontal: X+Width > 1\n";
sbX1=0.1; sbX1=0.1;
sbW=0.08; sbW =0.08;
aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_x", sbX1); aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_x", sbX1);
aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_width", sbW); aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_width", sbW);
} }
} }
else if(name == QString("scalar_bar_horizontal_y") || name == QString("scalar_bar_horizontal_height")){ else if (name == "scalar_bar_horizontal_y" || name == "scalar_bar_horizontal_height")
{
sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_y", sbY1); sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_y", sbY1);
sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_height",sbH); sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_height",sbH);
if(sbY1+sbH > aTol){ if ( sbY1 + sbH > aTol ) {
aWarning = "Origin and Size Horizontal: Y+Height > 1\n"; aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
sbY1=0.01; sbY1=0.01;
sbH=0.08; sbH =0.08;
aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_y", sbY1); aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_y", sbY1);
aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_height",sbH); aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_height",sbH);
} }
} }
else if ( name == "segmentation" ) { else if ( name == "segmentation" )
{
int nbSeg = aResourceMgr->integerValue( "SMESH", "segmentation", 10 ); int nbSeg = aResourceMgr->integerValue( "SMESH", "segmentation", 10 );
myComponentSMESH->SetBoundaryBoxSegmentation( nbSeg ); myComponentSMESH->SetBoundaryBoxSegmentation( nbSeg );
} }
else if ( name == "nb_segments_per_edge" ) { else if ( name == "nb_segments_per_edge" )
{
int nbSeg = aResourceMgr->integerValue( "SMESH", "nb_segments_per_edge", 15 ); int nbSeg = aResourceMgr->integerValue( "SMESH", "nb_segments_per_edge", 15 );
myComponentSMESH->SetDefaultNbSegments( nbSeg ); myComponentSMESH->SetDefaultNbSegments( nbSeg );
} }
else if ( name == "historical_python_dump" || else if ( name == "historical_python_dump" || name == "forget_mesh_on_hyp_modif")
name == "forget_mesh_on_hyp_modif") { {
QString val = aResourceMgr->stringValue( "SMESH", name ); QString val = aResourceMgr->stringValue( "SMESH", name );
myComponentSMESH->SetOption( name.toLatin1().constData(), val.toLatin1().constData() ); myComponentSMESH->SetOption( name.toLatin1().constData(), val.toLatin1().constData() );
} }
else if ( name == QString( "numbering_node_color" ) || name == QString( "numbering_node_font" ) ) { else if ( name == "numbering_node_color" || name == "numbering_node_font" )
{
SMESH::UpdateFontProp( this ); SMESH::UpdateFontProp( this );
} }
else if ( name == QString( "numbering_elem_color" ) || name == QString( "numbering_elem_font" ) ) { else if ( name == "numbering_elem_color" || name == "numbering_elem_font" )
{
SMESH::UpdateFontProp( this ); SMESH::UpdateFontProp( this );
} }
if(aWarning.size() != 0){ if ( aWarning.size() != 0 ) {
aWarning += "The default values are applied instead."; aWarning += "The default values are applied instead.";
SUIT_MessageBox::warning(SMESHGUI::desktop(), SUIT_MessageBox::warning(SMESHGUI::desktop(),
QObject::tr("SMESH_ERR_SCALARBAR_PARAMS"), QObject::tr("SMESH_ERR_SCALARBAR_PARAMS"),

View File

@ -84,6 +84,11 @@
#define SPACING 6 #define SPACING 6
#define MARGIN 11 #define MARGIN 11
namespace
{
enum { MANUAL_MODE = 0, SEARCH_MODE }; // how a node to move is specified
}
/*! /*!
* \brief Dialog to publish a sub-shape of the mesh main shape * \brief Dialog to publish a sub-shape of the mesh main shape
* by selecting mesh elements * by selecting mesh elements
@ -437,7 +442,7 @@ void SMESHGUI_MakeNodeAtPointOp::startOperation()
myDlg->myDestDZ->setReadOnly(true); myDlg->myDestDZ->setReadOnly(true);
myDlg->myRButNodeToMove->setChecked(true); myDlg->myRButNodeToMove->setChecked(true);
myDlg->ConstructorsClicked(GetConstructorId()); myDlg->ConstructorsClicked( GetConstructorId() );
myDlg->show(); myDlg->show();
@ -469,10 +474,11 @@ void SMESHGUI_MakeNodeAtPointOp::stopOperation()
mySimulation = 0; mySimulation = 0;
} }
if ( myMeshActor ) { if ( myMeshActor ) {
myMeshActor->SetPointRepresentation(false);
SMESH::RepaintCurrentView();
myMeshActor = 0; myMeshActor = 0;
} }
SMESH::SetPointRepresentation( false );
SMESH::RepaintCurrentView();
disconnect(mySMESHGUI, SIGNAL (SignalActivatedViewManager()), this, SLOT(onOpenView())); disconnect(mySMESHGUI, SIGNAL (SignalActivatedViewManager()), this, SLOT(onOpenView()));
disconnect(mySMESHGUI, SIGNAL (SignalCloseView()), this, SLOT(onCloseView())); disconnect(mySMESHGUI, SIGNAL (SignalCloseView()), this, SLOT(onCloseView()));
selectionMgr()->removeFilter( myFilter ); selectionMgr()->removeFilter( myFilter );
@ -685,6 +691,9 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
return; return;
myNoPreview = true; myNoPreview = true;
if ( !myMeshActor && GetConstructorId() == SEARCH_MODE )
onSelectionDone();
SMESH::MeshPreviewStruct_var aMeshPreviewStruct; SMESH::MeshPreviewStruct_var aMeshPreviewStruct;
bool moveShown = false; bool moveShown = false;
@ -776,7 +785,8 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
} }
} }
} }
}catch (...) { }
catch (...) {
} }
} }
} }