Version: 6.3.1
Defines | Functions

src/SMESHGUI/SMESHGUI_MeshOp.cxx File Reference

#include "SMESHGUI_MeshOp.h"
#include "SMESHGUI.h"
#include "SMESHGUI_MeshDlg.h"
#include "SMESHGUI_ShapeByMeshDlg.h"
#include "SMESHGUI_HypothesesUtils.h"
#include "SMESHGUI_Hypotheses.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_GEOMGenUtils.h"
#include <SMESH_TypeFilter.hxx>
#include <SMESH_NumberFilter.hxx>
#include <GEOM_SelectionFilter.h>
#include <GEOMBase.h>
#include <GeometryGUI.h>
#include <SalomeApp_Tools.h>
#include <SalomeApp_Application.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_UpdateFlags.h>
#include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h>
#include <SUIT_Session.h>
#include <SALOME_InteractiveObject.hxx>
#include <SALOME_ListIO.hxx>
#include <SALOMEDS_SComponent.hxx>
#include <SALOMEDS_SObject.hxx>
#include <QStringList>
#include <QLineEdit>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopExp_Explorer.hxx>
#include <BRep_Tool.hxx>
#include <SALOMEconfig.h>
#include <CORBA_CLIENT_HEADER(SMESH_Gen)>
Include dependency graph for SMESHGUI_MeshOp.cxx:

Go to the source code of this file.

Defines

#define WITHGENERICOBJ

Functions

 _PTR (SObject) SMESHGUI_MeshOp
 find an existing submesh by the selected shape
static bool isCompatible (const HypothesisData *theAlgoData, const HypothesisData *theHypData, const int theHypType)
 check compatibility of the algorithm and another algorithm or hypothesis
static int getTabDim (const QObject *tab, SMESHGUI_MeshDlg *dlg)
 Returns tab dimention

Define Documentation

#define WITHGENERICOBJ

Definition at line 77 of file SMESHGUI_MeshOp.cxx.


Function Documentation

_PTR ( SObject  )

find an existing submesh by the selected shape

Return values:
_PTR(SObject)- the found submesh SObject

Definition at line 424 of file SMESHGUI_MeshOp.cxx.

References _PTR(), EDGE, FACE, SMESH_box.geom, SMESHGUI_MeshDlg.Geom, SMESHGUI_MeshDlg.Mesh, SMESH.Tag_SubMeshOnCompound, SMESH.Tag_SubMeshOnEdge, SMESH.Tag_SubMeshOnFace, SMESH.Tag_SubMeshOnShell, SMESH.Tag_SubMeshOnSolid, SMESH.Tag_SubMeshOnVertex, and SMESH.Tag_SubMeshOnWire.

{
  QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
  QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
  _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
  _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() );
  if ( pMesh && pGeom ) {
    GEOM::GEOM_Object_var geom = SMESH::SObjectToInterface<GEOM::GEOM_Object>( pGeom );
    if ( !geom->_is_nil() ) {
      int tag = -1;
      switch ( geom->GetShapeType() ) {
      case GEOM::VERTEX:   tag = SMESH::Tag_SubMeshOnVertex;   break;
      case GEOM::EDGE:     tag = SMESH::Tag_SubMeshOnEdge;     break;
      case GEOM::WIRE:     tag = SMESH::Tag_SubMeshOnWire;     break;
      case GEOM::FACE:     tag = SMESH::Tag_SubMeshOnFace;     break;
      case GEOM::SHELL:    tag = SMESH::Tag_SubMeshOnShell;    break;
      case GEOM::SOLID:    tag = SMESH::Tag_SubMeshOnSolid;    break;
      case GEOM::COMPOUND: tag = SMESH::Tag_SubMeshOnCompound; break;
      default:;
      }
      _PTR(GenericAttribute) anAttr;
      _PTR(SObject) aSubmeshRoot;
      _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
      if ( pMesh->FindSubObject( tag, aSubmeshRoot ) )
      {
        _PTR(ChildIterator) smIter = aStudy->NewChildIterator( aSubmeshRoot );
        for ( ; smIter->More(); smIter->Next() )
        {
          _PTR(SObject) aSmObj = smIter->Value();
          if ( ! aSmObj->FindAttribute( anAttr, "AttributeIOR" ))
            continue;
          _PTR(ChildIterator) anIter1 = aStudy->NewChildIterator(aSmObj);
          for ( ; anIter1->More(); anIter1->Next()) {
            _PTR(SObject) pGeom2 = anIter1->Value();
            if ( pGeom2->ReferencedObject( pGeom2 ) &&
                 pGeom2->GetID() == pGeom->GetID() )
              return aSmObj;
          }
        }
      }
    }
  }
  return _PTR(SObject)();
}
static int getTabDim ( const QObject tab,
SMESHGUI_MeshDlg dlg 
) [static]

Returns tab dimention

Parameters:
tab- the tab in the dlg
dlg- my dialogue
Return values:
int- dimention

Definition at line 1004 of file SMESHGUI_MeshOp.cxx.

References SMESH.DIM_0D, SMESH.DIM_3D, and SMESHGUI_MeshDlg.tab().

Referenced by SMESHGUI_MeshOp.onAlgoSelected(), SMESHGUI_MeshOp.onCreateHyp(), and SMESHGUI_MeshOp.onEditHyp().

{
  int aDim = -1;
  for (int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++)
    if (tab == dlg->tab(i))
      aDim = i;
  return aDim;
}
static bool isCompatible ( const HypothesisData theAlgoData,
const HypothesisData theHypData,
const int  theHypType 
) [static]

check compatibility of the algorithm and another algorithm or hypothesis

Parameters:
theAlgoData- algorithm data
theHypData- hypothesis data
theHypType- hypothesis type
theHypTypeName- hypothesis type name, must be provided if 2-nd arg is not algo
Return values:
bool- check result

Definition at line 776 of file SMESHGUI_MeshOp.cxx.

References SMESHGUI_MeshOp.Algo, SMESH.IsAvailableHypothesis(), SMESH.IsCompatibleAlgorithm(), and HypothesisData.TypeName.

Referenced by SMESHGUI_MeshOp.availableHyps(), SMESHGUI_MeshOp.existingHyps(), SMESHGUI.isSelectionCompatible(), and SMESHGUI_MeshOp.onAlgoSelected().

{
  if ( !theAlgoData )
    return true;

  if ( theHypType == SMESHGUI_MeshOp::Algo )
    return SMESH::IsCompatibleAlgorithm( theAlgoData, theHypData );

  bool isOptional;
  return ( SMESH::IsAvailableHypothesis( theAlgoData, theHypData->TypeName, isOptional ));
}
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS