*/
//=============================================================================
BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
- int theStudyId,
- ::SMESH_Gen* theGenImpl) :
- SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA) {
- MESSAGE( "BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i" );
- myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(), theGenImpl);
+ ::SMESH_Gen* theGenImpl,
+ bool theHasGEOM) :
+ SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA)
+{
+ myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(),
- theStudyId,
++
+ theGenImpl,
+ theHasGEOM);
}
//=============================================================================
//=============================================================================
--void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius) //TODO à finir
++void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius) //TODO ?? finir
throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
// //=============================================================================
//
--// // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
++// // TODO coder cette fonction (utilis??e pour savoir si la valeur a chang??
// // A finir pour le dump
// char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
// throw (SALOME::SALOME_Exception)
}
/*!
- * Set/get/unset an enforced vertex on geom object given by entry
+ * Set/get/unset an enforced vertex on face - NEW (no face)
+ */
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+
+ try {
+ return SetEnforcedVertexEntry("", x, y, z);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set/get/unset an enforced vertex with name on face
+ */
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
+{
+ try {
+ return SetEnforcedVertexEntry("", x, y, z, theVertexName);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set/get/unset an enforced vertex with geom object on face
+ */
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
+ throw (SALOME::SALOME_Exception)
+{
+ if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
+ THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
+ }
+ string theVertexEntry = theVertex->GetStudyEntry();
+
+ GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ string aName;
+
+ if (theVertexEntry.empty()) {
+ if (theVertex->GetShapeType() == GEOM::VERTEX)
+ aName = "Vertex_";
+ if (theVertex->GetShapeType() == GEOM::COMPOUND)
+ aName = "Compound_";
+ aName += theVertex->GetEntry();
- SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
++ SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
+ if (!theSVertex->_is_nil())
+ theVertexEntry = theSVertex->GetID();
+ }
+ if (theVertexEntry.empty())
+ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
+
+ string theVertexName = theVertex->GetName();
+ try {
+ return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set an enforced vertex with group name on face
+ */
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+
+ try {
+ return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set an enforced vertex with name and group name on face
*/
-bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
- CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
- throw (SALOME::SALOME_Exception) {
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z,
+ const char* theVertexName, const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
ASSERT(myBaseImpl);
- MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
+
+ try {
+ return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set an enforced vertex with geom entry and group name on face
+ */
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
+ if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
+ THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
+ }
+
+ string theVertexEntry = theVertex->GetStudyEntry();
+
+ GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ string aName;
+
+ if (theVertexEntry.empty()) {
+ if (theVertex->GetShapeType() == GEOM::VERTEX)
+ aName = "Vertex_";
+ if (theVertex->GetShapeType() == GEOM::COMPOUND)
+ aName = "Compound_";
+ aName += theVertex->GetEntry();
- SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
++ SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
+ if (!theSVertex->_is_nil())
+ theVertexEntry = theSVertex->GetID();
+ }
+ if (theVertexEntry.empty())
+ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
+
+ string theVertexName = theVertex->GetName();
+ try {
+ return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
+{
+ try {
+ return UnsetEnforcedVertexEntry("", x, y, z);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
+ throw (SALOME::SALOME_Exception)
+{
+ if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
+ THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
+ }
+ std::string theVertexEntry = theVertex->GetStudyEntry();
+
+ GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ string aName;
+
+ if (theVertexEntry.empty()) {
+ if (theVertex->GetShapeType() == GEOM::VERTEX)
+ aName = "Vertex_";
+ if (theVertex->GetShapeType() == GEOM::COMPOUND)
+ aName = "Compound_";
+ aName += theVertex->GetEntry();
- SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
++ SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
+ if (!theSVertex->_is_nil())
+ theVertexEntry = theSVertex->GetID();
+ }
+ if (theVertexEntry.empty())
+ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
+
+ try {
+ return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
+{
+ try {
+ return UnsetEnforcedVerticesEntry("");
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set/get/unset an enforced vertex on geom object given by entry
+ */
+bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
+ CORBA::Double x,
+ CORBA::Double y,
+ CORBA::Double z,
+ const char* theVertexName,
+ const char* theVertexEntry,
+ const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
bool newValue = false;
if (string(theVertexEntry).empty()) {
try {
/*
* Enable internal enforced vertices on specific face if requested by user
*
-void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
+ void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
throw (SALOME::SALOME_Exception)
-{
- MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
- try {
- SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
- } catch (SALOME_Exception& ex) {
- THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
- }
-}
+ {
+ try {
+ SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+ }
-void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
+ void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
throw (SALOME::SALOME_Exception)
-{
- MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
-
- if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theFace shape type is not FACE or COMPOUND");
- THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
- }
-
- string theFaceEntry = theFace->GetStudyEntry();
-
- if (theFaceEntry.empty()) {
- GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- string aName;
- if (theFace->GetShapeType() == GEOM::FACE)
- aName = "Face_";
- if (theFace->GetShapeType() == GEOM::COMPOUND)
- aName = "Compound_";
- aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
- if (!theSFace->_is_nil())
- theFaceEntry = theSFace->GetID();
- }
- if (theFaceEntry.empty())
- THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
-
- MESSAGE("IDL : GetName : " << theFace->GetName());
- MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
- try {
- SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
- } catch (SALOME_Exception& ex) {
- THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
- }
-}
+ {
-void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
- throw (SALOME::SALOME_Exception)
-{
- MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
- ASSERT(myBaseImpl);
- try {
- this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
- std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
- if (string(theGroupName).empty())
- SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
- else
- SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
- } catch (const std::exception& ex) {
- std::cout << "Exception: " << ex.what() << std::endl;
- THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
- }
-}
+ if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
+ THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
+ }
-*/
+ string theFaceEntry = theFace->GetStudyEntry();
+
+ if (theFaceEntry.empty()) {
+ GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ string aName;
+ if (theFace->GetShapeType() == GEOM::FACE)
+ aName = "Face_";
+ if (theFace->GetShapeType() == GEOM::COMPOUND)
+ aName = "Compound_";
+ aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
++ SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
+ if (!theSFace->_is_nil())
+ theFaceEntry = theSFace->GetID();
+ }
+ if (theFaceEntry.empty())
+ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
-/* TODO GROUPS
- char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
- throw (SALOME::SALOME_Exception)
- {
- ASSERT(myBaseImpl);
- MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
try {
- return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
- }
- catch (const std::invalid_argument& ex) {
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = ex.what();
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
- ExDescription.lineNumber = 1146;
- throw SALOME::SALOME_Exception(ExDescription);
- }
- catch (SALOME_Exception& ex) {
+ SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
+ } catch (SALOME_Exception& ex) {
THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
}
- MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
- return 0;
}
-
- void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
+ void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);