1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : BLSURFPlugin_Hypothesis.cxx
22 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
23 // Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
26 #include "BLSURFPlugin_Hypothesis_i.hxx"
27 #include "SMESH_Gen.hxx"
28 #include "SMESH_Gen_i.hxx"
29 #include "SMESH_PythonDump.hxx"
30 #include "GEOM_Object.hxx"
32 #include "Utils_CorbaException.hxx"
33 #include "utilities.h"
37 #include "boost/regex.hpp"
39 //=============================================================================
41 * BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
45 //=============================================================================
46 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA, int theStudyId,
47 ::SMESH_Gen* theGenImpl) :
48 SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA) {
49 MESSAGE( "BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i" );
50 myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(), theStudyId, theGenImpl);
53 //=============================================================================
55 * BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
59 //=============================================================================
60 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i() {
61 MESSAGE( "BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i" );
65 * BLSURFPlugin_Hypothesis_i::SetTopology
70 //=============================================================================
71 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
72 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology");
74 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
75 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
78 //=============================================================================
80 * BLSURFPlugin_Hypothesis_i::GetTopology
84 //=============================================================================
85 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
86 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology");
88 return this->GetImpl()->GetTopology();
91 //=============================================================================
93 //=============================================================================
95 * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
100 //=============================================================================
101 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue) {
102 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh");
104 this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
105 SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
108 //=============================================================================
110 * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
114 //=============================================================================
115 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() {
116 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh");
118 return this->GetImpl()->GetPhysicalMesh();
121 //=============================================================================
123 * BLSURFPlugin_Hypothesis_i::SetPhySize
127 //=============================================================================
128 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue) {
129 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize");
131 this->GetImpl()->SetPhySize(theValue);
132 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
135 //=============================================================================
137 * BLSURFPlugin_Hypothesis_i::GetPhySize
141 //=============================================================================
142 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize() {
143 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhySize");
145 return this->GetImpl()->GetPhySize();
148 //=============================================================================
149 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
151 if (GetPhyMin() != theMinSize) {
152 this->GetImpl()->SetPhyMin(theMinSize);
153 SMESH::TPythonDump() << _this() << ".SetPhyMin( " << theMinSize << " )";
157 //=============================================================================
158 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
160 return this->GetImpl()->GetPhyMin();
163 //=============================================================================
164 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
166 if (GetPhyMax() != theMaxSize) {
167 this->GetImpl()->SetPhyMax(theMaxSize);
168 SMESH::TPythonDump() << _this() << ".SetPhyMax( " << theMaxSize << " )";
172 //=============================================================================
173 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
175 return this->GetImpl()->GetPhyMax();
178 //=============================================================================
180 * BLSURFPlugin_Hypothesis_i::SetGeometricMesh
185 //=============================================================================
186 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue) {
187 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh");
189 this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
190 SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
193 //=============================================================================
195 * BLSURFPlugin_Hypothesis_i::GetGeometricMesh
199 //=============================================================================
200 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh() {
201 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh");
203 return this->GetImpl()->GetGeometricMesh();
206 //=============================================================================
208 * BLSURFPlugin_Hypothesis_i::SetAngleMeshS
212 //=============================================================================
213 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
214 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMeshS");
216 this->GetImpl()->SetAngleMeshS(theValue);
217 SMESH::TPythonDump() << _this() << ".SetAngleMeshS( " << theValue << " )";
220 //=============================================================================
222 * BLSURFPlugin_Hypothesis_i::GetAngleMeshS
226 //=============================================================================
227 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
228 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMeshS");
230 return this->GetImpl()->GetAngleMeshS();
233 //=============================================================================
234 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double angle) {
236 this->GetImpl()->SetAngleMeshC(angle);
237 SMESH::TPythonDump() << _this() << ".SetAngleMeshC( " << angle << " )";
240 //=============================================================================
241 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
243 return this->GetImpl()->GetAngleMeshC();
246 //=============================================================================
247 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
249 if (GetGeoMin() != theMinSize) {
250 this->GetImpl()->SetGeoMin(theMinSize);
251 SMESH::TPythonDump() << _this() << ".SetGeoMin( " << theMinSize << " )";
255 //=============================================================================
256 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
258 return this->GetImpl()->GetGeoMin();
261 //=============================================================================
262 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
264 if (GetGeoMax() != theMaxSize) {
265 this->GetImpl()->SetGeoMax(theMaxSize);
266 SMESH::TPythonDump() << _this() << ".SetGeoMax( " << theMaxSize << " )";
270 //=============================================================================
271 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
273 return this->GetImpl()->GetGeoMax();
276 //=============================================================================
278 * BLSURFPlugin_Hypothesis_i::SetGradation
282 //=============================================================================
283 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) {
284 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation");
286 this->GetImpl()->SetGradation(theValue);
287 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
290 //=============================================================================
292 * BLSURFPlugin_Hypothesis_i::GetGradation
296 //=============================================================================
297 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() {
298 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation");
300 return this->GetImpl()->GetGradation();
303 //=============================================================================
305 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
309 //=============================================================================
310 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) {
311 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed");
313 this->GetImpl()->SetQuadAllowed(theValue);
314 SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValue << " )";
317 //=============================================================================
319 * BLSURFPlugin_Hypothesis_i::GetQuadAllowed
323 //=============================================================================
324 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() {
325 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed");
327 return this->GetImpl()->GetQuadAllowed();
330 //=============================================================================
332 * BLSURFPlugin_Hypothesis_i::SetDecimesh
336 //=============================================================================
337 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
338 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetDecimesh");
340 this->GetImpl()->SetDecimesh(theValue);
341 SMESH::TPythonDump() << _this() << ".SetDecimesh( " << theValue << " )";
344 //=============================================================================
346 * BLSURFPlugin_Hypothesis_i::GetDecimesh
350 //=============================================================================
351 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
352 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetDecimesh");
354 return this->GetImpl()->GetDecimesh();
357 //=============================================================================
358 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
360 if (theVal < 0 || theVal > 100)
361 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
362 this->GetImpl()->SetVerbosity(theVal);
363 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
366 //=============================================================================
368 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
370 return (CORBA::Short) this->GetImpl()->GetVerbosity();
373 //=============================================================================
375 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
376 throw (SALOME::SALOME_Exception) {
378 bool valueChanged = false;
380 valueChanged = (this->GetImpl()->GetOptionValue(optionName) != optionValue);
382 this->GetImpl()->SetOptionValue(optionName, optionValue);
383 } catch (const std::invalid_argument& ex) {
384 SALOME::ExceptionStruct ExDescription;
385 ExDescription.text = ex.what();
386 ExDescription.type = SALOME::BAD_PARAM;
387 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetOptionValue(name,value)";
388 ExDescription.lineNumber = 0;
389 throw SALOME::SALOME_Exception(ExDescription);
390 } catch (SALOME_Exception& ex) {
391 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
394 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
397 //=============================================================================
399 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
402 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName).c_str());
403 } catch (const std::invalid_argument& ex) {
404 SALOME::ExceptionStruct ExDescription;
405 ExDescription.text = ex.what();
406 ExDescription.type = SALOME::BAD_PARAM;
407 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetOptionValue(name)";
408 ExDescription.lineNumber = 0;
409 throw SALOME::SALOME_Exception(ExDescription);
410 } catch (SALOME_Exception& ex) {
411 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
416 //=============================================================================
418 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
420 this->GetImpl()->ClearOption(optionName);
421 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
424 //=============================================================================
426 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
428 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
430 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
431 result->length(opts.size());
433 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
434 for (int i = 0; opIt != opts.end(); ++opIt, ++i) {
435 string name_value = opIt->first;
436 if (!opIt->second.empty()) {
438 name_value += opIt->second;
440 result[i] = CORBA::string_dup(name_value.c_str());
442 return result._retn();
445 //=============================================================================
447 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
448 throw (SALOME::SALOME_Exception) {
450 for (int i = 0; i < options.length(); ++i) {
451 string name_value = options[i].in();
452 int colonPos = name_value.find(':');
454 if (colonPos == string::npos) // ':' not found
457 name = name_value.substr(0, colonPos);
458 if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ')
459 value = name_value.substr(colonPos + 1);
461 SetOptionValue(name.c_str(), value.c_str());
465 //=============================================================================
467 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
468 throw (SALOME::SALOME_Exception) {
470 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
471 bool valueChanged = false;
473 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
475 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
476 } catch (const std::invalid_argument& ex) {
477 SALOME::ExceptionStruct ExDescription;
478 ExDescription.text = ex.what();
479 ExDescription.type = SALOME::BAD_PARAM;
480 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
481 ExDescription.lineNumber = 0;
482 throw SALOME::SALOME_Exception(ExDescription);
483 } catch (SALOME_Exception& ex) {
484 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
486 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
488 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
491 //=============================================================================
493 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
494 throw (SALOME::SALOME_Exception) {
496 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
497 bool valueChanged = false;
499 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
500 if ( valueChanged ) {
501 //boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)\\)$");
502 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
503 if (!boost::regex_match(string(attractor), re))
504 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
505 this->GetImpl()->SetAttractorEntry(entry, attractor);
507 } catch (const std::invalid_argument& ex) {
508 SALOME::ExceptionStruct ExDescription;
509 ExDescription.text = ex.what();
510 ExDescription.type = SALOME::BAD_PARAM;
511 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
512 ExDescription.lineNumber = 0;
513 throw SALOME::SALOME_Exception(ExDescription);
514 } catch (SALOME_Exception& ex) {
515 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
517 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
519 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
522 //=============================================================================
524 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
527 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
528 } catch (const std::invalid_argument& ex) {
529 SALOME::ExceptionStruct ExDescription;
530 ExDescription.text = ex.what();
531 ExDescription.type = SALOME::BAD_PARAM;
532 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
533 ExDescription.lineNumber = 0;
534 throw SALOME::SALOME_Exception(ExDescription);
535 } catch (SALOME_Exception& ex) {
536 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
541 //=============================================================================
543 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
546 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
547 } catch (const std::invalid_argument& ex) {
548 SALOME::ExceptionStruct ExDescription;
549 ExDescription.text = ex.what();
550 ExDescription.type = SALOME::BAD_PARAM;
551 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
552 ExDescription.lineNumber = 0;
553 throw SALOME::SALOME_Exception(ExDescription);
554 } catch (SALOME_Exception& ex) {
555 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
560 //=============================================================================
562 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
564 this->GetImpl()->ClearEntry(entry);
565 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
568 //=============================================================================
570 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
572 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
574 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
575 result->length(sizeMaps.size());
577 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
578 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
579 string entry_sizemap = smIt->first;
580 if (!smIt->second.empty()) {
581 entry_sizemap += "|";
582 entry_sizemap += smIt->second;
584 result[i] = CORBA::string_dup(entry_sizemap.c_str());
586 return result._retn();
589 //=============================================================================
591 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
593 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
595 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
596 result->length(attractors.size());
598 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
599 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
600 string entry_attractor = atIt->first;
601 if (!atIt->second.empty()) {
602 entry_attractor += "|";
603 entry_attractor += atIt->second;
605 result[i] = CORBA::string_dup(entry_attractor.c_str());
607 return result._retn();
610 //=============================================================================
612 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
613 throw (SALOME::SALOME_Exception) {
615 for (int i = 0; i < sizeMaps.length(); ++i) {
616 string entry_sizemap = sizeMaps[i].in();
617 int colonPos = entry_sizemap.find('|');
618 string entry, sizemap;
619 if (colonPos == string::npos) // '|' separator not found
620 entry = entry_sizemap;
622 entry = entry_sizemap.substr(0, colonPos);
623 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
624 sizemap = entry_sizemap.substr(colonPos + 1);
626 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
630 //=============================================================================
632 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
634 this->GetImpl()->ClearSizeMaps();
637 //=============================================================================
639 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap) {
642 entry = GeomObj->GetStudyEntry();
643 MESSAGE("IDL : GetName : " << GeomObj->GetName());
644 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
645 SetSizeMapEntry(entry.c_str(), sizeMap);
648 //=============================================================================
649 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
652 entry = GeomObj->GetStudyEntry();
653 MESSAGE("IDL : GetName : " << GeomObj->GetName());
654 MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
655 UnsetEntry(entry.c_str());
656 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
659 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
662 entry = GeomObj->GetStudyEntry();
663 MESSAGE("IDL : GetName : " << GeomObj->GetName());
664 MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
665 SetAttractorEntry(entry.c_str(), attractor);
668 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
671 entry = GeomObj->GetStudyEntry();
672 MESSAGE("IDL : GetName : " << GeomObj->GetName());
673 MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
674 UnsetEntry(entry.c_str());
675 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
679 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
682 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
685 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
688 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
691 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
694 this->GetImpl()->UnsetCustomSizeMap(entry);
695 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
699 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
704 // ///////////////////////
705 // // ENFORCED VERTICES //
706 // ///////////////////////
710 * Returns the list of enforced vertices for a given Face entry
711 * @return A map of Face entry / List of enforced vertices
714 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
715 MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
718 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
720 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
721 this->GetImpl()->_GetAllEnforcedVerticesByFace();
722 resultMap->length(faceEntryEnfVertexListMap.size());
723 MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
725 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
726 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
727 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
728 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
729 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
730 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
731 MESSAGE("Face Entry: " << mapElement->faceEntry);
733 _enfVertexList = it_entry->second;
734 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
735 enfVertexList->length(_enfVertexList.size());
736 MESSAGE("Number of enf vertex: " << enfVertexList->length());
738 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
739 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
740 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
741 currentEnfVertex = (*it_enfVertex);
743 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
746 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
749 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
752 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
753 coords->length(currentEnfVertex->coords.size());
754 for (int i=0;i<coords->length();i++)
755 coords[i] = currentEnfVertex->coords[i];
756 enfVertex->coords = coords;
759 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
762 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
763 faceEntryList->length(currentEnfVertex->faceEntries.size());
764 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
765 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
766 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
767 enfVertex->faceEntries = faceEntryList;
770 msg << "Enforced vertex: \n"
771 << "Name: " << enfVertex->name << "\n";
772 if (coords->length())
773 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
774 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
775 << "Group Name: " << enfVertex->grpName;
778 enfVertexList[j] = enfVertex;
780 mapElement->enfVertexList = enfVertexList;
782 resultMap[i] = mapElement;
785 return resultMap._retn();
789 * Returns the list of all enforced vertices
790 * @return a list of enforced vertices
793 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
794 MESSAGE("IDL: GetAllEnforcedVertices()");
796 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
797 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
798 resultMap->length(enfVertexList.size());
799 MESSAGE("Enforced Vertex map size is " << resultMap->length());
801 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
802 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
803 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
804 MESSAGE("Enforced Vertex #" << i);
805 currentEnfVertex = (*evlIt);
806 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
808 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
810 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
812 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
813 coords->length(currentEnfVertex->coords.size());
814 for (int ind = 0; ind < coords->length(); ind++)
815 coords[ind] = currentEnfVertex->coords[ind];
816 enfVertex->coords = coords;
818 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
820 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
821 faceEntryList->length(currentEnfVertex->faceEntries.size());
822 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
823 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
824 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
825 enfVertex->faceEntries = faceEntryList;
828 msg << "Enforced vertex: \n"
829 << "Name: " << enfVertex->name << "\n";
830 if (coords->length())
831 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
832 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
833 << "Group Name: " << enfVertex->grpName;
836 resultMap[i] = enfVertex;
838 return resultMap._retn();
843 * Returns the list of enforced vertices coords for a given Face entry.
844 * They are the coords of the "manual" enforced vertices.
845 * @return A map of Face entry / List of enforced vertices coords
848 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
849 MESSAGE("IDL: GetAllCoordsByFace()");
852 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
854 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
855 resultMap->length(entryCoordsListMap.size());
856 MESSAGE("Enforced Vertex map size is " << resultMap->length());
858 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
859 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
860 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
861 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
862 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
863 MESSAGE("Face Entry: " << mapElement->faceEntry);
865 _coordsList = it_entry->second;
866 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
867 coordsList->length(_coordsList.size());
868 MESSAGE("Number of coords: " << coordsList->length());
870 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
871 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
872 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
873 coords->length((*it_coords).size());
874 for (int i=0;i<coords->length();i++)
875 coords[i] = (*it_coords)[i];
876 coordsList[j] = coords;
877 MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
879 mapElement->coordsList = coordsList;
881 resultMap[i] = mapElement;
884 return resultMap._retn();
888 * Returns a map of enforced vertices coords / enforced vertex.
889 * They are the coords of the "manual" enforced vertices.
891 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
892 MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
895 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
896 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
897 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
898 resultMap->length(coordsEnfVertexMap.size());
899 MESSAGE("Enforced Vertex map size is " << resultMap->length());
901 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
902 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
903 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
904 MESSAGE("Enforced Vertex #" << i);
905 currentEnfVertex = (it_coords->second);
906 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
907 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
908 coords->length(it_coords->first.size());
909 for (int ind=0;ind<coords->length();ind++)
910 coords[ind] = it_coords->first[ind];
911 mapElement->coords = coords;
912 MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
914 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
916 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
918 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
920 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
921 coords2->length(currentEnfVertex->coords.size());
922 for (int ind=0;ind<coords2->length();ind++)
923 coords2[ind] = currentEnfVertex->coords[ind];
924 enfVertex->coords = coords2;
926 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
928 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
929 faceEntryList->length(currentEnfVertex->faceEntries.size());
930 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
931 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
932 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
933 enfVertex->faceEntries = faceEntryList;
935 mapElement->enfVertex = enfVertex;
937 msg << "Enforced vertex: \n"
938 << "Name: " << enfVertex->name << "\n";
939 if (coords->length())
940 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
941 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
942 << "Group Name: " << enfVertex->grpName;
945 resultMap[i] = mapElement;
947 return resultMap._retn();
951 * Returns the list of enforced vertices entries for a given Face entry.
952 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
953 * @return A map of Face entry / List of enforced vertices geom entries
956 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
957 MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
960 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
962 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
963 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
964 resultMap->length(entryEnfVertexEntryListMap.size());
965 MESSAGE("Enforced Vertex map size is " << resultMap->length());
967 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
968 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
969 entryEnfVertexEntryListMap.begin();
970 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
971 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
972 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
973 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
974 MESSAGE("Face Entry: " << mapElement->faceEntry);
976 _enfVertexEntryList = it_entry->second;
977 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
978 enfVertexEntryList->length(_enfVertexEntryList.size());
979 MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
981 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
982 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
983 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
984 MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
986 mapElement->enfVertexEntryList = enfVertexEntryList;
988 resultMap[i] = mapElement;
991 return resultMap._retn();
995 * Returns a map of enforced vertices geom entry / enforced vertex.
996 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
998 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
999 MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
1002 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
1003 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
1004 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
1005 resultMap->length(enfVertexEntryEnfVertexMap.size());
1006 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1008 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
1009 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1010 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
1011 MESSAGE("Enforced Vertex #" << i);
1012 currentEnfVertex = it_enfVertexEntry->second;
1013 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
1014 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
1015 MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
1017 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1019 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1021 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1023 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1024 coords->length(currentEnfVertex->coords.size());
1025 for (int ind=0;ind<coords->length();ind++)
1026 coords[ind] = currentEnfVertex->coords[ind];
1027 enfVertex->coords = coords;
1029 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1031 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1032 faceEntryList->length(currentEnfVertex->faceEntries.size());
1033 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1034 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1035 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1036 enfVertex->faceEntries = faceEntryList;
1039 msg << "Enforced vertex: \n"
1040 << "Name: " << enfVertex->name << "\n";
1041 if (coords->length())
1042 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1043 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1044 << "Group Name: " << enfVertex->grpName;
1047 mapElement->enfVertex = enfVertex;
1048 resultMap[i] = mapElement;
1050 return resultMap._retn();
1054 * Erase all enforced vertices
1056 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
1058 this->GetImpl()->ClearAllEnforcedVertices();
1059 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
1063 * Set/get/unset an enforced vertex on face
1065 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1066 CORBA::Double z) throw (SALOME::SALOME_Exception) {
1069 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1070 MESSAGE("theFace shape type is not FACE or COMPOUND");
1071 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1074 string theFaceEntry = theFace->GetStudyEntry();
1076 if (theFaceEntry.empty()) {
1077 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1078 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1080 if (theFace->GetShapeType() == GEOM::FACE)
1082 if (theFace->GetShapeType() == GEOM::COMPOUND)
1083 aName = "Compound_";
1084 aName += theFace->GetEntry();
1085 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1086 if (!theSFace->_is_nil())
1087 theFaceEntry = theSFace->GetID();
1089 if (theFaceEntry.empty())
1090 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1091 MESSAGE("IDL : GetName : " << theFace->GetName());
1092 MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
1094 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
1095 } catch (SALOME_Exception& ex) {
1096 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1101 * Set/get/unset an enforced vertex with name on face
1103 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1104 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
1107 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1108 MESSAGE("theFace shape type is not FACE or COMPOUND");
1109 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1112 string theFaceEntry = theFace->GetStudyEntry();
1114 if (theFaceEntry.empty()) {
1115 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1116 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1118 if (theFace->GetShapeType() == GEOM::FACE)
1120 if (theFace->GetShapeType() == GEOM::COMPOUND)
1121 aName = "Compound_";
1122 aName += theFace->GetEntry();
1123 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1124 if (!theSFace->_is_nil())
1125 theFaceEntry = theSFace->GetID();
1127 if (theFaceEntry.empty())
1128 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1130 MESSAGE("IDL : GetName : " << theFace->GetName());
1131 MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
1133 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
1134 } catch (SALOME_Exception& ex) {
1135 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1140 * Set/get/unset an enforced vertex with geom object on face
1142 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
1143 throw (SALOME::SALOME_Exception) {
1146 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1147 MESSAGE("theFace shape type is not FACE or COMPOUND");
1148 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1151 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1152 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1153 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1156 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1157 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
1158 // if (CORBA::is_nil(measureOp))
1161 // CORBA::Double x, y, z;
1163 // measureOp->PointCoordinates(theVertex, x, y, z);
1165 string theFaceEntry = theFace->GetStudyEntry();
1166 string theVertexEntry = theVertex->GetStudyEntry();
1168 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1169 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1172 if (theFaceEntry.empty()) {
1173 if (theFace->GetShapeType() == GEOM::FACE)
1175 if (theFace->GetShapeType() == GEOM::COMPOUND)
1176 aName = "Compound_";
1177 aName += theFace->GetEntry();
1178 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1179 if (!theSFace->_is_nil())
1180 theFaceEntry = theSFace->GetID();
1182 if (theFaceEntry.empty())
1183 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1185 if (theVertexEntry.empty()) {
1186 if (theVertex->GetShapeType() == GEOM::VERTEX)
1188 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1189 aName = "Compound_";
1190 aName += theVertex->GetEntry();
1191 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1192 if (!theSVertex->_is_nil())
1193 theVertexEntry = theSVertex->GetID();
1195 if (theVertexEntry.empty())
1196 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1198 string theVertexName = theVertex->GetName();
1199 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
1200 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
1201 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
1203 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
1204 } catch (SALOME_Exception& ex) {
1205 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1210 * Set an enforced vertex with group name on face
1212 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
1213 throw (SALOME::SALOME_Exception)
1217 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1218 MESSAGE("theFace shape type is not FACE or COMPOUND");
1219 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1222 string theFaceEntry = theFace->GetStudyEntry();
1224 if (theFaceEntry.empty()) {
1225 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1226 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1228 if (theFace->GetShapeType() == GEOM::FACE)
1230 if (theFace->GetShapeType() == GEOM::COMPOUND)
1231 aName = "Compound_";
1232 aName += theFace->GetEntry();
1233 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1234 if (!theSFace->_is_nil())
1235 theFaceEntry = theSFace->GetID();
1237 if (theFaceEntry.empty())
1238 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1239 MESSAGE("IDL : GetName : " << theFace->GetName());
1240 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
1242 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
1243 } catch (SALOME_Exception& ex) {
1244 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1249 * Set an enforced vertex with name and group name on face
1251 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
1252 const char* theVertexName, const char* theGroupName)
1253 throw (SALOME::SALOME_Exception)
1257 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1258 MESSAGE("theFace shape type is not FACE or COMPOUND");
1259 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1262 string theFaceEntry = theFace->GetStudyEntry();
1264 if (theFaceEntry.empty()) {
1265 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1266 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1268 if (theFace->GetShapeType() == GEOM::FACE)
1270 if (theFace->GetShapeType() == GEOM::COMPOUND)
1271 aName = "Compound_";
1272 aName += theFace->GetEntry();
1273 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1274 if (!theSFace->_is_nil())
1275 theFaceEntry = theSFace->GetID();
1277 if (theFaceEntry.empty())
1278 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1279 MESSAGE("IDL : GetName : " << theFace->GetName());
1280 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
1282 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
1283 } catch (SALOME_Exception& ex) {
1284 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1289 * Set an enforced vertex with geom entry and group name on face
1291 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
1292 throw (SALOME::SALOME_Exception)
1296 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1297 MESSAGE("theFace shape type is not FACE or COMPOUND");
1298 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1301 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1302 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1303 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1306 string theFaceEntry = theFace->GetStudyEntry();
1307 string theVertexEntry = theVertex->GetStudyEntry();
1309 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1310 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1313 if (theFaceEntry.empty()) {
1314 if (theFace->GetShapeType() == GEOM::FACE)
1316 if (theFace->GetShapeType() == GEOM::COMPOUND)
1317 aName = "Compound_";
1318 aName += theFace->GetEntry();
1319 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1320 if (!theSFace->_is_nil())
1321 theFaceEntry = theSFace->GetID();
1323 if (theFaceEntry.empty())
1324 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1326 if (theVertexEntry.empty()) {
1327 if (theVertex->GetShapeType() == GEOM::VERTEX)
1329 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1330 aName = "Compound_";
1331 aName += theVertex->GetEntry();
1332 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1333 if (!theSVertex->_is_nil())
1334 theVertexEntry = theSVertex->GetID();
1336 if (theVertexEntry.empty())
1337 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1339 string theVertexName = theVertex->GetName();
1340 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
1341 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
1342 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
1344 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
1345 } catch (SALOME_Exception& ex) {
1346 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1351 * Get the list of all enforced vertices
1353 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
1354 throw (SALOME::SALOME_Exception) {
1357 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1358 MESSAGE("theFace shape type is not FACE or COMPOUND");
1359 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1362 string theFaceEntry = theFace->GetStudyEntry();
1364 if (theFaceEntry.empty()) {
1365 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1366 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1368 if (theFace->GetShapeType() == GEOM::FACE)
1370 if (theFace->GetShapeType() == GEOM::COMPOUND)
1371 aName = "Compound_";
1372 aName += theFace->GetEntry();
1373 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1374 if (!theSFace->_is_nil())
1375 theFaceEntry = theSFace->GetID();
1377 if (theFaceEntry.empty())
1378 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1380 MESSAGE("IDL : GetName : " << theFace->GetName());
1381 MESSAGE("IDL : GetEnforcedVertexList ( "<< theFaceEntry << ")");
1383 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
1384 } catch (SALOME_Exception& ex) {
1385 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1389 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1390 CORBA::Double z) throw (SALOME::SALOME_Exception) {
1393 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1394 MESSAGE("theFace shape type is not FACE or COMPOUND");
1395 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1398 string theFaceEntry = theFace->GetStudyEntry();
1400 if (theFaceEntry.empty()) {
1401 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1402 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1404 if (theFace->GetShapeType() == GEOM::FACE)
1406 if (theFace->GetShapeType() == GEOM::COMPOUND)
1407 aName = "Compound_";
1408 aName += theFace->GetEntry();
1409 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1410 if (!theSFace->_is_nil())
1411 theFaceEntry = theSFace->GetID();
1413 if (theFaceEntry.empty())
1414 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1415 MESSAGE("IDL : GetName : " << theFace->GetName());
1416 MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
1419 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
1420 } catch (SALOME_Exception& ex) {
1421 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1425 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
1426 throw (SALOME::SALOME_Exception) {
1429 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1430 MESSAGE("theFace shape type is not FACE or COMPOUND");
1431 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1433 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1434 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1435 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1438 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1439 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
1440 // if (CORBA::is_nil(measureOp))
1443 // CORBA::Double x, y, z;
1445 // measureOp->PointCoordinates(theVertex, x, y, z);
1447 std::string theFaceEntry = theFace->GetStudyEntry();
1448 std::string theVertexEntry = theVertex->GetStudyEntry();
1450 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1451 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1454 if (theFaceEntry.empty()) {
1455 if (theFace->GetShapeType() == GEOM::FACE)
1457 if (theFace->GetShapeType() == GEOM::COMPOUND)
1458 aName = "Compound_";
1459 aName += theFace->GetEntry();
1460 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1461 if (!theSFace->_is_nil())
1462 theFaceEntry = theSFace->GetID();
1464 if (theFaceEntry.empty())
1465 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1467 if (theVertexEntry.empty()) {
1468 if (theVertex->GetShapeType() == GEOM::VERTEX)
1470 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1471 aName = "Compound_";
1472 aName += theVertex->GetEntry();
1473 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1474 if (!theSVertex->_is_nil())
1475 theVertexEntry = theSVertex->GetID();
1477 if (theVertexEntry.empty())
1478 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1480 MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
1483 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
1484 } catch (SALOME_Exception& ex) {
1485 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1489 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
1492 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1493 MESSAGE("theFace shape type is not FACE or COMPOUND");
1494 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1497 string theFaceEntry = theFace->GetStudyEntry();
1499 if (theFaceEntry.empty()) {
1500 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1501 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1503 if (theFace->GetShapeType() == GEOM::FACE)
1505 if (theFace->GetShapeType() == GEOM::COMPOUND)
1506 aName = "Compound_";
1507 aName += theFace->GetEntry();
1508 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1509 if (!theSFace->_is_nil())
1510 theFaceEntry = theSFace->GetID();
1512 if (theFaceEntry.empty())
1513 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1515 MESSAGE("IDL : GetName : " << theFace->GetName());
1516 MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
1519 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
1520 } catch (SALOME_Exception& ex) {
1521 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1526 * Set/get/unset an enforced vertex on geom object given by entry
1528 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
1529 CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
1530 throw (SALOME::SALOME_Exception) {
1532 MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
1533 bool newValue = false;
1535 if (string(theVertexEntry).empty()) {
1537 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
1538 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
1539 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
1540 coords.push_back(x);
1541 coords.push_back(y);
1542 coords.push_back(z);
1543 if (coordsList.find(coords) == coordsList.end()) {
1544 MESSAGE("Coords not found: add it in coordsList");
1547 MESSAGE("Coords already found, compare names");
1548 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
1549 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
1550 MESSAGE("The names are different: update");
1551 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
1555 MESSAGE("The names are identical");
1558 } catch (const std::invalid_argument& ex) {
1559 // no enforced vertex for entry
1560 MESSAGE("Face entry not found : add it to the list");
1564 if (string(theVertexName).empty())
1565 if (string(theGroupName).empty())
1566 SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
1568 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
1570 if (string(theGroupName).empty())
1571 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
1573 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
1574 << theVertexName << "\", \"" << theGroupName << "\")";
1577 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
1578 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
1579 if ( it == enfVertexEntryList.end()) {
1580 MESSAGE("Geom entry not found: add it in enfVertexEntryList");
1584 MESSAGE("Geom entry already found, compare names");
1585 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
1586 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
1587 MESSAGE("The names are different: update");
1588 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
1592 MESSAGE("The names are identical");
1595 } catch (const std::invalid_argument& ex) {
1596 // no enforced vertex for entry
1597 MESSAGE("Face entry not found : add it to the list");
1601 if (string(theGroupName).empty())
1602 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
1604 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
1608 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
1610 MESSAGE("IDL : SetEnforcedVertexEntry END");
1614 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
1615 throw (SALOME::SALOME_Exception) {
1617 MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
1620 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
1621 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
1622 vertexList->length(_vList.size());
1623 MESSAGE("Number of enforced vertices: " << vertexList->length());
1624 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
1625 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
1626 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
1628 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1631 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
1632 // Geom Vertex Entry
1633 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
1635 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1636 coords->length(_enfVertex->coords.size());
1637 for (int ind=0;ind<coords->length();ind++)
1638 coords[ind] = _enfVertex->coords[ind];
1639 enfVertex->coords = coords;
1641 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
1643 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1644 faceEntryList->length(_enfVertex->faceEntries.size());
1645 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
1646 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
1647 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1648 enfVertex->faceEntries = faceEntryList;
1650 vertexList[i] = enfVertex;
1652 MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
1653 return vertexList._retn();
1654 } catch (const std::invalid_argument& ex) {
1655 SALOME::ExceptionStruct ExDescription;
1656 ExDescription.text = ex.what();
1657 ExDescription.type = SALOME::BAD_PARAM;
1658 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
1659 ExDescription.lineNumber = 1385;
1660 throw SALOME::SALOME_Exception(ExDescription);
1661 } catch (const std::exception& ex) {
1662 std::cout << "Exception: " << ex.what() << std::endl;
1663 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1667 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
1668 CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
1670 MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
1673 this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
1675 if (string(theVertexEntry).empty())
1676 SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
1679 SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
1681 } catch (const std::invalid_argument& ex) {
1683 } catch (const std::exception& ex) {
1684 std::cout << "Exception: " << ex.what() << std::endl;
1685 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1688 MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
1692 //bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
1693 // CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
1694 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
1696 // bool ret = false;
1699 // ret = _unsetEnfVertex(theFaceEntry, x, y, z);
1700 // } catch (SALOME_Exception& ex) {
1701 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1705 // SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
1708 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
1712 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
1714 MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
1717 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
1718 SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
1719 } catch (const std::invalid_argument& ex) {
1721 } catch (const std::exception& ex) {
1722 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1725 MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
1730 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
1731 throw (SALOME::SALOME_Exception)
1734 MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
1736 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
1738 catch (const std::invalid_argument& ex) {
1739 SALOME::ExceptionStruct ExDescription;
1740 ExDescription.text = ex.what();
1741 ExDescription.type = SALOME::BAD_PARAM;
1742 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
1743 ExDescription.lineNumber = 1146;
1744 throw SALOME::SALOME_Exception(ExDescription);
1746 catch (SALOME_Exception& ex) {
1747 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1749 MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
1754 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
1755 throw (SALOME::SALOME_Exception)
1758 MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
1760 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
1762 catch (const std::invalid_argument& ex) {
1763 SALOME::ExceptionStruct ExDescription;
1764 ExDescription.text = ex.what();
1765 ExDescription.type = SALOME::BAD_PARAM;
1766 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
1767 ExDescription.lineNumber = 1170;
1768 throw SALOME::SALOME_Exception(ExDescription);
1770 catch (SALOME_Exception& ex) {
1771 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1774 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
1775 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
1777 MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
1780 ///////////////////////
1783 //=============================================================================
1785 * BLSURFPlugin_Hypothesis_i::GetImpl
1787 * Get implementation
1789 //=============================================================================
1790 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
1791 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
1792 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
1795 //================================================================================
1797 * \brief Verify whether hypothesis supports given entity type
1798 * \param type - dimension (see SMESH::Dimension enumeration)
1799 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
1801 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
1803 //================================================================================
1804 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
1805 return type == SMESH::DIM_2D;