]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Merge branch 'V8_3_BR' into V8_4_BR V8_4_BR
authorvsr <vsr@opencascade.com>
Fri, 30 Mar 2018 14:20:40 +0000 (17:20 +0300)
committervsr <vsr@opencascade.com>
Fri, 30 Mar 2018 14:20:40 +0000 (17:20 +0300)
1  2 
src/SMESHGUI/SMESHGUI.cxx

index b584a345d6db12cd61a2060866d30b9404a6a563,5c2c18a7cf93eeed5f9fc17e82082a5e0fdc9ca0..5ae6a8d838e843eea57f08b348b012f29a520239
  #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
  #include CORBA_CLIENT_HEADER(SMESH_MeshEditor)
  #include CORBA_CLIENT_HEADER(SMESH_Measurements)
 +#include CORBA_CLIENT_HEADER(SMESH_Mesh)
  
  // Qt includes
  // #define       INCLUDE_MENUITEM_DEF // VSR commented ????????
@@@ -604,7 -603,6 +604,7 @@@ namespac
        notSupportedElemTypes.push_back( SMESH::Entity_Quad_Polygon );
        notSupportedElemTypes.push_back( SMESH::Entity_Quad_Pyramid );
        notSupportedElemTypes.push_back( SMESH::Entity_Quad_Penta );
 +      notSupportedElemTypes.push_back( SMESH::Entity_BiQuad_Penta );
        notSupportedElemTypes.push_back( SMESH::Entity_Hexagonal_Prism );
        notSupportedElemTypes.push_back( SMESH::Entity_Polyhedra );
        notSupportedElemTypes.push_back( SMESH::Entity_Quad_Polyhedra );
          "SMESH_TETRAHEDRA","SMESH_QUADRATIC_TETRAHEDRONS","SMESH_PYRAMIDS",
          "SMESH_QUADRATIC_PYRAMIDS","SMESH_HEXAHEDRA","SMESH_QUADRATIC_HEXAHEDRONS",
          "SMESH_TRIQUADRATIC_HEXAHEDRONS","SMESH_PENTAHEDRA","SMESH_QUADRATIC_PENTAHEDRONS",
 +              "SMESH_BIQUADRATIC_PENTAHEDRONS",
          "SMESH_OCTAHEDRA","SMESH_POLYEDRONS","SMESH_QUADRATIC_POLYEDRONS","SMESH_BALLS"
        };
        // is typeMsg complete? (compilation failure mains that enum SMDSAbs_EntityType changed)
        const int nbTypes = sizeof( typeMsg ) / sizeof( const char* );
 -      int _assert[( nbTypes == SMESH::Entity_Last ) ? 2 : -1 ]; _assert[0]=_assert[1];
 +      int _assert[( nbTypes == SMESH::Entity_Last ) ? 2 : -1 ]; _assert[0]=_assert[1]=0;
  
        QString andStr = " " + QObject::tr("SMESH_AND") + " ", comma(", ");
        for ( size_t iType = 0; iType < presentNotSupported.size(); ++iType ) {
      // Get parameters of export operation
  
      QString            aFilename;
 -    SMESH::MED_VERSION aFormat = SMESH::MED_V2_2;
 +    SMESH::MED_VERSION aFormat = SMESH::MED_LATEST;
      // Init the parameters with the default values
      bool aIsASCII_STL   = true;
      bool toCreateGroups = false;
      }
      else if ( isCGNS )// Export to CGNS
      {
 -      SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
 +      const char* theByTypeResource = "cgns_group_elems_by_type";
 +      toCreateGroups = SMESHGUI::resourceMgr()->booleanValue( "SMESH", theByTypeResource, false );
 +
 +      QStringList checkBoxes;
 +      checkBoxes << QObject::tr("CGNS_EXPORT_ELEMS_BY_TYPE");
 +
 +      SalomeApp_CheckFileDlg* fd =
 +        new SalomeApp_CheckFileDlg ( SMESHGUI::desktop(), false, checkBoxes, true, true );
        fd->setWindowTitle( aTitle );
        fd->setNameFilter( QObject::tr( "CGNS_FILES_FILTER" ) + " (*.cgns)" );
        if ( !anInitialPath.isEmpty() )
        fd->selectFile(aMeshName);
        SMESHGUI_FileValidator* fv = new SMESHGUI_FileValidator( fd );
        fd->setValidator( fv );
 +      fd->SetChecked( toCreateGroups, 0 );
  
        if ( fd->exec() )
          aFilename = fd->selectedFile();
 -      toOverwrite = fv->isOverwrite();
 +      toOverwrite    = fv->isOverwrite();
 +      toCreateGroups = fd->IsChecked(0);
 +      SMESHGUI::resourceMgr()->setValue("SMESH", theByTypeResource, toCreateGroups );
  
        delete fd;
      }
      else if ( isMED || isSAUV ) // Export to MED or SAUV
      {
        QMap<QString, SMESH::MED_VERSION> aFilterMap;
 -      //QString v21 (aMesh->GetVersionString(SMESH::MED_V2_1, 2));
        if ( isMED ) {
          QString v22 (aMesh->GetVersionString(SMESH::MED_V2_2, 2));
 -        //aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( v21 ) + " (*.med)", SMESH::MED_V2_1 );
          aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( v22 ) + " (*.med)", SMESH::MED_V2_2 );
 +        int minor = v22.split(".").last().toInt();
 +        int vv= int(SMESH::MED_MINOR_0); // add all minor from 0 to current
 +        for (int ii=0; ii<minor; ii++)
 +          {
 +            QString vs = aMesh->GetVersionString(SMESH::MED_VERSION(vv), 2);
 +            aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( vs ) + " (*.med)",  SMESH::MED_VERSION(vv));
 +            vv = vv +1;
 +          }
        }
        else { // isSAUV
          aFilterMap.insert("All files (*)", SMESH::MED_V2_1 );
  
        SMESHGUI_FieldSelectorWdg* fieldSelWdg = new SMESHGUI_FieldSelectorWdg();
        QList< QWidget* > wdgList;
 -      if ( fieldSelWdg->GetAllFeilds( aMeshList, aFieldList ))
 +      if ( fieldSelWdg->GetAllFields( aMeshList, aFieldList ))
          wdgList.append( fieldSelWdg );
  
        SalomeApp_CheckFileDlg* fd =
              }
            if( !toOverwrite ) {
              // can't append to an existing using other format
 -            SMESH::MED_VERSION aVersion = SMESH::MED_V2_1;
 +            SMESH::MED_VERSION aVersion = aFormat; //SMESH::MED_V2_1;
              bool isVersionOk = SMESHGUI::GetSMESHGen()->GetMEDVersion( aFilename.toUtf8().constData(), aVersion );
              if( !isVersionOk || aVersion != aFormat ) {
                int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
        }
        toCreateGroups = fd->IsChecked(0);
        toFindOutDim   = fd->IsChecked(1);
 -      fieldSelWdg->GetSelectedFeilds();
 +      fieldSelWdg->GetSelectedFields();
        if ( !fieldSelWdg->parent() )
          delete fieldSelWdg;
        delete fd;
              SMESH::SMESH_Mesh_var        aMeshItem = aMeshOrGroup->GetMesh();
              aMeshItem->ExportCGNS( aMeshOrGroup,
                                     aFilename.toUtf8().data(),
 -                                   toOverwrite && aMeshIndex == 0 );
 +                                   toOverwrite && aMeshIndex == 0,
 +                                   toCreateGroups );
            }
          }
          else if ( isGMF )
@@@ -1850,20 -1830,24 +1850,24 @@@ void SMESHGUI::OnEditDelete(
    int objectCount = 0;
    QString aNameList;
    QString aParentComponent = QString::null;
-   Handle(SALOME_InteractiveObject) anIO;
+   
    for( SALOME_ListIteratorOfListIO anIt( selected ); anIt.More(); anIt.Next() )
    {
-     anIO = anIt.Value();
-     QString cur = anIO->getComponentDataType();
-     _PTR(SObject) aSO = aStudy->FindObjectID(anIO->getEntry());
+     Handle(SALOME_InteractiveObject) anIO = anIt.Value();
+     if ( anIO.IsNull() ) continue;
+     
+     QString father = "unknown";
+     _PTR(SObject) aSO = aStudy->FindObjectID( anIO->getEntry() );
      if (aSO) {
+       father = QString::fromStdString( aSO->GetFatherComponent()->ComponentDataType() );
        // check if object is reference
        _PTR(SObject) aRefSObj;
        aNameList.append("\n    - ");
        if ( aSO->ReferencedObject( aRefSObj ) ) {
          QString aRefName = QString::fromStdString ( aRefSObj->GetName() );
          aNameList.append( aRefName );
-         cur = QString::fromStdString ( aRefSObj->GetFatherComponent()->ComponentDataType() );
+         father = QString::fromStdString ( aRefSObj->GetFatherComponent()->ComponentDataType() );
        }
        else
          aNameList.append(anIO->getName());
      }
  
      if( aParentComponent.isNull() )
-       aParentComponent = cur;
-     else if( !aParentComponent.isEmpty() && aParentComponent!=cur )
+       aParentComponent = father;
+     else if( !aParentComponent.isEmpty() && aParentComponent!=father )
        aParentComponent = "";
    }
  
@@@ -2133,7 -2117,7 +2137,7 @@@ bool SMESHGUI::automaticUpdate( SMESH::
    long nbVolumes = info[SMDSEntity_Tetra]   + info[SMDSEntity_Quad_Tetra] + 
                     info[SMDSEntity_Hexa]    + info[SMDSEntity_Quad_Hexa] + info[SMDSEntity_TriQuad_Hexa] + 
                     info[SMDSEntity_Pyramid] + info[SMDSEntity_Quad_Pyramid] + 
 -                   info[SMDSEntity_Penta]   + info[SMDSEntity_Quad_Penta] + 
 +                   info[SMDSEntity_Penta]   + info[SMDSEntity_Quad_Penta] + info[SMDSEntity_BiQuad_Penta] +
                     info[SMDSEntity_Polyhedra] + 
                     info[SMDSEntity_Hexagonal_Prism];
    long nbBalls   = info[SMDSEntity_Ball];
@@@ -2653,7 -2637,9 +2657,7 @@@ bool SMESHGUI::OnGUIEvent( int theComma
        if(checkLock(aStudy)) break;
        SUIT_OverrideCursor wc;
        try {
 -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
          OCC_CATCH_SIGNALS;
 -#endif
          SMESH::UpdateView();
        }
        catch (std::bad_alloc) { // PAL16774 (Crash after display of many groups)
    case SMESHOp::OpQuadraticTetrahedron:
    case SMESHOp::OpQuadraticPyramid:
    case SMESHOp::OpQuadraticPentahedron:
 +  case SMESHOp::OpBiQuadraticPentahedron:
    case SMESHOp::OpQuadraticHexahedron:
    case SMESHOp::OpTriQuadraticHexahedron:
      {
          case SMESHOp::OpQuadraticTetrahedron:   type = SMDSEntity_Quad_Tetra; break;
          case SMESHOp::OpQuadraticPyramid:       type = SMDSEntity_Quad_Pyramid; break;
          case SMESHOp::OpQuadraticPentahedron:   type = SMDSEntity_Quad_Penta; break;
 +        case SMESHOp::OpBiQuadraticPentahedron: type = SMDSEntity_BiQuad_Penta; break;
          case SMESHOp::OpQuadraticHexahedron:    type = SMDSEntity_Quad_Hexa; break;
          case SMESHOp::OpTriQuadraticHexahedron: type = SMDSEntity_TriQuad_Hexa; break;
          default: break;
@@@ -3963,7 -3947,6 +3967,7 @@@ void SMESHGUI::initialize( CAM_Applicat
    createSMESHAction( SMESHOp::OpQuadraticTetrahedron,   "QUADRATIC_TETRAHEDRON",   "ICON_DLG_QUADRATIC_TETRAHEDRON" );
    createSMESHAction( SMESHOp::OpQuadraticPyramid,       "QUADRATIC_PYRAMID",       "ICON_DLG_QUADRATIC_PYRAMID" );
    createSMESHAction( SMESHOp::OpQuadraticPentahedron,   "QUADRATIC_PENTAHEDRON",   "ICON_DLG_QUADRATIC_PENTAHEDRON" );
 +  createSMESHAction( SMESHOp::OpBiQuadraticPentahedron, "BIQUADRATIC_PENTAHEDRON", "ICON_DLG_BIQUADRATIC_PENTAHEDRON" );
    createSMESHAction( SMESHOp::OpQuadraticHexahedron,    "QUADRATIC_HEXAHEDRON",    "ICON_DLG_QUADRATIC_HEXAHEDRON" );
    createSMESHAction( SMESHOp::OpTriQuadraticHexahedron, "TRIQUADRATIC_HEXAHEDRON", "ICON_DLG_TRIQUADRATIC_HEXAHEDRON" );
  
    createMenu( SMESHOp::OpQuadraticTetrahedron,   addId, -1 );
    createMenu( SMESHOp::OpQuadraticPyramid,       addId, -1 );
    createMenu( SMESHOp::OpQuadraticPentahedron,   addId, -1 );
 +  createMenu( SMESHOp::OpBiQuadraticPentahedron, addId, -1 );
    createMenu( SMESHOp::OpQuadraticHexahedron,    addId, -1 );
    createMenu( SMESHOp::OpTriQuadraticHexahedron, addId, -1 );
  
    createTool( SMESHOp::OpQuadraticTetrahedron,   addNonElemTb );
    createTool( SMESHOp::OpQuadraticPyramid,       addNonElemTb );
    createTool( SMESHOp::OpQuadraticPentahedron,   addNonElemTb );
 +  createTool( SMESHOp::OpBiQuadraticPentahedron, addNonElemTb );
    createTool( SMESHOp::OpQuadraticHexahedron,    addNonElemTb );
    createTool( SMESHOp::OpTriQuadraticHexahedron, addNonElemTb );