Salome HOME
Fix crash of SALOME_TESTS/Grids/smesh/bugs_13/N9
authoreap <eap@opencascade.com>
Fri, 10 Feb 2017 18:20:38 +0000 (21:20 +0300)
committereap <eap@opencascade.com>
Fri, 10 Feb 2017 18:20:38 +0000 (21:20 +0300)
   (SMDS_VolumeTool.cxx)

Add "Show IDs" check box to Mesh Information dlg

Avoid warning in Choose Entity dialog when no entities are selected,
disable [OK] button instead

16 files changed:
doc/salome/gui/SMESH/images/eleminfo1.png [changed mode: 0755->0644]
doc/salome/gui/SMESH/images/eleminfo2.png [changed mode: 0755->0644]
doc/salome/gui/SMESH/input/mesh_infos.doc
src/SMDS/SMDS_VolumeTool.cxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_DisplayEntitiesDlg.cxx
src/SMESHGUI/SMESHGUI_DisplayEntitiesDlg.h
src/SMESHGUI/SMESHGUI_IdPreview.h
src/SMESHGUI/SMESHGUI_MeshInfo.cxx
src/SMESHGUI/SMESHGUI_MeshInfo.h
src/SMESHGUI/SMESHGUI_Selection.cxx
src/SMESHGUI/SMESHGUI_Selection.h
src/SMESHGUI/SMESH_msg_en.ts
src/SMESHUtils/SMESH_MeshAlgos.cxx
src/SMESH_SWIG/smeshBuilder.py
src/StdMeshers/StdMeshers_ViscousLayers.cxx

old mode 100755 (executable)
new mode 100644 (file)
index 74c76db..9f9e03a
Binary files a/doc/salome/gui/SMESH/images/eleminfo1.png and b/doc/salome/gui/SMESH/images/eleminfo1.png differ
old mode 100755 (executable)
new mode 100644 (file)
index b7a785b..34061d9
Binary files a/doc/salome/gui/SMESH/images/eleminfo2.png and b/doc/salome/gui/SMESH/images/eleminfo2.png differ
index 49a5a5ce43044df0730206b35b16805946a6de4f..e20375251f09ea41831b53b21eaf3d70f918a857 100644 (file)
@@ -78,6 +78,9 @@ The user can either input the ID of a node or element he wants to
 analyze directly in the dialog box or select the node(s) or element(s) in
 the 3D viewer.
 
+If <b>Show IDs</b> is activated, IDs of selected nodes or elements are
+displayed in the 3D viewer.
+
 \note The information about the groups, to which the node or element belongs,
 can be shown in a short or in a detailed form. By default, for performance
 reasons, this information is shown in a short form (group names
index dca32c2580a6ff6ecb91d4724797cb3325c546ae..d7dd7f826f6d2180446e8030667e976da1009946 100644 (file)
@@ -425,11 +425,13 @@ struct SMDS_VolumeTool::SaveFacet
   SaveFacet( SMDS_VolumeTool::Facet& facet ): myToRestore( facet )
   {
     mySaved = facet;
+    mySaved.myNodes.swap( facet.myNodes );
   }
   ~SaveFacet()
   {
     if ( myToRestore.myIndex != mySaved.myIndex )
       myToRestore = mySaved;
+    myToRestore.myNodes.swap( mySaved.myNodes );
   }
 };
 
index 31f16a61f7bf2468e1c5d30ec3549290f5266c6b..705afa376d58ab9336402e9f55b7e6857b82aae7 100644 (file)
@@ -4383,6 +4383,7 @@ void SMESHGUI::initialize( CAM_Application* app )
     hasNodes("(numberOfNodes > 0 ) && hasActor"),
     hasElems("(count( elemTypes ) > 0)"),
     hasDifferentElems("(count( elemTypes ) > 1)"),
+    hasDifferentObjElems("(count( objElemTypes ) > 1)"),
     hasBalls("({'BallElem'} in elemTypes)"),
     hasElems0d("({'Elem0d'} in elemTypes)"),
     hasEdges("({'Edge'} in elemTypes)"),
@@ -4532,7 +4533,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   popupMgr()->insert( separator(), anId, -1 );
 
   popupMgr()->insert( action( SMESHOp::OpDEChoose ), anId, -1 );
-  popupMgr()->setRule( action( SMESHOp::OpDEChoose ), aClient + "&& $type in {" + mesh + "} &&" + hasDifferentElems, QtxPopupMgr::VisibleRule );
+  popupMgr()->setRule( action( SMESHOp::OpDEChoose ), aClient + "&& $type in {" + mesh + "} &&" + hasDifferentObjElems, QtxPopupMgr::VisibleRule );
 
   popupMgr()->insert( separator(), anId, -1 );
 
index 8c9ac135b6137183b53c83b867e22a35485f2084..5af7f78159e78780147431139fad3136f9e6f62e 100644 (file)
@@ -97,6 +97,7 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
   hl->addWidget( nb0DElemsLab, 0, 1 );
   my0DElemsTB->setEnabled( nbElements );
   nb0DElemsLab->setEnabled( nbElements );
+  myNbTypes += ( nbElements > 0 );
 
   // Edges
   nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Edge ) : aMesh->NbEdges();
@@ -112,6 +113,7 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
   hl->addWidget( nbEdgesLab, 1, 1 );
   myEdgesTB->setEnabled( nbElements );
   nbEdgesLab->setEnabled( nbElements );
+  myNbTypes += ( nbElements > 0 );
 
   // Faces
   nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Face ) : aMesh->NbFaces();
@@ -127,6 +129,7 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
   hl->addWidget( nbFacesLab, 2, 1 );
   myFacesTB->setEnabled( nbElements );
   nbFacesLab->setEnabled( nbElements );
+  myNbTypes += ( nbElements > 0 );
 
   // Volumes
   nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Volume ) : aMesh->NbVolumes();
@@ -142,6 +145,7 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
   hl->addWidget( nbVolumesLab, 3, 1 );
   myVolumesTB->setEnabled( nbElements );
   nbVolumesLab->setEnabled( nbElements );
+  myNbTypes += ( nbElements > 0 );
 
   // Balls
   nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Ball ) : aMesh->NbBalls();
@@ -157,6 +161,7 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
   hl->addWidget( nbBallsLab, 4, 1 );
   myBallsTB->setEnabled( nbElements );
   nbBallsLab->setEnabled( nbElements );
+  myNbTypes += ( nbElements > 0 );
 
   QVBoxLayout* aDlgLay = new QVBoxLayout( mainFrame() );
   aDlgLay->setMargin( 0 );
@@ -165,8 +170,10 @@ SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
   
   button( OK )->setText( tr( "SMESH_BUT_OK" ) );
 
-  connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
-  connect( this, SIGNAL( dlgOk() ),   this, SLOT( onOk() ) );
+  connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ));
+  connect( this, SIGNAL( dlgOk() ),   this, SLOT( onOk() ));
+
+  updateButtons();
 }
 
 /*
@@ -192,14 +199,6 @@ void SMESHGUI_DisplayEntitiesDlg::InverseEntityMode(unsigned int& theOutputMode,
 void SMESHGUI_DisplayEntitiesDlg::onChangeEntityMode( bool isChecked )
 {
   QCheckBox* aSender = (QCheckBox*)sender();
-  if ( myNbCheckedButtons == 1 && !isChecked ) {
-    SUIT_MessageBox::warning(this, tr("SMESH_WRN_WARNING"),
-                             tr("WRN_AT_LEAST_ONE"));
-    disconnect( aSender, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
-    aSender->setChecked( true );
-    connect( aSender, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
-    return;
-  }
   if ( my0DElemsTB == aSender )
     InverseEntityMode( myEntityMode, SMESH_Actor::e0DElements );
   else if ( myEdgesTB == aSender )
@@ -210,9 +209,9 @@ void SMESHGUI_DisplayEntitiesDlg::onChangeEntityMode( bool isChecked )
     InverseEntityMode( myEntityMode, SMESH_Actor::eVolumes );
   else if ( myBallsTB == aSender )
     InverseEntityMode( myEntityMode, SMESH_Actor::eBallElem );
-  
+
   isChecked ? myNbCheckedButtons++ : myNbCheckedButtons--;
-  
+  updateButtons();
 }
 
 /*!
@@ -248,3 +247,11 @@ void SMESHGUI_DisplayEntitiesDlg::onOk()
     SMESH::UpdateView( wnd, SMESH::eDisplay, entry );
   }
 }
+
+/*!
+ * \brief Enable/disable OK button depending on nb of selected entities
+ */
+void SMESHGUI_DisplayEntitiesDlg::updateButtons()
+{
+  setButtonEnabled( myNbCheckedButtons > 0 || myNbTypes == 0, OK );
+}
index e6305b2d6245511d931a129f855bc8f3a48ebbdf..4901bd6ce857f01c64a3e049c5480dc52f10186a 100644 (file)
@@ -40,6 +40,7 @@ public:
 private:
   void InverseEntityMode( unsigned int& theOutputMode,
                           unsigned int theMode );
+  void updateButtons();
 
 private slots:
   void              onOk();
@@ -51,6 +52,7 @@ private:
   unsigned int myEntityMode;
   SMESH_Actor *myActor;
   int myNbCheckedButtons;
+  int myNbTypes;
   QCheckBox* my0DElemsTB;
   QCheckBox* myEdgesTB;
   QCheckBox* myFacesTB;
index 6c72b1fd545d92d56d1f6b837e863842ef31c14a..6890f1df652b7b4d28d42dbab56bf310019927d4 100644 (file)
@@ -55,6 +55,14 @@ public:
   void SetPointsData( SMDS_Mesh* theMesh, const TColStd_MapOfInteger & theNodesIdMap );
   void SetElemsData ( const std::vector<int> &  theElemsIdMap,
                       const std::list<gp_XYZ> & theGrCentersXYZ );
+  template< class INT_ITER, class XYZ_ITER >
+  void SetElemsData ( INT_ITER theElemsBegin, INT_ITER theElemsEnd,
+                      XYZ_ITER theGrCentersBegin, XYZ_ITER theGrCentersEnd )
+  {
+    std::vector<int> elemsIds( theElemsBegin, theElemsEnd );
+    std::list<gp_XYZ> gcXYZ( theGrCentersBegin, theGrCentersEnd );
+    SetElemsData( elemsIds, gcXYZ );
+  }
   void SetPointsLabeled( bool theIsPointsLabeled, bool theIsActorVisible = true );
 
   void AddToRender     ( vtkRenderer* theRenderer );
index b8328b4a6d7236e7d55b94ecb6a4f88df62c1951..f85d5d3f756603c761d12dca51dc1dd6fba76c86 100644 (file)
@@ -33,6 +33,7 @@
 #include "SMESHDS_Mesh.hxx"
 #include "SMESHGUI.h"
 #include "SMESHGUI_FilterUtils.h"
+#include "SMESHGUI_IdPreview.h"
 #include "SMESHGUI_IdValidator.h"
 #include "SMESHGUI_SpinBox.h"
 #include "SMESHGUI_Utils.h"
@@ -2826,7 +2827,7 @@ void SMESHGUI_AddInfo::saveInfo( QTextStream &out )
   \param page specifies the dialog page to be shown at the start-up
 */
 SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
-: QDialog( parent ), myActor( 0 )
+  : QDialog( parent ), myActor( 0 )
 {
   setModal( false );
   setAttribute( Qt::WA_DeleteOnClose, true );
@@ -2835,13 +2836,13 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
 
   myTabWidget = new QTabWidget( this );
 
-  // base info 
+  // base info
 
   myBaseInfo = new SMESHGUI_MeshInfo( myTabWidget );
   myTabWidget->addTab( myBaseInfo, tr( "BASE_INFO" ) );
 
   // elem info 
-  
+
   QWidget* w = new QWidget( myTabWidget );
 
   myMode = new QButtonGroup( this );
@@ -2850,11 +2851,13 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
   myMode->button( NodeMode )->setChecked( true );
   myID = new QLineEdit( w );
   myID->setValidator( new SMESHGUI_IdValidator( this ) );
+  myIDPreviewCheck = new QCheckBox( tr( "SHOW_IDS" ), w );
+  myIDPreview = new SMESHGUI_IdPreview( SMESH::GetViewWindow( SMESHGUI::GetSMESHGUI() ));
 
   int mode = SMESHGUI::resourceMgr()->integerValue( "SMESH", "mesh_elem_info", 1 );
   mode = qMin( 1, qMax( 0, mode ) );
-  
-  if ( mode == 0 ) 
+
+  if ( mode == 0 )
     myElemInfo = new SMESHGUI_SimpleElemInfo( w );
   else
     myElemInfo = new SMESHGUI_TreeElemInfo( w );
@@ -2864,9 +2867,10 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
   elemLayout->setSpacing( SPACING );
   elemLayout->addWidget( myMode->button( NodeMode ), 0, 0 );
   elemLayout->addWidget( myMode->button( ElemMode ), 0, 1 );
-  elemLayout->addWidget( myID, 0, 2 );
-  elemLayout->addWidget( myElemInfo, 1, 0, 1, 3 );
-  
+  elemLayout->addWidget( myID,                       0, 2 );
+  elemLayout->addWidget( myIDPreviewCheck,           1, 0, 1, 2 );
+  elemLayout->addWidget( myElemInfo,                 2, 0, 1, 3 );
+
   myTabWidget->addTab( w, tr( "ELEM_INFO" ) );
 
   // additional info
@@ -2905,18 +2909,19 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
   l->addWidget( myTabWidget );
   l->addLayout( btnLayout );
 
-  myTabWidget->setCurrentIndex( qMax( (int)BaseInfo, qMin( (int)ElemInfo, page ) ) );
+  myTabWidget->setCurrentIndex( qMax( (int)BaseInfo, qMin( (int)ElemInfo, page )));
 
-  connect( okBtn,       SIGNAL( clicked() ),              this, SLOT( reject() ) );
-  connect( dumpBtn,     SIGNAL( clicked() ),              this, SLOT( dump() ) );
-  connect( helpBtn,     SIGNAL( clicked() ),              this, SLOT( help() ) );
-  connect( myTabWidget, SIGNAL( currentChanged( int  ) ), this, SLOT( updateSelection() ) );
-  connect( myMode,      SIGNAL( buttonClicked( int  ) ),  this, SLOT( modeChanged() ) );
-  connect( myID,        SIGNAL( textChanged( QString ) ), this, SLOT( idChanged() ) );
-  connect( SMESHGUI::GetSMESHGUI(),  SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ) );
-  connect( SMESHGUI::GetSMESHGUI(),  SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( reject() ) );
-  connect( myElemInfo,  SIGNAL( itemInfo( int ) ),     this, SLOT( showItemInfo( int ) ) );
-  connect( myElemInfo,  SIGNAL( itemInfo( QString ) ), this, SLOT( showItemInfo( QString ) ) );
+  connect( okBtn,       SIGNAL( clicked() ),              this, SLOT( reject() ));
+  connect( dumpBtn,     SIGNAL( clicked() ),              this, SLOT( dump() ));
+  connect( helpBtn,     SIGNAL( clicked() ),              this, SLOT( help() ));
+  connect( myTabWidget, SIGNAL( currentChanged( int  ) ), this, SLOT( updateSelection() ));
+  connect( myMode,      SIGNAL( buttonClicked( int  ) ),  this, SLOT( modeChanged() ));
+  connect( myID,        SIGNAL( textChanged( QString ) ), this, SLOT( idChanged() ));
+  connect( myIDPreviewCheck,         SIGNAL( toggled(bool) ), this, SLOT( idPreviewChange(bool) ));
+  connect( SMESHGUI::GetSMESHGUI(),  SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ));
+  connect( SMESHGUI::GetSMESHGUI(),  SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( reject() ));
+  connect( myElemInfo,  SIGNAL( itemInfo( int ) ),     this, SLOT( showItemInfo( int )));
+  connect( myElemInfo,  SIGNAL( itemInfo( QString ) ), this, SLOT( showItemInfo( QString )));
 
   updateSelection();
 }
@@ -2926,6 +2931,7 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
 */
 SMESHGUI_MeshInfoDlg::~SMESHGUI_MeshInfoDlg()
 {
+  delete myIDPreview;
 }
 
 /*!
@@ -2983,6 +2989,7 @@ void SMESHGUI_MeshInfoDlg::reject()
   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
     aViewWindow->SetSelectionMode( ActorSelection );
   QDialog::reject();
+  myIDPreview->SetPointsLabeled(false);
 }
 
 /*!
@@ -3016,7 +3023,9 @@ void SMESHGUI_MeshInfoDlg::updateSelection()
   disconnect( selMgr, 0, this, 0 );
   selMgr->clearFilters();
 
-  if ( myTabWidget->currentIndex() == BaseInfo || myTabWidget->currentIndex() == AddInfo || myTabWidget->currentIndex() == CtrlInfo ) {
+  if ( myTabWidget->currentIndex() == BaseInfo ||
+       myTabWidget->currentIndex() == AddInfo ||
+       myTabWidget->currentIndex() == CtrlInfo ) {
     SMESH::SetPointRepresentation( false );
     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
       aViewWindow->SetSelectionMode( ActorSelection );
@@ -3106,28 +3115,48 @@ void SMESHGUI_MeshInfoDlg::modeChanged()
 }
 
 /*!
-  \brief Caled when users prints mesh element ID in the corresponding field.
+  \brief Called when users prints mesh element ID in the corresponding field.
 */
 void SMESHGUI_MeshInfoDlg::idChanged()
 {
+  myIDPreview->SetPointsLabeled( false );
+
   SVTK_Selector* selector = SMESH::GetSelector();
   if ( myActor && selector ) {
     Handle(SALOME_InteractiveObject) IO = myActor->getIO();
     TColStd_MapOfInteger ID;
-    QSet<long> ids;
+    QSet<long>           ids;
+    std::vector<int>     idVec;
+    std::list< gp_XYZ >  aGrCentersXYZ;
     QStringList idTxt = myID->text().split( " ", QString::SkipEmptyParts );
     foreach ( QString tid, idTxt ) {
       long id = tid.trimmed().toLong();
-      const SMDS_MeshElement* e = myMode->checkedId() == ElemMode ? 
+      const SMDS_MeshElement* e = myMode->checkedId() == ElemMode ?
         myActor->GetObject()->GetMesh()->FindElement( id ) :
         myActor->GetObject()->GetMesh()->FindNode( id );
       if ( e ) {
         ID.Add( id );
         ids << id;
+        if ( myMode->checkedId() == ElemMode )
+        {
+          idVec.push_back( id );
+          aGrCentersXYZ.push_back( myElemInfo->getGravityCenter( e ));
+        }
       }
     }
     selector->AddOrRemoveIndex( IO, ID, false );
     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() ) {
+
+      if ( myMode->checkedId() == NodeMode )
+        myIDPreview->SetPointsData( myActor->GetObject()->GetMesh(), ID );
+      else
+        myIDPreview->SetElemsData( idVec, aGrCentersXYZ );
+
+      bool showIDs = ( !ID.IsEmpty() &&
+                       myIDPreviewCheck->isChecked() &&
+                       myTabWidget->currentIndex() == ElemInfo );
+      myIDPreview->SetPointsLabeled( showIDs, myActor->GetVisibility() );
+
       aViewWindow->highlight( IO, true, true );
       aViewWindow->Repaint();
     }
@@ -3135,6 +3164,16 @@ void SMESHGUI_MeshInfoDlg::idChanged()
   }
 }
 
+/*!
+ * \brief Show IDs clicked
+ */
+void SMESHGUI_MeshInfoDlg::idPreviewChange( bool isOn )
+{
+  myIDPreview->SetPointsLabeled( isOn && !myID->text().simplified().isEmpty() );
+  if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
+    aViewWindow->Repaint();
+}
+
 void SMESHGUI_MeshInfoDlg::showItemInfo( int id )
 {
   if ( id > 0 &&  myActor->GetObject()->GetMesh()->FindNode( id ) ) {
index 2edf2e58a42033271e1121d5b1fe1fe792cafd75..843a37f5b66ff260cf9da0c478aaa619cbf062a9 100644 (file)
 
 class QAbstractButton;
 class QButtonGroup;
+class QCheckBox;
 class QContextMenuEvent;
+class QGridLayout;
 class QLabel;
 class QLineEdit;
 class QPushButton;
 class QTabWidget;
 class QTextBrowser;
-class QGridLayout;
-class SMESH_Actor;
-class SMDS_MeshNode;
 class SMDS_MeshElement;
+class SMDS_MeshNode;
+class SMESHGUI_IdPreview;
 class SMESHGUI_SpinBox;
+class SMESH_Actor;
 
 class ExtraWidget;
 
@@ -157,6 +159,8 @@ public:
   void         clear();
   virtual void saveInfo( QTextStream &out ) = 0;
 
+  gp_XYZ       getGravityCenter( const SMDS_MeshElement* e ) { return gravityCenter(e); }
+
 protected:
   struct XYZ
   {
@@ -168,6 +172,7 @@ protected:
     double x() const  { return myX; }
     double y() const  { return myY; }
     double z() const  { return myZ; }
+    operator gp_XYZ() const { return gp_XYZ( myX, myY, myZ ); }
   };
   typedef QMap< int, QList<int> > Connectivity;
 
@@ -382,19 +387,22 @@ private slots:
   void deactivate();
   void modeChanged();
   void idChanged();
+  void idPreviewChange(bool);
   void showItemInfo( int );
   void showItemInfo( const QString& );
   void dump();
 
 private:
-  QTabWidget*        myTabWidget;
-  SMESHGUI_MeshInfo* myBaseInfo;
-  QButtonGroup*      myMode;
-  QLineEdit*         myID;
-  SMESHGUI_ElemInfo* myElemInfo;   
-  SMESHGUI_AddInfo*  myAddInfo;
-  SMESHGUI_CtrlInfo* myCtrlInfo;
-  SMESH_Actor*       myActor;
+  QTabWidget*                      myTabWidget;
+  SMESHGUI_MeshInfo*               myBaseInfo;
+  QButtonGroup*                    myMode;
+  QLineEdit*                       myID;
+  QCheckBox*                       myIDPreviewCheck;
+  SMESHGUI_IdPreview*              myIDPreview;
+  SMESHGUI_ElemInfo*               myElemInfo;   
+  SMESHGUI_AddInfo*                myAddInfo;
+  SMESHGUI_CtrlInfo*               myCtrlInfo;
+  SMESH_Actor*                     myActor;
   Handle(SALOME_InteractiveObject) myIO;
 };
 
index 2cf05756e7480781cc7be8c15a5fabcb9d9a35b0..b6976df864921b7e5219e1bf10c74d7c794b9f9a 100644 (file)
@@ -120,7 +120,8 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
   if      ( p=="client" )               val = QVariant( LightApp_Selection::parameter( p ) );
   else if ( p=="type" )                 val = QVariant( myTypes[ind] );
   else if ( p=="hasActor" )             val = QVariant( getActor( ind ) != 0 );
-  else if ( p=="elemTypes" )            val = QVariant( elemTypes( ind ) );
+  else if ( p=="elemTypes" )            val = QVariant( elemTypes( ind, false ) );
+  else if ( p=="objElemTypes" )         val = QVariant( elemTypes( ind, true ) );
   else if ( p=="isAutoColor" )          val = QVariant( isAutoColor( ind ) );
   else if ( p=="numberOfNodes" )        val = QVariant( numberOfNodes( ind ) );
   else if ( p=="dim" )                  val = QVariant( dim( ind ) );
@@ -168,7 +169,7 @@ QVariant SMESHGUI_Selection::parameter( const QString& p ) const
 
 //=======================================================================
 //function : getVtkOwner
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 SMESH_Actor* SMESHGUI_Selection::getActor( int ind ) const
@@ -184,18 +185,42 @@ SMESH_Actor* SMESHGUI_Selection::getActor( int ind ) const
 //purpose  : may return {'Elem0d' 'Edge' 'Face' 'Volume' 'BallElem'} at most
 //=======================================================================
 
-QList<QVariant> SMESHGUI_Selection::elemTypes( int ind ) const
+QList<QVariant> SMESHGUI_Selection::elemTypes( int ind, bool fromObj ) const
 {
   QList<QVariant> types;
   SMESH_Actor* actor = getActor( ind );
   if ( actor ) {
     TVisualObjPtr object = actor->GetObject();
     if ( object ) {
-      if ( object->GetNbEntities( SMDSAbs_0DElement )) types.append( "Elem0d" );
-      if ( object->GetNbEntities( SMDSAbs_Ball ))      types.append( "BallElem" );
       if ( object->GetNbEntities( SMDSAbs_Edge ))      types.append( "Edge" );
       if ( object->GetNbEntities( SMDSAbs_Face ))      types.append( "Face" );
       if ( object->GetNbEntities( SMDSAbs_Volume ))    types.append( "Volume" );
+      if ( object->GetNbEntities( SMDSAbs_0DElement )) types.append( "Elem0d" );
+      if ( object->GetNbEntities( SMDSAbs_Ball ))      types.append( "BallElem" );
+    }
+  }
+  else if ( fromObj )
+  {
+    if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
+    {
+      _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
+      CORBA::Object_var obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() );
+      SMESH::SMESH_IDSource_var idSrc = SMESH::SMESH_IDSource::_narrow( obj );
+      if ( !CORBA::is_nil( idSrc ) )
+      {
+        SMESH::array_of_ElementType_var typeVar = idSrc->GetTypes();
+        for ( CORBA::ULong i = 0; i < typeVar->length(); ++i )
+          switch ( typeVar[i] ) {
+          case SMESH::EDGE:   types.append( "Edge" );     break;
+          case SMESH::FACE:   types.append( "Face" );     break;
+          case SMESH::VOLUME: types.append( "Volume" );   break;
+          case SMESH::ELEM0D: types.append( "Elem0d" );   break;
+          case SMESH::BALL:   types.append( "BallElem" ); break;
+          case SMESH::ALL:
+          case SMESH::NODE:
+          case SMESH::NB_ELEMENT_TYPES: break;
+          }
+      }
     }
   }
   return types;
@@ -439,13 +464,10 @@ bool SMESHGUI_Selection::isAutoColor( int ind ) const
   if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
   {
     _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
-    CORBA::Object_var obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() );
-
-    if ( !CORBA::is_nil( obj ) ) {
-      SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
-      if ( !CORBA::is_nil( mesh ) )
-        return mesh->GetAutoColor();
-    }
+    CORBA::Object_var      obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() );
+    SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
+    if ( !CORBA::is_nil( mesh ) )
+      return mesh->GetAutoColor();
   }
   return false;
 }
index 5847126f746d57ddcd01a7a562d0b5122b104ef0..71690c7137dfbe63f99ccda2ab828ed6a1502ea6 100644 (file)
@@ -71,8 +71,8 @@ public:
   virtual int             nbChildren( int ) const;
   virtual bool            isContainer( int ) const;
 
-  // parameters got from actor return nothing if an actor is not visible
-  virtual QList<QVariant> elemTypes( int ) const;
+  // parameters got from actor, return nothing if an actor is not visible
+  virtual QList<QVariant> elemTypes( int, bool ) const; // == objElemTypes w/o actor
   virtual QList<QVariant> labeledTypes( int ) const;
   virtual QString         displayMode( int ) const;
   virtual QString         shrinkMode( int ) const;
index ec5537169aa316a1538b9125f80885d8110c8155..c3d9d8579e8f763d0418b3744dcba39d8461104b 100644 (file)
@@ -7422,6 +7422,10 @@ as they are of improper type:
         <source>ELEM_MODE</source>
         <translation>Element</translation>
     </message>
+    <message>
+        <source>SHOW_IDS</source>
+        <translation>Show IDs</translation>
+    </message>
     <message>
         <source>BUT_DUMP_MESH</source>
         <translation>&amp;Dump</translation>
index 1112eb973a4cc1c02af7ad606ac63e91d9464735..464a068138ef58aabab7c41531706e893e55bf43 100644 (file)
@@ -459,6 +459,7 @@ struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher
       _ebbTree[i] = NULL;
       _ebbTreeHeight[i] = -1;
     }
+    _elementType = SMDSAbs_All;
   }
   virtual ~SMESH_ElementSearcherImpl()
   {
@@ -878,10 +879,10 @@ SMESH_ElementSearcherImpl::FindClosestTo( const gp_Pnt&       point,
 
 TopAbs_State SMESH_ElementSearcherImpl::GetPointState(const gp_Pnt& point)
 {
-  double tolerance = getTolerance();
-
   _elementType = SMDSAbs_Face;
 
+  double tolerance = getTolerance();
+
   ElementBndBoxTree*& ebbTree = _ebbTree[ SMDSAbs_Face ];
   if ( !ebbTree )
     ebbTree = new ElementBndBoxTree( *_mesh, _elementType, _meshPartIt );
index f289a5fe7ed72eebc569d9026d39fcc631b1ccfd..748d4baafe5145d961f42ee6617c462670c1d5df 100644 (file)
@@ -1469,7 +1469,7 @@ class Mesh:
                     errText = "code %s" % -err.code
                 if errText: errText += ". "
                 errText += err.comment
-                if allReasons != "":allReasons += "\n"
+                if allReasonsallReasons += "\n"
                 if ok:
                     allReasons += '-  "%s"%s - %s' %(err.algoName, shapeText, errText)
                 else:
@@ -1507,7 +1507,7 @@ class Mesh:
                     reason = ("For unknown reason. "
                               "Developer, revise Mesh.Compute() implementation in smeshBuilder.py!")
                     pass
-                if allReasons != "":allReasons += "\n"
+                if allReasonsallReasons += "\n"
                 allReasons += "-  " + reason
                 pass
             if not ok or allReasons != "":
index f84fc5b5e791102a8d181afa598a336bcce75639..e977252e69bcc2b45915789ac52763edfca381bf 100644 (file)
@@ -445,6 +445,7 @@ namespace VISCOUS_3D
     bool Is   ( int flag ) const { return _flags & flag; }
     void Set  ( int flag ) { _flags |= flag; }
     void Unset( int flag ) { _flags &= ~flag; }
+    std::string DumpFlags() const; // debug
 
     void SetNewLength( double len, _EdgesOnShape& eos, SMESH_MesherHelper& helper );
     bool SetNewLength2d( Handle(Geom_Surface)& surface,
@@ -9199,10 +9200,48 @@ void _LayerEdge::SmoothPos( const vector< double >& segLen, const double tol )
 
 //================================================================================
 /*!
- * \brief Create layers of prisms
+ * \brief Print flags
  */
 //================================================================================
 
+std::string _LayerEdge::DumpFlags() const
+{
+  SMESH_Comment dump;
+  for ( int flag = 1; flag < 0x1000000; flag *= 2 )
+    if ( _flags & flag )
+    {
+      EFlags f = (EFlags) flag;
+      switch ( f ) {
+      case TO_SMOOTH:       dump << "TO_SMOOTH";       break;
+      case MOVED:           dump << "MOVED";           break;
+      case SMOOTHED:        dump << "SMOOTHED";        break;
+      case DIFFICULT:       dump << "DIFFICULT";       break;
+      case ON_CONCAVE_FACE: dump << "ON_CONCAVE_FACE"; break;
+      case BLOCKED:         dump << "BLOCKED";         break;
+      case INTERSECTED:     dump << "INTERSECTED";     break;
+      case NORMAL_UPDATED:  dump << "NORMAL_UPDATED";  break;
+      case MARKED:          dump << "MARKED";          break;
+      case MULTI_NORMAL:    dump << "MULTI_NORMAL";    break;
+      case NEAR_BOUNDARY:   dump << "NEAR_BOUNDARY";   break;
+      case SMOOTHED_C1:     dump << "SMOOTHED_C1";     break;
+      case DISTORTED:       dump << "DISTORTED";       break;
+      case RISKY_SWOL:      dump << "RISKY_SWOL";      break;
+      case SHRUNK:          dump << "SHRUNK";          break;
+      case UNUSED_FLAG:     dump << "UNUSED_FLAG";     break;
+      }
+      dump << " ";
+    }
+  cout << dump << endl;
+  return dump;
+}
+
+//================================================================================
+/*!
+  case brief:
+  default:
+*/
+//================================================================================
+
 bool _ViscousBuilder::refine(_SolidData& data)
 {
   SMESH_MesherHelper& helper = data.GetHelper();