X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FBLSURFPlugin%2FBLSURFPlugin_Hypothesis_i.cxx;h=beaddc1b30b9a60713a33f5d78db4ff812e72d7d;hb=8422810dcc5e588762f906db7a15f31eb337f3eb;hp=77af19a96c2c02c0ccb447887755aac823889551;hpb=92893180990bccec5db0f74c6efb0500145a0687;p=plugins%2Fblsurfplugin.git diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx index 77af19a..beaddc1 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,17 +24,18 @@ // --- // #include "BLSURFPlugin_Hypothesis_i.hxx" -#include "SMESH_Gen.hxx" -#include "SMESH_Gen_i.hxx" -#include "SMESH_PythonDump.hxx" -#include "GEOM_Object.hxx" -#include "Utils_CorbaException.hxx" -#include "utilities.h" +#include +#include +#include + +#include +#include +#include #include #include -#include "boost/regex.hpp" +#include //============================================================================= /*! @@ -144,7 +145,7 @@ void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue) { // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySizeRel"); ASSERT(myBaseImpl); this->GetImpl()->SetPhySize(theValue, true); - SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << ", isRelative = True )"; + SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )"; } //============================================================================= @@ -176,7 +177,7 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel() { //============================================================================= void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize) { ASSERT(myBaseImpl); - if (GetMinSize() != theMinSize) { + if (IsMinSizeRel() || GetMinSize() != theMinSize ) { this->GetImpl()->SetMinSize(theMinSize, false); SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )"; } @@ -185,9 +186,9 @@ void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize) { //============================================================================= void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize) { ASSERT(myBaseImpl); - if ( IsMinSizeRel() && (GetMinSize() != theMinSize) ) { + if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) { this->GetImpl()->SetMinSize(theMinSize, true); - SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << ", isRelative = True )"; + SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )"; } } @@ -207,7 +208,7 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel() { //============================================================================= void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize) { ASSERT(myBaseImpl); - if (GetMaxSize() != theMaxSize) { + if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) { this->GetImpl()->SetMaxSize(theMaxSize, false); SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )"; } @@ -216,9 +217,9 @@ void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize) { //============================================================================= void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize) { ASSERT(myBaseImpl); - if ( IsMaxSizeRel() && (GetMaxSize() != theMaxSize) ) { + if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) { this->GetImpl()->SetMaxSize(theMaxSize, true); - SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << ", isRelative = True )"; + SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )"; } } @@ -807,16 +808,30 @@ BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() { BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array(); const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues(); - result->length(opts.size()); + const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues(); + result->length(opts.size()+custom_opts.size()); + int i=0; ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin(); - for (int i = 0; opIt != opts.end(); ++opIt, ++i) { - string name_value = opIt->first; + for (; opIt != opts.end(); ++opIt, ++i) { + string name_value_type = opIt->first; + if (!opIt->second.empty()) { + name_value_type += ":"; + name_value_type += opIt->second; + name_value_type += ":0"; + } + result[i] = CORBA::string_dup(name_value_type.c_str()); + } + + opIt = custom_opts.begin(); + for (; opIt != custom_opts.end(); ++opIt,++i) { + string name_value_type = opIt->first; if (!opIt->second.empty()) { - name_value += ":"; - name_value += opIt->second; + name_value_type += ":"; + name_value_type += opIt->second; + name_value_type += ":1"; } - result[i] = CORBA::string_dup(name_value.c_str()); + result[i] = CORBA::string_dup(name_value_type.c_str()); } return result._retn(); } @@ -828,16 +843,30 @@ BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() { BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array(); const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues(); - result->length(opts.size()); + const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomPreCADOptionValues(); + result->length(opts.size()+custom_opts.size()); + int i=0; ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin(); - for (int i = 0; opIt != opts.end(); ++opIt, ++i) { - string name_value = opIt->first; + for (; opIt != opts.end(); ++opIt, ++i) { + string name_value_type = opIt->first; + if (!opIt->second.empty()) { + name_value_type += ":"; + name_value_type += opIt->second; + name_value_type += ":0"; + } + result[i] = CORBA::string_dup(name_value_type.c_str()); + } + + opIt = custom_opts.begin(); + for (; opIt != custom_opts.end(); ++opIt,++i) { + string name_value_type = opIt->first; if (!opIt->second.empty()) { - name_value += ":"; - name_value += opIt->second; + name_value_type += ":"; + name_value_type += opIt->second; + name_value_type += ":1"; } - result[i] = CORBA::string_dup(name_value.c_str()); + result[i] = CORBA::string_dup(name_value_type.c_str()); } return result._retn(); } @@ -848,17 +877,25 @@ void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); for (int i = 0; i < options.length(); ++i) { - string name_value = options[i].in(); - int colonPos = name_value.find(':'); + string name_value_type = options[i].in(); + if(name_value_type.empty()) + continue; + int colonPos = name_value_type.find(':'); string name, value; + bool custom = false; if (colonPos == string::npos) // ':' not found - name = name_value; + name = name_value_type; else { - name = name_value.substr(0, colonPos); - if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ') - value = name_value.substr(colonPos + 1); + name = name_value_type.substr(0, colonPos); + if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') { + string value_type = name_value_type.substr(colonPos + 1); + colonPos = value_type.find(':'); + value = value_type.substr(0, colonPos); + if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ') + custom = atoi((value_type.substr(colonPos + 1)).c_str()); + } } - SetOptionValue(name.c_str(), value.c_str()); + custom ? AddOption(name.c_str(), value.c_str()) : SetOptionValue(name.c_str(), value.c_str()); } } @@ -868,26 +905,76 @@ void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); for (int i = 0; i < options.length(); ++i) { - string name_value = options[i].in(); - int colonPos = name_value.find(':'); + string name_value_type = options[i].in(); + if(name_value_type.empty()) + continue; + int colonPos = name_value_type.find(':'); string name, value; + bool custom = false; if (colonPos == string::npos) // ':' not found - name = name_value; + name = name_value_type; else { - name = name_value.substr(0, colonPos); - if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ') - value = name_value.substr(colonPos + 1); + name = name_value_type.substr(0, colonPos); + if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') { + string value_type = name_value_type.substr(colonPos + 1); + colonPos = value_type.find(':'); + value = value_type.substr(0, colonPos); + if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ') + custom = atoi((value_type.substr(colonPos + 1)).c_str()); + } } - SetPreCADOptionValue(name.c_str(), value.c_str()); + custom ? AddPreCADOption(name.c_str(), value.c_str()) : SetPreCADOptionValue(name.c_str(), value.c_str()); + } +} + +//============================================================================= + +void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue) +{ + ASSERT(myBaseImpl); + bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue); + if (valueChanged) { + this->GetImpl()->AddOption(optionName, optionValue); + SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )"; + } +} + +//============================================================================= + +void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue) +{ + ASSERT(myBaseImpl); + bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue); + if (valueChanged) { + this->GetImpl()->AddPreCADOption(optionName, optionValue); + SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )"; } } //============================================================================= +char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName) +{ + ASSERT(myBaseImpl); + return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str()); +} + +//============================================================================= + +char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName) +{ + ASSERT(myBaseImpl); + return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str()); +} + +//============================================================================= + void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap) throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry); + if ( !entry || !entry[0] ) + THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM ); bool valueChanged = false; try { valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap); @@ -993,7 +1080,7 @@ void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const } MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry); //if ( valueChanged ) - SMESH::TPythonDump() << _this() << ".SetAttractorGeom(" + SMESH::TPythonDump() << _this() << ".SetAttractorGeom( " << entry << ", " << att_entry << ", "<GetStudyEntry(); @@ -1242,7 +1331,7 @@ void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace, if (theFaceEntry.empty()) { aName = "Face_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -1259,7 +1348,7 @@ void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace, if (theAttractor->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theAttractor->GetEntry(); - SALOMEDS::SObject_ptr theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str()); + SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str()); if (!theSAtt->_is_nil()) theAttEntry = theSAtt->GetID(); } @@ -1273,32 +1362,44 @@ void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace, SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius); } -void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace) +void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace, + GEOM::GEOM_Object_ptr theAttractor) { ASSERT(myBaseImpl); - string theFaceEntry; - theFaceEntry = theFace->GetStudyEntry(); + CORBA::String_var theFaceEntry = theFace->GetStudyEntry(); + CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry(); - GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine(); - SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen(); - string aName; + // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine(); + // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen(); + // string aName; - if (theFaceEntry.empty()) { - aName = "Face_"; - aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); - if (!theSFace->_is_nil()) - theFaceEntry = theSFace->GetID(); - } - if (theFaceEntry.empty()) + // if (theFaceEntry.empty()) { + // aName = "Face_"; + // aName += theFace->GetEntry(); + // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + // if (!theSFace->_is_nil()) + // theFaceEntry = theSFace->GetID(); + // } + if ( !theFaceEntry.in() || !theFaceEntry.in()[0] || + !theAttrEntry.in() || !theAttrEntry.in()[0] ) THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM ); MESSAGE("IDL : GetName : " << theFace->GetName()); MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")"); - UnsetEntry( theFaceEntry.c_str()); - SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( " << theFaceEntry.c_str() << " )"; + GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() ); + SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( " + << theFace << ", " << theAttractor << " )"; +} + +void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry, + const char* attractorEntry) +{ + GetImpl()->ClearEntry( faceEntry, attractorEntry ); + SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '" + << faceEntry << "', '" << attractorEntry << "' )"; } + /* void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap) {} @@ -1706,7 +1807,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -1744,7 +1845,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr the if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -1799,7 +1900,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theF if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -1812,7 +1913,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theF if (theVertex->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theVertex->GetEntry(); - SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); + SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); if (!theSVertex->_is_nil()) theVertexEntry = theSVertex->GetID(); } @@ -1854,7 +1955,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -1894,7 +1995,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Objec if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -1940,7 +2041,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -1953,7 +2054,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object if (theVertex->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theVertex->GetEntry(); - SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); + SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); if (!theSVertex->_is_nil()) theVertexEntry = theSVertex->GetID(); } @@ -1995,7 +2096,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object // if (theFace->GetShapeType() == GEOM::COMPOUND) // aName = "Compound_"; // aName += theFace->GetEntry(); -// SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); +// SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); // if (!theSFace->_is_nil()) // theFaceEntry = theSFace->GetID(); // } @@ -2034,7 +2135,7 @@ BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEO if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -2070,7 +2171,7 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFac if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -2121,7 +2222,7 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr th if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -2134,7 +2235,7 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr th if (theVertex->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theVertex->GetEntry(); - SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); + SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); if (!theSVertex->_is_nil()) theVertexEntry = theSVertex->GetID(); } @@ -2169,7 +2270,7 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theF if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -2492,7 +2593,7 @@ void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Ob if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -2581,6 +2682,546 @@ void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFa */ /////////////////////// +/////////////////////// +// PERIODICITY // +/////////////////////// + + +std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType) +{ +//enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ }; + std::map MapShapeTypeToString; + MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND"); + MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID"); + MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID"); + MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL"); + MapShapeTypeToString[GEOM::FACE] = std::string("FACE"); + MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE"); + MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE"); + MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX"); + MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE"); + std::string txtShapeType = MapShapeTypeToString[theShapeType]; + return txtShapeType; +} + +void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector theShapeTypes) +{ + // Check shape types + bool ok = false; + std::stringstream typesTxt; + for (std::size_t i=0; iGetShapeType() == theShapeType) + ok = true; + typesTxt << ShapeTypeToString(theShapeType); + if (i < theShapeTypes.size()-1 ) + typesTxt << ", "; + } + if (!ok){ + std::stringstream msg; + msg << "shape shape type is not in" << typesTxt; + MESSAGE(msg); + THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM); + } +} + +void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType) +{ + // Check shape type + if (shape->GetShapeType() != theShapeType) { + std::stringstream msg; + msg << "shape shape type is not " << ShapeTypeToString(theShapeType); + MESSAGE(msg); + THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM); + } +} + +std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix) +{ + // Check shape is published in the object browser + string shapeEntry = shape->GetStudyEntry(); + + GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine(); + SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen(); + string aName; + + // Publish shape if needed + if (shapeEntry.empty()) { + if (shape->GetShapeType() == theShapeType) + aName = prefix; + aName += shape->GetEntry(); + SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str()); + if (!theSFace1->_is_nil()) + shapeEntry = theSFace1->GetID(); + } + if (shapeEntry.empty()) + THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM ); + return shapeEntry; +} + +// Format the output of two vectors to use it in MESSAGE and PythonDump +std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector &theSourceVerticesEntries, vector &theTargetVerticesEntries) +{ + std::stringstream listEntriesTxt; + + if (!theSourceVerticesEntries.empty()) + { + listEntriesTxt << ", [" ; + size_t i =0; + for (std::vector::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++) + { + if (i>0) + listEntriesTxt << ", "; + listEntriesTxt << *it; + } + + listEntriesTxt << "], [" ; + i =0; + for (std::vector::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++) + { + if (i>0) + listEntriesTxt << ", "; + listEntriesTxt << *it; + } + listEntriesTxt << "]" ; + } + return listEntriesTxt.str(); +} + +/** + * Erase all PreCad periodicity associations + */ +void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() { + ASSERT(myBaseImpl); + this->GetImpl()->ClearPreCadPeriodicityVectors(); + SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()"; +} + +BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector() +{ + MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector"); + const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector = + this->GetImpl()->_GetPreCadFacesPeriodicityVector(); + + BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector); + + MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end"); + return periodicityList._retn(); +} + +BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector() +{ + MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector"); + const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector = + this->GetImpl()->_GetPreCadEdgesPeriodicityVector(); + + BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector); + + MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end"); + return periodicityList._retn(); +} + +// convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence +BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector) +{ + MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence"); + BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList(); + + periodicityList->length(preCadPeriodicityVector.size()); + + for (size_t i = 0; ishape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str()); + myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str()); + + BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList(); + if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty()) + { + sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size()); + for (size_t j=0; jtheSourceVerticesEntries = sourceVertices; + + BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList(); + if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty()) + { + targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size()); + for (size_t j=0; jtheTargetVerticesEntries = targetVertices; + + periodicityList[i] = myPreCadPeriodicity; + } + + + return periodicityList._retn(); +} + + +void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2) +throw (SALOME::SALOME_Exception) +{ + ASSERT(myBaseImpl); + const GEOM::ListOfGO theSourceVertices; + const GEOM::ListOfGO theTargetVertices; + AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices); +} + + +void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2, + const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices) +throw (SALOME::SALOME_Exception) +{ + ASSERT(myBaseImpl); + MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices"); + + size_t theLength = theSourceVertices.length(); + if (theLength != theTargetVertices.length()) + THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM ); + + std::vector allowedShapeTypes; + allowedShapeTypes.push_back(GEOM::FACE); + allowedShapeTypes.push_back(GEOM::COMPOUND); + + string prefix1 = "Source_face_"; + CheckShapeTypes(theFace1, allowedShapeTypes); + string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1); + + string prefix2 = "Target_face_"; + CheckShapeTypes(theFace2, allowedShapeTypes); + string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2); + + string prefix3 = "Source_vertex_"; + BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList(); + theSourceVerticesEntries->length(theLength); + GEOM::GEOM_Object_ptr theVtx_i; + string theEntry_i; + for (size_t ind = 0; ind < theLength; ind++) { + theVtx_i = theSourceVertices[ind]; + theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3); + theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str()); + } + + string prefix4 = "Target_vertex_"; + BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList(); + theTargetVerticesEntries->length(theLength); + for (size_t ind = 0; ind < theLength; ind++) { + theVtx_i = theTargetVertices[ind]; + theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4); + theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str()); + } + + string theFace2Name = theFace2->GetName(); + MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName()); + MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName()); + MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")"); + try { + AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(), + theSourceVerticesEntries, theTargetVerticesEntries); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } +} + + +void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry, + const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba) + throw (SALOME::SALOME_Exception) +{ + + ASSERT(myBaseImpl); + + // Convert BLSURFPlugin::TEntryList to vector + vector theSourceVerticesEntries, theTargetVerticesEntries; + for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) { + theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in()); + theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in()); + } + + string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries); + + MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")"); + + this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry, + theSourceVerticesEntries, theTargetVerticesEntries); + + SMESH::TPythonDump pd; + if (!theSourceVerticesEntries.empty()) + { + pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry; + pd << listEntriesTxt.c_str(); + pd << ")"; + } + else + pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")"; + MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END"); +} + +void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2) + throw (SALOME::SALOME_Exception) +{ + ASSERT(myBaseImpl); + const GEOM::ListOfGO theSourceVertices; + const GEOM::ListOfGO theTargetVertices; + AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices); +} + +void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2, + const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices"); + ASSERT(myBaseImpl); + + size_t theLength = theSourceVertices.length(); + if (theLength != theTargetVertices.length()) + THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM ); + + std::vector allowedShapeTypes; + allowedShapeTypes.push_back(GEOM::EDGE); + allowedShapeTypes.push_back(GEOM::COMPOUND); + + string prefix1 = "Source_edge_"; + CheckShapeTypes(theEdge1, allowedShapeTypes); + string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1); + + string prefix2 = "Target_edge_"; + CheckShapeTypes(theEdge2, allowedShapeTypes); + string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2); + + string prefix3 = "Source_vertex_"; + BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList(); + theSourceVerticesEntries->length(theLength); + GEOM::GEOM_Object_ptr theVtx_i; + string theEntry_i; + for (size_t ind = 0; ind < theLength; ind++) { + theVtx_i = theSourceVertices[ind]; + theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3); + theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str()); + } + + string prefix4 = "Target_vertex_"; + BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList(); + theTargetVerticesEntries->length(theLength); + for (size_t ind = 0; ind < theLength; ind++) { + theVtx_i = theTargetVertices[ind]; + theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4); + theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str()); + } + + string theEdge2Name = theEdge2->GetName(); + MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName()); + MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName()); + MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")"); + try { + AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(), + theSourceVerticesEntries, theTargetVerticesEntries); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } +} + + +void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry, + const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba) + throw (SALOME::SALOME_Exception) +{ + + ASSERT(myBaseImpl); + + // Convert BLSURFPlugin::TEntryList to vector + vector theSourceVerticesEntries, theTargetVerticesEntries; + for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) { + theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in()); + theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in()); + } + + string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries); + + MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")"); + this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry, + theSourceVerticesEntries, theTargetVerticesEntries); + + SMESH::TPythonDump pd; + if (!theSourceVerticesEntries.empty()) + { + pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry; + pd << listEntriesTxt.c_str(); + pd << ")"; + } + else + pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")"; + + MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END"); +} + +void BLSURFPlugin_Hypothesis_i::AddFacePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2) + throw (SALOME::SALOME_Exception) +{ + ASSERT(myBaseImpl); + + string prefix1 = "Source_face_"; + CheckShapeType(theFace1, GEOM::FACE); + string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1); + string prefix2 = "Target_face_"; + CheckShapeType(theFace2, GEOM::FACE); + string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2); + + MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName()); + MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName()); + MESSAGE("IDL : AddFacePeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")"); + try { + AddFacePeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str()); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } + + +} + +void BLSURFPlugin_Hypothesis_i::AddFacePeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry) + throw (SALOME::SALOME_Exception){ + + ASSERT(myBaseImpl); + + MESSAGE("IDL : AddFacePeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << ")"); + this->GetImpl()->AddFacePeriodicity(theFace1Entry, theFace2Entry); + SMESH::TPythonDump pd; + pd << _this() << ".AddFacePeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")"; + MESSAGE("IDL : AddFacePeriodicityEntry END"); +} + + +void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theFace2, GEOM::GEOM_Object_ptr theEdge2, + CORBA::Long edge_orientation) + throw (SALOME::SALOME_Exception){ + ASSERT(myBaseImpl); + + string prefix_theFace1 = "Source_face_"; + CheckShapeType(theFace1, GEOM::FACE); + string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix_theFace1); + string prefix_theFace2 = "Target_face_"; + CheckShapeType(theFace2, GEOM::FACE); + string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix_theFace2); + + string prefix_theEdge1 = "Source_edge_"; + CheckShapeType(theEdge1, GEOM::EDGE); + string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1); + string prefix_theEdge2 = "Target_edge_"; + CheckShapeType(theEdge2, GEOM::EDGE); + string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2); + + MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName()); + MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName()); + MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName()); + MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName()); + MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")"); + try { + AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } + + +} + +void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityWithoutFaces(GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theEdge2, + CORBA::Long edge_orientation) + throw (SALOME::SALOME_Exception){ + ASSERT(myBaseImpl); + + string theFace1Entry = ""; + string theFace2Entry = ""; + + string prefix_theEdge1 = "Source_edge_"; + CheckShapeType(theEdge1, GEOM::EDGE); + string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1); + string prefix_theEdge2 = "Target_edge_"; + CheckShapeType(theEdge2, GEOM::EDGE); + string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2); + + MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName()); + MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName()); + MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")"); + try { + AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } + + +} + +void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityEntry(const char* theFace1Entry, const char* theEdge1Entry, const char* theFace2Entry, const char* theEdge2Entry, const long edge_orientation) + throw (SALOME::SALOME_Exception){ + + ASSERT(myBaseImpl); + + MESSAGE("IDL : AddEdgePeriodicityEntry(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")"); + this->GetImpl()->AddEdgePeriodicity(theFace1Entry, theEdge1Entry, theFace2Entry, theEdge2Entry, edge_orientation); + SMESH::TPythonDump pd; + if (theFace1Entry) + pd << _this() << ".AddEdgePeriodicity(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")"; + else + pd << _this() << ".AddEdgePeriodicityWithoutFaces(" << theEdge1Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")"; + MESSAGE("IDL : AddEdgePeriodicityEntry END"); +} + +void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theVertex1, + GEOM::GEOM_Object_ptr theEdge2, GEOM::GEOM_Object_ptr theVertex2) + throw (SALOME::SALOME_Exception){ + ASSERT(myBaseImpl); + + string prefix_theEdge1 = "Source_edge_"; + CheckShapeType(theEdge1, GEOM::EDGE); + string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1); + string prefix_theEdge2 = "Target_edge_"; + CheckShapeType(theEdge2, GEOM::EDGE); + string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2); + + string prefix_theVertex1 = "Source_vertex_"; + CheckShapeType(theVertex1, GEOM::VERTEX); + string theVertex1Entry = PublishIfNeeded(theVertex1, GEOM::VERTEX, prefix_theVertex1); + string prefix_theVertex2 = "Target_vertex_"; + CheckShapeType(theVertex2, GEOM::VERTEX); + string theVertex2Entry = PublishIfNeeded(theVertex2, GEOM::VERTEX, prefix_theVertex2); + + MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName()); + MESSAGE("IDL : theVertex1->GetName : " << theVertex1->GetName()); + MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName()); + MESSAGE("IDL : theVertex2->GetName : " << theVertex2->GetName()); + MESSAGE("IDL : AddVertexPeriodicity( "<< theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")"); + try { + AddVertexPeriodicityEntry(theEdge1Entry.c_str(), theVertex1Entry.c_str(), theEdge2Entry.c_str(), theVertex2Entry.c_str()); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } + + +} + +void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicityEntry(const char* theEdge1Entry, const char* theVertex1Entry, const char* theEdge2Entry, const char* theVertex2Entry) + throw (SALOME::SALOME_Exception){ + + ASSERT(myBaseImpl); + + MESSAGE("IDL : AddVertexPeriodicityEntry(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")"); + this->GetImpl()->AddVertexPeriodicity(theEdge1Entry, theVertex1Entry, theEdge2Entry, theVertex2Entry); + SMESH::TPythonDump pd; + pd << _this() << ".AddVertexPeriodicity(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")"; + MESSAGE("IDL : AddVertexPeriodicityEntry END"); +} + //================================================================================ /*!