From 2742029b9094540c12b9e30bbdb958087e0cb850 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 21 Oct 2014 14:50:56 +0400 Subject: [PATCH] http://www.salome-platform.org/forum/forum_10/881672547 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 --- .../gui/SMESH/input/1d_meshing_hypo.doc | 11 ++++---- src/SMESHGUI/SMESHGUI_Hypotheses.cxx | 2 +- src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx | 2 +- src/SMESHGUI/SMESHGUI_HypothesesUtils.h | 7 +++-- src/SMESHGUI/SMESHGUI_MeshOp.cxx | 27 ++++++++++++++++--- 5 files changed, 36 insertions(+), 13 deletions(-) diff --git a/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc b/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc index 7a9228b68..8c38c8ddf 100644 --- a/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc +++ b/doc/salome/gui/SMESH/input/1d_meshing_hypo.doc @@ -257,15 +257,14 @@ hypothesis operation. \anchor automatic_length_anchor

Automatic Length

-This hypothesis is automatically applied when you select Assign a -set of hypotheses 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 -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." diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx index af1377aba..630100e71 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx @@ -670,7 +670,7 @@ void SMESHGUI_HypothesisDlg::onHelp() 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())); diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx index 836c2e360..dc499bd73 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx @@ -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. - aCreator->setProperty(PLUGIN_NAME,aHypData->PluginName); + aCreator->setProperty(SMESH::Plugin_Name(),aHypData->PluginName); } } } diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.h b/src/SMESHGUI/SMESHGUI_HypothesesUtils.h index 2841b7a7f..4e4f4a868 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.h +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.h @@ -58,8 +58,6 @@ class SALOMEDSClient_SObject; class algo_error_array; -#define PLUGIN_NAME "PLUGIN_NAME" - namespace SMESH { SMESHGUI_EXPORT @@ -119,6 +117,11 @@ namespace SMESH 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 diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index 8c1813f56..bed7c25fd 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -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! */ - 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); } + 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 ); + } + } + } } } -- 2.39.2