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
This commit is contained in:
eap 2014-10-21 14:50:56 +04:00
parent 82d27750a5
commit 2742029b90
5 changed files with 36 additions and 13 deletions

View File

@ -257,15 +257,14 @@ hypothesis operation.
\anchor automatic_length_anchor \anchor automatic_length_anchor
<h2>Automatic Length</h2> <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 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, only one parameter, which is \b Fineness, ranging from 0 (coarse mesh,
low number of elements) to 1 (extremely fine mesh, great number of 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. minimum and maximum value of this parameter.
\image html image147.gif "Example of a very rough mesh. Automatic Length works for 0." \image html image147.gif "Example of a very rough mesh. Automatic Length works for 0."

View File

@ -670,7 +670,7 @@ void SMESHGUI_HypothesisDlg::onHelp()
if (app) { if (app) {
QString name = "SMESH"; QString name = "SMESH";
if(myCreator) { if(myCreator) {
QVariant pluginName = myCreator->property( PLUGIN_NAME ); QVariant pluginName = myCreator->property( SMESH::Plugin_Name() );
if( pluginName.isValid() ) { if( pluginName.isValid() ) {
QString rootDir = pluginName.toString() + "PLUGIN_ROOT_DIR"; QString rootDir = pluginName.toString() + "PLUGIN_ROOT_DIR";
QString varValue = QString( getenv(rootDir.toLatin1().constData())); QString varValue = QString( getenv(rootDir.toLatin1().constData()));

View File

@ -469,7 +469,7 @@ namespace SMESH
// It is used to obtain plugin root dir environment variable // It is used to obtain plugin root dir environment variable
// in the SMESHGUI_HypothesisDlg class. Plugin root dir environment // in the SMESHGUI_HypothesisDlg class. Plugin root dir environment
// variable is used to display documentation. // variable is used to display documentation.
aCreator->setProperty(PLUGIN_NAME,aHypData->PluginName); aCreator->setProperty(SMESH::Plugin_Name(),aHypData->PluginName);
} }
} }
} }

View File

@ -58,8 +58,6 @@ class SALOMEDSClient_SObject;
class algo_error_array; class algo_error_array;
#define PLUGIN_NAME "PLUGIN_NAME"
namespace SMESH namespace SMESH
{ {
SMESHGUI_EXPORT SMESHGUI_EXPORT
@ -119,6 +117,11 @@ namespace SMESH
SMESHGUI_EXPORT SMESHGUI_EXPORT
QString GetMessageOnAlgoStateErrors( const algo_error_array& ); 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

View File

@ -363,15 +363,36 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
// skl for NPAL14695 - implementation of searching of mainObj // skl for NPAL14695 - implementation of searching of mainObj
GEOM::GEOM_Object_var mainObj = op->GetMainShape(aSubGeomVar); /* _var not _wrap as GEOM::GEOM_Object_var mainObj = op->GetMainShape(aSubGeomVar); /* _var not _wrap as
mainObj already exists! */ mainObj already exists! */
while(1) { while( !mainObj->_is_nil()) {
if (mainObj->_is_nil())
return false;
CORBA::String_var entry1 = mainObj->GetEntry(); CORBA::String_var entry1 = mainObj->GetEntry();
CORBA::String_var entry2 = mainGeom->GetEntry(); CORBA::String_var entry2 = mainGeom->GetEntry();
if (std::string( entry1.in() ) == entry2.in() ) if (std::string( entry1.in() ) == entry2.in() )
return true; return true;
mainObj = op->GetMainShape(mainObj); 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 );
}
}
}
} }
} }