* Verify whether hypothesis supports given entity type
*/
boolean IsDimSupported( in Dimension type );
+
+ /*!
+ * Return true if a hypothesis has parameters.
+ *
+ * This method is intended for GUI to know if "Edit" menu item sould be available
+ */
+ boolean HasParameters();
};
typedef sequence<string> ListOfHypothesisName;
createPopupItem( SMESHOp::OpCreateGeometryGroup, OB, mesh, "&& hasGeomReference" );
createPopupItem( SMESHOp::OpConstructGroup, OB, subMesh );
popupMgr()->insert( separator(), -1, 0 );
- createPopupItem( SMESHOp::OpEditHypothesis, OB, hypo);
+ createPopupItem( SMESHOp::OpEditHypothesis, OB, hypo, "&& isEditableHyp");
createPopupItem( SMESHOp::OpUnassign, OB, hyp_alg ); // REMOVE HYPOTHESIS / ALGORITHMS
popupMgr()->insert( separator(), -1, 0 );
createPopupItem( SMESHOp::OpConvertMeshToQuadratic, OB, mesh + " " + subMesh ); // convert to quadratic
else if ( p=="isComputable" ) val = QVariant( isComputable( ind ) );
else if ( p=="isPreComputable" ) val = QVariant( isPreComputable( ind ) );
else if ( p=="hasGeomReference" ) val = QVariant( hasGeomReference( ind ) );
+ else if ( p=="isEditableHyp" ) val = QVariant( isEditableHyp( ind ) );
else if ( p=="isImported" ) val = QVariant( isImported( ind ) );
else if ( p=="facesOrientationMode" ) val = QVariant( facesOrientationMode( ind ) );
else if ( p=="groupType" ) val = QVariant( groupType( ind ) );
//purpose : return true for a ready-to-compute mesh
//=======================================================================
-QVariant SMESHGUI_Selection::isComputable( int ind ) const
+bool SMESHGUI_Selection::isComputable( int ind ) const
{
if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] == "Mesh" )
{
QMap<int,int> modeMap;
_PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
SMESHGUI_PrecomputeOp::getAssignedAlgos( so, modeMap );
- return QVariant( modeMap.size() > 0 );
+ return modeMap.size() > 0;
}
- return QVariant( false );
+ return false;
}
//=======================================================================
//purpose : returns true for a mesh with algorithms
//=======================================================================
-QVariant SMESHGUI_Selection::isPreComputable( int ind ) const
+bool SMESHGUI_Selection::isPreComputable( int ind ) const
{
if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] == "Mesh" )
{
_PTR(SObject) pMesh = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
SMESHGUI_PrecomputeOp::getAssignedAlgos( pMesh, modeMap );
if ( modeMap.size() > 1 )
- return QVariant( ( modeMap.contains( SMESH::DIM_3D )) ||
- ( modeMap.contains( SMESH::DIM_2D ) && maxDim < 1 ));
+ return (( modeMap.contains( SMESH::DIM_3D )) ||
+ ( modeMap.contains( SMESH::DIM_2D ) && maxDim < 1 ));
}
}
- return QVariant( false );
+ return false;
}
//=======================================================================
//purpose : returns true for a mesh or sub-mesh on geometry
//=======================================================================
-QVariant SMESHGUI_Selection::hasGeomReference( int ind ) const
+bool SMESHGUI_Selection::hasGeomReference( int ind ) const
{
if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
{
_PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
GEOM::GEOM_Object_var shape = SMESH::GetShapeOnMeshOrSubMesh( so );
- return QVariant( !shape->_is_nil() );
+ return !shape->_is_nil();
+ }
+ return false;
+}
+
+//=======================================================================
+//function : isEditableHyp
+//purpose :
+//=======================================================================
+
+bool SMESHGUI_Selection::isEditableHyp( int ind ) const
+{
+ bool isEditable = true;
+ if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] == "Hypothesis" )
+ {
+ _PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
+ SMESH::SMESH_Hypothesis_var hyp = SMESH::SObjectToInterface<SMESH::SMESH_Hypothesis>( so );
+ if ( !hyp->_is_nil() )
+ {
+ isEditable = hyp->HasParameters();
+ }
}
- return QVariant( false );
+ return isEditable;
}
//=======================================================================
//purpose :
//=======================================================================
-QVariant SMESHGUI_Selection::isVisible( int ind ) const
+bool SMESHGUI_Selection::isVisible( int ind ) const
{
if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
{
SMESH_Actor* actor = SMESH::FindActorByEntry( entry( ind ).toLatin1().data() );
if ( actor && actor->hasIO() ) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView() )
- return QVariant( aViewWindow->isVisible( actor->getIO() ) );
+ return aViewWindow->isVisible( actor->getIO() );
}
}
- return QVariant( false );
+ return false;
}
//=======================================================================
virtual bool isAutoColor( int ) const;
virtual int numberOfNodes( int ) const;
virtual int dim( int ) const;
- virtual QVariant isComputable( int ) const;
- virtual QVariant isPreComputable( int ) const;
- virtual QVariant hasGeomReference( int ) const;
- virtual QVariant isVisible( int ) const;
+ virtual bool isComputable( int ) const;
+ virtual bool isPreComputable( int ) const;
+ virtual bool hasGeomReference( int ) const;
+ virtual bool isEditableHyp( int ) const;
+ virtual bool isVisible( int ) const;
virtual QString quadratic2DMode( int ) const;
Threshold = SMESH + types[ iGeom ];
#ifdef _DEBUG_
// is types complete? (compilation failure mains that enum GeometryType changed)
- int _assert[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 1 : -1 ];
+ int _assert[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 1 : -1 ]; _assert[0]=1;
#endif
}
if (Type == "SMESH.FT_EntityType")
Threshold = SMESH + types[ iGeom ];
#ifdef _DEBUG_
// is types complete? (compilation failure mains that enum EntityType changed)
- int _assert[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 1 : -1 ];
+ int _assert[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 1 : -1 ]; _assert[0]=1;
#endif
}
}
TCollection_AsciiString grIDs = theCommand->GetResultValue();
list< _pyID > idList = theCommand->GetStudyEntries( grIDs );
list< _pyID >::iterator grID = idList.begin();
- const int nbGroupsBefore = myGroups.size();
+ const size_t nbGroupsBefore = myGroups.size();
Handle(_pyObject) obj;
for ( ; grID != idList.end(); ++grID )
{
{
if ( myCurCrMethod )
{
- while ( myCurCrMethod->myArgs.size() < argNb )
+ while ( (int) myCurCrMethod->myArgs.size() < argNb )
myCurCrMethod->myArgs.push_back( "None" );
if ( arg.IsEmpty() )
myCurCrMethod->myArgs[ argNb-1 ] = "None";
for ( ; type2meth != myAlgoType2CreationMethod.end(); ++type2meth )
{
CreationMethod& crMethod = type2meth->second;
- while ( crMethod.myArgs.size() < i+1 )
+ while ( (int) crMethod.myArgs.size() < i+1 )
crMethod.myArgs.push_back( "[]" );
crMethod.myArgs[ i ] = theCommand->GetArg( 1 ); // arg value
}
public:
_pyCommand() {};
_pyCommand( const _AString& theString, int theNb=-1 )
- : myString( theString ), myOrderNb( theNb ) {};
+ : myOrderNb( theNb ), myString( theString ) {};
_AString & GetString() { return myString; }
int GetOrderNb() const { return myOrderNb; }
void SetOrderNb( int theNb ) { myOrderNb = theNb; }
return TopoDS_Shape();
}
-static std::string getShapeNameByID (const char* theID)
-{
- if ( theID && strlen( theID ) > 0 ) {
- SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
- SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
- if ( !aStudy->_is_nil() ) {
- SALOMEDS::SObject_wrap aSObj = aStudy->FindObjectID(theID);
- if ( !aSObj->_is_nil() ) {
- CORBA::String_var name = aSObj->GetName();
- return name.in();
- }
- }
- }
- return "";
-}
+// static std::string getShapeNameByID (const char* theID)
+// {
+// if ( theID && strlen( theID ) > 0 ) {
+// SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+// SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
+// if ( !aStudy->_is_nil() ) {
+// SALOMEDS::SObject_wrap aSObj = aStudy->FindObjectID(theID);
+// if ( !aSObj->_is_nil() ) {
+// CORBA::String_var name = aSObj->GetName();
+// return name.in();
+// }
+// }
+// }
+// return "";
+// }
/*
FUNCTORS
Class : LogicalNOT_i
Description : Logical NOT predicate
*/
-LogicalNOT_i::LogicalNOT_i()
-: myPredicate( NULL ),
- myLogicalNOTPtr( new Controls::LogicalNOT() )
+LogicalNOT_i::LogicalNOT_i():
+ myLogicalNOTPtr( new Controls::LogicalNOT() ),
+ myPredicate( NULL )
{
myFunctorPtr = myPredicatePtr = myLogicalNOTPtr;
}
#ifdef _DEBUG_
// check if functName is complete, compilation failure means that enum FunctorType changed
const int nbFunctors = sizeof(functName) / sizeof(const char*);
- int _assert[( nbFunctors == SMESH::FT_Undefined + 1 ) ? 1 : -1 ];
+ int _assert[( nbFunctors == SMESH::FT_Undefined + 1 ) ? 1 : -1 ]; _assert[0]=1;
#endif
return functName;
return myBaseImpl;
}
+//================================================================================
+/*!
+ * \brief Return true if a hypothesis has parameters
+ */
+//================================================================================
+
+CORBA::Boolean SMESH_Hypothesis_i::HasParameters()
+{
+ std::ostringstream os;
+ myBaseImpl->SaveTo( os );
+ return ( !os.str().empty() );
+}
+
//=============================================================================
/*!
* SMESH_Hypothesis_i::SaveTo
virtual ~SMESH_Hypothesis_i();
// Get type name of hypothesis
- char* GetName();
+ virtual char* GetName();
// Get plugin library name of hypothesis
- char* GetLibName();
+ virtual char* GetLibName();
// Set plugin library name of hypothesis
void SetLibName( const char* theLibName );
// Get unique id of hypothesis
- CORBA::Long GetId();
-
+ virtual CORBA::Long GetId();
+
+ // Return true if a hypothesis has parameters
+ virtual CORBA::Boolean HasParameters();
+
// Set the variable parameter (a variable name or a parameter value); \a method is a name
// of method setting this parameter.
// This method must be called by the hypothesis creator just before calling hyp->method()
- void SetVarParameter (const char* parameter, const char* method);
+ virtual void SetVarParameter (const char* parameter, const char* method);
// Return the variable parameter used at Hypothesis Creation by the name of method
// setting this parameter. The returned variable name is used at Hypothesis Edition.
- char* GetVarParameter (const char* methodName);
+ virtual char* GetVarParameter (const char* methodName);
// Store a hypothesis wrapping this not published one. This hyp, which has
// no own parameters but is published, is used to store variables defining parameters
// of this hypothesis. This method is to be called before setting parameters
// of this hypothesis.
- void SetHolderHypothesis(const SMESH::SMESH_Hypothesis_ptr hyp);
+ virtual void SetHolderHypothesis(const SMESH::SMESH_Hypothesis_ptr hyp);
//Return true if hypothesis was published in study
bool IsPublished();
return theTypes->length() > 0 && theTypes[0] == SMESH::NODE;
}
-static double getNumericalValue(SMESH::SMESH_IDSource_ptr theSource, SMESH::Controls::NumericalFunctorPtr theFunctor)
+static double getNumericalValue(SMESH::SMESH_IDSource_ptr theSource,
+ SMESH::Controls::NumericalFunctorPtr theFunctor)
{
double value = 0;
theFunctor->SetMesh( aMesh );
SMESH::long_array_var anElementsId = theSource->GetIDs();
- for (int i = 0; i < anElementsId->length(); i++) {
+ for ( CORBA::ULong i = 0; i < anElementsId->length(); i++) {
value += theFunctor->GetValue( anElementsId[i] );
}
}
list<const gp_XYZ *> xyzList;
set<const SMDS_MeshFace*> fset;
- for (int i = 0; i < theFacesIDs.length(); i++)
+ for ( CORBA::ULong i = 0; i < theFacesIDs.length(); i++)
{
CORBA::Long index = theFacesIDs[i];
const SMDS_MeshElement * elem = aMesh->GetMeshDS()->FindElement(index);
list<const gp_XYZ *> xyzList;
set<const SMDS_MeshVolume*> vset;
- for (int i = 0; i < theVolumesIDs.length(); i++)
+ for ( CORBA::ULong i = 0; i < theVolumesIDs.length(); i++)
{
CORBA::Long index = theVolumesIDs[i];
const SMDS_MeshElement * elem = aMesh->GetMeshDS()->FindElement(index);
HDFdataset* aDataset = new HDFdataset( (char*) aDSName.c_str(), aGroup );
aDataset->OpenOnDisk();
// read submesh IDs for all elements sorted by ID
- int nbElems = aDataset->GetSize();
+ size_t nbElems = aDataset->GetSize();
int* smIDs = new int [ nbElems ];
aDataset->ReadFromDisk( smIDs );
aDataset->CloseOnDisk();
}
// add elements to submeshes
TIDSortedElemSet::iterator iE = elemSet.begin();
- for ( int i = 0; i < nbElems; ++i, ++iE )
+ for ( size_t i = 0; i < nbElems; ++i, ++iE )
{
int smID = smIDs[ i ];
if ( smID == 0 ) continue;
bool getSubMeshes(::SMESH_subMesh* theSubMesh,
TListOfSubMeshes& theSubMeshList)
{
- int size = theSubMeshList.size();
+ size_t size = theSubMeshList.size();
SMESH_Mesh* aMesh = theSubMesh->GetFather();
SMESHDS_Mesh* aMeshDS = aMesh->GetMeshDS();
allEdges, theShortEdges[ nbBranchPoints > 0 ] ))
return false;
- for ( size_t iS = 0; iS < theShortEdges[ nbBranchPoints ].size(); ++iS )
+ for ( size_t iS = 0; iS < theShortEdges[ nbBranchPoints > 0 ].size(); ++iS )
shortMap.Add( theShortEdges[ nbBranchPoints ][ iS ]);
++nbBranchPoints;
SMESH::double_array_var anArray = new SMESH::double_array;
std::vector<double> params = this->GetImpl()->GetPoints();
anArray->length( params.size() );
- for ( CORBA::Long i = 0; i < params.size(); i++)
+ for ( CORBA::ULong i = 0; i < params.size(); i++)
anArray [ i ] = params [ i ];
return anArray._retn();
SMESH::long_array_var anArray = new SMESH::long_array;
std::vector<int> nbsegs = this->GetImpl()->GetNbSegments();
anArray->length( nbsegs.size() );
- for ( CORBA::Long i = 0; i < nbsegs.size(); i++)
+ for ( CORBA::ULong i = 0; i < nbsegs.size(); i++)
anArray [ i ] = nbsegs [ i ];
return anArray._retn();
SMESH::long_array_var anArray = new SMESH::long_array;
std::vector<int> ids = this->GetImpl()->GetReversedEdges();
anArray->length( ids.size() );
- for ( CORBA::Long i = 0; i < ids.size(); i++)
+ for ( CORBA::ULong i = 0; i < ids.size(); i++)
anArray [ i ] = ids [ i ];
return anArray._retn();
std::vector<SMESH_Group*> smesh_groups;
std::vector<string> entries;
SALOMEDS::Study_var study = SMESH_Gen_i::GetSMESHGen()->GetCurrentStudy();
- for ( int i = 0; i < groups.length(); ++i )
+ for ( CORBA::ULong i = 0; i < groups.length(); ++i )
if ( SMESH_GroupBase_i* gp_i = SMESH::DownCast<SMESH_GroupBase_i*>( groups[i] ))
{
if ( gp_i->GetType() != SMESH::EDGE )
_groupEntries = new SMESH::string_array;
_groupEntries->length( entries.size ());
- for ( int i = 0; i < entries.size(); ++i )
+ for ( size_t i = 0; i < entries.size(); ++i )
_groupEntries[i] = entries[i].c_str();
}
catch ( SALOME_Exception& S_ex )
os << " " << _groupEntries->length();
SALOMEDS::Study_var study = SMESH_Gen_i::GetSMESHGen()->GetCurrentStudy();
- for ( int i = 0; i < _groupEntries->length(); ++i )
+ for ( size_t i = 0; i < _groupEntries->length(); ++i )
{
// entry
os << " " << _groupEntries[i];
_groupEntries = new SMESH::string_array;
_groupEntries->length( nbGroups );
std::string id, entry;
- for ( int i = 0; i < _groupEntries->length(); ++i )
+ for ( size_t i = 0; i < _groupEntries->length(); ++i )
{
if ( is >> entry )
_groupEntries[i] = entry.c_str();
std::vector<SMESH_Group*> smesh_groups;
std::vector<string> entries;
SALOMEDS::Study_var study = SMESH_Gen_i::GetSMESHGen()->GetCurrentStudy();
- for ( int i = 0; i < groups.length(); ++i )
+ for ( CORBA::ULong i = 0; i < groups.length(); ++i )
if ( SMESH_GroupBase_i* gp_i = SMESH::DownCast<SMESH_GroupBase_i*>( groups[i] ))
{
if ( gp_i->GetType() != SMESH::FACE )
_groupEntries = new SMESH::string_array;
_groupEntries->length( entries.size ());
- for ( int i = 0; i < entries.size(); ++i )
+ for ( size_t i = 0; i < entries.size(); ++i )
_groupEntries[i] = entries[i].c_str();
}
catch ( SALOME_Exception& S_ex )
os << " " << _groupEntries->length();
SALOMEDS::Study_var study = SMESH_Gen_i::GetSMESHGen()->GetCurrentStudy();
- for ( int i = 0; i < _groupEntries->length(); ++i )
+ for ( CORBA::ULong i = 0; i < _groupEntries->length(); ++i )
{
// entry
os << " " << _groupEntries[i];
_groupEntries = new SMESH::string_array;
_groupEntries->length( nbGroups );
std::string id, entry;
- for ( int i = 0; i < _groupEntries->length(); ++i )
+ for ( CORBA::ULong i = 0; i < _groupEntries->length(); ++i )
{
if ( is >> entry )
_groupEntries[i] = entry.c_str();
return this->GetImpl()->GetMode();
}
+//================================================================================
+/*!
+ * \brief Return false as in SALOME the mode is not used
+ */
+//================================================================================
+
+CORBA::Boolean StdMeshers_LengthFromEdges_i::HasParameters()
+{
+ return false;
+}
//=============================================================================
/*!
// Get mode
CORBA::Long GetMode();
+ // Return false as in SALOME the mode is not used
+ CORBA::Boolean HasParameters();
+
// Get implementation
::StdMeshers_LengthFromEdges* GetImpl();