Salome HOME
23368: [CEA 1865] Possibility to define faces to mesh as a single one: transpatch... V8_2_0a1 V8_2_0b1
authoreap <eap@opencascade.com>
Mon, 31 Oct 2016 13:16:25 +0000 (16:16 +0300)
committereap <eap@opencascade.com>
Mon, 31 Oct 2016 13:16:25 +0000 (16:16 +0300)
12 files changed:
doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_hyperpatch.png [new file with mode: 0644]
doc/salome/gui/BLSURFPLUGIN/input/blsurf_hypo.doc
idl/BLSURFPlugin_Algorithm.idl
src/BLSURFPlugin/BLSURFPluginBuilder.py
src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx
src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx
src/GUI/BLSURFPluginGUI_HypothesisCreator.h
src/GUI/BLSURFPlugin_msg_en.ts

diff --git a/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_hyperpatch.png b/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_hyperpatch.png
new file mode 100644 (file)
index 0000000..49904b9
Binary files /dev/null and b/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_hyperpatch.png differ
index ad2770a733c01ed0e8ed3ab7f1507c45b3e3d99d..34101a4c81de6ca7685759a5b6efbfb4753f6b03 100644 (file)
@@ -393,6 +393,27 @@ List of source and target vertices to define a transformation are optional.
 
 \sa Sample TUI Script of the definition of MG-CADSurf periodicity \ref tui_blsurf_periodicity_preCAD "using preCAD".
 
+\section blsurf_hyperpatch Hyper-patch
+
+\image html blsurf_parameters_hyperpatch.png
+
+Hyper-patch tab page allows defining faces that will be meshes together as
+  part of a global hyper-patch.
+
+- <b>Hyper-patch IDs</b> table - shows IDs of faces of defined hyper-patches.
+
+- <b>Face selection</b> - activates selection of faces in the VTK Viewer.
+
+- <b>Group selection</b> - activates selection of faces and groups of
+  faces in the Object Browser.
+
+- \b IDs - allows typing IDs of faces composing a hyper-patch and
+  shows IDs of faces selected in the Viewer or the Object Browser.
+
+- \b Add - adds a new row to the table and moves \b IDs there.
+
+- \b Remove - removes selected hyper-patches from the table.
+
 \ref blsurf_top "Back to top"
 
 For more information on MeshGems-CADSurf, you can read its documentation at $MESHGEMS_ROOT_DIR/Docs/mg-cadsurf_user_manual.pdf
index 98469977674894c0f4a42b656d20b1fbcfd7bc5a..1296ba19e9f3fcfff4eef6624e38a20f9a066a87 100644 (file)
@@ -119,6 +119,10 @@ module BLSURFPlugin
   };
   
   typedef sequence<TPreCadPeriodicity> TPeriodicityList;
+
+  // Hyper-patches
+  typedef sequence<long> THyperPatch;
+  typedef sequence<THyperPatch> THyperPatchList;
   
   /*!
    * BLSURFPlugin_BLSURF: interface of BLSURF algorithm
@@ -430,6 +434,12 @@ module BLSURFPlugin
     void SetTags( in string howToTreat ) raises (SALOME::SALOME_Exception);
     string GetTags();
 
+    /*!
+     * Set hyper-patches
+     */
+    void SetHyperPatches(in THyperPatchList hpl);
+    THyperPatchList GetHyperPatches();
+
     /*!
      * To merges edges.
      */
index f61279b6dc20f8e6147df3800933bfadde7f7924..9fd78e96357fee5b910da555a083e5b7ce1be3fb 100644 (file)
@@ -22,6 +22,7 @@
 # Python API for the MG-CADSurf meshing plug-in module.
 
 from salome.smesh.smesh_algorithm import Mesh_Algorithm
+import GEOM
 
 LIBRARY = "libBLSURFEngine.so"
 
@@ -695,6 +696,37 @@ class BLSURF_Algorithm(Mesh_Algorithm):
         self.Parameters().AddPreCadEdgesPeriodicity(theEdge1, theEdge2)
     pass
 
+  #-----------------------------------------
+  # Hyper-Patches
+  #-----------------------------------------
+  
+  ## Defines hyper-patches. A hyper-patch is a set of adjacent faces meshed as a whole,
+  #  ignoring edges between them
+  #  @param hyperPatchList : list of hyper-patches. A hyper-patch is defined as a list of
+  #         faces or groups of faces. A face can be identified either as a GEOM object or
+  #         a face ID (returned e.g. by geompy.GetSubShapeID( mainShape, subShape )).
+  #         
+  #  Example: cadsurf.SetHyperPatches([[ Face_1, Group_2 ],[ 13, 23 ]])
+  def SetHyperPatches(self, hyperPatchList):
+    hpl = []
+    for patch in hyperPatchList:
+      ids = []
+      for face in patch:
+        if isinstance( face, int ):
+          ids.append( face )
+        elif isinstance( face, GEOM._objref_GEOM_Object):
+          faces = self.mesh.geompyD.SubShapeAll( face, self.mesh.geompyD.ShapeType["FACE"] )
+          for f in faces:
+            ids.append( self.mesh.geompyD.GetSubShapeID( self.mesh.geom, f ))
+        else:
+          raise TypeError, \
+            "Face of hyper-patch should be either ID or GEOM_Object, not %s" % type(face)
+        pass
+      hpl.append( ids )
+      pass
+    self.Parameters().SetHyperPatches( hpl )
+    return
+
   #=====================
   # Obsolete methods
   #=====================
index 9c59492c31614003e35e2369ac1869c981ea3e82..8a91ab3ecf2c4871ca4d9457f84266aaa3f16e2c 100644 (file)
@@ -1940,10 +1940,6 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
       f.Orientation(TopAbs_FORWARD);
 
     iface = fmap.Add(f);
-//    std::string aFileName = "fmap_face_";
-//    aFileName.append(val_to_string(iface));
-//    aFileName.append(".brep");
-//    BRepTools::Write(f,aFileName.c_str());
 
     surfaces.push_back(BRep_Tool::Surface(f));
 
@@ -1961,7 +1957,8 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
 
     /* by default a face has no tag (color).
        The following call sets it to the same value as the Geom module ID : */
-    const int faceTag = meshDS->ShapeToIndex(f);
+    int faceTag = meshDS->ShapeToIndex(f);
+    faceTag = BLSURFPlugin_Hypothesis::GetHyperPatchTag( faceTag, _hypothesis );
     cad_face_set_tag(fce, faceTag);
 
     /* Set face orientation (optional if you want a well oriented output mesh)*/
@@ -2127,11 +2124,6 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
       if (ic <= 0)
         ic = emap.Add(e);
 
-//      std::string aFileName = "fmap_edge_";
-//      aFileName.append(val_to_string(ic));
-//      aFileName.append(".brep");
-//      BRepTools::Write(e,aFileName.c_str());
-
       double tmin,tmax;
       curves.push_back(BRep_Tool::CurveOnSurface(e, f, tmin, tmax));
 
@@ -2198,7 +2190,25 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
 
       /* by default an edge has no tag (color).
          The following call sets it to the same value as the edge_id : */
-      cad_edge_set_tag(edg, ic);
+      // IMP23368. Do not set tag to an EDGE shared by FACEs of a hyper-patch
+      bool isInHyperPatch = false;
+      {
+        std::set< int > faceTags;
+        PShapeIteratorPtr faceIf = helper.GetAncestors( e, aMesh, TopAbs_FACE );
+        while ( const TopoDS_Shape* face = faceIf->next() )
+          if ( helper.IsSubShape( *face, aShape ))
+          {
+            int faceTag = meshDS->ShapeToIndex( *face );
+            int hpTag   = BLSURFPlugin_Hypothesis::GetHyperPatchTag( faceTag, _hypothesis );
+            if ( !faceTags.insert( hpTag ).second )
+            {
+              isInHyperPatch = true;
+              break;
+            }
+          }
+      }
+      if ( !isInHyperPatch )
+        cad_edge_set_tag(edg, ic);
 
       /* by default, an edge does not necessalry appear in the resulting mesh,
          unless the following property is set :
@@ -2800,8 +2810,17 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
     SMESH_subMesh* sm = aMesh.GetSubMesh( f );
     if ( !sm->GetSubMeshDS() || sm->GetSubMeshDS()->NbElements() == 0 )
     {
-      sm->GetComputeError().reset( new SMESH_ComputeError( err, _comment, this ));
-      badFaceFound = true;
+      int faceTag = sm->GetId();
+      if ( faceTag != BLSURFPlugin_Hypothesis::GetHyperPatchTag( faceTag, _hypothesis ))
+      {
+        // triangles are assigned to the first face of hyper-patch
+        sm->SetIsAlwaysComputed( true );
+      }
+      else
+      {
+        sm->GetComputeError().reset( new SMESH_ComputeError( err, _comment, this ));
+        badFaceFound = true;
+      }
     }
   }
   if ( err == COMPERR_WARNING )
index 7d2be5b279286d74d0ee9d34537c56925ad8e0fa..ca91973b53556a07e2365c4b3eeb2863b527f22e 100644 (file)
@@ -684,6 +684,78 @@ std::string BLSURFPlugin_Hypothesis::GetTags()
   return GetPreCADOptionValue("tags", GET_DEFAULT());
 }
 //=============================================================================
+void BLSURFPlugin_Hypothesis::SetHyperPatches(const THyperPatchList& hpl)
+{
+  if ( hpl != _hyperPatchList )
+  {
+    // join patches sharing tags
+    _hyperPatchList.clear();
+    for ( size_t i = 0; i < hpl.size(); ++i )
+    {
+      const THyperPatchTags& tags = hpl[i];
+      if ( tags.size() < 2 ) continue;
+
+      std::set<int> iPatches;
+      if ( !_hyperPatchList.empty() )
+      {
+        THyperPatchTags::iterator t = tags.begin();
+        for ( ; t != tags.end(); ++t )
+        {
+          int iPatch = -1;
+          GetHyperPatchTag( *t, this, &iPatch );
+          if ( iPatch >= 0 )
+            iPatches.insert( iPatch );
+        }
+      }
+
+      if ( iPatches.empty() )
+      {
+        _hyperPatchList.push_back( tags );
+      }
+      else
+      {
+        std::set<int>::iterator iPatch = iPatches.begin();
+        THyperPatchTags&     mainPatch = _hyperPatchList[ *iPatch ];
+        mainPatch.insert( tags.begin(), tags.end() );
+
+        for ( ++iPatch; iPatch != iPatches.end(); ++iPatch )
+        {
+          mainPatch.insert( _hyperPatchList[ *iPatch ].begin(), _hyperPatchList[ *iPatch ].end() );
+          _hyperPatchList[ *iPatch ].clear();
+        }
+        if ( iPatches.size() > 1 )
+          for ( int j = _hyperPatchList.size()-1; j > 0; --j )
+            if ( _hyperPatchList[j].empty() )
+              _hyperPatchList.erase( _hyperPatchList.begin() + j );
+      }
+    }
+    NotifySubMeshesHypothesisModification();
+  }
+}
+//=============================================================================
+/*!
+ * \brief Return a tag of a face taking into account the hyper-patches. Optionally
+ *        return an index of a patch including the face
+ */
+//================================================================================
+
+int BLSURFPlugin_Hypothesis::GetHyperPatchTag( const int                      faceTag,
+                                               const BLSURFPlugin_Hypothesis* hyp,
+                                               int*                           iPatch)
+{
+  if ( hyp )
+  {
+    const THyperPatchList& hpl = hyp->_hyperPatchList;
+    for ( size_t i = 0; i < hpl.size(); ++i )
+      if ( hpl[i].count( faceTag ))
+      {
+        if ( iPatch ) *iPatch = i;
+        return *( hpl[i].begin() );
+      }
+  }
+  return faceTag;
+}
+//=============================================================================
 void BLSURFPlugin_Hypothesis::SetPreCADMergeEdges(bool theVal)
 {
   if (theVal != ToBool( GetPreCADOptionValue("merge_edges", GET_DEFAULT()))) {
@@ -753,6 +825,7 @@ bool BLSURFPlugin_Hypothesis::HasPreCADOptions(const BLSURFPlugin_Hypothesis* hy
            !hyp->_facesPeriodicityVector.empty()                                         ||
            !hyp->_edgesPeriodicityVector.empty()                                         ||
            !hyp->_verticesPeriodicityVector.empty()                                      ||
+           !hyp->GetHyperPatches().empty()                                               ||
            hyp->GetTopology() != FromCAD );
 }
 
@@ -1759,7 +1832,7 @@ void BLSURFPlugin_Hypothesis::ClearPreCadPeriodicityVectors() {
 //function : AddPreCadFacesPeriodicity
 //=======================================================================
 void BLSURFPlugin_Hypothesis::AddPreCadFacesPeriodicity(TEntry theFace1Entry, TEntry theFace2Entry,
-    std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries) {
+                                                        std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries) {
 
   TPreCadPeriodicity preCadFacesPeriodicity;
   preCadFacesPeriodicity.shape1Entry = theFace1Entry;
@@ -1790,37 +1863,38 @@ void BLSURFPlugin_Hypothesis::AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TE
 }
 
 //=============================================================================
-std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) {
-   // We must keep at least the same number of arguments when increasing the SALOME version
-   // When MG-CADSurf becomes CADMESH, some parameters were fused into a single one. Thus the same
-   // parameter can be written several times to keep the old global number of parameters.
+std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save)
+{
+  // We must keep at least the same number of arguments when increasing the SALOME version
+  // When MG-CADSurf becomes CADMESH, some parameters were fused into a single one. Thus the same
+  // parameter can be written several times to keep the old global number of parameters.
+
+  // Treat old options which are now in the advanced options
+  TOptionValues::iterator op_val;
+  int _decimesh = -1;
+  int _preCADRemoveNanoEdges = -1;
+  double _preCADEpsNano = -1.0;
+  op_val = _option2value.find("respect_geometry");
+  if (op_val != _option2value.end()) {
+    std::string value = op_val->second;
+    if (!value.empty())
+      _decimesh = value.compare("1") == 0 ? 1 : 0;
+  }
+  op_val = _preCADoption2value.find("remove_tiny_edges");
+  if (op_val != _preCADoption2value.end()) {
+    std::string value = op_val->second;
+    if (!value.empty())
+      _preCADRemoveNanoEdges = value.compare("1") == 0 ? 1 : 0;
+  }
+  op_val = _preCADoption2value.find("tiny_edge_length");
+  if (op_val != _preCADoption2value.end()) {
+    std::string value = op_val->second;
+    if (!value.empty())
+      _preCADEpsNano = strtod(value.c_str(), NULL);
+  }
 
-   // Treat old options which are now in the advanced options
-   TOptionValues::iterator op_val;
-   int _decimesh = -1;
-   int _preCADRemoveNanoEdges = -1;
-   double _preCADEpsNano = -1.0;
-   op_val = _option2value.find("respect_geometry");
-   if (op_val != _option2value.end()) {
-     std::string value = op_val->second;
-     if (!value.empty())
-       _decimesh = value.compare("1") == 0 ? 1 : 0;
-   }
-   op_val = _preCADoption2value.find("remove_tiny_edges");
-   if (op_val != _preCADoption2value.end()) {
-     std::string value = op_val->second;
-     if (!value.empty())
-       _preCADRemoveNanoEdges = value.compare("1") == 0 ? 1 : 0;
-   }
-   op_val = _preCADoption2value.find("tiny_edge_length");
-   if (op_val != _preCADoption2value.end()) {
-     std::string value = op_val->second;
-     if (!value.empty())
-       _preCADEpsNano = strtod(value.c_str(), NULL);
-   }
-   
   save << " " << (int) _topology << " " << (int) _physicalMesh << " " << (int) _geometricMesh << " " << _phySize << " "
-      << _angleMesh << " " << _gradation << " " << (int) _quadAllowed << " " << _decimesh;
+       << _angleMesh << " " << _gradation << " " << (int) _quadAllowed << " " << _decimesh;
   save << " " << _minSize << " " << _maxSize << " " << _angleMesh << " " << _minSize << " " << _maxSize << " " << _verb;
   save << " " << (int) _preCADMergeEdges << " " << _preCADRemoveNanoEdges << " " << (int) _preCADDiscardInput << " " << _preCADEpsNano ;
   save << " " << (int) _enforcedInternalVerticesAllFaces;
@@ -1956,6 +2030,17 @@ std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) {
   SaveEdgesPeriodicity(save);
   SaveVerticesPeriodicity(save);
 
+  // HYPER-PATCHES
+  save << " " << _hyperPatchList.size() << " ";
+  for ( size_t i = 0; i < _hyperPatchList.size(); ++i )
+  {
+    THyperPatchTags& patch = _hyperPatchList[i];
+    save << patch.size() << " ";
+    THyperPatchTags::iterator tag = patch.begin();
+    for ( ; tag != patch.end(); ++tag )
+      save << *tag << " ";
+  }
+
   return save;
 }
 
@@ -2091,7 +2176,8 @@ void BLSURFPlugin_Hypothesis::SavePreCADPeriodicity(std::ostream & save, const c
 }
 
 //=============================================================================
-std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
+std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load)
+{
   bool isOK = true;
   int i;
   double val;
@@ -2745,17 +2831,17 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
 // __ENFORCED_VERTICES_BEGIN__ 
 // __BEGIN_VERTEX__  => no name, no entry
 // __BEGIN_GROUP__ mon groupe __END_GROUP__
-// __BEGIN_COORDS__ 10 10 10 __END_COORDS__ 
-// __BEGIN_FACELIST__ 0:1:1:1:1 __END_FACELIST__ 
-// __END_VERTEX__ 
+// __BEGIN_COORDS__ 10 10 10 __END_COORDS__
+// __BEGIN_FACELIST__ 0:1:1:1:1 __END_FACELIST__
+// __END_VERTEX__
 // __BEGIN_VERTEX__ => no coords
-// __BEGIN_NAME__ mes points __END_NAME__ 
+// __BEGIN_NAME__ mes points __END_NAME__
 // __BEGIN_ENTRY__ 0:1:1:4 __END_ENTRY__
 // __BEGIN_GROUP__ mon groupe __END_GROUP__
 // __BEGIN_FACELIST__ 0:1:1:1:3 __END_FACELIST__
-// __END_VERTEX__ 
+// __END_VERTEX__
 // __ENFORCED_VERTICES_END__
-// 
+//
 
   std::string enfSeparator;
   std::string enfName;
@@ -2764,27 +2850,28 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
   TEntryList enfFaceEntryList;
   double enfCoords[3];
   bool hasCoords = false;
-  
+
   _faceEntryEnfVertexListMap.clear();
   _enfVertexList.clear();
   _faceEntryCoordsListMap.clear();
   _coordsEnfVertexMap.clear();
   _faceEntryEnfVertexEntryListMap.clear();
   _enfVertexEntryEnfVertexMap.clear();
-  
-  
-  while (isOK && hasEnforcedVertex) {
+
+
+  while (isOK && hasEnforcedVertex)
+  {
     isOK = static_cast<bool>(load >> enfSeparator); // __BEGIN_VERTEX__
     TEnfVertex *enfVertex = new TEnfVertex();
     if (enfSeparator == "__ENFORCED_VERTICES_END__")
       break; // __ENFORCED_VERTICES_END__
     if (enfSeparator != "__BEGIN_VERTEX__")
       throw std::exception();
-    
+
     while (isOK) {
       isOK = static_cast<bool>(load >> enfSeparator);
       if (enfSeparator == "__END_VERTEX__") {
-        
+
         enfVertex->name = enfName;
         enfVertex->geomEntry = enfGeomEntry;
         enfVertex->grpName = enfGroup;
@@ -2792,9 +2879,9 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
         if (hasCoords)
           enfVertex->coords.assign(enfCoords,enfCoords+3);
         enfVertex->faceEntries = enfFaceEntryList;
-        
+
         _enfVertexList.insert(enfVertex);
-        
+
         if (enfVertex->coords.size()) {
           _coordsEnfVertexMap[enfVertex->coords] = enfVertex;
           for (TEntryList::const_iterator it = enfVertex->faceEntries.begin() ; it != enfVertex->faceEntries.end(); ++it) {
@@ -2809,7 +2896,7 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
             _faceEntryEnfVertexListMap[(*it)].insert(enfVertex);
           }
         }
-        
+
         enfName.clear();
         enfGeomEntry.clear();
         enfGroup.clear();
@@ -2817,7 +2904,7 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
         hasCoords = false;
         break; // __END_VERTEX__
       }
-        
+
       if (enfSeparator == "__BEGIN_NAME__") {  // __BEGIN_NAME__
         while (isOK && (enfSeparator != "__END_NAME__")) {
           isOK = static_cast<bool>(load >> enfSeparator);
@@ -2828,14 +2915,14 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
           }
         }
       }
-        
+
       if (enfSeparator == "__BEGIN_ENTRY__") {  // __BEGIN_ENTRY__
         isOK = static_cast<bool>(load >> enfGeomEntry);
         isOK = static_cast<bool>(load >> enfSeparator); // __END_ENTRY__
         if (enfSeparator != "__END_ENTRY__")
           throw std::exception();
       }
-        
+
       if (enfSeparator == "__BEGIN_GROUP__") {  // __BEGIN_GROUP__
         while (isOK && (enfSeparator != "__END_GROUP__")) {
           isOK = static_cast<bool>(load >> enfSeparator);
@@ -2846,15 +2933,15 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
           }
         }
       }
-        
+
       if (enfSeparator == "__BEGIN_COORDS__") {  // __BEGIN_COORDS__
         hasCoords = true;
         isOK = static_cast<bool>(load >> enfCoords[0] >> enfCoords[1] >> enfCoords[2]);
         isOK = static_cast<bool>(load >> enfSeparator); // __END_COORDS__
         if (enfSeparator != "__END_COORDS__")
           throw std::exception();
-      } 
-        
+      }
+
       if (enfSeparator == "__BEGIN_FACELIST__") {  // __BEGIN_FACELIST__
         while (isOK && (enfSeparator != "__END_FACELIST__")) {
           isOK = static_cast<bool>(load >> enfSeparator);
@@ -2862,13 +2949,14 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
             enfFaceEntryList.insert(enfSeparator);
           }
         }
-      } 
+      }
     }
   }
 
   // PERIODICITY
 
-  if (hasPreCADFacesPeriodicity){
+  if (hasPreCADFacesPeriodicity)
+  {
     LoadPreCADPeriodicity(load, "FACES");
 
     isOK = static_cast<bool>(load >> option_or_sm);
@@ -2884,7 +2972,8 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
     }
   }
 
-  if (hasPreCADEdgesPeriodicity){
+  if (hasPreCADEdgesPeriodicity)
+  {
     LoadPreCADPeriodicity(load, "EDGES");
 
     isOK = static_cast<bool>(load >> option_or_sm);
@@ -2898,8 +2987,9 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
     }
   }
 
-  if (hasFacesPeriodicity){
-      LoadFacesPeriodicity(load);
+  if (hasFacesPeriodicity)
+  {
+    LoadFacesPeriodicity(load);
 
     isOK = static_cast<bool>(load >> option_or_sm);
     if (isOK) {
@@ -2910,8 +3000,9 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
     }
   }
 
-  if (hasEdgesPeriodicity){
-      LoadEdgesPeriodicity(load);
+  if (hasEdgesPeriodicity)
+  {
+    LoadEdgesPeriodicity(load);
 
     isOK = static_cast<bool>(load >> option_or_sm);
     if (isOK)
@@ -2920,7 +3011,38 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
   }
 
   if (hasVerticesPeriodicity)
-      LoadVerticesPeriodicity(load);
+    LoadVerticesPeriodicity(load);
+
+  // HYPER-PATCHES
+  if ( !option_or_sm.empty() && option_or_sm[0] == '_' )
+    isOK = static_cast<bool>(load >> option_or_sm);
+  if ( isOK && !option_or_sm.empty() )
+  {
+    int nbPatches = atoi( option_or_sm.c_str() );
+    if ( nbPatches >= 0 )
+    {
+      _hyperPatchList.resize( nbPatches );
+      for ( int iP = 0; iP < nbPatches && isOK; ++iP )
+      {
+        isOK = static_cast<bool>(load >> i) && i >= 2;
+        if ( !isOK ) break;
+        int nbTags = i;
+        for ( int iT = 0; iT < nbTags; ++iT )
+        {
+          if (( isOK = static_cast<bool>(load >> i)))
+            _hyperPatchList[ iP ].insert( i );
+          else
+            break;
+        }
+      }
+      if ( !isOK ) // remove invalid patches
+      {
+        for ( i = nbPatches - 1; i >= 0; i-- )
+          if ( _hyperPatchList[i].size() < 2 )
+            _hyperPatchList.resize( i );
+      }
+    }
+  }
 
   return load;
 }
@@ -3050,8 +3172,8 @@ void BLSURFPlugin_Hypothesis::LoadEdgesPeriodicity(std::istream & load){
   }
 }
 
-void BLSURFPlugin_Hypothesis::LoadVerticesPeriodicity(std::istream & load){
-
+void BLSURFPlugin_Hypothesis::LoadVerticesPeriodicity(std::istream & load)
+{
   bool isOK = true;
 
   std::string periodicitySeparator;
index f6e40b4f1805bf8b6f4920b6b54595b0a0b5fd83..18ffa41dd31257b29ae5445da38b457d0ae81831 100644 (file)
@@ -186,6 +186,14 @@ public:
   void SetTags( const std::string& howToTreat ) throw (std::invalid_argument);
   std::string GetTags();
 
+  // Hyper-patches
+  typedef std::set< int > THyperPatchTags;
+  typedef std::vector< THyperPatchTags > THyperPatchList;
+
+  void SetHyperPatches(const THyperPatchList& hpl);
+  const THyperPatchList& GetHyperPatches() const { return _hyperPatchList; }
+  static int GetHyperPatchTag( int faceTag, const BLSURFPlugin_Hypothesis* hyp, int* iPatch=0 );
+
   void SetPreCADMergeEdges(bool theVal);
   bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
 
@@ -614,6 +622,8 @@ private:
   TEdgesPeriodicityVector _edgesPeriodicityVector;
   TVerticesPeriodicityVector _verticesPeriodicityVector;
 
+  THyperPatchList _hyperPatchList;
+
   // Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
   void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);
 
index c5cb677c6067ce223170afc06fc26040ee993d58..3db9133b7eb91c6c58b98636370a9448ea744399 100644 (file)
@@ -1059,6 +1059,51 @@ char* BLSURFPlugin_Hypothesis_i::GetTags()
   return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
 }
 
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl)
+{
+  ::BLSURFPlugin_Hypothesis::THyperPatchList patchList( hpl.length() );
+  SMESH_Comment hplDump;
+  hplDump << "[";
+  for ( size_t i = 0; i < patchList.size(); ++i )
+  {
+    hplDump << "[ ";
+    BLSURFPlugin::THyperPatch tags = hpl[ i ];
+    for ( CORBA::ULong j = 0; j < tags.length(); ++j )
+    {
+      patchList[ i ].insert( tags[ j ]);
+      hplDump << tags[ j ] << ( j+1 < tags.length() ? ", " : " ]" );
+    }
+    hplDump << ( i+1 < patchList.size() ? "," : "]");
+  }
+  if ( GetImpl()->GetHyperPatches() != patchList )
+  {
+    GetImpl()->SetHyperPatches( patchList );
+    SMESH::TPythonDump() << _this() << ".SetHyperPatches( " << hplDump << " )";
+  }
+}
+
+//=============================================================================
+BLSURFPlugin::THyperPatchList* BLSURFPlugin_Hypothesis_i::GetHyperPatches()
+{
+  const ::BLSURFPlugin_Hypothesis::THyperPatchList& hpl = GetImpl()->GetHyperPatches();
+  BLSURFPlugin::THyperPatchList* resHpl = new BLSURFPlugin::THyperPatchList();
+  resHpl->length( hpl.size() );
+
+  ::BLSURFPlugin_Hypothesis::THyperPatchList::const_iterator hpIt = hpl.begin();
+  for ( int i = 0; hpIt != hpl.end(); ++hpIt, ++i )
+  {
+    const ::BLSURFPlugin_Hypothesis::THyperPatchTags& hp = *hpIt;
+    BLSURFPlugin::THyperPatch& resHp = (*resHpl)[ i ];
+    resHp.length( hp.size() );
+
+    ::BLSURFPlugin_Hypothesis::THyperPatchTags::const_iterator tag = hp.begin();
+    for ( int j = 0; tag != hp.end(); ++tag, ++j )
+      resHp[ j ] = *tag;
+  }
+  return resHpl;
+}
+
 //=============================================================================
 /*!
  *  BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
index 5cfc3d9fd76e1d64f09583a8f59ea2b657aa6c29..ad283c949f89514d3732074a90ca2f4936d883e3 100644 (file)
@@ -163,6 +163,9 @@ public:
   void SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception);
   char* GetTags();
 
+  void SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl);
+  BLSURFPlugin::THyperPatchList* GetHyperPatches();
+
   void SetPreCADMergeEdges(CORBA::Boolean theValue);
   CORBA::Boolean GetPreCADMergeEdges();
 
index d4075da7bd179e5289fcedecd50a140b57702815..30d0cac0a31b58a88276aaa7004b9370f02e2a96 100644 (file)
 #include "BLSURFPluginGUI_HypothesisCreator.h"
 #include "BLSURFPluginGUI_Dlg.h"
 
-#include "GeometryGUI.h"
+#include <GeometryGUI.h>
 
-#include <SMESHGUI_Utils.h>
-#include <SMESHGUI_HypothesesUtils.h>
 #include <SMESHGUI_Dialog.h>
-#include "SMESHGUI_SpinBox.h"
-#include "SMESH_NumberFilter.hxx"
+#include <SMESHGUI_HypothesesUtils.h>
+#include <SMESHGUI_IdValidator.h>
+#include <SMESHGUI_SpinBox.h>
+#include <SMESHGUI_Utils.h>
+#include <SMESH_Gen_i.hxx>
+#include <SMESH_NumberFilter.hxx>
+#include <StdMeshersGUI_SubShapeSelectorWdg.h>
 
-#include <SUIT_Session.h>
+#include <LightApp_SelectionMgr.h>
+#include <SALOME_ListIO.hxx>
 #include <SUIT_MessageBox.h>
 #include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+#include <SalomeApp_Application.h>
 #include <SalomeApp_Tools.h>
 
 #include <QApplication>
 #include <QCheckBox>
 #include <QComboBox>
 #include <QFrame>
-#include <QHBoxLayout>
-#include <QHeaderView>
 #include <QGridLayout>
 #include <QGroupBox>
+#include <QHBoxLayout>
+#include <QHeaderView>
 #include <QLabel>
 #include <QLineEdit>
 #include <QMenu>
+#include <QModelIndexList>
 #include <QObject>
 #include <QPushButton>
 #include <QRadioButton>
 #include <QSpinBox>
-#include <QTableWidget>
-#include <QTabWidget>
-#include <QVBoxLayout>
 #include <QSplitter>
-
-#include <QStandardItemModel>
 #include <QStandardItem>
+#include <QStandardItemModel>
+#include <QTabWidget>
+#include <QTableWidget>
 #include <QTreeWidget>
 #include <QTreeWidgetItem>
-#include <QModelIndexList>
-
-#include <LightApp_SelectionMgr.h>
-#include <SalomeApp_Application.h>
-#include <SALOME_ListIO.hxx>
-#include "SALOME_LifeCycleCORBA.hxx"
+#include <QVBoxLayout>
 
 #include <TopoDS_Shape.hxx>
 #include <TopoDS_Iterator.hxx>
-#include <SMESH_Gen_i.hxx>
-#include <boost/shared_ptr.hpp>
-#include <boost/algorithm/string.hpp>
-#include <structmember.h>
-#include <stdexcept>
-#include <algorithm>
+
+#include <structmember.h> // Python
 
 using namespace std;
 
@@ -88,6 +84,7 @@ enum {
   SMP_TAB,
   ENF_TAB,
   PERIODICITY_TAB,
+  HYPERPATCH_TAB,
   SMP_NAME_COLUMN =0,
   SMP_SIZEMAP_COLUMN,
   SMP_ENTRY_COLUMN,
@@ -650,9 +647,7 @@ bool BLSURFPluginGUI_HypothesisCreator::checkParams(QString& msg) const
 QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
 {
   QFrame* fr = new QFrame( 0 );
- // fr-> setMinimumSize(600,400);
   QVBoxLayout* lay = new QVBoxLayout( fr );
- // lay->setSizeConstraint(QLayout::SetDefaultConstraint);
   lay->setMargin( 5 );
   lay->setSpacing( 0 );
 
@@ -681,14 +676,11 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   }
   aStdLayout->addWidget( myStdWidget,                                   row++, 0, 1, 4 );
   
-  //int maxrow = row;
   row = 0;
   if( isCreation() )
     row = 1;
-//   row = max(row,maxrow)+1;
   aStdLayout->setRowStretch(row,1);
   aStdLayout->setColumnStretch(1,1);
-  //maxrow = row;
 
   
   // advanced parameters
@@ -697,14 +689,12 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   anAdvLayout->setSpacing( 6 );
   anAdvLayout->setMargin( 11 );  
   myAdvWidget = new BLSURFPluginGUI_AdvWidget(myAdvGroup);
-  //myAdvWidget->addBtn->setMenu( new QMenu() );
   anAdvLayout->addWidget( myAdvWidget );
 
 
   // Size Maps parameters
 
   mySmpGroup = new QWidget();
-//   mySmpGroup->setMinimumWidth(500);
 
   //Layout
   QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup);
@@ -837,10 +827,6 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   // Enforced vertices parameters
   myEnfGroup = new QWidget();
   QGridLayout* anEnfLayout = new QGridLayout(myEnfGroup);
-//
-//   myEnforcedVertexWidget = new DlgBlSurfHyp_Enforced(myEnfGroup);
-//   anEnfLayout->addWidget(myEnforcedVertexWidget);
-//   myEnforcedVertexWidget = new DlgBlSurfHyp_Enforced();
 
   myEnforcedTreeWidget = new QTreeWidget(myEnfGroup);
   myEnforcedTreeWidget->setColumnCount( ENF_VER_NB_COLUMNS );
@@ -869,7 +855,7 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   myEnforcedTreeWidget->hideColumn(ENF_VER_ENTRY_COLUMN);
   myEnforcedTreeWidget->setItemDelegate(new EnforcedTreeWidgetDelegate());
   
-// FACE AND VERTEX SELECTION
+  // FACE AND VERTEX SELECTION
   TColStd_MapOfInteger shapeTypes1, shapeTypes2;
   shapeTypes1.Add( TopAbs_FACE );
   shapeTypes1.Add( TopAbs_COMPOUND );
@@ -909,9 +895,6 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   QLabel* myInternalEnforcedVerticesAllFacesGroupLabel = new QLabel( tr( "BLSURF_ENF_VER_GROUP_LABEL" ), myEnfGroup );
   myInternalEnforcedVerticesAllFacesGroup = new QLineEdit(myEnfGroup);
 
-//   myGlobalGroupName = new QCheckBox(tr("BLSURF_ENF_VER_GROUPS"), myEnfGroup);
-//   myGlobalGroupName->setChecked(false);
-
   anEnfLayout->addWidget(myEnforcedTreeWidget,     0, 0, ENF_VER_NB_LINES, 1);
   QGridLayout* anEnfLayout2 = new QGridLayout(myEnfGroup);
 //  FACE AND VERTEX SELECTION
@@ -925,17 +908,13 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   anEnfLayout2->addWidget(myZCoord,                 ENF_VER_Z_COORD, 1, 1, 1);
   anEnfLayout2->addWidget(myGroupNameLabel,         ENF_VER_GROUP, 0, 1, 1);
   anEnfLayout2->addWidget(myGroupName,              ENF_VER_GROUP, 1, 1, 1);
-//   anEnfLayout2->addWidget(myGlobalGroupName,        ENF_VER_GROUP_CHECK, 0, 1, 2);
-//   anEnfLayout2->setRowStretch(                      ENF_VER_SPACE, 1);
   anEnfLayout2->addWidget(addVertexButton,          ENF_VER_BTN, 0, 1, 1);
   anEnfLayout2->addWidget(removeVertexButton,       ENF_VER_BTN, 1, 1, 1);
   anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFaces, ENF_VER_INTERNAL_ALL_FACES, 0, 1, 2);
   anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFacesGroupLabel, ENF_VER_INTERNAL_ALL_FACES_GROUP, 0, 1, 1);
   anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFacesGroup, ENF_VER_INTERNAL_ALL_FACES_GROUP, 1, 1, 1);
   anEnfLayout2->setRowStretch(ENF_VER_NB_LINES+1, 1);
-//   anEnfLayout2->addWidget(makeGroupsCheck,          ENF_VER_GROUP_CHECK, 0, 1, 2);
   anEnfLayout->addLayout(anEnfLayout2, 0,1,ENF_VER_NB_LINES+1,2);
-//   anEnfLayout->setRowStretch(1, 1);
 
   // ---
   // Periodicity parameters
@@ -1128,12 +1107,49 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   myPeriodicitySelectionWidgets.append(myPeriodicityP3TargetWdg);
   avoidSimultaneousSelection(myPeriodicitySelectionWidgets);
 
+  // HyperPatch parameters
+
+  QWidget*      hpGroup = new QWidget();
+  QGridLayout* hpLayout = new QGridLayout(hpGroup);
+
+  myHyPatchTable = new QTableWidget( hpGroup );
+  myHyPatchTable->setColumnCount(1);
+  myHyPatchTable->setHorizontalHeaderLabels( QStringList() << tr("BLSURF_HYPATCH_TBL_HEADER") );
+  myHyPatchTable->setAlternatingRowColors(true);
+  myHyPatchTable->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
+
+
+  QPixmap iconSelect (SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+  myHyPatchFaceSelBtn  = new QPushButton( iconSelect, tr("BLSURF_HYPATCH_SEL_FACE"), hpGroup );
+  myHyPatchGroupSelBtn = new QPushButton( iconSelect, tr("BLSURF_HYPATCH_SEL_GROUP"), hpGroup );
+  myHyPatchFaceSelBtn->setCheckable( true );
+  myHyPatchGroupSelBtn->setCheckable( true );
+
+  myHyPatchFaceSelector = new StdMeshersGUI_SubShapeSelectorWdg( hpGroup, TopAbs_FACE, /*toShowList=*/false );
+
+  QLabel* hpTagsLbl = new QLabel( tr("BLSURF_TAGS"), hpGroup );
+  myHyPatchTagsLE   = new QLineEdit( hpGroup );
+  myHyPatchTagsLE->setValidator( new SMESHGUI_IdValidator( hpGroup ));
+
+  QPushButton* hpAddBtn = new QPushButton( tr("BLSURF_SM_ADD"), hpGroup );
+  QPushButton* hpRemBtn = new QPushButton( tr("BLSURF_SM_REMOVE"), hpGroup );
+
+  hpLayout->addWidget( myHyPatchTable,        0, 0, 5, 1 );
+  hpLayout->addWidget( myHyPatchFaceSelBtn,   0, 1, 1, 2 );
+  hpLayout->addWidget( myHyPatchGroupSelBtn,  0, 3, 1, 2 );
+  hpLayout->addWidget( hpTagsLbl,             1, 1, 1, 1 );
+  hpLayout->addWidget( myHyPatchTagsLE,       1, 2, 1, 3 );
+  hpLayout->addWidget( hpAddBtn,              2, 1, 1, 2 );
+  hpLayout->addWidget( hpRemBtn,              2, 3, 1, 2 );
+  hpLayout->addWidget( myHyPatchFaceSelector, 3, 1, 1, 4 );
+
   // ---
   myTabWidget->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) );
   myTabWidget->insertTab( ADV_TAB, myAdvGroup, tr( "BLSURF_ADV_ARGS" ) );
   myTabWidget->insertTab( SMP_TAB, mySmpGroup, tr( "LOCAL_SIZE" ) );
   myTabWidget->insertTab( ENF_TAB, myEnfGroup, tr( "BLSURF_ENF_VER" ) );
   myTabWidget->insertTab( PERIODICITY_TAB, myPeriodicityGroup, tr( "BLSURF_PERIODICITY" ) );
+  myTabWidget->insertTab( HYPERPATCH_TAB, hpGroup, tr( "BLSURF_HYPERPATCH_TAB" ));
 
   myTabWidget->setCurrentIndex( STD_TAB );
 
@@ -1144,12 +1160,10 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   connect( addMapButton,        SIGNAL( clicked()),                    this,         SLOT( onAddMap() ) );
   connect( removeMapButton,     SIGNAL( clicked()),                    this,         SLOT( onRemoveMap() ) );
   connect( modifyMapButton,     SIGNAL( clicked()),                    this,         SLOT( onModifyMap() ) );
-//   connect( mySizeMapTable,      SIGNAL( cellChanged ( int, int  )),    this,         SLOT( onSetSizeMap(int,int ) ) );
   connect( mySizeMapTable,      SIGNAL( itemClicked (QTreeWidgetItem *, int)),this,  SLOT( onSmpItemClicked(QTreeWidgetItem *, int) ) );
   connect( myGeomSelWdg2,       SIGNAL( contentModified() ),           this,         SLOT( onMapGeomContentModified() ) );
   connect( myGeomSelWdg1,       SIGNAL( contentModified() ),           this,         SLOT( onMapGeomContentModified() ) );
   connect( myAttSelWdg,         SIGNAL( contentModified() ),           this,         SLOT( onMapGeomContentModified() ) );
-//   connect( myAttractorGroup,    SIGNAL( clicked(bool) ),               this,         SLOT( onAttractorGroupClicked(bool) ) );
   connect( mySizeMapTable,      SIGNAL( itemChanged (QTreeWidgetItem *, int)),this,  SLOT( onSetSizeMap(QTreeWidgetItem *, int) ) );
   connect( myAttractorCheck,    SIGNAL( stateChanged ( int )),         this,         SLOT( onAttractorClicked( int ) ) );
   connect( myConstSizeCheck,    SIGNAL( stateChanged ( int )),         this,         SLOT( onConstSizeClicked( int ) ) );
@@ -1159,14 +1173,11 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   // Enforced vertices
   connect( myEnforcedTreeWidget,SIGNAL( itemClicked(QTreeWidgetItem *, int)), this,  SLOT( synchronizeCoords() ) );
   connect( myEnforcedTreeWidget,SIGNAL( itemChanged(QTreeWidgetItem *, int)), this,  SLOT( updateEnforcedVertexValues(QTreeWidgetItem *, int) ) );
-//   connect( myEnforcedTreeWidget,SIGNAL( itemChanged(QTreeWidgetItem *, int)), this,  SLOT( update(QTreeWidgetItem *, int) ) );
   connect( myEnforcedTreeWidget,SIGNAL( itemSelectionChanged() ),      this,         SLOT( synchronizeCoords() ) );
   connect( addVertexButton,     SIGNAL( clicked()),                    this,         SLOT( onAddEnforcedVertices() ) );
   connect( removeVertexButton,  SIGNAL( clicked()),                    this,         SLOT( onRemoveEnforcedVertex() ) );
   connect( myEnfVertexWdg,      SIGNAL( contentModified()),            this,         SLOT( onSelectEnforcedVertex() ) );
   connect( myInternalEnforcedVerticesAllFaces, SIGNAL( stateChanged ( int )), this,  SLOT( onInternalVerticesClicked( int ) ) );
-//   connect( myEnfVertexWdg,     SIGNAL( selectionActivated()),         this,         SLOT( onVertexSelectionActivated() ) );
-//   connect( myEnfFaceWdg,       SIGNAL( selectionActivated()),         this,         SLOT( onFaceSelectionActivated() ) );
 
   // Periodicity
   connect( myPeriodicityAddButton,     SIGNAL( clicked()),                    this,   SLOT( onAddPeriodicity() ) );
@@ -1176,17 +1187,24 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
 
   ListOfWidgets::const_iterator anIt = myPeriodicitySelectionWidgets.begin();
   for (; anIt != myPeriodicitySelectionWidgets.end(); anIt++)
-    {
-      StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
-      connect( w1,     SIGNAL(contentModified ()),                 this,   SLOT(onPeriodicityContentModified()));
+  {
+    StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
+    connect( w1,     SIGNAL(contentModified ()),                 this,   SLOT(onPeriodicityContentModified()));
+
+  }
+
+  // HyperPatch
+  connect( myHyPatchFaceSelBtn,   SIGNAL( toggled(bool) ),   SLOT( onHyPatchFaceSelection(bool) ));
+  connect( myHyPatchGroupSelBtn,  SIGNAL( toggled(bool) ),   SLOT( onHyPatchGroupSelection(bool) ));
+  connect( myHyPatchFaceSelector, SIGNAL( shapeSelected() ), SLOT( onHyPatchSelectionChanged()));
+  connect( hpAddBtn,              SIGNAL( clicked() ),       SLOT( onHyPatchAdd()));
+  connect( hpRemBtn,              SIGNAL( clicked() ),       SLOT( onHyPatchRemove()));
 
-    }
-//  connect( myPeriodicitySourceFaceWdg,     SIGNAL(contentModified()),    this,   SLOT(onPeriodicityContentModified()));
   return fr;
 }
 
 /** BLSURFPluginGUI_HypothesisCreator::deactivateSelection(QWidget*, QWidget*)
-This method stop the selection of the widgets StdMeshersGUI_ObjectReferenceParamWdg
+    This method stop the selection of the widgets StdMeshersGUI_ObjectReferenceParamWdg
 */
 // void BLSURFPluginGUI_HypothesisCreator::deactivateSelection(QWidget* old, QWidget* now)
 // {
@@ -1215,12 +1233,12 @@ void BLSURFPluginGUI_HypothesisCreator::clearEnforcedVertexWidgets()
   myXCoord->setText("");
   myYCoord->setText("");
   myZCoord->setText("");
-//   myGroupName->setText("");
+  //   myGroupName->setText("");
 }
 
 /** BLSURFPluginGUI_HypothesisCreator::updateEnforcedVertexValues(item, column)
-This method updates the tooltip of a modified item. The QLineEdit widgets content
-is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
+    This method updates the tooltip of a modified item. The QLineEdit widgets content
+    is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
 */
 void BLSURFPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTreeWidgetItem* item, int column) {
   QVariant vertexName = item->data(ENF_VER_NAME_COLUMN, Qt::EditRole);
@@ -1418,42 +1436,26 @@ void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, do
 /** BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices()
 This method is called when a item is added into the enforced vertices tree widget
 */
-void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices() {
-
+void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices()
+{
   BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
 
   getGeomSelectionTool()->selectionMgr()->clearFilters();
-  //myEnfFaceWdg->deactivateSelection();
   myEnfVertexWdg->deactivateSelection();
 
   for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
     myEnforcedTreeWidget->resizeColumnToContents(column);
 
   // Vertex selection
-  //int selEnfFace   = myEnfFaceWdg->NbObjects();
   int selEnfVertex = myEnfVertexWdg->NbObjects();
   bool coordsEmpty = (myXCoord->text().isEmpty()) || (myYCoord->text().isEmpty()) || (myZCoord->text().isEmpty());
 
-  // if (selEnfFace == 0)
-  //   return;
-
   if ((selEnfVertex == 0) && coordsEmpty)
     return;
 
   string entry, shapeName;
-
-  //for (int i = 0 ; i < selEnfVertex + !coordsEmpty; i++)
   {
-    //myEnfFace = myEnfFaceWdg->GetObject< GEOM::GEOM_Object >(i);
-    //entry = myEnfFace->GetStudyEntry();
-    //shapeName = myEnfFace->GetName();
-    
-    //QTreeWidgetItem * faceItem = addEnforcedFace(entry, shapeName);
-    
-    std::string groupName = myGroupName->text().toStdString();
-
-    if (boost::trim_copy(groupName).empty())
-      groupName = "";
+    std::string groupName = myGroupName->text().simplified().toStdString();
 
     if (selEnfVertex <= 1)
     {
@@ -1493,7 +1495,6 @@ void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices() {
     }
   }
 
-  //myEnfFaceWdg->SetObject(GEOM::GEOM_Object::_nil());
   myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
   
   for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
@@ -1882,7 +1883,7 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
     else
     {
       item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant( sizeMap ) );
-    } 
+    }
   }
   mySizeMapTable->resizeColumnToContents( SMP_ENTRY_COLUMN );
   mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
@@ -1894,7 +1895,7 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
   for ( ; evmIt != data.faceEntryEnfVertexListMap.end() ; ++evmIt) {
     TEntry entry = (*evmIt).first;
     std::string shapeName = myGeomToolSelected->getNameFromEntry(entry);
-    
+
     //QTreeWidgetItem* faceItem = that->addEnforcedFace(entry, shapeName);
 
     TEnfVertexList evs = (*evmIt).second;
@@ -1912,7 +1913,7 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
       that->addEnforcedVertex(x, y, z, enfVertex->name, enfVertex->geomEntry, enfVertex->grpName);
     }
   }
-  
+
   for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
     myEnforcedTreeWidget->resizeColumnToContents(column);
 
@@ -1922,22 +1923,25 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
 
   // Periodicity
 
-
   // Add an item in the tree widget for each association
   for (size_t i=0 ; i<data.preCadPeriodicityVector.size() ; i++)
+  {
+    QTreeWidgetItem* item = new QTreeWidgetItem();
+    myPeriodicityTreeWidget->addTopLevelItem(item);
+    item->setFlags( Qt::ItemIsSelectable   |Qt::ItemIsEnabled );
+    TPreCadPeriodicity periodicity_i = data.preCadPeriodicityVector[i];
+    for (size_t k=0; k<periodicity_i.size(); k++)
     {
-      QTreeWidgetItem* item = new QTreeWidgetItem();
-      myPeriodicityTreeWidget->addTopLevelItem(item);
-      item->setFlags( Qt::ItemIsSelectable   |Qt::ItemIsEnabled );
-      TPreCadPeriodicity periodicity_i = data.preCadPeriodicityVector[i];
-      for (size_t k=0; k<periodicity_i.size(); k++)
-        {
-          string shapeEntry = periodicity_i[k];
-          string shapeName = myGeomToolSelected->getNameFromEntry(shapeEntry);
-          item->setData(k, Qt::EditRole, shapeName.c_str() );
-          item->setData(k, Qt::UserRole, shapeEntry.c_str() );
-        }
+      string shapeEntry = periodicity_i[k];
+      string shapeName = myGeomToolSelected->getNameFromEntry(shapeEntry);
+      item->setData(k, Qt::EditRole, shapeName.c_str() );
+      item->setData(k, Qt::UserRole, shapeEntry.c_str() );
     }
+  }
+
+  // Hyper patches
+  for ( int i = 0; i < data.hyperpatches.size(); ++i )
+    that->addHyPatchToTable( data.hyperpatches[i] );
 
   // update widgets
   that->myStdWidget->onPhysicalMeshChanged();
@@ -2138,6 +2142,21 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData
 
   BLSURFPlugin::TPeriodicityList_var preCadEdgePeriodicityVector = h->GetPreCadEdgesPeriodicityVector();
   AddPreCadSequenceToVector(h_data, preCadEdgePeriodicityVector, false);
+
+  // Hyper Patches
+
+  h_data.hyperpatches.clear();
+  BLSURFPlugin::THyperPatchList_var patchList = h->GetHyperPatches();
+  for ( CORBA::ULong i = 0; i < patchList->length(); ++i )
+  {
+    QString tags;
+    BLSURFPlugin::THyperPatch& patch = patchList[i];
+    for ( CORBA::ULong j = 0; j < patch.length(); ++j )
+      tags += QString::number( patch[j] ) + " ";
+    if ( !tags.isEmpty() )
+      h_data.hyperpatches.append( tags );
+  }
+
   return true;
 }
 
@@ -2266,7 +2285,7 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi
       h->SetOptimizeMesh( h_data.myOptimizeMesh );    
     
     if ( h->GetQuadraticMesh() != h_data.myQuadraticMesh )
-      h->SetQuadraticMesh( h_data.myQuadraticMesh );    
+      h->SetQuadraticMesh( h_data.myQuadraticMesh );
 
     if ( h->GetVerbosity() != h_data.myVerbosity )
       h->SetVerbosity( h_data.myVerbosity );
@@ -2282,10 +2301,10 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi
     // options are set in checkParams()
     //h->SetOptionValues( myOptions ); // is set in readParamsFromWidgets()
     //h->SetPreCADOptionValues( myPreCADOptions ); // is set in readParamsFromWidgets()
-    
+
     if ( h->GetGMFFile() != h_data.myGMFFileName )
-//       || ( h->GetGMFFileMode() != h_data.myGMFFileMode ) )
-//       h->SetGMFFile( h_data.myGMFFileName.c_str(), h_data.myGMFFileMode );
+      //       || ( h->GetGMFFileMode() != h_data.myGMFFileMode ) )
+      //       h->SetGMFFile( h_data.myGMFFileName.c_str(), h_data.myGMFFileMode );
       h->SetGMFFile( h_data.myGMFFileName.c_str());
 
     BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
@@ -2302,7 +2321,7 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi
         h->SetAttractorEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData());
       }
       else if (sizeMap.startsWith("def")) {
-//        h->SetCustomSizeMapEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() );
+        //        h->SetCustomSizeMapEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() );
       }
       else {
         if (!myATTMap[entry].empty()){
@@ -2340,13 +2359,13 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi
     double x, y, z = 0;
     std::string enfName;
     /* TODO GROUPS
-    std::string groupName = "";
+       std::string groupName = "";
     */
 
     TFaceEntryEnfVertexListMap::const_iterator evmIt = h_data.faceEntryEnfVertexListMap.begin();
     // 1. Clear all enforced vertices in hypothesis
     // 2. Add new enforced vertex according to h_data
-    
+
     if ( h->GetAllEnforcedVertices()->length() > 0 )
       h->ClearAllEnforcedVertices();
     TEnfName faceEntry;
@@ -2377,65 +2396,73 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi
 
     // Periodicity
     if ( h->GetPreCadFacesPeriodicityVector()->length() > 0 || h->GetPreCadEdgesPeriodicityVector()->length() > 0 )
-          h->ClearPreCadPeriodicityVectors();
+      h->ClearPreCadPeriodicityVectors();
 
     TPreCadPeriodicityVector::const_iterator pIt = h_data.preCadPeriodicityVector.begin();
     for ( ; pIt != h_data.preCadPeriodicityVector.end() ; ++pIt)
+    {
+      TPreCadPeriodicity periodicity_i = *pIt;
+      TEntry source = periodicity_i[PERIODICITY_OBJ_SOURCE_COLUMN];
+      TEntry target = periodicity_i[PERIODICITY_OBJ_TARGET_COLUMN];
+      TEntry p1Source = periodicity_i[PERIODICITY_P1_SOURCE_COLUMN];
+      TEntry p2Source = periodicity_i[PERIODICITY_P2_SOURCE_COLUMN];
+      TEntry p3Source = periodicity_i[PERIODICITY_P3_SOURCE_COLUMN];
+      TEntry p1Target = periodicity_i[PERIODICITY_P1_TARGET_COLUMN];
+      TEntry p2Target = periodicity_i[PERIODICITY_P2_TARGET_COLUMN];
+      TEntry p3Target = periodicity_i[PERIODICITY_P3_TARGET_COLUMN];
+      bool onFace = (periodicity_i[PERIODICITY_SHAPE_TYPE]=="1") ? true : false;
+
+      BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
+      if (! p1Source.empty())
       {
-        TPreCadPeriodicity periodicity_i = *pIt;
-        TEntry source = periodicity_i[PERIODICITY_OBJ_SOURCE_COLUMN];
-        TEntry target = periodicity_i[PERIODICITY_OBJ_TARGET_COLUMN];
-        TEntry p1Source = periodicity_i[PERIODICITY_P1_SOURCE_COLUMN];
-        TEntry p2Source = periodicity_i[PERIODICITY_P2_SOURCE_COLUMN];
-        TEntry p3Source = periodicity_i[PERIODICITY_P3_SOURCE_COLUMN];
-        TEntry p1Target = periodicity_i[PERIODICITY_P1_TARGET_COLUMN];
-        TEntry p2Target = periodicity_i[PERIODICITY_P2_TARGET_COLUMN];
-        TEntry p3Target = periodicity_i[PERIODICITY_P3_TARGET_COLUMN];
-        bool onFace = (periodicity_i[PERIODICITY_SHAPE_TYPE]=="1") ? true : false;
-
-        BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
-        if (! p1Source.empty())
-          {
-            sourceVertices->length(3);
-            sourceVertices[0]=CORBA::string_dup(p1Source.c_str());
-            sourceVertices[1]=CORBA::string_dup(p2Source.c_str());
-            sourceVertices[2]=CORBA::string_dup(p3Source.c_str());
-          }
-
+        sourceVertices->length(3);
+        sourceVertices[0]=CORBA::string_dup(p1Source.c_str());
+        sourceVertices[1]=CORBA::string_dup(p2Source.c_str());
+        sourceVertices[2]=CORBA::string_dup(p3Source.c_str());
+      }
 
-        BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
-        if (! p1Target.empty())
-          {
-            targetVertices->length(3);
-            targetVertices[0]=CORBA::string_dup(p1Target.c_str());
-            targetVertices[1]=CORBA::string_dup(p2Target.c_str());
-            targetVertices[2]=CORBA::string_dup(p3Target.c_str());
-          }
 
-        if (onFace)
-          h->AddPreCadFacesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
-        else
-          h->AddPreCadEdgesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
+      BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
+      if (! p1Target.empty())
+      {
+        targetVertices->length(3);
+        targetVertices[0]=CORBA::string_dup(p1Target.c_str());
+        targetVertices[1]=CORBA::string_dup(p2Target.c_str());
+        targetVertices[2]=CORBA::string_dup(p3Target.c_str());
       }
 
+      if (onFace)
+        h->AddPreCadFacesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
+      else
+        h->AddPreCadEdgesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
+    }
+
+    // Hyper-patches
+    BLSURFPlugin::THyperPatchList_var hpl = new BLSURFPlugin::THyperPatchList();
+    hpl->length( h_data.hyperpatches.size() );
+
+    for ( int i = 0; i < h_data.hyperpatches.size(); ++i )
+    {
+      QStringList tags = h_data.hyperpatches[i].split(" ",  QString::SkipEmptyParts);
+      BLSURFPlugin::THyperPatch& patch = hpl[ i ];
+      patch.length( tags.size() );
+
+      for ( int j = 0; j < tags.size(); ++j )
+        patch[ j ] = tags[ j ].toDouble();
+    }
+    h->SetHyperPatches( hpl );
 
 
   } // try
-  catch(const std::exception& ex) {
-    std::cout << "Exception: " << ex.what() << std::endl;
-    throw ex;
-  }
-//   catch(const SALOME::SALOME_Exception& ex)
-//   {
-//     throw ex;
-// //     SalomeApp_Tools::QtCatchCorbaException(ex);
-// //     ok = false;
-//   }
+  catch(...) {
+    ok = false;
+  }
+
   return ok;
 }
 
 /** BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets(h_data)
-Stores the widgets content to the hypothesis data.
+    Stores the widgets content to the hypothesis data.
 */
 QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothesisData& h_data ) const
 {
@@ -2580,6 +2607,11 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes
     guiHyp += "PERIODICITY = yes; ";
   }
 
+  // Hyper-patches
+  h_data.hyperpatches.clear();
+  for ( int row = 0; row < myHyPatchTable->rowCount(); ++row )
+    h_data.hyperpatches.append( myHyPatchTable->item( row, 0 )->text() );
+
   return guiHyp;
 }
 
@@ -2707,7 +2739,6 @@ void BLSURFPluginGUI_HypothesisCreator::onTabChanged(int tab)
     myGeomSelWdg1             ->deactivateSelection();
     myGeomSelWdg2             ->deactivateSelection();
     myAttSelWdg               ->deactivateSelection();
-    //myEnfFaceWdg              ->deactivateSelection();
     myEnfVertexWdg            ->deactivateSelection();
     myPeriodicitySourceFaceWdg->deactivateSelection();
     myPeriodicityTargetFaceWdg->deactivateSelection();
@@ -2717,6 +2748,10 @@ void BLSURFPluginGUI_HypothesisCreator::onTabChanged(int tab)
     myPeriodicityP1TargetWdg  ->deactivateSelection();
     myPeriodicityP2TargetWdg  ->deactivateSelection();
     myPeriodicityP3TargetWdg  ->deactivateSelection();
+    if ( myHyPatchFaceSelBtn->isChecked() )
+      myHyPatchFaceSelBtn->toggle();
+    if ( myHyPatchGroupSelBtn->isChecked() )
+      myHyPatchGroupSelBtn->toggle();
     return;
   }
   else if ( sender() == smpTab )
@@ -3237,6 +3272,121 @@ bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry(QString myEnt
   return true;
 }
 
+//================================================================================
+/*!
+ * \brief SLOT: Activate selection of faces in the Viewer
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::onHyPatchFaceSelection(bool on)
+{
+  if ( on && myHyPatchFaceSelector->GetMainShape().IsNull() )
+  {
+    QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
+    QString aSubEntry  = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
+    myHyPatchFaceSelector->SetGeomShapeEntry( aSubEntry, aMainEntry );
+  }
+  myHyPatchFaceSelector->setVisible( on );  // show its buttons
+  myHyPatchFaceSelector->ShowPreview( on ); // show faces in the Viewer
+  // treat selection or not
+  myHyPatchFaceSelector->ActivateSelection( on || myHyPatchGroupSelBtn->isChecked() );
+
+  if ( on )
+    myHyPatchGroupSelBtn->setChecked( false );
+}
+
+//================================================================================
+/*!
+ * \brief SLOT: Deactivate selection of faces in the Viewer
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::onHyPatchGroupSelection(bool on)
+{
+  if ( on && myHyPatchFaceSelector->GetMainShape().IsNull() )
+  {
+    QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
+    QString aSubEntry  = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
+    myHyPatchFaceSelector->SetGeomShapeEntry( aSubEntry, aMainEntry );
+  }
+  if ( !myHyPatchFaceSelBtn->isChecked() )
+  {
+    myHyPatchFaceSelector->setVisible( false ); // show its buttons
+    myHyPatchFaceSelector->ShowPreview( false ); // show faces in the Viewer
+  }
+  // treat selection or not
+  myHyPatchFaceSelector->ActivateSelection( on || myHyPatchFaceSelBtn->isChecked() );
+
+  if ( on )
+    myHyPatchFaceSelBtn->setChecked( false );
+}
+
+//================================================================================
+/*!
+ * \brief SLOT: show IDs of selected faces in Tags LineEdit
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::onHyPatchSelectionChanged()
+{
+  QString tagString;
+  const QList<int>& tags = myHyPatchFaceSelector->GetSelectedIDs();
+  for ( int i = 0; i < tags.size(); ++i )
+    tagString += QString::number( tags[i] ) + " ";
+
+  myHyPatchTagsLE->setText( tagString );
+}
+
+//================================================================================
+/*!
+ * \brief SLOT: Add the Tags to the HyperPatch table
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::onHyPatchAdd()
+{
+  QStringList tagList = myHyPatchTagsLE->text().split(" ",  QString::SkipEmptyParts);
+  if ( tagList.size() > 1 )
+  {
+    addHyPatchToTable( myHyPatchTagsLE->text() );
+    myHyPatchTagsLE->setText("");
+  }
+}
+
+//================================================================================
+/*!
+ * \brief Add a row to myHyPatchTable
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::addHyPatchToTable(const QString& tags)
+{
+  if ( tags.isEmpty() ) return;
+
+  QTableWidgetItem* cell = new QTableWidgetItem( tags );
+  cell->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
+
+  int row = myHyPatchTable->rowCount();
+  myHyPatchTable->insertRow( row );
+  myHyPatchTable->setItem( row, 0, cell );
+}
+
+//================================================================================
+/*!
+ * \brief SLOT: remove selected rows from the HyperPatch table
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::onHyPatchRemove()
+{
+  QList<QTableWidgetItem *> items = myHyPatchTable->selectedItems();
+  while ( !items.isEmpty() )
+  {
+    myHyPatchTable->removeRow( items[0]->row() );
+    items = myHyPatchTable->selectedItems();
+  }
+}
+
 QString BLSURFPluginGUI_HypothesisCreator::caption() const
 {
   return tr( "BLSURF_TITLE" );
index 8c0cdd4c4afd5a0deee82450109ce0ce6bc70011..91c959ab4346a6ec6c2aec3f051864f0aad4b2a6 100644 (file)
@@ -95,6 +95,7 @@ class SMESH_NumberFilter;
 class LightApp_SelectionMgr;
 class BLSURFPluginGUI_StdWidget;
 class BLSURFPluginGUI_AdvWidget;
+class StdMeshersGUI_SubShapeSelectorWdg;
 // class DlgBlSurfHyp_Enforced;
 
 // Name
@@ -178,6 +179,7 @@ typedef struct
   TGroupNameEnfVertexListMap groupNameEnfVertexListMap;
   */
   TPreCadPeriodicityVector preCadPeriodicityVector;
+  QStringList hyperpatches;
   QString myName;
 } BlsurfHypothesisData;
 
@@ -209,10 +211,7 @@ protected slots:
   void                onStateChange();
   // Advanced tab
   void                onAddOption();
-//  void                onDeleteOption();
-//  void                onEditOption( int, int );
   void                onChangeOptionName( int, int );
-//  void                onOptionChosenInPopup( QAction* );
   // Sizemap tab
   void                onMapGeomContentModified();
   void                onSmpItemClicked( QTreeWidgetItem *, int );
@@ -226,22 +225,28 @@ protected slots:
   // Enforced vertices tab
   QTreeWidgetItem*    addEnforcedFace(std::string theFaceEntry, std::string theFaceName);
   void                addEnforcedVertex(double x=0, double y=0, double z=0, 
-                                        std::string vertexName = "", std::string geomEntry = "", std::string groupName = "");
+                                        std::string vertexName = "",
+                                        std::string geomEntry = "",
+                                        std::string groupName = "");
   void                onAddEnforcedVertices();
   void                onRemoveEnforcedVertex();
   void                synchronizeCoords();
   void                updateEnforcedVertexValues(QTreeWidgetItem* , int );
   void                onSelectEnforcedVertex();
-//   void                deactivateSelection(QWidget*, QWidget*);
   void                clearEnforcedVertexWidgets();
   void                onInternalVerticesClicked(int);
   // Periodicity tab
   void                onPeriodicityByVerticesChecked(bool);
-//  void                onPeriodicityRadioButtonChanged();
   void                onAddPeriodicity();
   void                onRemovePeriodicity();
   void                onPeriodicityTreeClicked(QTreeWidgetItem*, int);
   void                onPeriodicityContentModified();
+  // HyperPatch tab
+  void                onHyPatchFaceSelection(bool);
+  void                onHyPatchGroupSelection(bool);
+  void                onHyPatchSelectionChanged();
+  void                onHyPatchAdd();
+  void                onHyPatchRemove();
 
 private:
   bool                readParamsFromHypo( BlsurfHypothesisData& ) const;
@@ -260,6 +265,7 @@ private:
   static LightApp_SelectionMgr* selectionMgr();
   void                avoidSimultaneousSelection(ListOfWidgets &myCustomWidgets) const;
   void                AddPreCadSequenceToVector(BlsurfHypothesisData& h_data, BLSURFPlugin::TPeriodicityList_var preCadFacePeriodicityVector, bool onFace) const;
+  void                addHyPatchToTable(const QString& tags);
 
 private:
   
@@ -305,21 +311,17 @@ private:
   
   
   QWidget*            myEnfGroup;
-//    TODO FACE AND VERTEX SELECTION
   StdMeshersGUI_ObjectReferenceParamWdg *myEnfFaceWdg;
   GEOM::GEOM_Object_var myEnfFace;
   StdMeshersGUI_ObjectReferenceParamWdg *myEnfVertexWdg;
   GEOM::GEOM_Object_var myEnfVertex;
 
-//   DlgBlSurfHyp_Enforced* myEnforcedVertexWidget;
   QTreeWidget*        myEnforcedTreeWidget;
   SMESHGUI_SpinBox*   myXCoord;
   SMESHGUI_SpinBox*   myYCoord;
   SMESHGUI_SpinBox*   myZCoord;
 
   QLineEdit*          myGroupName;
-//   QGroupBox*          makeGroupsCheck;
-//   QCheckBox*          myGlobalGroupName;
 
   QPushButton*        addVertexButton;
   QPushButton*        removeVertexButton;
@@ -330,41 +332,37 @@ private:
   // map =  entry , size map
   QMap<QString, QString>          mySMPMap;           // Map <face entry, size>
   QMap<QString, TAttractorVec >   myATTMap;           // Map <face entry, att. entry, etc>
-  // QMap<QString, double>           myDistMap;          // Map <entry,distance with constant size> 
-  // QMap<QString, double>           myAttDistMap;       // Map <entry, influence distance> 
   QMap<QString, TopAbs_ShapeEnum> mySMPShapeTypeMap;
   GeomSelectionTools*             GeomToolSelected;
   LightApp_SelectionMgr*          aSel;
 
   // Periodicity
-  QWidget* myPeriodicityGroup;
-  QSplitter* myPeriodicitySplitter;
-  QTreeWidget* myPeriodicityTreeWidget;
-  QWidget* myPeriodicityRightWidget;
-  QGridLayout* myPeriodicityRightGridLayout;
-  QGroupBox* myPeriodicityGroupBox1;
-  QGroupBox* myPeriodicityGroupBox2;
+  QWidget*      myPeriodicityGroup;
+  QSplitter*    myPeriodicitySplitter;
+  QTreeWidget*  myPeriodicityTreeWidget;
+  QWidget*      myPeriodicityRightWidget;
+  QGridLayout*  myPeriodicityRightGridLayout;
+  QGroupBox*    myPeriodicityGroupBox1;
+  QGroupBox*    myPeriodicityGroupBox2;
   QGridLayout* aPeriodicityLayout1;
-  QGridLayout* myPeriodicityGroupBox1Layout;
-  QGridLayout* myPeriodicityGroupBox2Layout;
+  QGridLayout*  myPeriodicityGroupBox1Layout;
+  QGridLayout*  myPeriodicityGroupBox2Layout;
   QRadioButton* myPeriodicityOnFaceRadioButton;
   QRadioButton* myPeriodicityOnEdgeRadioButton;
-  QLabel* myPeriodicityMainSourceLabel;
-  QLabel* myPeriodicityMainTargetLabel;
-  QLabel* myPeriodicitySourceLabel;
-  QLabel* myPeriodicityTargetLabel;
+  QLabel*       myPeriodicityMainSourceLabel;
+  QLabel*       myPeriodicityMainTargetLabel;
+  QLabel*       myPeriodicitySourceLabel;
+  QLabel*       myPeriodicityTargetLabel;
   StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicitySourceFaceWdg;
-//  StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicitySourceEdgeWdg;
   GEOM::GEOM_Object_var myPeriodicityFace;
   StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityTargetFaceWdg;
-//  StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityTargetEdgeWdg;
   GEOM::GEOM_Object_var myPeriodicityEdge;
-  QLabel* myPeriodicityP1SourceLabel;
-  QLabel* myPeriodicityP2SourceLabel;
-  QLabel* myPeriodicityP3SourceLabel;
-  QLabel* myPeriodicityP1TargetLabel;
-  QLabel* myPeriodicityP2TargetLabel;
-  QLabel* myPeriodicityP3TargetLabel;
+  QLabel*       myPeriodicityP1SourceLabel;
+  QLabel*       myPeriodicityP2SourceLabel;
+  QLabel*       myPeriodicityP3SourceLabel;
+  QLabel*       myPeriodicityP1TargetLabel;
+  QLabel*       myPeriodicityP2TargetLabel;
+  QLabel*       myPeriodicityP3TargetLabel;
   StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP1SourceWdg;
   StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP2SourceWdg;
   StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP3SourceWdg;
@@ -372,9 +370,15 @@ private:
   StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP2TargetWdg;
   StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP3TargetWdg;
   ListOfWidgets myPeriodicitySelectionWidgets;
-  QPushButton* myPeriodicityAddButton;
-  QPushButton* myPeriodicityRemoveButton;
-  QSpacerItem* myPeriodicityVerticalSpacer;
+  QPushButton*  myPeriodicityAddButton;
+  QPushButton*  myPeriodicityRemoveButton;
+  QSpacerItem*  myPeriodicityVerticalSpacer;
+
+  QTableWidget*                      myHyPatchTable;
+  StdMeshersGUI_SubShapeSelectorWdg* myHyPatchFaceSelector;
+  QLineEdit*                         myHyPatchTagsLE;
+  QPushButton*                       myHyPatchFaceSelBtn;
+  QPushButton*                       myHyPatchGroupSelBtn;
 
   BLSURFPlugin::string_array_var myOptions, myPreCADOptions, myCustomOptions;
 
index 5cda76bc76061cb73cd08d29f7552ff7dbb2e17c..80948d7a6b3cab5eb4d2b347ecaa694a88d65212 100644 (file)
@@ -594,6 +594,26 @@ The smaller this distance is, the closer the mesh is to the exact surface (only
         <source>BLSURF_PERIODICITY_SELECT_EDGE</source>
         <translation>Edge</translation>
     </message>
+    <message>
+        <source>BLSURF_HYPATCH_TBL_HEADER</source>
+        <translation>Hyper-patch IDs</translation>
+    </message>
+    <message>
+        <source>BLSURF_HYPATCH_SEL_FACE</source>
+        <translation>Face selection</translation>
+    </message>
+    <message>
+        <source>BLSURF_HYPATCH_SEL_GROUP</source>
+        <translation>Group selection</translation>
+    </message>
+    <message>
+        <source>BLSURF_TAGS</source>
+        <translation>IDs</translation>
+    </message>
+    <message>
+        <source>BLSURF_HYPERPATCH_TAB</source>
+        <translation>Hyper-patch</translation>
+    </message>
 </context>
 <context>
     <name>BLSURFPluginGUI_AdvWidget</name>
@@ -661,9 +681,5 @@ The smaller this distance is, the closer the mesh is to the exact surface (only
         <source>tags</source>
         <translation>Tags</translation>
     </message>
-    <message>
-        <source></source>
-        <translation></translation>
-    </message>
 </context> 
 </TS>