Salome HOME
0022362: EDF SMESH: Quadrangle (mapping) algorithm: enforced vortices
authoreap <eap@opencascade.com>
Fri, 14 Feb 2014 11:53:14 +0000 (15:53 +0400)
committereap <eap@opencascade.com>
Fri, 14 Feb 2014 11:53:14 +0000 (15:53 +0400)
  Create GUI

doc/salome/gui/SMESH/images/hypo_quad_params_dialog.png
doc/salome/gui/SMESH/images/hypo_quad_params_dialog_enf.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/hypo_quad_params_dialog_vert.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/hypo_quad_params_enfnodes_algo.png [new file with mode: 0755]
doc/salome/gui/SMESH/input/2d_meshing_hypo.doc
src/SMESHGUI/SMESH_msg_en.ts
src/StdMeshers/StdMeshers_Quadrangle_2D.cxx
src/StdMeshersGUI/StdMeshersGUI_QuadrangleParamWdg.cxx
src/StdMeshersGUI/StdMeshersGUI_QuadrangleParamWdg.h
src/StdMeshersGUI/StdMeshers_msg_en.ts

index 3cd442a8d4317a1b4defb0151b3ff6ded3b00dcb..62dc9f41534af164fa62659434f387e5369566fb 100644 (file)
Binary files a/doc/salome/gui/SMESH/images/hypo_quad_params_dialog.png and b/doc/salome/gui/SMESH/images/hypo_quad_params_dialog.png differ
diff --git a/doc/salome/gui/SMESH/images/hypo_quad_params_dialog_enf.png b/doc/salome/gui/SMESH/images/hypo_quad_params_dialog_enf.png
new file mode 100644 (file)
index 0000000..a3e7cfa
Binary files /dev/null and b/doc/salome/gui/SMESH/images/hypo_quad_params_dialog_enf.png differ
diff --git a/doc/salome/gui/SMESH/images/hypo_quad_params_dialog_vert.png b/doc/salome/gui/SMESH/images/hypo_quad_params_dialog_vert.png
new file mode 100644 (file)
index 0000000..5c75853
Binary files /dev/null and b/doc/salome/gui/SMESH/images/hypo_quad_params_dialog_vert.png differ
diff --git a/doc/salome/gui/SMESH/images/hypo_quad_params_enfnodes_algo.png b/doc/salome/gui/SMESH/images/hypo_quad_params_enfnodes_algo.png
new file mode 100755 (executable)
index 0000000..adddf84
Binary files /dev/null and b/doc/salome/gui/SMESH/images/hypo_quad_params_enfnodes_algo.png differ
index 38efc810cf3624f94b4f49be8819119d7d5a93c9..e019c8b87ff3c96bc64f282dc329f8b3395aab1b 100644 (file)
@@ -38,32 +38,12 @@ of a given face.
 
 \image html hypo_quad_params_dialog.png "Quadrangle parameters creation/edition dialog"
 
 
 \image html hypo_quad_params_dialog.png "Quadrangle parameters creation/edition dialog"
 
-<b>Quadrangle parameters</b> is a hypothesis for Quadrangle (Mapping).
+<b>Quadrangle parameters</b> is a hypothesis for Quadrangle (Mapping) algorithm.
 
 
-<b>Base vertex</b> parameter allows using Quadrangle (Mapping)
-algorithm for meshing of trilateral faces. In this case it is
-necessary to select the vertex, which will be used as the fourth edge
-(degenerated).
-
-\image html hypo_quad_params_1.png "A face built from 3 edges"
-
-\image html hypo_quad_params_res.png "The resulting mesh"
-
-This parameter can be also used to mesh a segment of a circular face.
-Please, consider that there is a limitation on the selection of the
-vertex for the faces built with the angle > 180 degrees (see the picture).
-
-\image html hypo_quad_params_2.png "3/4 of a circular face"
-
-In this case, selection of a wrong vertex for the <b>Base vertex</b>
-parameter will generate a wrong mesh. The picture below
-shows the good (left) and the bad (right) results of meshing.
-
-\image html hypo_quad_params_res_2.png "The resulting meshes"
-
-<b>Type</b> parameter is used on faces with a different number of
-segments on opposite sides to define the algorithm of transition
-between them. The following types are available:
+<b>Transition</b> tab is used to define the algorithm of transition
+between opposite sides of faces with a different number of
+segments on opposite sides. The following types of transition
+algorithms are available:
 
 - <b>Standard</b> is the default case, when both triangles and quadrangles
   are possible in the transition area along the finer meshed sides.
 
 - <b>Standard</b> is the default case, when both triangles and quadrangles
   are possible in the transition area along the finer meshed sides.
@@ -92,7 +72,65 @@ between them. The following types are available:
   to Nmin segments is log<sub>3</sub>( Nmax / Nmin ). The number of
   face rows is equal to the number of segments on each of equally
   discretized sides.
   to Nmin segments is log<sub>3</sub>( Nmax / Nmin ). The number of
   face rows is equal to the number of segments on each of equally
   discretized sides.
-  \image html reduce_three_to_one.png "The fastest transition pattern: 3 to 1"
+
+\image html reduce_three_to_one.png "The fastest transition pattern: 3 to 1"
+
+<b>Base vertex</b> tab allows using Quadrangle (Mapping)
+algorithm for meshing of trilateral faces. In this case it is
+necessary to select the vertex, which will be used as the fourth edge
+(degenerated).
+
+\image html hypo_quad_params_dialog_vert.png "Base Vertex tab of Quadrangle parameters creation/edition dialog"
+
+\image html hypo_quad_params_1.png "A face built from 3 edges"
+
+\image html hypo_quad_params_res.png "The resulting mesh"
+
+This parameter can be also used to mesh a segment of a circular face.
+Please, consider that there is a limitation on the selection of the
+vertex for the faces built with the angle > 180 degrees (see the picture).
+
+\image html hypo_quad_params_2.png "3/4 of a circular face"
+
+In this case, selection of a wrong vertex for the <b>Base vertex</b>
+parameter will generate a wrong mesh. The picture below
+shows the good (left) and the bad (right) results of meshing.
+
+\image html hypo_quad_params_res_2.png "The resulting meshes"
+
+\image html hypo_quad_params_dialog_enf.png "Enforced nodes tab of Quadrangle parameters creation/edition dialog"
+
+<b>Enforced nodes</b> tab allows for defining points where the
+algorithm should create nodes. There are two ways to define positions
+of the enforced nodes.
+<ul>
+  <li>\b Vertices group allows to set up shapes whose vertices will
+    define positions of the enforced nodes. Only vertices successfully
+    projected to the meshed face and located close enough to the
+    meshed face will be used to create the enforced nodes.</li>
+  <li> \b Points group allows to explicitly define coordinates of
+    points used to create the enforced nodes. Only points successfully
+    projected to the meshed face and located close enough to the
+    meshed face will be used to create the enforced nodes.</li>
+</ul>
+Algorithm of creation of the enforced nodes is following.
+
+\image html hypo_quad_params_enfnodes_algo.png "Steps of the algorithm of creation of the enforced nodes"
+<ol>
+  <li> Left image: Positions of nodes are computed without taking into
+  account the enforced vertex (yellow point).</li> 
+  <li> Middle image: A node closest to the enforced vertex is
+    detected. Extreme nodes of the row and column of the detected node
+    are used to create virtual edges (yellow lines) ending at the
+    enforced vertex. </li>
+  <li> Right image: The meshed face is thus divided by the virtual
+    edges into four quadrilateral sub-domains each of which is meshed
+    as usually: the nodes of the row and column of detected node are
+    moved to the virtual edges and the quadrilateral elements are
+    constructed. 
+</ol>
+If there are several enforced vertices, the algorithm is applied
+recursively to the formed sub-domains.
 
 <b>See Also</b> a sample TUI Script of a 
 \ref tui_quadrangle_parameters "Quadrangle Parameters" hypothesis.
 
 <b>See Also</b> a sample TUI Script of a 
 \ref tui_quadrangle_parameters "Quadrangle Parameters" hypothesis.
index 8bb38cd7cc985f279996a10884a5287366830b6f..4f87f5cf5528ea2564959a42982dce4d46583b04 100644 (file)
@@ -6002,10 +6002,15 @@ Please specify them and try again</translation>
         <translation>No sense in creating a submesh ignored by global algorithm &quot;%1&quot;</translation>
     </message>
     <message>
         <translation>No sense in creating a submesh ignored by global algorithm &quot;%1&quot;</translation>
     </message>
     <message>
-        <source>GEOMETRY_OBJECT_IS_NOT_DEFINED</source>
+        <source>GEOMETRY_OBJECT_IS_NOT_DEFINED_MESH</source>
         <translation>Geometry object is not defined.
 Do you want to create an empty mesh 
 without algorithms and hypotheses? </translation>
         <translation>Geometry object is not defined.
 Do you want to create an empty mesh 
 without algorithms and hypotheses? </translation>
+    </message>
+    <message>
+        <source>GEOMETRY_OBJECT_IS_NOT_DEFINED_SUBMESH</source>
+        <translation>Geometry object is not defined.
+Please specify it and try again</translation>
     </message>
     <message>
         <source>GEOMETRY_OBJECT_IS_NULL</source>
     </message>
     <message>
         <source>GEOMETRY_OBJECT_IS_NULL</source>
@@ -6071,6 +6076,14 @@ Please enter valid name and try again</translation>
         <translation>There is no object for editing. Please
 select mesh or sub-mesh and try again</translation>
     </message>
         <translation>There is no object for editing. Please
 select mesh or sub-mesh and try again</translation>
     </message>
+    <message>
+        <source>CONCURRENT_SUBMESH_APPEARS</source>
+        <translation> 
+The assigned algorithm has the same priority as one assigned to an 
+adjacent sub-mesh, hence it's undefined which algorithm to use for
+meshing boundary shared by two sub-meshes. Would you like to set
+the order of sub-mesh computation? </translation>
+    </message>
 </context>
 <context>
     <name>SMESHGUI_MeshPatternDlg</name>
 </context>
 <context>
     <name>SMESHGUI_MeshPatternDlg</name>
@@ -6233,6 +6246,14 @@ It is impossible to read point coordinates from file</translation>
         <source>NONE</source>
         <translation>&lt;None&gt;</translation>
     </message>
         <source>NONE</source>
         <translation>&lt;None&gt;</translation>
     </message>
+    <message>
+        <source>DEFAULT</source>
+        <translation>&lt;Default&gt;</translation>
+    </message>
+    <message>
+        <source>SELECT</source>
+        <translation>&lt;Select&gt;</translation>
+    </message>
 </context>
 <context>
     <name>SMESHGUI_MultiEditDlg</name>
 </context>
 <context>
     <name>SMESHGUI_MultiEditDlg</name>
index fd0cdb6ca1995b86efa725ac046f77a565c4f7e6..2c4ce511f85a4809e4655ea013fa982421ef4031 100644 (file)
 #include "StdMeshers_QuadrangleParams.hxx"
 #include "StdMeshers_ViscousLayers2D.hxx"
 
 #include "StdMeshers_QuadrangleParams.hxx"
 #include "StdMeshers_ViscousLayers2D.hxx"
 
+#include <BRepBndLib.hxx>
 #include <BRepClass_FaceClassifier.hxx>
 #include <BRep_Tool.hxx>
 #include <BRepClass_FaceClassifier.hxx>
 #include <BRep_Tool.hxx>
+#include <Bnd_Box.hxx>
 #include <GeomAPI_ProjectPointOnSurf.hxx>
 #include <Geom_Surface.hxx>
 #include <NCollection_DefineArray2.hxx>
 #include <GeomAPI_ProjectPointOnSurf.hxx>
 #include <Geom_Surface.hxx>
 #include <NCollection_DefineArray2.hxx>
@@ -3736,6 +3738,8 @@ void StdMeshers_Quadrangle_2D::smooth (FaceQuadStruct::Ptr quad)
 
   // Get nodes to smooth
 
 
   // Get nodes to smooth
 
+  // TODO: do not smooth fixed nodes
+
   typedef map< const SMDS_MeshNode*, TSmoothNode, TIDCompare > TNo2SmooNoMap;
   TNo2SmooNoMap smooNoMap;
 
   typedef map< const SMDS_MeshNode*, TSmoothNode, TIDCompare > TNo2SmooNoMap;
   TNo2SmooNoMap smooNoMap;
 
@@ -4205,6 +4209,9 @@ bool StdMeshers_Quadrangle_2D::getEnforcedUV()
   surf->Bounds( u1,u2,v1,v2 );
   GeomAPI_ProjectPointOnSurf project;
   project.Init(surf, u1,u2, v1,v2, tol );
   surf->Bounds( u1,u2,v1,v2 );
   GeomAPI_ProjectPointOnSurf project;
   project.Init(surf, u1,u2, v1,v2, tol );
+  Bnd_Box bbox;
+  BRepBndLib::Add( face, bbox );
+  double farTol = 0.01 * sqrt( bbox.SquareExtent() );
 
   for ( size_t iP = 0; iP < points.size(); ++iP )
   {
 
   for ( size_t iP = 0; iP < points.size(); ++iP )
   {
@@ -4217,7 +4224,7 @@ bool StdMeshers_Quadrangle_2D::getEnforcedUV()
            << points[ iP ].X() << ", "<< points[ iP ].Y() << ", "<< points[ iP ].Z() << " )");
       continue;
     }
            << points[ iP ].X() << ", "<< points[ iP ].Y() << ", "<< points[ iP ].Z() << " )");
       continue;
     }
-    if ( project.LowerDistance() > tol*1000 )
+    if ( project.LowerDistance() > farTol )
     {
       if ( isStrictCheck && iP < nbPoints )
         return error
     {
       if ( isStrictCheck && iP < nbPoints )
         return error
index bbde9200ced6819239079f1991f5b01f5b1ba0b6..4d98ef2b91f00e23ef35d145373a9fef092f5cd7 100644 (file)
 #include "StdMeshersGUI_QuadrangleParamWdg.h"
 
 #include "SMESHGUI.h"
 #include "StdMeshersGUI_QuadrangleParamWdg.h"
 
 #include "SMESHGUI.h"
+#include "SMESHGUI_SpinBox.h"
+#include "StdMeshersGUI_SubShapeSelectorWdg.h"
 
 
-#include "SUIT_ResourceMgr.h"
+#include <GEOMBase.h>
+#include <LightApp_SelectionMgr.h>
+#include <SALOME_ListIO.hxx>
+#include <SALOME_ListIteratorOfListIO.hxx>
+#include <SUIT_ResourceMgr.h>
 
 // Qt includes
 #include <QButtonGroup>
 
 // Qt includes
 #include <QButtonGroup>
-#include <QRadioButton>
-#include <QLabel>
+#include <QFrame>
 #include <QGridLayout>
 #include <QGridLayout>
+#include <QGroupBox>
+#include <QLabel>
+#include <QLineEdit>
+#include <QListWidget>
+#include <QListWidgetItem>
+#include <QPushButton>
+#include <QRadioButton>
+#include <QTreeWidget>
+#include <QVBoxLayout>
 
 // IDL includes
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(SMESH_BasicHypothesis)
 
 // IDL includes
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(SMESH_BasicHypothesis)
+#include CORBA_CLIENT_HEADER(GEOM_Gen)
+
 
 #define SPACING 6
 
 #define SPACING 6
-#define MARGIN 0
+#define MARGIN 11
+
+enum { TAB_TRANSITION, TAB_VERTEX, TAB_ENF_POINTS };
+
+//================================================================================
+// function : Constructor
+// purpose  :
+//================================================================================
+
+StdMeshersGUI_QuadrangleParamCreator::StdMeshersGUI_QuadrangleParamCreator(const QString& aHypType)
+  : StdMeshersGUI_StdHypothesisCreator( aHypType )
+{
+}
+
+//=======================================================================
+//function : helpPage
+//purpose  : 
+//=======================================================================
+
+QString  StdMeshersGUI_QuadrangleParamCreator::helpPage() const
+{
+  return "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
+}
+
+//=======================================================================
+//function : buildFrame
+//purpose  :
+//=======================================================================
+
+QFrame*  StdMeshersGUI_QuadrangleParamCreator::buildFrame()
+{
+  QFrame* fr = new QFrame();
+
+  QGridLayout* lay = new QGridLayout( fr );
+  lay->setMargin( MARGIN );
+  lay->setSpacing( SPACING );
+  int row = 0;
+
+  myName = 0;
+  if ( isCreation() )
+  {
+    myName = new QLineEdit( fr );
+    QLabel* nameLab = new QLabel( tr("SMESH_NAME"));
+    lay->addWidget( nameLab, row, 0 );
+    lay->addWidget( myName,  row, 1 );
+    ++row;
+  }
+
+  // Transition type
+
+  myTypeWdg = new StdMeshersGUI_QuadrangleParamWdg( fr );
+
+  // Vertexes
+
+  myVertexSelWdg = new StdMeshersGUI_SubShapeSelectorWdg( fr, TopAbs_VERTEX );
+  myVertexSelWdg->layout()->setMargin( MARGIN );
+
+  // Enforced Points
+
+  QWidget* pointsFrame = new QWidget( fr );
+  QVBoxLayout* pointsLay = new QVBoxLayout( pointsFrame );
+  pointsLay->setMargin(MARGIN);
+  pointsLay->setSpacing(SPACING);
+
+  // shapes
+  QGroupBox* shapesGroup = new QGroupBox( tr("SHAPES"), pointsFrame );
+  myShapesList = new QListWidget( shapesGroup );
+  myAddShapeBut = new QPushButton( tr("SMESH_BUT_ADD"), shapesGroup );
+  QPushButton* remShapeBut = new QPushButton( tr("SMESH_BUT_REMOVE"), shapesGroup );
+  //
+  QGridLayout* shapesLay = new QGridLayout( shapesGroup );
+  shapesLay->setMargin(MARGIN);
+  shapesLay->setSpacing(SPACING);
+  shapesLay->addWidget( myShapesList,  0, 0, 3, 2 );
+  shapesLay->addWidget( myAddShapeBut, 0, 2 );
+  shapesLay->addWidget( remShapeBut,   1, 2 );
+  shapesLay->setColumnStretch( 0, 1 );
+  shapesLay->setRowStretch   ( 2, 1 );
+
+  // coords
+  QGroupBox* coordsGroup = new QGroupBox( tr("POINTS"), pointsFrame );
+  myCoordsTreeWdg = new QTreeWidget( coordsGroup );
+  myCoordsTreeWdg->setColumnCount ( 3 );
+  myCoordsTreeWdg->setHeaderLabels( QStringList() << "X" << "Y" << "Z" );
+  myCoordsTreeWdg->setItemDelegate( new ItemDelegate( myCoordsTreeWdg ));
+  QPushButton* addCoordBut = new QPushButton( tr("SMESH_BUT_ADD"), coordsGroup );
+  QPushButton* remCoordBut = new QPushButton( tr("SMESH_BUT_REMOVE"), coordsGroup );
+  //
+  QGridLayout* coordsLay = new QGridLayout( coordsGroup );
+  coordsLay->setMargin(MARGIN);
+  coordsLay->setSpacing(SPACING);
+  coordsLay->addWidget( myCoordsTreeWdg, 0, 0, 3, 2 );
+  coordsLay->addWidget( addCoordBut,     0, 2 );
+  coordsLay->addWidget( remCoordBut,     1, 2 );
+  coordsLay->setColumnStretch( 0, 1 );
+  coordsLay->setRowStretch   ( 2, 1 );
+
+  pointsLay->addWidget( shapesGroup );
+  pointsLay->addWidget( coordsGroup );
+
+  // Tabs
+  myTabs = new QTabWidget( fr );
+  myTabs->addTab( myTypeWdg,      tr("TRANSITION"));
+  myTabs->addTab( myVertexSelWdg, tr("SMESH_BASE_VERTEX"));
+  myTabs->addTab( pointsFrame,    tr("ENF_NODES"));
+
+  lay->addWidget( myTabs, row, 0, 2, 3 );
+
+  // signals
+  connect( myTypeWdg,     SIGNAL( typeChanged(int)),   SLOT( onTypeChanged(int)));
+  connect( myAddShapeBut, SIGNAL( clicked()),          SLOT( onAddShape() ));
+  connect( remShapeBut,   SIGNAL( clicked()),          SLOT( onRemoveShape() ));
+  connect( addCoordBut,   SIGNAL( clicked()),          SLOT( onAddPoint() ));
+  connect( remCoordBut,   SIGNAL( clicked()),          SLOT( onRemovePoint() ));
+  connect( myTabs,        SIGNAL( currentChanged(int)),SLOT( onTabChanged(int)));
+
+  LightApp_SelectionMgr* selMgr = SMESHGUI::GetSMESHGUI()->selectionMgr();
+  connect( selMgr, SIGNAL(currentSelectionChanged()), SLOT( onSelectionChanged()));
+
+  return fr;
+}
+
+//=======================================================================
+//function : retrieveParams
+//purpose  :
+//=======================================================================
+
+void StdMeshersGUI_QuadrangleParamCreator::retrieveParams() const
+{
+  StdMeshers::StdMeshers_QuadrangleParams_var h =
+    StdMeshers::StdMeshers_QuadrangleParams::_narrow( initParamsHypothesis() );
+
+  // name
+  if( myName )
+    myName->setText( hypName() );
+
+  // main shape
+  myVertexSelWdg->SetMaxSize(1);
+  QString anEntry    = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
+  QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
+  if ( anEntry.isEmpty() )
+    anEntry = h->GetObjectEntry();
+  myVertexSelWdg->SetGeomShapeEntry(anEntry);
+  myVertexSelWdg->SetMainShapeEntry(aMainEntry);
+
+  if ( !isCreation())
+  {
+    // type
+    myTypeWdg->SetType(int(h->GetQuadType()));
+
+    // vertex
+    int vertID = h->GetTriaVertex();
+    if (vertID > 0) {
+      SMESH::long_array_var aVec = new SMESH::long_array;
+      aVec->length(1);
+      aVec[0] = vertID;
+      myVertexSelWdg->SetListOfIDs(aVec);
+    }
+
+    // enforced nodes
+    GEOM::ListOfGO_var     shapes;
+    SMESH::nodes_array_var points;
+    h->GetEnforcedNodes( shapes, points );
+    for ( int i = 0; i < shapes->length(); ++i )
+    {
+      CORBA::String_var name  = shapes[i]->GetName();
+      CORBA::String_var entry = shapes[i]->GetStudyEntry();
+      QListWidgetItem* item = new QListWidgetItem( name.in() );
+      item->setData( Qt::UserRole, entry.in() );
+      myShapesList->addItem( item );
+    }
+    for ( int i = 0; i < points->length(); ++i )
+    {
+      QTreeWidgetItem* item = new QTreeWidgetItem
+        ( QStringList()
+          << QString::number( points[i].x )
+          << QString::number( points[i].y )
+          << QString::number( points[i].z ));
+      item->setFlags( item->flags() | Qt::ItemIsEditable );
+      myCoordsTreeWdg->addTopLevelItem( item );
+    }
+  }
+  ((StdMeshersGUI_QuadrangleParamCreator*) this)->onSelectionChanged();
+}
+
+//=======================================================================
+//function : storeParams
+//purpose  :
+//=======================================================================
+
+QString  StdMeshersGUI_QuadrangleParamCreator::storeParams() const
+{
+  StdMeshers::StdMeshers_QuadrangleParams_var h =
+    StdMeshers::StdMeshers_QuadrangleParams::_narrow( hypothesis() );
+
+  // name
+  if( myName )
+    SMESH::SetName( SMESH::FindSObject( h ), myName->text().toLatin1().constData() );
+
+  // transition
+  h->SetQuadType( StdMeshers::QuadType( myTypeWdg->GetType()) );
+
+  // vertex
+  if ( myVertexSelWdg->GetListSize() > 0 )
+  {
+    h->SetTriaVertex( myVertexSelWdg->GetListOfIDs()[0] ); // getlist must be called once
+    h->SetObjectEntry( myVertexSelWdg->GetMainShapeEntry() );
+  }
+  else
+  {
+    h->SetTriaVertex( -1 );
+  }
+
+  // enfored nodes
+
+  GEOM::ListOfGO_var goList = new GEOM::ListOfGO;
+  int nbShapes = 0;
+  goList->length( myShapesList->count() );
+  for ( int i = 0; i < myShapesList->count(); ++i )
+  {
+    QListWidgetItem* item = myShapesList->item(i);
+    QString         entry = item->data( Qt::UserRole ).toString();
+    Handle(SALOME_InteractiveObject) io =
+      new SALOME_InteractiveObject( entry.toStdString().c_str(), "GEOM" );
+    GEOM::GEOM_Object_var go = GEOMBase::ConvertIOinGEOMObject( io );
+    if ( !go->_is_nil() )
+      goList[ nbShapes++ ] = go;
+  }
+  goList->length( nbShapes );
+  
+  SMESH::nodes_array_var points = new SMESH::nodes_array;
+  points->length( myCoordsTreeWdg->topLevelItemCount() );
+  for ( int i = 0; i < myCoordsTreeWdg->topLevelItemCount(); ++i )
+  {
+    QTreeWidgetItem* item = myCoordsTreeWdg->topLevelItem( i );
+    points[i].x = item->text(0).toInt();
+    points[i].y = item->text(1).toInt();
+    points[i].z = item->text(2).toInt();
+  }
+  h->SetEnforcedNodes( goList, points );
+
+  return "";
+}
+
+//=======================================================================
+//function : onTypeChanged
+//purpose  :
+//=======================================================================
+
+void StdMeshersGUI_QuadrangleParamCreator::onTypeChanged(int type)
+{
+  myTabs->setTabEnabled( TAB_ENF_POINTS, ( type != StdMeshers::QUAD_REDUCED ));
+}
+
+//=======================================================================
+//function : onAddShape
+//purpose  : 
+//=======================================================================
+
+void StdMeshersGUI_QuadrangleParamCreator::onAddShape()
+{
+  if ( !mySelectedShapeIO.IsNull() )
+  {
+    QListWidgetItem* item = new QListWidgetItem( mySelectedShapeIO->getName() );
+    item->setData( Qt::UserRole, mySelectedShapeIO->getEntry() );
+    myShapesList->addItem( item );
+    mySelectedShapeIO.Nullify();
+    myAddShapeBut->setEnabled( false );
+  }
+}
+
+//=======================================================================
+//function : onRemoveShape
+//purpose  : 
+//=======================================================================
+
+void StdMeshersGUI_QuadrangleParamCreator::onRemoveShape()
+{
+  if ( QListWidgetItem * item = myShapesList->currentItem() )
+    delete item;
+  onSelectionChanged();
+}
+
+//=======================================================================
+//function : onAddPoint
+//purpose  : 
+//=======================================================================
+
+void StdMeshersGUI_QuadrangleParamCreator::onAddPoint()
+{
+  QTreeWidgetItem* item = new QTreeWidgetItem( QStringList() << "0" << "0" << "0" );
+  item->setFlags( item->flags() | Qt::ItemIsEditable );
+  myCoordsTreeWdg->addTopLevelItem( item );
+}
+
+//=======================================================================
+//function : onRemovePoint
+//purpose  :
+//=======================================================================
+
+void StdMeshersGUI_QuadrangleParamCreator::onRemovePoint()
+{
+  if ( myCoordsTreeWdg->topLevelItemCount() )
+    delete myCoordsTreeWdg->currentItem();
+}
+
+//=======================================================================
+//function : onSelectionChanged
+//purpose  : 
+//=======================================================================
+
+void StdMeshersGUI_QuadrangleParamCreator::onSelectionChanged()
+{
+  mySelectedShapeIO.Nullify();
+
+  // find a sole selected geometry
+  LightApp_SelectionMgr* selMgr = SMESHGUI::GetSMESHGUI()->selectionMgr();
+  SALOME_ListIO          selList;
+  selMgr->selectedObjects( selList );
+  SALOME_ListIteratorOfListIO selIt( selList );
+  for ( ; selIt.More(); selIt.Next() )
+  {
+    GEOM::GEOM_Object_var go = GEOMBase::ConvertIOinGEOMObject( selIt.Value() );
+    if ( !go->_is_nil() )
+    {
+      if ( !mySelectedShapeIO.IsNull() )
+      {
+        mySelectedShapeIO.Nullify();
+        break;
+      }
+      mySelectedShapeIO = selIt.Value();
+      if ( !mySelectedShapeIO->getName() || !mySelectedShapeIO->getName()[0] )
+        mySelectedShapeIO.Nullify();
+    }
+  }
+  // check if a selected geometry is not already in myShapesList
+  if ( !mySelectedShapeIO.IsNull() )
+  {
+    for ( int i = 0; i < myShapesList->count(); ++i )
+      if ( myShapesList->item(i)->data( Qt::UserRole ) == mySelectedShapeIO->getEntry() )
+      {
+        mySelectedShapeIO.Nullify();
+        break;
+      }
+  }
+  myAddShapeBut->setEnabled( !mySelectedShapeIO.IsNull() );
+}
+
+//=======================================================================
+//function : onTabChanged
+//purpose  : 
+//=======================================================================
+
+void StdMeshersGUI_QuadrangleParamCreator::onTabChanged(int i)
+{
+  myVertexSelWdg->showPreview( i == TAB_VERTEX );
+}
 
 //================================================================================
 // function : Constructor
 // purpose  :
 //================================================================================
 
 //================================================================================
 // function : Constructor
 // purpose  :
 //================================================================================
+
 StdMeshersGUI_QuadrangleParamWdg::StdMeshersGUI_QuadrangleParamWdg (QWidget * parent)
 StdMeshersGUI_QuadrangleParamWdg::StdMeshersGUI_QuadrangleParamWdg (QWidget * parent)
-  : QWidget(parent),
-    myType(0)
+  : QWidget(parent), myType(0)
 {
   myType = new QButtonGroup (this);
 
 {
   myType = new QButtonGroup (this);
 
@@ -71,6 +443,8 @@ StdMeshersGUI_QuadrangleParamWdg::StdMeshersGUI_QuadrangleParamWdg (QWidget * pa
 
   setLayout(typeLay);
   setMinimumWidth(300);
 
   setLayout(typeLay);
   setMinimumWidth(300);
+
+  connect( myType, SIGNAL( buttonClicked(int)), this, SIGNAL( typeChanged(int)));
 }
 
 //================================================================================
 }
 
 //================================================================================
@@ -98,3 +472,25 @@ int StdMeshersGUI_QuadrangleParamWdg::GetType()
 {
   return myType->checkedId();
 }
 {
   return myType->checkedId();
 }
+
+//================================================================================
+/*!
+  \brief Constructor
+*/
+StdMeshersGUI_QuadrangleParamCreator::
+ItemDelegate::ItemDelegate( QObject* parent ) : QItemDelegate( parent )
+{
+}
+//================================================================================
+/*!
+  \brief Create item editor widget
+*/
+QWidget* StdMeshersGUI_QuadrangleParamCreator::
+ItemDelegate::createEditor( QWidget*                    parent,
+                            const QStyleOptionViewItem& option,
+                            const QModelIndex&          index ) const
+{
+  SMESHGUI_SpinBox* sb = new SMESHGUI_SpinBox( parent );
+  sb->RangeStepAndValidator( COORD_MIN, COORD_MAX, 10 );
+  return sb;
+}
index 7ce5b314d626425e62fc6c82fd01a054041cc8bd..539c8316788c44c4cc9a1cb491f521989f6ebd82 100644 (file)
 
 // SMESH includes
 #include "SMESH_StdMeshersGUI.hxx"
 
 // SMESH includes
 #include "SMESH_StdMeshersGUI.hxx"
+#include "StdMeshersGUI_StdHypothesisCreator.h"
+
+#include <SALOME_InteractiveObject.hxx>
 
 // Qt includes
 #include <QWidget>
 
 // Qt includes
 #include <QWidget>
+#include <QItemDelegate>
+
 
 class QButtonGroup;
 
 class QButtonGroup;
+class QLineEdit;
+class QListWidget;
+class QPushButton;
+class QTabWidget;
+class QTreeWidget;
+class StdMeshersGUI_QuadrangleParamWdg;
+class StdMeshersGUI_SubShapeSelectorWdg;
+
+//================================================================================
+/*!
+ * \brief Quadrangle Parameters Creator
+ */
+class STDMESHERSGUI_EXPORT StdMeshersGUI_QuadrangleParamCreator : public StdMeshersGUI_StdHypothesisCreator
+{
+  Q_OBJECT
+
+    class ItemDelegate;
+
+ public:
+  StdMeshersGUI_QuadrangleParamCreator( const QString& aHypType );
+
+  //virtual bool     checkParams( QString& ) const;
+  virtual QString  helpPage() const;
+
+ protected:
+  virtual QFrame*  buildFrame();
+  virtual void     retrieveParams() const;
+  virtual QString  storeParams() const;
+
+ private slots:
+
+  void onTypeChanged(int type);
+  void onAddShape();
+  void onRemoveShape();
+  void onAddPoint();
+  void onRemovePoint();
+  void onSelectionChanged();
+  void onTabChanged(int);
+
+ private:
 
 
+  QLineEdit*                         myName;
+  StdMeshersGUI_QuadrangleParamWdg*  myTypeWdg;
+  StdMeshersGUI_SubShapeSelectorWdg* myVertexSelWdg;
+  QListWidget*                       myShapesList;
+  QPushButton*                       myAddShapeBut;
+  QTreeWidget*                       myCoordsTreeWdg;
+  QTabWidget*                        myTabs;
+  Handle(SALOME_InteractiveObject)   mySelectedShapeIO;
+};
+
+//================================================================================
+/*!
+ * \brief Transition type widget
+ */
 class STDMESHERSGUI_EXPORT StdMeshersGUI_QuadrangleParamWdg : public QWidget
 {
   Q_OBJECT
 
 class STDMESHERSGUI_EXPORT StdMeshersGUI_QuadrangleParamWdg : public QWidget
 {
   Q_OBJECT
 
-public:
+    public:
   StdMeshersGUI_QuadrangleParamWdg (QWidget* parent = 0);
   ~StdMeshersGUI_QuadrangleParamWdg();
 
   void SetType (int theType);
   int  GetType ();
 
   StdMeshersGUI_QuadrangleParamWdg (QWidget* parent = 0);
   ~StdMeshersGUI_QuadrangleParamWdg();
 
   void SetType (int theType);
   int  GetType ();
 
-private:
-  // Quadranle preference, Triangle preference, Reduced
-  QButtonGroup* myType;
+  GEOM::ListOfGO*     GetShapes();
+  SMESH::nodes_array* GetPoints();
+  void                Set( GEOM::ListOfGO_var shapes, SMESH::nodes_array_var points );
+
+ signals:
+
+  void typeChanged(int);
+
+ private:
+  QButtonGroup* myType; // Quadranle preference, Triangle preference, Reduced
+};
+
+//================================================================================
+/*!
+ * \brief Item delegate for a tree widget
+ */
+class StdMeshersGUI_QuadrangleParamCreator::ItemDelegate : public QItemDelegate
+{
+  Q_OBJECT
+public:
+  ItemDelegate( QObject* );
+  QWidget* createEditor( QWidget*, const QStyleOptionViewItem&, const QModelIndex& ) const;
 };
 
 #endif // STDMESHERSGUI_QUADRANGLEPARAMWDG_H
 };
 
 #endif // STDMESHERSGUI_QUADRANGLEPARAMWDG_H
index 8b94762e7b8c8430e2797c07a0c7c2b25dd7edaa..08dcd56718567ff24e3e5fafeca25a544978d25e 100644 (file)
         <translation>Reduced</translation>
     </message>
 </context>
         <translation>Reduced</translation>
     </message>
 </context>
+<context>
+    <name>StdMeshersGUI_QuadrangleParamCreator</name>
+    <message>
+        <source>POINTS</source>
+        <translation>Points</translation>
+    </message>
+    <message>
+        <source>SHAPES</source>
+        <translation>Vertices</translation>
+    </message>
+    <message>
+        <source>TRANSITION</source>
+        <translation>Transition</translation>
+    </message>
+    <message>
+        <source>ENF_NODES</source>
+        <translation>Enforced nodes</translation>
+    </message>
+    <message>
+        <source></source>
+        <translation></translation>
+    </message>
+</context>
 <context>
     <name>StdMeshersGUI_LayerDistributionParamWdg</name>
     <message>
 <context>
     <name>StdMeshersGUI_LayerDistributionParamWdg</name>
     <message>