Salome HOME
http://www.salome-platform.org/forum/forum_10/881672547
authoreap <eap@opencascade.com>
Tue, 21 Oct 2014 10:50:56 +0000 (14:50 +0400)
committereap <eap@opencascade.com>
Tue, 21 Oct 2014 10:50:56 +0000 (14:50 +0400)
1) Allow defining a sub-mesh on a compound of sub-shape of the main shape
in GUI to be coherent with TUI.
2) Eliminate clashing #define PLUGIN_NAME in SMESH and GEOM

doc/salome/gui/SMESH/input/1d_meshing_hypo.doc
src/SMESHGUI/SMESHGUI_Hypotheses.cxx
src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx
src/SMESHGUI/SMESHGUI_HypothesesUtils.h
src/SMESHGUI/SMESHGUI_MeshOp.cxx

index 7a9228b68497eb5bfd97e9677b94ce5d68387799..8c38c8ddfa1e645374989affaa7a24a80e9e1e85 100644 (file)
@@ -257,15 +257,14 @@ hypothesis operation.
 \anchor automatic_length_anchor
 <h2>Automatic Length</h2>
 
 \anchor automatic_length_anchor
 <h2>Automatic Length</h2>
 
-This hypothesis is automatically applied when you select <b>Assign a
-set of hypotheses</b> option in Create Mesh menu.
-
-\image html automaticlength.png
-
 The dialog box prompts you to define the quality of the future mesh by
 only one parameter, which is \b Fineness, ranging from 0 (coarse mesh,
 low number of elements) to 1 (extremely fine mesh, great number of
 The dialog box prompts you to define the quality of the future mesh by
 only one parameter, which is \b Fineness, ranging from 0 (coarse mesh,
 low number of elements) to 1 (extremely fine mesh, great number of
-elements). Compare one and the same object (sphere) meshed with
+elements). 
+
+\image html automaticlength.png
+
+Compare one and the same object (sphere) meshed with
 minimum and maximum value of this parameter.
 
 \image html image147.gif "Example of a very rough mesh. Automatic Length works for 0."
 minimum and maximum value of this parameter.
 
 \image html image147.gif "Example of a very rough mesh. Automatic Length works for 0."
index af1377aba7ebc70904b2d6e9fea9948d170433a9..630100e7174f28b7773217b1ded4e0186b0653f0 100644 (file)
@@ -670,7 +670,7 @@ void SMESHGUI_HypothesisDlg::onHelp()
   if (app) {
     QString name = "SMESH";
     if(myCreator) {
   if (app) {
     QString name = "SMESH";
     if(myCreator) {
-      QVariant pluginName = myCreator->property( PLUGIN_NAME );
+      QVariant pluginName = myCreator->property( SMESH::Plugin_Name() );
       if( pluginName.isValid() ) {
         QString rootDir = pluginName.toString() + "PLUGIN_ROOT_DIR";
         QString varValue = QString( getenv(rootDir.toLatin1().constData()));
       if( pluginName.isValid() ) {
         QString rootDir = pluginName.toString() + "PLUGIN_ROOT_DIR";
         QString varValue = QString( getenv(rootDir.toLatin1().constData()));
index 836c2e3609f2fe2b0a8b0dc9c2f516a54216239f..dc499bd7381fe9e7db3feb31fc0cad754090bebe 100644 (file)
@@ -469,7 +469,7 @@ namespace SMESH
               //      It is used to obtain plugin root dir environment variable
               //      in the SMESHGUI_HypothesisDlg class. Plugin root dir environment
               //      variable is used to display documentation.
               //      It is used to obtain plugin root dir environment variable
               //      in the SMESHGUI_HypothesisDlg class. Plugin root dir environment
               //      variable is used to display documentation.
-              aCreator->setProperty(PLUGIN_NAME,aHypData->PluginName);
+              aCreator->setProperty(SMESH::Plugin_Name(),aHypData->PluginName);
             }
           }
         }
             }
           }
         }
index 2841b7a7f6c412f04d76bb3e91d7e194cdf1ca07..4e4f4a86857d2e40bf4e71fe95c5a900b60bb616 100644 (file)
@@ -58,8 +58,6 @@ class SALOMEDSClient_SObject;
 class algo_error_array;
 
 
 class algo_error_array;
 
 
-#define PLUGIN_NAME "PLUGIN_NAME"
-
 namespace SMESH
 {
   SMESHGUI_EXPORT
 namespace SMESH
 {
   SMESHGUI_EXPORT
@@ -119,6 +117,11 @@ namespace SMESH
 
   SMESHGUI_EXPORT
   QString GetMessageOnAlgoStateErrors( const algo_error_array& );
 
   SMESHGUI_EXPORT
   QString GetMessageOnAlgoStateErrors( const algo_error_array& );
+
+  SMESHGUI_EXPORT
+  // name of proprty saving plug-in of a hypothesis
+  static const char* Plugin_Name() { return "PLUGIN_NAME"; }
+
 }
 
 #endif // SMESHGUI_HYPOTHESESUTILS_H
 }
 
 #endif // SMESHGUI_HYPOTHESESUTILS_H
index 8c1813f5636753b9da8cf4fa6521e4c69c2edf31..bed7c25fda6dc159638fb18e57d4e00ba54d7c87 100644 (file)
@@ -363,15 +363,36 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
       // skl for NPAL14695 - implementation of searching of mainObj
       GEOM::GEOM_Object_var mainObj = op->GetMainShape(aSubGeomVar); /* _var not _wrap as
                                                                         mainObj already exists! */
       // skl for NPAL14695 - implementation of searching of mainObj
       GEOM::GEOM_Object_var mainObj = op->GetMainShape(aSubGeomVar); /* _var not _wrap as
                                                                         mainObj already exists! */
-      while(1) {
-        if (mainObj->_is_nil())
-          return false;
+      while( !mainObj->_is_nil()) {
         CORBA::String_var entry1 = mainObj->GetEntry();
         CORBA::String_var entry2 = mainGeom->GetEntry();
         if (std::string( entry1.in() ) == entry2.in() )
           return true;
         mainObj = op->GetMainShape(mainObj);
       }
         CORBA::String_var entry1 = mainObj->GetEntry();
         CORBA::String_var entry2 = mainGeom->GetEntry();
         if (std::string( entry1.in() ) == entry2.in() )
           return true;
         mainObj = op->GetMainShape(mainObj);
       }
+      if ( aSubGeomVar->GetShapeType() == GEOM::COMPOUND )
+      {
+        // is aSubGeomVar a compound of sub-shapes?
+        GEOM::GEOM_IShapesOperations_wrap sop = geomGen->GetIShapesOperations(aStudy->StudyId());
+        if (sop->_is_nil()) return false;
+        GEOM::ListOfLong_var ids = sop->GetAllSubShapesIDs( aSubGeomVar,
+                                                            GEOM::SHAPE,/*sorted=*/false);
+        if ( ids->length() > 0 )
+        {
+          ids->length( 1 );
+          GEOM::GEOM_Object_var compSub = geomGen->AddSubShape( aSubGeomVar, ids );
+          if ( !compSub->_is_nil() )
+          {
+            GEOM::ListOfGO_var shared = sop->GetSharedShapes( mainGeom,
+                                                              compSub,
+                                                              compSub->GetShapeType() );
+            geomGen->RemoveObject( compSub );
+            if ( shared->length() > 0 )
+              geomGen->RemoveObject( shared[0] );
+            return ( shared->length() > 0 );
+          }
+        }
+      }
     }
   }
 
     }
   }