X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FStdMeshersGUI%2FStdMeshersGUI_StdHypothesisCreator.cxx;h=a7841c1e5c7203e01d5378874a795cec72d69640;hp=1c60072962d6e207c182f31bb286f7327a67f640;hb=20d9e162bd67182cbfa841bbfc9319919f4703e3;hpb=bd8f1aee7c78f7d2eb82bd4fec5e08c9e3d280ce diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx index 1c6007296..a7841c1e5 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 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 @@ -6,7 +6,7 @@ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -30,14 +30,15 @@ #include #include #include - #include #include #include "StdMeshersGUI_FixedPointsParamWdg.h" #include "StdMeshersGUI_LayerDistributionParamWdg.h" #include "StdMeshersGUI_ObjectReferenceParamWdg.h" +#include "StdMeshersGUI_PropagationHelperWdg.h" #include "StdMeshersGUI_QuadrangleParamWdg.h" +#include "StdMeshersGUI_RadioButtonsGrpWdg.h" #include "StdMeshersGUI_SubShapeSelectorWdg.h" #include @@ -45,7 +46,9 @@ #include // SALOME GUI includes +#include #include +#include // IDL includes #include @@ -58,6 +61,7 @@ #include #include #include +#include const double VALUE_MAX = 1.0e+15, // COORD_MAX VALUE_MAX_2 = VALUE_MAX * VALUE_MAX, @@ -74,7 +78,7 @@ const double VALUE_MAX = 1.0e+15, // COORD_MAX //================================================================================ StdMeshersGUI_StdHypothesisCreator::StdMeshersGUI_StdHypothesisCreator( const QString& type ) -: SMESHGUI_GenericHypothesisCreator( type ) + : SMESHGUI_GenericHypothesisCreator( type ), myHelperWidget( 0 ) { } @@ -405,7 +409,7 @@ bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const srcV = w1->GetValue(); tgtV = w2->GetValue(); ok = (( srcV.isEmpty() && tgtV.isEmpty() ) || - ( !srcV.isEmpty() && !tgtV.isEmpty() && srcV != tgtV )); + ( !srcV.isEmpty() && !tgtV.isEmpty() /*&& srcV != tgtV*/ )); if ( !ok ) { w1->SetObject( CORBA::Object::_nil() ); w2->SetObject( CORBA::Object::_nil() ); @@ -521,6 +525,23 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const h->SetObjectEntry( w->GetMainShapeEntry() ); } } + else if( hypType()=="GeometricProgression" ) + { + StdMeshers::StdMeshers_Geometric1D_var h = + StdMeshers::StdMeshers_Geometric1D::_narrow( hypothesis() ); + + StdMeshersGUI_SubShapeSelectorWdg* w = + widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 ); + + h->SetVarParameter( params[0].text(), "SetStartLength" ); + h->SetStartLength( params[0].myValue.toDouble() ); + h->SetVarParameter( params[1].text(), "SetCommonRatio" ); + h->SetCommonRatio( params[1].myValue.toDouble() ); + if (w) { + h->SetReversedEdges( w->GetListOfIDs() ); + h->SetObjectEntry( w->GetMainShapeEntry() ); + } + } else if( hypType()=="FixedPoints1D" ) { StdMeshers::StdMeshers_FixedPoints1D_var h = @@ -580,6 +601,17 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const h->SetVarParameter( params[0].text(), "SetDeflection" ); h->SetDeflection( params[0].myValue.toDouble() ); } + else if( hypType()=="Adaptive1D" ) + { + StdMeshers::StdMeshers_Adaptive1D_var h = + StdMeshers::StdMeshers_Adaptive1D::_narrow( hypothesis() ); + h->SetVarParameter( params[0].text(), "SetMinSize" ); + h->SetMinSize( params[0].myValue.toDouble() ); + h->SetVarParameter( params[0].text(), "SetMaxSize" ); + h->SetMaxSize( params[1].myValue.toDouble() ); + h->SetVarParameter( params[0].text(), "SetDeflection" ); + h->SetDeflection( params[2].myValue.toDouble() ); + } else if( hypType()=="AutomaticLength" ) { StdMeshers::StdMeshers_AutomaticLength_var h = @@ -683,17 +715,18 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const StdMeshers::StdMeshers_ViscousLayers_var h = StdMeshers::StdMeshers_ViscousLayers::_narrow( hypothesis() ); - h->SetVarParameter( params[0].text(), "SetTotalThickness" ); + h->SetVarParameter ( params[0].text(), "SetTotalThickness" ); h->SetTotalThickness( params[0].myValue.toDouble() ); - h->SetVarParameter( params[1].text(), "SetNumberLayers" ); + h->SetVarParameter ( params[1].text(), "SetNumberLayers" ); h->SetNumberLayers ( params[1].myValue.toInt() ); - h->SetVarParameter( params[2].text(), "SetStretchFactor" ); + h->SetVarParameter ( params[2].text(), "SetStretchFactor" ); h->SetStretchFactor ( params[2].myValue.toDouble() ); + h->SetMethod (( StdMeshers::VLExtrusionMethod ) params[3].myValue.toInt() ); - if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg = - widget< StdMeshersGUI_SubShapeSelectorWdg >( 3 )) + if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg = + widget< StdMeshersGUI_SubShapeSelectorWdg >( 5 )) { - h->SetIgnoreFaces( idsWg->GetListOfIDs() ); + h->SetFaces( idsWg->GetListOfIDs(), params[4].myValue.toInt() ); } } else if( hypType()=="ViscousLayers2D" ) @@ -701,36 +734,36 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const StdMeshers::StdMeshers_ViscousLayers2D_var h = StdMeshers::StdMeshers_ViscousLayers2D::_narrow( hypothesis() ); - h->SetVarParameter( params[0].text(), "SetTotalThickness" ); + h->SetVarParameter ( params[0].text(), "SetTotalThickness" ); h->SetTotalThickness( params[0].myValue.toDouble() ); - h->SetVarParameter( params[1].text(), "SetNumberLayers" ); + h->SetVarParameter ( params[1].text(), "SetNumberLayers" ); h->SetNumberLayers ( params[1].myValue.toInt() ); - h->SetVarParameter( params[2].text(), "SetStretchFactor" ); + h->SetVarParameter ( params[2].text(), "SetStretchFactor" ); h->SetStretchFactor ( params[2].myValue.toDouble() ); - if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg = - widget< StdMeshersGUI_SubShapeSelectorWdg >( 3 )) + if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg = + widget< StdMeshersGUI_SubShapeSelectorWdg >( 4 )) { - h->SetIgnoreEdges( idsWg->GetListOfIDs() ); - } - } - else if( hypType()=="QuadrangleParams" ) - { - StdMeshers::StdMeshers_QuadrangleParams_var h = - StdMeshers::StdMeshers_QuadrangleParams::_narrow( hypothesis() ); - StdMeshersGUI_SubShapeSelectorWdg* w1 = - widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 ); - StdMeshersGUI_QuadrangleParamWdg* w2 = - widget< StdMeshersGUI_QuadrangleParamWdg >( 1 ); - if (w1 && w2) { - if (w1->GetListSize() > 0) { - h->SetTriaVertex(w1->GetListOfIDs()[0]); // getlist must be called once - const char * entry = w1->GetMainShapeEntry(); - h->SetObjectEntry(entry); - } - h->SetQuadType(StdMeshers::QuadType(w2->GetType())); + h->SetEdges( idsWg->GetListOfIDs(), params[3].myValue.toInt() ); } } + // else if( hypType()=="QuadrangleParams" ) + // { + // StdMeshers::StdMeshers_QuadrangleParams_var h = + // StdMeshers::StdMeshers_QuadrangleParams::_narrow( hypothesis() ); + // StdMeshersGUI_SubShapeSelectorWdg* w1 = + // widget< StdMeshersGUI_SubShapeSelectorWdg >( 0 ); + // StdMeshersGUI_QuadrangleParamWdg* w2 = + // widget< StdMeshersGUI_QuadrangleParamWdg >( 1 ); + // if (w1 && w2) { + // if (w1->GetListSize() > 0) { + // h->SetTriaVertex(w1->GetListOfIDs()[0]); // getlist must be called once + // const char * entry = w1->GetMainShapeEntry(); + // h->SetObjectEntry(entry); + // } + // h->SetQuadType(StdMeshers::QuadType(w2->GetType())); + // } + // } } return valueStr; } @@ -851,20 +884,33 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const item.myName = tr( "SMESH_REVERSED_EDGES" ); p.append( item ); - StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget = - new StdMeshersGUI_SubShapeSelectorWdg(); - QString aGeomEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); - QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); - if ( aGeomEntry == "" ) - aGeomEntry = h->GetObjectEntry(); - - aDirectionWidget->SetGeomShapeEntry( aGeomEntry ); - aDirectionWidget->SetMainShapeEntry( aMainEntry ); - aDirectionWidget->SetListOfIDs( h->GetReversedEdges() ); - aDirectionWidget->showPreview( true ); - customWidgets()->append ( aDirectionWidget ); + customWidgets()->append ( makeReverseEdgesWdg( h->GetReversedEdges(), h->GetObjectEntry() )); } + else if( hypType()=="GeometricProgression" ) + { + StdMeshers::StdMeshers_Geometric1D_var h = + StdMeshers::StdMeshers_Geometric1D::_narrow( hyp ); + + item.myName = tr( "SMESH_START_LENGTH_PARAM" ); + if(!initVariableName( hyp, item, "SetStartLength" )) + item.myValue = h->GetStartLength(); + p.append( item ); + + customWidgets()->append (0); + + item.myName = tr( "SMESH_COMMON_RATIO" ); + if(!initVariableName( hyp, item, "SetCommonRatio" )) + item.myValue = h->GetCommonRatio(); + p.append( item ); + + customWidgets()->append (0); + + item.myName = tr( "SMESH_REVERSED_EDGES" ); + p.append( item ); + + customWidgets()->append ( makeReverseEdgesWdg( h->GetReversedEdges(), h->GetObjectEntry() )); + } else if( hypType()=="FixedPoints1D" ) { @@ -886,17 +932,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const item.myName = tr( "SMESH_REVERSED_EDGES" ); p.append( item ); - StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget = - new StdMeshersGUI_SubShapeSelectorWdg(); - QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); - QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); - if ( anEntry == "" ) - anEntry = h->GetObjectEntry(); - aDirectionWidget->SetGeomShapeEntry( anEntry ); - aDirectionWidget->SetMainShapeEntry( aMainEntry ); - aDirectionWidget->SetListOfIDs( h->GetReversedEdges() ); - aDirectionWidget->showPreview( true ); - customWidgets()->append ( aDirectionWidget ); + customWidgets()->append ( makeReverseEdgesWdg( h->GetReversedEdges(), h->GetObjectEntry() )); } @@ -909,7 +945,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const if(!initVariableName( hyp, item, "SetMaxElementArea" )) item.myValue = h->GetMaxElementArea(); p.append( item ); - + } else if( hypType()=="MaxElementVolume" ) { @@ -928,13 +964,13 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const item.myName = tr( "SMESH_START_LENGTH_PARAM" ); - if(!initVariableName( hyp, item, "SetStartLength" )) + if(!initVariableName( hyp, item, "SetStartLength" )) item.myValue = h->GetLength( true ); p.append( item ); customWidgets()->append(0); item.myName = tr( "SMESH_END_LENGTH_PARAM" ); - if(!initVariableName( hyp, item, "SetEndLength" )) + if(!initVariableName( hyp, item, "SetEndLength" )) item.myValue = h->GetLength( false ); p.append( item ); customWidgets()->append(0); @@ -942,25 +978,35 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const item.myName = tr( "SMESH_REVERSED_EDGES" ); p.append( item ); - StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget = - new StdMeshersGUI_SubShapeSelectorWdg(); - QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); - QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); - if ( anEntry == "" ) - anEntry = h->GetObjectEntry(); - aDirectionWidget->SetGeomShapeEntry( anEntry ); - aDirectionWidget->SetMainShapeEntry( aMainEntry ); - aDirectionWidget->SetListOfIDs( h->GetReversedEdges() ); - aDirectionWidget->showPreview( true ); - customWidgets()->append ( aDirectionWidget ); + customWidgets()->append ( makeReverseEdgesWdg( h->GetReversedEdges(), h->GetObjectEntry() )); } else if( hypType()=="Deflection1D" ) { StdMeshers::StdMeshers_Deflection1D_var h = StdMeshers::StdMeshers_Deflection1D::_narrow( hyp ); - + item.myName = tr( "SMESH_DEFLECTION1D_PARAM" ); - if(!initVariableName( hyp, item, "SetDeflection" )) + if(!initVariableName( hyp, item, "SetDeflection" )) + item.myValue = h->GetDeflection(); + p.append( item ); + } + else if( hypType()=="Adaptive1D" ) + { + StdMeshers::StdMeshers_Adaptive1D_var h = + StdMeshers::StdMeshers_Adaptive1D::_narrow( hyp ); + + item.myName = tr( "SMESH_MIN_SIZE" ); + if(!initVariableName( hyp, item, "SetMinSize" )) + item.myValue = h->GetMinSize(); + p.append( item ); + + item.myName = tr( "SMESH_MAX_SIZE" ); + if(!initVariableName( hyp, item, "SetMaxSize" )) + item.myValue = h->GetMaxSize(); + p.append( item ); + + item.myName = tr( "SMESH_DEFLECTION1D_PARAM" ); + if(!initVariableName( hyp, item, "SetDeflection" )) item.myValue = h->GetDeflection(); p.append( item ); } @@ -1156,19 +1202,52 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const p.append( item ); customWidgets()->append (0); + item.myName = tr( "EXTRUSION_METHOD" ); + p.append( item ); + StdMeshersGUI_RadioButtonsGrpWdg* methodWdg = new StdMeshersGUI_RadioButtonsGrpWdg(""); + methodWdg->setButtonLabels ( QStringList() + << tr("EXTMETH_SURF_OFFSET_SMOOTH") + << tr("EXTMETH_FACE_OFFSET") + << tr("EXTMETH_NODE_OFFSET"), + QStringList() + << tr("ICON_EXTMETH_SURF_OFFSET_SMOOTH") + << tr("ICON_EXTMETH_FACE_OFFSET") + << tr("ICON_EXTMETH_NODE_OFFSET")); + methodWdg->setChecked( (int) h->GetMethod() ); + customWidgets()->append( methodWdg ); + QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); + QString aSubEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); if ( !aMainEntry.isEmpty() ) { - item.myName = tr( "SMESH_FACES_WO_LAYERS" ); + item.myName = tr( "TO_IGNORE_FACES_OR_NOT" ); + p.append( item ); + + StdMeshersGUI_RadioButtonsGrpWdg* ignoreWdg = new StdMeshersGUI_RadioButtonsGrpWdg(""); + ignoreWdg->setButtonLabels ( QStringList() + << tr("NOT_TO_IGNORE_FACES") + << tr("TO_IGNORE_FACES") ); + ignoreWdg->setChecked( h->GetIsToIgnoreFaces() ); + connect(ignoreWdg->getButtonGroup(),SIGNAL(buttonClicked(int)),this,SLOT(onValueChanged())); + customWidgets()->append( ignoreWdg ); + + item.myName = + tr( h->GetIsToIgnoreFaces() ? "SMESH_FACES_WO_LAYERS" : "SMESH_FACES_WITH_LAYERS" ); p.append( item ); StdMeshersGUI_SubShapeSelectorWdg* idsWg = new StdMeshersGUI_SubShapeSelectorWdg(0,TopAbs_FACE); - idsWg->SetGeomShapeEntry( aMainEntry ); - idsWg->SetMainShapeEntry( aMainEntry ); - idsWg->SetListOfIDs( h->GetIgnoreFaces() ); - idsWg->showPreview( true ); + idsWg->SetGeomShapeEntry( aSubEntry, aMainEntry ); + if ( idsWg->SetListOfIDs( h->GetFaces() )) + { + idsWg->ShowPreview( true ); + } + else + { + SUIT_MessageBox::warning( dlg(),tr( "SMESH_WRN_WARNING" ),tr( "BAD_FACES_WARNING" )); + idsWg->setEnabled( false ); + } customWidgets()->append ( idsWg ); } } @@ -1196,60 +1275,39 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const customWidgets()->append (0); QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); + QString aSubEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); if ( !aMainEntry.isEmpty() ) { - item.myName = tr( "SMESH_EDGES_WO_LAYERS" ); + item.myName = tr("TO_IGNORE_EDGES_OR_NOT"); p.append( item ); - StdMeshersGUI_SubShapeSelectorWdg* idsWg = - new StdMeshersGUI_SubShapeSelectorWdg(0,TopAbs_EDGE); + StdMeshersGUI_RadioButtonsGrpWdg* ignoreWdg = new StdMeshersGUI_RadioButtonsGrpWdg(""); + ignoreWdg->setButtonLabels ( QStringList() + << tr("NOT_TO_IGNORE_EDGES") + << tr("TO_IGNORE_EDGES") ); + ignoreWdg->setChecked( h->GetIsToIgnoreEdges() ); + connect(ignoreWdg->getButtonGroup(),SIGNAL(buttonClicked(int)),this,SLOT(onValueChanged())); + customWidgets()->append( ignoreWdg ); - idsWg->SetGeomShapeEntry( aMainEntry ); - idsWg->SetMainShapeEntry( aMainEntry ); - idsWg->SetListOfIDs( h->GetIgnoreEdges() ); - idsWg->showPreview( true ); - customWidgets()->append ( idsWg ); - } - } - else if (hypType() == "QuadrangleParams") - { - StdMeshers::StdMeshers_QuadrangleParams_var h = - StdMeshers::StdMeshers_QuadrangleParams::_narrow(hyp); + item.myName = + tr( h->GetIsToIgnoreEdges() ? "SMESH_EDGES_WO_LAYERS" : "SMESH_EDGES_WITH_LAYERS" ); + p.append( item ); - item.myName = tr("SMESH_BASE_VERTEX"); - p.append(item); + StdMeshersGUI_SubShapeSelectorWdg* idsWg = + new StdMeshersGUI_SubShapeSelectorWdg(0,TopAbs_EDGE); - StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget = - new StdMeshersGUI_SubShapeSelectorWdg(0, TopAbs_VERTEX); - aDirectionWidget->SetMaxSize(1); - QString anEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); - QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); - if (anEntry == "") - anEntry = h->GetObjectEntry(); - aDirectionWidget->SetGeomShapeEntry(anEntry); - aDirectionWidget->SetMainShapeEntry(aMainEntry); - if (!isCreation()) { - SMESH::long_array_var aVec = new SMESH::long_array; - int vertID = h->GetTriaVertex(); - if (vertID > 0) { - aVec->length(1); - aVec[0] = vertID; - aDirectionWidget->SetListOfIDs(aVec); + idsWg->SetGeomShapeEntry( aSubEntry, aMainEntry ); + if ( idsWg->SetListOfIDs( h->GetEdges() )) + { + idsWg->ShowPreview( true ); } + else + { + SUIT_MessageBox::warning( dlg(),tr( "SMESH_WRN_WARNING" ),tr( "BAD_EDGES_WARNING" )); + idsWg->setEnabled( false ); + } + customWidgets()->append ( idsWg ); } - aDirectionWidget->showPreview(true); - - item.myName = tr("SMESH_QUAD_TYPE"); - p.append(item); - - StdMeshersGUI_QuadrangleParamWdg* aTypeWidget = - new StdMeshersGUI_QuadrangleParamWdg(); - if (!isCreation()) { - aTypeWidget->SetType(int(h->GetQuadType())); - } - - customWidgets()->append(aDirectionWidget); - customWidgets()->append(aTypeWidget); } else res = false; @@ -1280,10 +1338,18 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int) { sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" ); } + else if( hypType()=="GeometricProgression" ) + { + if (sb->objectName() == tr("SMESH_START_LENGTH_PARAM")) + sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" ); + else if (sb->objectName() == tr("SMESH_COMMON_RATIO")) + sb->RangeStepAndValidator( -VALUE_MAX, VALUE_MAX, 0.5, "len_tol_precision" ); + } else if( hypType()=="MaxLength" ) { sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" ); sb->setEnabled( !widget< QCheckBox >( 1 )->isChecked() ); + sb->setMinimumWidth( 150 ); } else if( hypType()=="MaxElementArea" ) { @@ -1301,6 +1367,10 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int) { sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" ); } + else if( hypType()=="Adaptive1D" ) + { + sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" ); + } else if( hypType().startsWith( "ViscousLayers" )) { if (sb->objectName() == tr("SMESH_STRETCH_FACTOR")) @@ -1313,6 +1383,14 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int) sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" ); } } + else if ( SalomeApp_IntSpinBox* sb = qobject_cast< SalomeApp_IntSpinBox* >( w )) + { + if ( hypType().startsWith( "NumberOfLayers" ) || + hypType().startsWith( "ViscousLayers" )) + { + sb->setMinimum( 1 ); + } + } } //================================================================================ @@ -1372,7 +1450,9 @@ QString StdMeshersGUI_StdHypothesisCreator::hypTypeName( const QString& t ) cons types.insert( "MaxElementVolume", "MAX_ELEMENT_VOLUME" ); types.insert( "StartEndLength", "START_END_LENGTH" ); types.insert( "Deflection1D", "DEFLECTION1D" ); + types.insert( "Adaptive1D", "ADAPTIVE1D" ); types.insert( "Arithmetic1D", "ARITHMETIC_1D" ); + types.insert( "GeometricProgression", "GEOMETRIC_1D" ); types.insert( "FixedPoints1D", "FIXED_POINTS_1D" ); types.insert( "AutomaticLength", "AUTOMATIC_LENGTH" ); types.insert( "ProjectionSource1D", "PROJECTION_SOURCE_1D" ); @@ -1469,13 +1549,11 @@ bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget( StdParam & pa param.myValue = w->GetValue(); return true; } - if ( widget->inherits( "StdMeshersGUI_QuadrangleParamWdg" )) - { - //const StdMeshersGUI_QuadrangleParamWdg * w = - // static_cast( widget ); - param.myValue = "QuadType"; - return true; - } + // if ( widget->inherits( "StdMeshersGUI_QuadrangleParamWdg" )) + // { + // param.myValue = "QuadType"; + // return true; + // } if ( widget->inherits( "StdMeshersGUI_FixedPointsParamWdg" )) { const StdMeshersGUI_FixedPointsParamWdg * w = @@ -1489,6 +1567,13 @@ bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget( StdParam & pa //param.myValue = w->isChecked(); return true; } + if ( widget->inherits( "StdMeshersGUI_RadioButtonsGrpWdg" )) + { + const StdMeshersGUI_RadioButtonsGrpWdg * w = + static_cast( widget ); + param.myValue = w->checkedId(); + return true; + } return false; } @@ -1539,6 +1624,18 @@ void StdMeshersGUI_StdHypothesisCreator::valueChanged( QWidget* paramWidget) toCopyGroups->setEnabled( true ); } } + else if ( hypType().startsWith( "ViscousLayers" ) && paramWidget->inherits("QButtonGroup")) + { + int widgetNumber = hypType() == "ViscousLayers2D" ? 3 : 4; + if ( QLabel* label = getLabel( widgetNumber + 1 ) ) + { + bool toIgnore = widget< StdMeshersGUI_RadioButtonsGrpWdg >( widgetNumber )->checkedId(); + if ( hypType() == "ViscousLayers2D" ) + label->setText( tr( toIgnore ? "SMESH_EDGES_WO_LAYERS" : "SMESH_EDGES_WITH_LAYERS" )); + else + label->setText( tr( toIgnore ? "SMESH_FACES_WO_LAYERS" : "SMESH_FACES_WITH_LAYERS" )); + } + } } //================================================================================ @@ -1558,3 +1655,34 @@ bool StdMeshersGUI_StdHypothesisCreator::initVariableName(SMESH::SMESH_Hypothesi return theParams.isVariable; } + +//================================================================================ +/*! + * \brief Creates two widgets used to define reversed edges for some 1D hypotheses + * \param [in] edgeIDs - ids of reversed edges to set to the widgets + * \param [in] shapeEntry - entry of a sub-shape of a sub-mesh if any + * \return QWidget* - new StdMeshersGUI_SubShapeSelectorWdg; + * new StdMeshersGUI_PropagationHelperWdg is stored in \a myHelperWidget field. + */ +//================================================================================ + +QWidget* +StdMeshersGUI_StdHypothesisCreator::makeReverseEdgesWdg( SMESH::long_array_var edgeIDs, + CORBA::String_var shapeEntry) const +{ + QString aGeomEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry(); + QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry(); + if ( aGeomEntry.isEmpty() && shapeEntry.in() ) + aGeomEntry = shapeEntry.in(); + + StdMeshersGUI_SubShapeSelectorWdg* wdg = new StdMeshersGUI_SubShapeSelectorWdg(); + wdg->SetGeomShapeEntry( aGeomEntry, aMainEntry ); + wdg->SetListOfIDs( edgeIDs ); + wdg->ShowPreview( true ); + + if ( !aGeomEntry.isEmpty() || !aMainEntry.isEmpty() ) + const_cast( this )-> + myHelperWidget = new StdMeshersGUI_PropagationHelperWdg( wdg ); + + return wdg; +}