1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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"
28 #include <SMESH_Gen.hxx>
29 #include <SMESH_Gen_i.hxx>
30 #include <SMESH_PythonDump.hxx>
32 #include <SALOMEDS_wrap.hxx>
33 #include <Utils_CorbaException.hxx>
34 #include <utilities.h>
38 #include <boost/regex.hpp>
42 //=============================================================================
44 * BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
48 //=============================================================================
49 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA, int theStudyId,
50 ::SMESH_Gen* theGenImpl) :
51 SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA) {
52 MESSAGE( "BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i" );
53 myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(), theStudyId, theGenImpl);
56 //=============================================================================
58 * BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
62 //=============================================================================
63 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i() {
64 MESSAGE( "BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i" );
67 //=============================================================================
69 //=============================================================================
71 * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
76 //=============================================================================
77 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue) {
78 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh");
80 this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
81 SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
84 //=============================================================================
86 * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
90 //=============================================================================
91 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() {
92 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh");
94 return this->GetImpl()->GetPhysicalMesh();
97 //=============================================================================
99 * BLSURFPlugin_Hypothesis_i::SetGeometricMesh
104 //=============================================================================
105 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue) {
106 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh");
108 this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
109 SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
112 //=============================================================================
114 * BLSURFPlugin_Hypothesis_i::GetGeometricMesh
118 //=============================================================================
119 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh() {
120 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh");
122 return this->GetImpl()->GetGeometricMesh();
125 //=============================================================================
127 * BLSURFPlugin_Hypothesis_i::SetPhySize
131 //=============================================================================
132 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue) {
133 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize");
135 this->GetImpl()->SetPhySize(theValue, false);
136 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
139 //=============================================================================
141 * BLSURFPlugin_Hypothesis_i::SetPhySizeRel
143 * Set Relative PhySize
145 //=============================================================================
146 void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue) {
147 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySizeRel");
149 this->GetImpl()->SetPhySize(theValue, true);
150 SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
153 //=============================================================================
155 * BLSURFPlugin_Hypothesis_i::GetPhySize
159 //=============================================================================
160 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize() {
161 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhySize");
163 return this->GetImpl()->GetPhySize();
166 //=============================================================================
168 * BLSURFPlugin_Hypothesis_i::IsPhySizeRel
170 * Returns True if PhySize is relative
172 //=============================================================================
173 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel() {
174 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsPhySizeRel");
176 return this->GetImpl()->IsPhySizeRel();
179 //=============================================================================
180 void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize) {
182 if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
183 this->GetImpl()->SetMinSize(theMinSize, false);
184 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
188 //=============================================================================
189 void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize) {
191 if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
192 this->GetImpl()->SetMinSize(theMinSize, true);
193 SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
197 //=============================================================================
198 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize() {
200 return this->GetImpl()->GetMinSize();
203 //=============================================================================
204 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel() {
205 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsMinSizeRel");
207 return this->GetImpl()->IsMinSizeRel();
210 //=============================================================================
211 void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize) {
213 if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
214 this->GetImpl()->SetMaxSize(theMaxSize, false);
215 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
219 //=============================================================================
220 void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize) {
222 if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
223 this->GetImpl()->SetMaxSize(theMaxSize, true);
224 SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
228 //=============================================================================
229 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize() {
231 return this->GetImpl()->GetMaxSize();
234 //=============================================================================
235 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel() {
236 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsMaxSizeRel");
238 return this->GetImpl()->IsMaxSizeRel();
241 //=============================================================================
243 * BLSURFPlugin_Hypothesis_i::SetGradation
247 //=============================================================================
248 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) {
249 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation");
251 this->GetImpl()->SetGradation(theValue);
252 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
255 //=============================================================================
257 * BLSURFPlugin_Hypothesis_i::GetGradation
261 //=============================================================================
262 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() {
263 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation");
265 return this->GetImpl()->GetGradation();
268 //=============================================================================
270 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
274 //=============================================================================
275 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) {
276 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed");
278 this->GetImpl()->SetQuadAllowed(theValue);
279 std::string theValueStr = theValue ? "True" : "False";
280 SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )";
283 //=============================================================================
285 * BLSURFPlugin_Hypothesis_i::GetQuadAllowed
289 //=============================================================================
290 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() {
291 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed");
293 return this->GetImpl()->GetQuadAllowed();
296 //=============================================================================
298 * BLSURFPlugin_Hypothesis_i::SetAngleMesh
302 //=============================================================================
303 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue) {
304 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMesh");
306 this->GetImpl()->SetAngleMesh(theValue);
307 SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
310 //=============================================================================
312 * BLSURFPlugin_Hypothesis_i::GetAngleMesh
316 //=============================================================================
317 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh() {
318 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMesh");
320 return this->GetImpl()->GetAngleMesh();
323 //=============================================================================
325 * BLSURFPlugin_Hypothesis_i::SetChordalError
329 //=============================================================================
330 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue) {
331 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetChordalError");
333 this->GetImpl()->SetChordalError(theValue);
334 SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
337 //=============================================================================
339 * BLSURFPlugin_Hypothesis_i::GetChordalError
343 //=============================================================================
344 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError() {
345 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetChordalError");
347 return this->GetImpl()->GetChordalError();
350 //=============================================================================
352 * BLSURFPlugin_Hypothesis_i::SetAnisotropic
356 //=============================================================================
357 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue) {
358 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropic");
360 this->GetImpl()->SetAnisotropic(theValue);
361 std::string theValueStr = theValue ? "True" : "False";
362 SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
365 //=============================================================================
367 * BLSURFPlugin_Hypothesis_i::GetAnisotropic
371 //=============================================================================
372 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic() {
373 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropic");
375 return this->GetImpl()->GetAnisotropic();
378 //=============================================================================
380 * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
382 * Set Anisotropic Ratio
384 //=============================================================================
385 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue) {
386 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio");
388 this->GetImpl()->SetAnisotropicRatio(theValue);
389 SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
392 //=============================================================================
394 * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
396 * Get Anisotropic Ratio
398 //=============================================================================
399 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio() {
400 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio");
402 return this->GetImpl()->GetAnisotropicRatio();
406 //=============================================================================
408 * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
412 //=============================================================================
413 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
414 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges");
416 this->GetImpl()->SetRemoveTinyEdges(theValue);
417 std::string theValueStr = theValue ? "True" : "False";
418 SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
421 //=============================================================================
423 * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
427 //=============================================================================
428 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
429 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges");
431 return this->GetImpl()->GetRemoveTinyEdges();
434 //=============================================================================
436 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
438 * Set Tiny Edge Length
440 //=============================================================================
441 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
442 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength");
444 this->GetImpl()->SetTinyEdgeLength(theValue);
445 SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
448 //=============================================================================
450 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
452 * Get Tiny Edge Length
454 //=============================================================================
455 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
456 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength");
458 return this->GetImpl()->GetTinyEdgeLength();
461 //=============================================================================
463 * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
467 //=============================================================================
468 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
469 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementRemoval");
471 this->GetImpl()->SetBadElementRemoval(theValue);
472 std::string theValueStr = theValue ? "True" : "False";
473 SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
476 //=============================================================================
478 * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
482 //=============================================================================
483 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
484 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementRemoval");
486 return this->GetImpl()->GetBadElementRemoval();
489 //=============================================================================
491 * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
493 * Set Bad Surface Element Aspect Ratio
495 //=============================================================================
496 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
497 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio");
499 this->GetImpl()->SetBadElementAspectRatio(theValue);
500 SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
503 //=============================================================================
505 * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
507 * Get Bad Surface Element Aspect Ratio
509 //=============================================================================
510 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
511 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio");
513 return this->GetImpl()->GetBadElementAspectRatio();
516 //=============================================================================
518 * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
522 //=============================================================================
523 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
524 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimizeMesh");
526 this->GetImpl()->SetOptimizeMesh(theValue);
527 std::string theValueStr = theValue ? "True" : "False";
528 SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
531 //=============================================================================
533 * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
537 //=============================================================================
538 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
539 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimizeMesh");
541 return this->GetImpl()->GetOptimizeMesh();
544 //=============================================================================
546 * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
550 //=============================================================================
551 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
552 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadraticMesh");
554 this->GetImpl()->SetQuadraticMesh(theValue);
555 std::string theValueStr = theValue ? "True" : "False";
556 SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
559 //=============================================================================
561 * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
565 //=============================================================================
566 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
567 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadraticMesh");
569 return this->GetImpl()->GetQuadraticMesh();
577 * BLSURFPlugin_Hypothesis_i::SetTopology
582 //=============================================================================
583 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
584 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology");
586 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
587 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
590 //=============================================================================
592 * BLSURFPlugin_Hypothesis_i::GetTopology
596 //=============================================================================
597 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
598 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology");
600 return this->GetImpl()->GetTopology();
603 //=============================================================================
604 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
606 if (theVal < 0 || theVal > 100)
607 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
608 this->GetImpl()->SetVerbosity(theVal);
609 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
612 //=============================================================================
614 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
616 return (CORBA::Short) this->GetImpl()->GetVerbosity();
619 //=============================================================================
621 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
625 //=============================================================================
626 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
627 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges");
629 this->GetImpl()->SetPreCADMergeEdges(theValue);
630 std::string theValueStr = theValue ? "True" : "False";
631 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
634 //=============================================================================
636 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
640 //=============================================================================
641 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
642 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges");
644 return this->GetImpl()->GetPreCADMergeEdges();
647 //=============================================================================
649 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
653 //=============================================================================
654 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
655 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology");
657 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
658 std::string theValueStr = theValue ? "True" : "False";
659 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
662 //=============================================================================
664 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
668 //=============================================================================
669 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
670 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology");
672 return this->GetImpl()->GetPreCADProcess3DTopology();
675 //=============================================================================
677 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
681 //=============================================================================
682 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
683 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput");
685 this->GetImpl()->SetPreCADDiscardInput(theValue);
686 std::string theValueStr = theValue ? "True" : "False";
687 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
690 //=============================================================================
692 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
696 //=============================================================================
697 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
698 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput");
700 return this->GetImpl()->GetPreCADDiscardInput();
704 //=============================================================================
706 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
707 throw (SALOME::SALOME_Exception) {
709 bool valueChanged = false;
711 valueChanged = (this->GetImpl()->GetOptionValue(optionName) != optionValue);
713 this->GetImpl()->SetOptionValue(optionName, optionValue);
714 } catch (const std::invalid_argument& ex) {
715 SALOME::ExceptionStruct ExDescription;
716 ExDescription.text = ex.what();
717 ExDescription.type = SALOME::BAD_PARAM;
718 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetOptionValue(name,value)";
719 ExDescription.lineNumber = 0;
720 throw SALOME::SALOME_Exception(ExDescription);
721 } catch (SALOME_Exception& ex) {
722 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
725 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
728 //=============================================================================
730 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
731 throw (SALOME::SALOME_Exception) {
733 bool valueChanged = false;
735 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
737 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
738 } catch (const std::invalid_argument& ex) {
739 SALOME::ExceptionStruct ExDescription;
740 ExDescription.text = ex.what();
741 ExDescription.type = SALOME::BAD_PARAM;
742 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetPreCADOptionValue(name,value)";
743 ExDescription.lineNumber = 0;
744 throw SALOME::SALOME_Exception(ExDescription);
745 } catch (SALOME_Exception& ex) {
746 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
749 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
752 //=============================================================================
754 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
757 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName).c_str());
758 } catch (const std::invalid_argument& ex) {
759 SALOME::ExceptionStruct ExDescription;
760 ExDescription.text = ex.what();
761 ExDescription.type = SALOME::BAD_PARAM;
762 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetOptionValue(name)";
763 ExDescription.lineNumber = 0;
764 throw SALOME::SALOME_Exception(ExDescription);
765 } catch (SALOME_Exception& ex) {
766 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
771 //=============================================================================
773 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
776 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName).c_str());
777 } catch (const std::invalid_argument& ex) {
778 SALOME::ExceptionStruct ExDescription;
779 ExDescription.text = ex.what();
780 ExDescription.type = SALOME::BAD_PARAM;
781 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetPreCADOptionValue(name)";
782 ExDescription.lineNumber = 0;
783 throw SALOME::SALOME_Exception(ExDescription);
784 } catch (SALOME_Exception& ex) {
785 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
790 //=============================================================================
792 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
794 this->GetImpl()->ClearOption(optionName);
795 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
798 //=============================================================================
800 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
802 this->GetImpl()->ClearPreCADOption(optionName);
803 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
806 //=============================================================================
808 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
810 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
812 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
813 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
814 result->length(opts.size()+custom_opts.size());
817 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
818 for (; opIt != opts.end(); ++opIt, ++i) {
819 string name_value_type = opIt->first;
820 if (!opIt->second.empty()) {
821 name_value_type += ":";
822 name_value_type += opIt->second;
823 name_value_type += ":0";
825 result[i] = CORBA::string_dup(name_value_type.c_str());
828 opIt = custom_opts.begin();
829 for (; opIt != custom_opts.end(); ++opIt,++i) {
830 string name_value_type = opIt->first;
831 if (!opIt->second.empty()) {
832 name_value_type += ":";
833 name_value_type += opIt->second;
834 name_value_type += ":1";
836 result[i] = CORBA::string_dup(name_value_type.c_str());
838 return result._retn();
841 //=============================================================================
843 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
845 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
847 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
848 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomPreCADOptionValues();
849 result->length(opts.size()+custom_opts.size());
852 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
853 for (; opIt != opts.end(); ++opIt, ++i) {
854 string name_value_type = opIt->first;
855 if (!opIt->second.empty()) {
856 name_value_type += ":";
857 name_value_type += opIt->second;
858 name_value_type += ":0";
860 result[i] = CORBA::string_dup(name_value_type.c_str());
863 opIt = custom_opts.begin();
864 for (; opIt != custom_opts.end(); ++opIt,++i) {
865 string name_value_type = opIt->first;
866 if (!opIt->second.empty()) {
867 name_value_type += ":";
868 name_value_type += opIt->second;
869 name_value_type += ":1";
871 result[i] = CORBA::string_dup(name_value_type.c_str());
873 return result._retn();
876 //=============================================================================
878 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
879 throw (SALOME::SALOME_Exception) {
881 for (CORBA::ULong i = 0; i < options.length(); ++i) {
882 string name_value_type = options[i].in();
883 if(name_value_type.empty())
885 size_t colonPos = name_value_type.find(':');
888 if (colonPos == string::npos) // ':' not found
889 name = name_value_type;
891 name = name_value_type.substr(0, colonPos);
892 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
893 string value_type = name_value_type.substr(colonPos + 1);
894 colonPos = value_type.find(':');
895 value = value_type.substr(0, colonPos);
896 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
897 custom = atoi((value_type.substr(colonPos + 1)).c_str());
900 custom ? AddOption(name.c_str(), value.c_str()) : SetOptionValue(name.c_str(), value.c_str());
904 //=============================================================================
906 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
907 throw (SALOME::SALOME_Exception) {
909 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
910 string name_value_type = options[i].in();
911 if(name_value_type.empty())
913 size_t colonPos = name_value_type.find(':');
916 if (colonPos == string::npos) // ':' not found
917 name = name_value_type;
919 name = name_value_type.substr(0, colonPos);
920 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
921 string value_type = name_value_type.substr(colonPos + 1);
922 colonPos = value_type.find(':');
923 value = value_type.substr(0, colonPos);
924 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
925 custom = atoi((value_type.substr(colonPos + 1)).c_str());
928 custom ? AddPreCADOption(name.c_str(), value.c_str()) : SetPreCADOptionValue(name.c_str(), value.c_str());
932 //=============================================================================
934 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
937 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
939 this->GetImpl()->AddOption(optionName, optionValue);
940 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
944 //=============================================================================
946 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
949 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
951 this->GetImpl()->AddPreCADOption(optionName, optionValue);
952 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
956 //=============================================================================
958 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
961 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
964 //=============================================================================
966 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
969 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
972 //=============================================================================
974 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
975 throw (SALOME::SALOME_Exception) {
977 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
978 if ( !entry || !entry[0] )
979 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
980 bool valueChanged = false;
982 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
984 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
985 } catch (const std::invalid_argument& ex) {
986 SALOME::ExceptionStruct ExDescription;
987 ExDescription.text = ex.what();
988 ExDescription.type = SALOME::BAD_PARAM;
989 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
990 ExDescription.lineNumber = 0;
991 throw SALOME::SALOME_Exception(ExDescription);
992 } catch (SALOME_Exception& ex) {
993 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
995 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
997 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1000 //=============================================================================
1002 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1003 throw (SALOME::SALOME_Exception) {
1005 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1006 bool valueChanged = false;
1007 std::ostringstream sizeMapFunction;
1008 switch (shapeType) {
1009 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1010 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1011 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1015 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1017 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1018 } catch (const std::invalid_argument& ex) {
1019 SALOME::ExceptionStruct ExDescription;
1020 ExDescription.text = ex.what();
1021 ExDescription.type = SALOME::BAD_PARAM;
1022 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1023 ExDescription.lineNumber = 0;
1024 throw SALOME::SALOME_Exception(ExDescription);
1025 } catch (SALOME_Exception& ex) {
1026 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1028 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1030 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1033 //=============================================================================
1035 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1036 throw (SALOME::SALOME_Exception) {
1038 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1039 bool valueChanged = false;
1041 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1042 if ( valueChanged ) {
1043 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1044 if (!boost::regex_match(string(attractor), re))
1045 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1046 this->GetImpl()->SetAttractorEntry(entry, attractor);
1048 } catch (const std::invalid_argument& ex) {
1049 SALOME::ExceptionStruct ExDescription;
1050 ExDescription.text = ex.what();
1051 ExDescription.type = SALOME::BAD_PARAM;
1052 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1053 ExDescription.lineNumber = 0;
1054 throw SALOME::SALOME_Exception(ExDescription);
1055 } catch (SALOME_Exception& ex) {
1056 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1058 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1060 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1063 //=============================================================================
1065 void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius) //TODO à finir
1066 throw (SALOME::SALOME_Exception)
1069 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1070 //bool valueChanged = false;
1072 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1074 catch (const std::invalid_argument& ex) {
1075 SALOME::ExceptionStruct ExDescription;
1076 ExDescription.text = ex.what();
1077 ExDescription.type = SALOME::BAD_PARAM;
1078 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1079 ExDescription.lineNumber = 0;
1080 throw SALOME::SALOME_Exception(ExDescription);
1081 } catch (SALOME_Exception& ex) {
1082 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1084 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1085 //if ( valueChanged )
1086 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1087 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1090 //=============================================================================
1092 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1095 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1096 } catch (const std::invalid_argument& ex) {
1097 SALOME::ExceptionStruct ExDescription;
1098 ExDescription.text = ex.what();
1099 ExDescription.type = SALOME::BAD_PARAM;
1100 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1101 ExDescription.lineNumber = 0;
1102 throw SALOME::SALOME_Exception(ExDescription);
1103 } catch (SALOME_Exception& ex) {
1104 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1109 //=============================================================================
1111 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1114 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1115 } catch (const std::invalid_argument& ex) {
1116 SALOME::ExceptionStruct ExDescription;
1117 ExDescription.text = ex.what();
1118 ExDescription.type = SALOME::BAD_PARAM;
1119 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1120 ExDescription.lineNumber = 0;
1121 throw SALOME::SALOME_Exception(ExDescription);
1122 } catch (SALOME_Exception& ex) {
1123 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1128 // //=============================================================================
1130 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1131 // // A finir pour le dump
1132 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1133 // throw (SALOME::SALOME_Exception)
1135 // ASSERT(myBaseImpl);
1137 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1139 // catch (const std::invalid_argument& ex) {
1140 // SALOME::ExceptionStruct ExDescription;
1141 // ExDescription.text = ex.what();
1142 // ExDescription.type = SALOME::BAD_PARAM;
1143 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1144 // ExDescription.lineNumber = 0;
1145 // throw SALOME::SALOME_Exception(ExDescription);
1147 // catch (SALOME_Exception& ex) {
1148 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1153 //=============================================================================
1155 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1157 this->GetImpl()->ClearEntry(entry);
1158 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1161 //=============================================================================
1163 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1165 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1167 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1168 result->length(sizeMaps.size());
1170 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1171 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1172 string entry_sizemap = smIt->first;
1173 if (!smIt->second.empty()) {
1174 entry_sizemap += "|";
1175 entry_sizemap += smIt->second;
1177 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1179 return result._retn();
1182 //=============================================================================
1184 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1186 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1188 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1189 result->length(attractors.size());
1191 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1192 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1193 string entry_attractor = atIt->first;
1194 if (!atIt->second.empty()) {
1195 entry_attractor += "|";
1196 entry_attractor += atIt->second;
1198 result[i] = CORBA::string_dup(entry_attractor.c_str());
1200 return result._retn();
1203 //=============================================================================
1205 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1208 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1210 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1211 result->length( attractors.size() );
1213 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1214 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1215 string faceEntry = atIt->first;
1217 double startSize, endSize, infDist, constDist;
1218 if ( !atIt->second->Empty() ) {
1219 attEntry = atIt->second->GetAttractorEntry();
1220 MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
1221 std::vector<double> params = atIt->second->GetParameters();
1222 startSize = params[0];
1223 endSize = params[1];
1224 infDist = params[2];
1225 constDist = params[3];
1227 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1228 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1229 result[i].startSize = startSize;
1230 result[i].endSize = endSize;
1231 result[i].infDist = infDist;
1232 result[i].constDist = constDist;
1233 MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
1234 MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
1236 return result._retn();
1239 //=============================================================================
1241 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1242 throw (SALOME::SALOME_Exception) {
1244 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1245 string entry_sizemap = sizeMaps[i].in();
1246 size_t colonPos = entry_sizemap.find('|');
1247 string entry, sizemap;
1248 if (colonPos == string::npos) // '|' separator not found
1249 entry = entry_sizemap;
1251 entry = entry_sizemap.substr(0, colonPos);
1252 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1253 sizemap = entry_sizemap.substr(colonPos + 1);
1255 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1259 //=============================================================================
1261 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1263 this->GetImpl()->ClearSizeMaps();
1266 //=============================================================================
1268 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1269 throw (SALOME::SALOME_Exception)
1273 entry = GeomObj->GetStudyEntry();
1274 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1275 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1276 SetSizeMapEntry(entry.c_str(), sizeMap);
1279 //=============================================================================
1281 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1283 string entry = GeomObj->GetStudyEntry();
1284 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1285 if (shapeType == GEOM::COMPOUND)
1286 shapeType = GeomObj->GetMaxShapeType();
1287 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1288 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1289 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1292 //=============================================================================
1293 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1296 entry = GeomObj->GetStudyEntry();
1297 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1298 MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
1299 UnsetEntry(entry.c_str());
1300 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
1303 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
1306 entry = GeomObj->GetStudyEntry();
1307 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1308 MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
1309 SetAttractorEntry(entry.c_str(), attractor);
1312 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
1315 entry = GeomObj->GetStudyEntry();
1316 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1317 MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
1318 UnsetEntry(entry.c_str());
1319 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
1322 void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theAttractor, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius)
1325 string theFaceEntry;
1327 theFaceEntry = theFace->GetStudyEntry();
1328 theAttEntry = theAttractor->GetStudyEntry();
1330 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1331 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1334 if (theFaceEntry.empty()) {
1336 aName += theFace->GetEntry();
1337 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1338 if (!theSFace->_is_nil())
1339 theFaceEntry = theSFace->GetID();
1341 if (theFaceEntry.empty())
1342 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1344 if (theAttEntry.empty()) {
1345 if (theAttractor->GetShapeType() == GEOM::VERTEX)
1347 if (theAttractor->GetShapeType() == GEOM::EDGE)
1349 if (theAttractor->GetShapeType() == GEOM::WIRE)
1351 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
1352 aName = "Compound_";
1353 aName += theAttractor->GetEntry();
1354 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
1355 if (!theSAtt->_is_nil())
1356 theAttEntry = theSAtt->GetID();
1358 if (theAttEntry.empty())
1359 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1361 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
1362 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
1363 MESSAGE("IDL : GetName : " << theFace->GetName());
1364 MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
1365 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
1368 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
1369 GEOM::GEOM_Object_ptr theAttractor)
1372 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
1373 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
1375 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1376 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1379 // if (theFaceEntry.empty()) {
1381 // aName += theFace->GetEntry();
1382 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1383 // if (!theSFace->_is_nil())
1384 // theFaceEntry = theSFace->GetID();
1386 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
1387 !theAttrEntry.in() || !theAttrEntry.in()[0] )
1388 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1390 MESSAGE("IDL : GetName : " << theFace->GetName());
1391 MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
1392 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
1393 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
1394 << theFace << ", " << theAttractor << " )";
1397 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
1398 const char* attractorEntry)
1400 GetImpl()->ClearEntry( faceEntry, attractorEntry );
1401 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
1402 << faceEntry << "', '" << attractorEntry << "' )";
1407 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1410 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
1413 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
1416 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
1419 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
1422 this->GetImpl()->UnsetCustomSizeMap(entry);
1423 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
1427 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
1432 // ///////////////////////
1433 // // ENFORCED VERTICES //
1434 // ///////////////////////
1438 * Returns the list of enforced vertices for a given Face entry
1439 * @return A map of Face entry / List of enforced vertices
1442 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
1443 MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
1446 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
1448 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
1449 this->GetImpl()->_GetAllEnforcedVerticesByFace();
1450 resultMap->length(faceEntryEnfVertexListMap.size());
1451 MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
1453 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
1454 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
1455 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
1456 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
1457 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
1458 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1459 MESSAGE("Face Entry: " << mapElement->faceEntry);
1461 _enfVertexList = it_entry->second;
1462 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
1463 enfVertexList->length(_enfVertexList.size());
1464 MESSAGE("Number of enf vertex: " << enfVertexList->length());
1466 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
1467 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1468 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
1469 currentEnfVertex = (*it_enfVertex);
1471 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1474 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1477 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1480 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1481 coords->length(currentEnfVertex->coords.size());
1482 for (CORBA::ULong i=0;i<coords->length();i++)
1483 coords[i] = currentEnfVertex->coords[i];
1484 enfVertex->coords = coords;
1487 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1490 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1491 faceEntryList->length(currentEnfVertex->faceEntries.size());
1492 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1493 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1494 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1495 enfVertex->faceEntries = faceEntryList;
1498 msg << "Enforced vertex: \n"
1499 << "Name: " << enfVertex->name << "\n";
1500 if (coords->length())
1501 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1502 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1503 << "Group Name: " << enfVertex->grpName;
1506 enfVertexList[j] = enfVertex;
1508 mapElement->enfVertexList = enfVertexList;
1510 resultMap[i] = mapElement;
1513 return resultMap._retn();
1517 * Returns the list of all enforced vertices
1518 * @return a list of enforced vertices
1521 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
1522 MESSAGE("IDL: GetAllEnforcedVertices()");
1524 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
1525 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
1526 resultMap->length(enfVertexList.size());
1527 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1529 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
1530 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1531 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
1532 MESSAGE("Enforced Vertex #" << i);
1533 currentEnfVertex = (*evlIt);
1534 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1536 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1538 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1540 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1541 coords->length(currentEnfVertex->coords.size());
1542 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
1543 coords[ind] = currentEnfVertex->coords[ind];
1544 enfVertex->coords = coords;
1546 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1548 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1549 faceEntryList->length(currentEnfVertex->faceEntries.size());
1550 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1551 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1552 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1553 enfVertex->faceEntries = faceEntryList;
1556 msg << "Enforced vertex: \n"
1557 << "Name: " << enfVertex->name << "\n";
1558 if (coords->length())
1559 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1560 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1561 << "Group Name: " << enfVertex->grpName;
1564 resultMap[i] = enfVertex;
1566 return resultMap._retn();
1571 * Returns the list of enforced vertices coords for a given Face entry.
1572 * They are the coords of the "manual" enforced vertices.
1573 * @return A map of Face entry / List of enforced vertices coords
1576 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
1577 MESSAGE("IDL: GetAllCoordsByFace()");
1580 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
1582 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
1583 resultMap->length(entryCoordsListMap.size());
1584 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1586 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
1587 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
1588 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
1589 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
1590 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1591 MESSAGE("Face Entry: " << mapElement->faceEntry);
1593 _coordsList = it_entry->second;
1594 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
1595 coordsList->length(_coordsList.size());
1596 MESSAGE("Number of coords: " << coordsList->length());
1598 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
1599 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
1600 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1601 coords->length((*it_coords).size());
1602 for (CORBA::ULong i=0;i<coords->length();i++)
1603 coords[i] = (*it_coords)[i];
1604 coordsList[j] = coords;
1605 MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
1607 mapElement->coordsList = coordsList;
1609 resultMap[i] = mapElement;
1612 return resultMap._retn();
1616 * Returns a map of enforced vertices coords / enforced vertex.
1617 * They are the coords of the "manual" enforced vertices.
1619 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
1620 MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
1623 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
1624 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
1625 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
1626 resultMap->length(coordsEnfVertexMap.size());
1627 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1629 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
1630 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1631 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
1632 MESSAGE("Enforced Vertex #" << i);
1633 currentEnfVertex = (it_coords->second);
1634 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
1635 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1636 coords->length(it_coords->first.size());
1637 for (CORBA::ULong ind=0;ind<coords->length();ind++)
1638 coords[ind] = it_coords->first[ind];
1639 mapElement->coords = coords;
1640 MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
1642 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1644 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1646 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1648 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
1649 coords2->length(currentEnfVertex->coords.size());
1650 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
1651 coords2[ind] = currentEnfVertex->coords[ind];
1652 enfVertex->coords = coords2;
1654 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1656 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1657 faceEntryList->length(currentEnfVertex->faceEntries.size());
1658 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1659 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1660 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1661 enfVertex->faceEntries = faceEntryList;
1663 mapElement->enfVertex = enfVertex;
1665 msg << "Enforced vertex: \n"
1666 << "Name: " << enfVertex->name << "\n";
1667 if (coords->length())
1668 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1669 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1670 << "Group Name: " << enfVertex->grpName;
1673 resultMap[i] = mapElement;
1675 return resultMap._retn();
1679 * Returns the list of enforced vertices entries for a given Face entry.
1680 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
1681 * @return A map of Face entry / List of enforced vertices geom entries
1684 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
1685 MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
1688 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
1690 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
1691 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
1692 resultMap->length(entryEnfVertexEntryListMap.size());
1693 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1695 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
1696 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
1697 entryEnfVertexEntryListMap.begin();
1698 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
1699 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
1700 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
1701 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1702 MESSAGE("Face Entry: " << mapElement->faceEntry);
1704 _enfVertexEntryList = it_entry->second;
1705 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
1706 enfVertexEntryList->length(_enfVertexEntryList.size());
1707 MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
1709 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
1710 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
1711 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
1712 MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
1714 mapElement->enfVertexEntryList = enfVertexEntryList;
1716 resultMap[i] = mapElement;
1719 return resultMap._retn();
1723 * Returns a map of enforced vertices geom entry / enforced vertex.
1724 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
1726 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
1727 MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
1730 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
1731 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
1732 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
1733 resultMap->length(enfVertexEntryEnfVertexMap.size());
1734 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1736 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
1737 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1738 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
1739 MESSAGE("Enforced Vertex #" << i);
1740 currentEnfVertex = it_enfVertexEntry->second;
1741 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
1742 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
1743 MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
1745 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1747 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1749 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1751 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1752 coords->length(currentEnfVertex->coords.size());
1753 for (CORBA::ULong ind=0;ind<coords->length();ind++)
1754 coords[ind] = currentEnfVertex->coords[ind];
1755 enfVertex->coords = coords;
1757 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1759 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1760 faceEntryList->length(currentEnfVertex->faceEntries.size());
1761 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1762 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1763 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1764 enfVertex->faceEntries = faceEntryList;
1767 msg << "Enforced vertex: \n"
1768 << "Name: " << enfVertex->name << "\n";
1769 if (coords->length())
1770 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1771 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1772 << "Group Name: " << enfVertex->grpName;
1775 mapElement->enfVertex = enfVertex;
1776 resultMap[i] = mapElement;
1778 return resultMap._retn();
1782 * Erase all enforced vertices
1784 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
1786 this->GetImpl()->ClearAllEnforcedVertices();
1787 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
1791 * Set/get/unset an enforced vertex on face
1793 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1794 CORBA::Double z) throw (SALOME::SALOME_Exception) {
1797 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1798 MESSAGE("theFace shape type is not FACE or COMPOUND");
1799 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1802 string theFaceEntry = theFace->GetStudyEntry();
1804 if (theFaceEntry.empty()) {
1805 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1806 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1808 if (theFace->GetShapeType() == GEOM::FACE)
1810 if (theFace->GetShapeType() == GEOM::COMPOUND)
1811 aName = "Compound_";
1812 aName += theFace->GetEntry();
1813 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1814 if (!theSFace->_is_nil())
1815 theFaceEntry = theSFace->GetID();
1817 if (theFaceEntry.empty())
1818 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1819 MESSAGE("IDL : GetName : " << theFace->GetName());
1820 MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
1822 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
1823 } catch (SALOME_Exception& ex) {
1824 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1829 * Set/get/unset an enforced vertex with name on face
1831 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1832 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
1835 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1836 MESSAGE("theFace shape type is not FACE or COMPOUND");
1837 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1840 string theFaceEntry = theFace->GetStudyEntry();
1842 if (theFaceEntry.empty()) {
1843 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1844 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1846 if (theFace->GetShapeType() == GEOM::FACE)
1848 if (theFace->GetShapeType() == GEOM::COMPOUND)
1849 aName = "Compound_";
1850 aName += theFace->GetEntry();
1851 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1852 if (!theSFace->_is_nil())
1853 theFaceEntry = theSFace->GetID();
1855 if (theFaceEntry.empty())
1856 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1858 MESSAGE("IDL : GetName : " << theFace->GetName());
1859 MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
1861 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
1862 } catch (SALOME_Exception& ex) {
1863 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1868 * Set/get/unset an enforced vertex with geom object on face
1870 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
1871 throw (SALOME::SALOME_Exception) {
1874 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1875 MESSAGE("theFace shape type is not FACE or COMPOUND");
1876 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1879 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1880 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1881 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1884 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1885 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
1886 // if (CORBA::is_nil(measureOp))
1889 // CORBA::Double x, y, z;
1891 // measureOp->PointCoordinates(theVertex, x, y, z);
1893 string theFaceEntry = theFace->GetStudyEntry();
1894 string theVertexEntry = theVertex->GetStudyEntry();
1896 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1897 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1900 if (theFaceEntry.empty()) {
1901 if (theFace->GetShapeType() == GEOM::FACE)
1903 if (theFace->GetShapeType() == GEOM::COMPOUND)
1904 aName = "Compound_";
1905 aName += theFace->GetEntry();
1906 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1907 if (!theSFace->_is_nil())
1908 theFaceEntry = theSFace->GetID();
1910 if (theFaceEntry.empty())
1911 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1913 if (theVertexEntry.empty()) {
1914 if (theVertex->GetShapeType() == GEOM::VERTEX)
1916 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1917 aName = "Compound_";
1918 aName += theVertex->GetEntry();
1919 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1920 if (!theSVertex->_is_nil())
1921 theVertexEntry = theSVertex->GetID();
1923 if (theVertexEntry.empty())
1924 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1926 string theVertexName = theVertex->GetName();
1927 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
1928 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
1929 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
1931 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
1932 } catch (SALOME_Exception& ex) {
1933 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1938 * Set an enforced vertex with group name on face
1940 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
1941 throw (SALOME::SALOME_Exception)
1945 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1946 MESSAGE("theFace shape type is not FACE or COMPOUND");
1947 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1950 string theFaceEntry = theFace->GetStudyEntry();
1952 if (theFaceEntry.empty()) {
1953 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1954 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1956 if (theFace->GetShapeType() == GEOM::FACE)
1958 if (theFace->GetShapeType() == GEOM::COMPOUND)
1959 aName = "Compound_";
1960 aName += theFace->GetEntry();
1961 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1962 if (!theSFace->_is_nil())
1963 theFaceEntry = theSFace->GetID();
1965 if (theFaceEntry.empty())
1966 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1967 MESSAGE("IDL : GetName : " << theFace->GetName());
1968 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
1970 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
1971 } catch (SALOME_Exception& ex) {
1972 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1977 * Set an enforced vertex with name and group name on face
1979 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
1980 const char* theVertexName, const char* theGroupName)
1981 throw (SALOME::SALOME_Exception)
1985 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1986 MESSAGE("theFace shape type is not FACE or COMPOUND");
1987 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1990 string theFaceEntry = theFace->GetStudyEntry();
1992 if (theFaceEntry.empty()) {
1993 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1994 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1996 if (theFace->GetShapeType() == GEOM::FACE)
1998 if (theFace->GetShapeType() == GEOM::COMPOUND)
1999 aName = "Compound_";
2000 aName += theFace->GetEntry();
2001 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2002 if (!theSFace->_is_nil())
2003 theFaceEntry = theSFace->GetID();
2005 if (theFaceEntry.empty())
2006 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2007 MESSAGE("IDL : GetName : " << theFace->GetName());
2008 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
2010 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2011 } catch (SALOME_Exception& ex) {
2012 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2017 * Set an enforced vertex with geom entry and group name on face
2019 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2020 throw (SALOME::SALOME_Exception)
2024 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2025 MESSAGE("theFace shape type is not FACE or COMPOUND");
2026 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2029 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2030 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2031 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2034 string theFaceEntry = theFace->GetStudyEntry();
2035 string theVertexEntry = theVertex->GetStudyEntry();
2037 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2038 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2041 if (theFaceEntry.empty()) {
2042 if (theFace->GetShapeType() == GEOM::FACE)
2044 if (theFace->GetShapeType() == GEOM::COMPOUND)
2045 aName = "Compound_";
2046 aName += theFace->GetEntry();
2047 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2048 if (!theSFace->_is_nil())
2049 theFaceEntry = theSFace->GetID();
2051 if (theFaceEntry.empty())
2052 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2054 if (theVertexEntry.empty()) {
2055 if (theVertex->GetShapeType() == GEOM::VERTEX)
2057 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2058 aName = "Compound_";
2059 aName += theVertex->GetEntry();
2060 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2061 if (!theSVertex->_is_nil())
2062 theVertexEntry = theSVertex->GetID();
2064 if (theVertexEntry.empty())
2065 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2067 string theVertexName = theVertex->GetName();
2068 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2069 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2070 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
2072 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2073 } catch (SALOME_Exception& ex) {
2074 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2078 //Enable internal enforced vertices on specific face if requested by user
2080 // * Are internal enforced vertices used for a face ?
2082 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2083 // throw (SALOME::SALOME_Exception) {
2084 // ASSERT(myBaseImpl);
2086 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2087 // MESSAGE("theFace shape type is not FACE or COMPOUND");
2088 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2091 // string theFaceEntry = theFace->GetStudyEntry();
2093 // if (theFaceEntry.empty()) {
2094 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2095 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2097 // if (theFace->GetShapeType() == GEOM::FACE)
2099 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2100 // aName = "Compound_";
2101 // aName += theFace->GetEntry();
2102 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2103 // if (!theSFace->_is_nil())
2104 // theFaceEntry = theSFace->GetID();
2106 // if (theFaceEntry.empty())
2107 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2109 // MESSAGE("IDL : GetName : " << theFace->GetName());
2110 // MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2112 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2113 // } catch (SALOME_Exception& ex) {
2114 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2119 * Get the list of all enforced vertices
2121 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2122 throw (SALOME::SALOME_Exception) {
2125 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2126 MESSAGE("theFace shape type is not FACE or COMPOUND");
2127 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2130 string theFaceEntry = theFace->GetStudyEntry();
2132 if (theFaceEntry.empty()) {
2133 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2134 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2136 if (theFace->GetShapeType() == GEOM::FACE)
2138 if (theFace->GetShapeType() == GEOM::COMPOUND)
2139 aName = "Compound_";
2140 aName += theFace->GetEntry();
2141 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2142 if (!theSFace->_is_nil())
2143 theFaceEntry = theSFace->GetID();
2145 if (theFaceEntry.empty())
2146 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2148 MESSAGE("IDL : GetName : " << theFace->GetName());
2149 MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
2151 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2152 } catch (SALOME_Exception& ex) {
2153 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2157 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2158 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2161 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2162 MESSAGE("theFace shape type is not FACE or COMPOUND");
2163 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2166 string theFaceEntry = theFace->GetStudyEntry();
2168 if (theFaceEntry.empty()) {
2169 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2170 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2172 if (theFace->GetShapeType() == GEOM::FACE)
2174 if (theFace->GetShapeType() == GEOM::COMPOUND)
2175 aName = "Compound_";
2176 aName += theFace->GetEntry();
2177 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2178 if (!theSFace->_is_nil())
2179 theFaceEntry = theSFace->GetID();
2181 if (theFaceEntry.empty())
2182 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2183 MESSAGE("IDL : GetName : " << theFace->GetName());
2184 MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2187 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2188 } catch (SALOME_Exception& ex) {
2189 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2193 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2194 throw (SALOME::SALOME_Exception) {
2197 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2198 MESSAGE("theFace shape type is not FACE or COMPOUND");
2199 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2201 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2202 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2203 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2206 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2207 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2208 // if (CORBA::is_nil(measureOp))
2211 // CORBA::Double x, y, z;
2213 // measureOp->PointCoordinates(theVertex, x, y, z);
2215 std::string theFaceEntry = theFace->GetStudyEntry();
2216 std::string theVertexEntry = theVertex->GetStudyEntry();
2218 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2219 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2222 if (theFaceEntry.empty()) {
2223 if (theFace->GetShapeType() == GEOM::FACE)
2225 if (theFace->GetShapeType() == GEOM::COMPOUND)
2226 aName = "Compound_";
2227 aName += theFace->GetEntry();
2228 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2229 if (!theSFace->_is_nil())
2230 theFaceEntry = theSFace->GetID();
2232 if (theFaceEntry.empty())
2233 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2235 if (theVertexEntry.empty()) {
2236 if (theVertex->GetShapeType() == GEOM::VERTEX)
2238 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2239 aName = "Compound_";
2240 aName += theVertex->GetEntry();
2241 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2242 if (!theSVertex->_is_nil())
2243 theVertexEntry = theSVertex->GetID();
2245 if (theVertexEntry.empty())
2246 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2248 MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
2251 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2252 } catch (SALOME_Exception& ex) {
2253 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2257 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2260 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2261 MESSAGE("theFace shape type is not FACE or COMPOUND");
2262 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2265 string theFaceEntry = theFace->GetStudyEntry();
2267 if (theFaceEntry.empty()) {
2268 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2269 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2271 if (theFace->GetShapeType() == GEOM::FACE)
2273 if (theFace->GetShapeType() == GEOM::COMPOUND)
2274 aName = "Compound_";
2275 aName += theFace->GetEntry();
2276 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2277 if (!theSFace->_is_nil())
2278 theFaceEntry = theSFace->GetID();
2280 if (theFaceEntry.empty())
2281 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2283 MESSAGE("IDL : GetName : " << theFace->GetName());
2284 MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
2287 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2288 } catch (SALOME_Exception& ex) {
2289 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2294 * Set/get/unset an enforced vertex on geom object given by entry
2296 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2297 CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
2298 throw (SALOME::SALOME_Exception) {
2300 MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
2301 bool newValue = false;
2302 if (string(theVertexEntry).empty()) {
2304 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
2305 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
2306 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
2307 coords.push_back(x);
2308 coords.push_back(y);
2309 coords.push_back(z);
2310 if (coordsList.find(coords) == coordsList.end()) {
2311 MESSAGE("Coords not found: add it in coordsList");
2314 MESSAGE("Coords already found, compare names");
2315 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
2316 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2317 MESSAGE("The names are different: update");
2318 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2322 MESSAGE("The names are identical");
2325 } catch (const std::invalid_argument& ex) {
2326 // no enforced vertex for entry
2327 MESSAGE("Face entry not found : add it to the list");
2331 if (string(theVertexName).empty()) {
2332 if (string(theGroupName).empty())
2333 SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
2335 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
2338 if (string(theGroupName).empty())
2339 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
2341 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
2342 << theVertexName << "\", \"" << theGroupName << "\")";
2347 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
2348 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
2349 if ( it == enfVertexEntryList.end()) {
2350 MESSAGE("Geom entry not found: add it in enfVertexEntryList");
2354 MESSAGE("Geom entry already found, compare names");
2355 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
2356 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2357 MESSAGE("The names are different: update");
2358 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2362 MESSAGE("The names are identical");
2365 } catch (const std::invalid_argument& ex) {
2366 // no enforced vertex for entry
2367 MESSAGE("Face entry not found : add it to the list");
2371 if (string(theGroupName).empty())
2372 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2374 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
2379 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
2381 MESSAGE("IDL : SetEnforcedVertexEntry END");
2385 //Enable internal enforced vertices on specific face if requested by user
2386 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry)
2387 // throw (SALOME::SALOME_Exception) {
2388 // ASSERT(myBaseImpl);
2390 // return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry);
2391 // } catch (const std::exception& ex) {
2392 // std::cout << "Exception: " << ex.what() << std::endl;
2393 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2397 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
2398 throw (SALOME::SALOME_Exception) {
2400 MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
2403 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
2404 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
2405 vertexList->length(_vList.size());
2406 MESSAGE("Number of enforced vertices: " << vertexList->length());
2407 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
2408 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
2409 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
2411 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2414 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
2415 // Geom Vertex Entry
2416 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
2418 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2419 coords->length(_enfVertex->coords.size());
2420 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
2421 coords[ind] = _enfVertex->coords[ind];
2422 enfVertex->coords = coords;
2424 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
2426 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2427 faceEntryList->length(_enfVertex->faceEntries.size());
2428 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
2429 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
2430 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2431 enfVertex->faceEntries = faceEntryList;
2433 vertexList[i] = enfVertex;
2435 MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
2436 return vertexList._retn();
2437 } catch (const std::invalid_argument& ex) {
2438 SALOME::ExceptionStruct ExDescription;
2439 ExDescription.text = ex.what();
2440 ExDescription.type = SALOME::BAD_PARAM;
2441 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
2442 ExDescription.lineNumber = 1385;
2443 throw SALOME::SALOME_Exception(ExDescription);
2444 } catch (const std::exception& ex) {
2445 std::cout << "Exception: " << ex.what() << std::endl;
2446 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2450 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2451 CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
2453 MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
2457 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
2459 if (string(theVertexEntry).empty())
2460 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
2463 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2465 } catch (const std::invalid_argument& ex) {
2467 } catch (const std::exception& ex) {
2468 std::cout << "Exception: " << ex.what() << std::endl;
2469 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2472 MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
2476 //bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
2477 // CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
2478 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
2480 // bool ret = false;
2483 // ret = _unsetEnfVertex(theFaceEntry, x, y, z);
2484 // } catch (SALOME_Exception& ex) {
2485 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2489 // SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
2492 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
2496 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
2498 MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
2501 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
2502 SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
2503 } catch (const std::invalid_argument& ex) {
2505 } catch (const std::exception& ex) {
2506 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2509 MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
2513 //=============================================================================
2515 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
2519 //=============================================================================
2520 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
2521 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
2523 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
2524 std::string theValueStr = theValue ? "True" : "False";
2525 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
2528 //=============================================================================
2530 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
2534 //=============================================================================
2535 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
2536 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
2538 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
2541 //=============================================================================
2543 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
2547 //=============================================================================
2548 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName) {
2549 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
2551 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
2552 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
2555 //=============================================================================
2557 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
2561 //=============================================================================
2562 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
2563 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
2565 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
2569 * Enable internal enforced vertices on specific face if requested by user
2571 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
2572 throw (SALOME::SALOME_Exception)
2574 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
2576 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
2577 } catch (SALOME_Exception& ex) {
2578 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2582 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2583 throw (SALOME::SALOME_Exception)
2585 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
2587 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2588 MESSAGE("theFace shape type is not FACE or COMPOUND");
2589 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2592 string theFaceEntry = theFace->GetStudyEntry();
2594 if (theFaceEntry.empty()) {
2595 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2596 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2598 if (theFace->GetShapeType() == GEOM::FACE)
2600 if (theFace->GetShapeType() == GEOM::COMPOUND)
2601 aName = "Compound_";
2602 aName += theFace->GetEntry();
2603 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2604 if (!theSFace->_is_nil())
2605 theFaceEntry = theSFace->GetID();
2607 if (theFaceEntry.empty())
2608 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2610 MESSAGE("IDL : GetName : " << theFace->GetName());
2611 MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2613 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
2614 } catch (SALOME_Exception& ex) {
2615 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2619 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2620 throw (SALOME::SALOME_Exception)
2622 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
2625 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
2626 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
2627 if (string(theGroupName).empty())
2628 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
2630 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
2631 } catch (const std::exception& ex) {
2632 std::cout << "Exception: " << ex.what() << std::endl;
2633 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2640 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
2641 throw (SALOME::SALOME_Exception)
2644 MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
2646 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
2648 catch (const std::invalid_argument& ex) {
2649 SALOME::ExceptionStruct ExDescription;
2650 ExDescription.text = ex.what();
2651 ExDescription.type = SALOME::BAD_PARAM;
2652 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
2653 ExDescription.lineNumber = 1146;
2654 throw SALOME::SALOME_Exception(ExDescription);
2656 catch (SALOME_Exception& ex) {
2657 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2659 MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
2664 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
2665 throw (SALOME::SALOME_Exception)
2668 MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
2670 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
2672 catch (const std::invalid_argument& ex) {
2673 SALOME::ExceptionStruct ExDescription;
2674 ExDescription.text = ex.what();
2675 ExDescription.type = SALOME::BAD_PARAM;
2676 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
2677 ExDescription.lineNumber = 1170;
2678 throw SALOME::SALOME_Exception(ExDescription);
2680 catch (SALOME_Exception& ex) {
2681 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2684 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
2685 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
2687 MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
2690 ///////////////////////
2692 ///////////////////////
2694 ///////////////////////
2697 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
2699 //enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
2700 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
2701 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
2702 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
2703 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
2704 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
2705 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
2706 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
2707 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
2708 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
2709 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
2710 std::string txtShapeType = MapShapeTypeToString[theShapeType];
2711 return txtShapeType;
2714 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
2716 // Check shape types
2718 std::stringstream typesTxt;
2719 for (std::size_t i=0; i<theShapeTypes.size(); i++)
2721 GEOM::shape_type theShapeType = theShapeTypes[i];
2722 if (shape->GetShapeType() == theShapeType)
2724 typesTxt << ShapeTypeToString(theShapeType);
2725 if (i < theShapeTypes.size()-1 )
2729 std::stringstream msg;
2730 msg << "shape shape type is not in" << typesTxt.str();
2732 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2736 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
2739 if (shape->GetShapeType() != theShapeType) {
2740 std::stringstream msg;
2741 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
2743 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2747 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
2749 // Check shape is published in the object browser
2750 string shapeEntry = shape->GetStudyEntry();
2752 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2753 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2756 // Publish shape if needed
2757 if (shapeEntry.empty()) {
2758 if (shape->GetShapeType() == theShapeType)
2760 aName += shape->GetEntry();
2761 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
2762 if (!theSFace1->_is_nil())
2763 shapeEntry = theSFace1->GetID();
2765 if (shapeEntry.empty())
2766 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2770 // Format the output of two vectors to use it in MESSAGE and PythonDump
2771 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
2773 std::stringstream listEntriesTxt;
2775 if (!theSourceVerticesEntries.empty())
2777 listEntriesTxt << ", [" ;
2779 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
2782 listEntriesTxt << ", ";
2783 listEntriesTxt << *it;
2786 listEntriesTxt << "], [" ;
2788 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
2791 listEntriesTxt << ", ";
2792 listEntriesTxt << *it;
2794 listEntriesTxt << "]" ;
2796 return listEntriesTxt.str();
2800 * Erase all PreCad periodicity associations
2802 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
2804 this->GetImpl()->ClearPreCadPeriodicityVectors();
2805 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
2808 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
2810 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
2811 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2812 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
2814 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2816 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
2817 return periodicityList._retn();
2820 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
2822 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
2823 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2824 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
2826 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2828 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
2829 return periodicityList._retn();
2832 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
2833 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
2835 MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
2836 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
2838 periodicityList->length(preCadPeriodicityVector.size());
2840 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
2842 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
2844 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
2845 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
2846 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
2848 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
2849 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
2851 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
2852 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
2853 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
2856 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
2858 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
2859 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
2861 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
2862 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
2863 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
2866 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
2868 periodicityList[i] = myPreCadPeriodicity;
2872 return periodicityList._retn();
2876 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
2877 throw (SALOME::SALOME_Exception)
2880 const GEOM::ListOfGO theSourceVertices;
2881 const GEOM::ListOfGO theTargetVertices;
2882 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
2886 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
2887 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2888 throw (SALOME::SALOME_Exception)
2891 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
2893 size_t theLength = theSourceVertices.length();
2894 if (theLength != theTargetVertices.length())
2895 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2897 std::vector<GEOM::shape_type> allowedShapeTypes;
2898 allowedShapeTypes.push_back(GEOM::FACE);
2899 allowedShapeTypes.push_back(GEOM::COMPOUND);
2901 string prefix1 = "Source_face_";
2902 CheckShapeTypes(theFace1, allowedShapeTypes);
2903 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
2905 string prefix2 = "Target_face_";
2906 CheckShapeTypes(theFace2, allowedShapeTypes);
2907 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
2909 string prefix3 = "Source_vertex_";
2910 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
2911 theSourceVerticesEntries->length(theLength);
2912 GEOM::GEOM_Object_ptr theVtx_i;
2914 for (size_t ind = 0; ind < theLength; ind++) {
2915 theVtx_i = theSourceVertices[ind];
2916 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
2917 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2920 string prefix4 = "Target_vertex_";
2921 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
2922 theTargetVerticesEntries->length(theLength);
2923 for (size_t ind = 0; ind < theLength; ind++) {
2924 theVtx_i = theTargetVertices[ind];
2925 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
2926 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2929 string theFace2Name = theFace2->GetName();
2930 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
2931 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
2932 MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
2934 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
2935 theSourceVerticesEntries, theTargetVerticesEntries);
2936 } catch (SALOME_Exception& ex) {
2937 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2942 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
2943 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
2944 throw (SALOME::SALOME_Exception)
2949 // Convert BLSURFPlugin::TEntryList to vector<string>
2950 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
2951 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
2952 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
2953 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
2956 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
2958 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
2960 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
2961 theSourceVerticesEntries, theTargetVerticesEntries);
2963 SMESH::TPythonDump pd;
2964 if (!theSourceVerticesEntries.empty())
2966 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
2967 pd << listEntriesTxt.c_str();
2971 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
2972 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
2975 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
2976 throw (SALOME::SALOME_Exception)
2979 const GEOM::ListOfGO theSourceVertices;
2980 const GEOM::ListOfGO theTargetVertices;
2981 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
2984 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
2985 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2986 throw (SALOME::SALOME_Exception)
2988 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
2991 size_t theLength = theSourceVertices.length();
2992 if (theLength != theTargetVertices.length())
2993 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2995 std::vector<GEOM::shape_type> allowedShapeTypes;
2996 allowedShapeTypes.push_back(GEOM::EDGE);
2997 allowedShapeTypes.push_back(GEOM::COMPOUND);
2999 string prefix1 = "Source_edge_";
3000 CheckShapeTypes(theEdge1, allowedShapeTypes);
3001 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3003 string prefix2 = "Target_edge_";
3004 CheckShapeTypes(theEdge2, allowedShapeTypes);
3005 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3007 string prefix3 = "Source_vertex_";
3008 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3009 theSourceVerticesEntries->length(theLength);
3010 GEOM::GEOM_Object_ptr theVtx_i;
3012 for (size_t ind = 0; ind < theLength; ind++) {
3013 theVtx_i = theSourceVertices[ind];
3014 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3015 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3018 string prefix4 = "Target_vertex_";
3019 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3020 theTargetVerticesEntries->length(theLength);
3021 for (size_t ind = 0; ind < theLength; ind++) {
3022 theVtx_i = theTargetVertices[ind];
3023 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3024 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3027 string theEdge2Name = theEdge2->GetName();
3028 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3029 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3030 MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
3032 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3033 theSourceVerticesEntries, theTargetVerticesEntries);
3034 } catch (SALOME_Exception& ex) {
3035 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3040 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3041 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3042 throw (SALOME::SALOME_Exception)
3047 // Convert BLSURFPlugin::TEntryList to vector<string>
3048 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3049 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3050 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3051 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3054 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3056 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
3057 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3058 theSourceVerticesEntries, theTargetVerticesEntries);
3060 SMESH::TPythonDump pd;
3061 if (!theSourceVerticesEntries.empty())
3063 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3064 pd << listEntriesTxt.c_str();
3068 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3070 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
3073 void BLSURFPlugin_Hypothesis_i::AddFacePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3074 throw (SALOME::SALOME_Exception)
3078 string prefix1 = "Source_face_";
3079 CheckShapeType(theFace1, GEOM::FACE);
3080 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3081 string prefix2 = "Target_face_";
3082 CheckShapeType(theFace2, GEOM::FACE);
3083 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3085 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3086 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3087 MESSAGE("IDL : AddFacePeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
3089 AddFacePeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str());
3090 } catch (SALOME_Exception& ex) {
3091 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3097 void BLSURFPlugin_Hypothesis_i::AddFacePeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry)
3098 throw (SALOME::SALOME_Exception){
3102 MESSAGE("IDL : AddFacePeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << ")");
3103 this->GetImpl()->AddFacePeriodicity(theFace1Entry, theFace2Entry);
3104 SMESH::TPythonDump pd;
3105 pd << _this() << ".AddFacePeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3106 MESSAGE("IDL : AddFacePeriodicityEntry END");
3110 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theEdge1,
3111 GEOM::GEOM_Object_ptr theFace2, GEOM::GEOM_Object_ptr theEdge2,
3112 CORBA::Long edge_orientation)
3113 throw (SALOME::SALOME_Exception){
3116 string prefix_theFace1 = "Source_face_";
3117 CheckShapeType(theFace1, GEOM::FACE);
3118 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix_theFace1);
3119 string prefix_theFace2 = "Target_face_";
3120 CheckShapeType(theFace2, GEOM::FACE);
3121 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix_theFace2);
3123 string prefix_theEdge1 = "Source_edge_";
3124 CheckShapeType(theEdge1, GEOM::EDGE);
3125 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3126 string prefix_theEdge2 = "Target_edge_";
3127 CheckShapeType(theEdge2, GEOM::EDGE);
3128 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3130 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3131 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3132 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3133 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3134 MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3136 AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
3137 } catch (SALOME_Exception& ex) {
3138 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3144 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityWithoutFaces(GEOM::GEOM_Object_ptr theEdge1,
3145 GEOM::GEOM_Object_ptr theEdge2,
3146 CORBA::Long edge_orientation)
3147 throw (SALOME::SALOME_Exception){
3150 string theFace1Entry = "";
3151 string theFace2Entry = "";
3153 string prefix_theEdge1 = "Source_edge_";
3154 CheckShapeType(theEdge1, GEOM::EDGE);
3155 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3156 string prefix_theEdge2 = "Target_edge_";
3157 CheckShapeType(theEdge2, GEOM::EDGE);
3158 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3160 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3161 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3162 MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3164 AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
3165 } catch (SALOME_Exception& ex) {
3166 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3172 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityEntry(const char* theFace1Entry, const char* theEdge1Entry, const char* theFace2Entry, const char* theEdge2Entry, const long edge_orientation)
3173 throw (SALOME::SALOME_Exception){
3177 MESSAGE("IDL : AddEdgePeriodicityEntry(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3178 this->GetImpl()->AddEdgePeriodicity(theFace1Entry, theEdge1Entry, theFace2Entry, theEdge2Entry, edge_orientation);
3179 SMESH::TPythonDump pd;
3181 pd << _this() << ".AddEdgePeriodicity(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")";
3183 pd << _this() << ".AddEdgePeriodicityWithoutFaces(" << theEdge1Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")";
3184 MESSAGE("IDL : AddEdgePeriodicityEntry END");
3187 void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theVertex1,
3188 GEOM::GEOM_Object_ptr theEdge2, GEOM::GEOM_Object_ptr theVertex2)
3189 throw (SALOME::SALOME_Exception){
3192 string prefix_theEdge1 = "Source_edge_";
3193 CheckShapeType(theEdge1, GEOM::EDGE);
3194 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3195 string prefix_theEdge2 = "Target_edge_";
3196 CheckShapeType(theEdge2, GEOM::EDGE);
3197 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3199 string prefix_theVertex1 = "Source_vertex_";
3200 CheckShapeType(theVertex1, GEOM::VERTEX);
3201 string theVertex1Entry = PublishIfNeeded(theVertex1, GEOM::VERTEX, prefix_theVertex1);
3202 string prefix_theVertex2 = "Target_vertex_";
3203 CheckShapeType(theVertex2, GEOM::VERTEX);
3204 string theVertex2Entry = PublishIfNeeded(theVertex2, GEOM::VERTEX, prefix_theVertex2);
3206 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3207 MESSAGE("IDL : theVertex1->GetName : " << theVertex1->GetName());
3208 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3209 MESSAGE("IDL : theVertex2->GetName : " << theVertex2->GetName());
3210 MESSAGE("IDL : AddVertexPeriodicity( "<< theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")");
3212 AddVertexPeriodicityEntry(theEdge1Entry.c_str(), theVertex1Entry.c_str(), theEdge2Entry.c_str(), theVertex2Entry.c_str());
3213 } catch (SALOME_Exception& ex) {
3214 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3220 void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicityEntry(const char* theEdge1Entry, const char* theVertex1Entry, const char* theEdge2Entry, const char* theVertex2Entry)
3221 throw (SALOME::SALOME_Exception){
3225 MESSAGE("IDL : AddVertexPeriodicityEntry(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")");
3226 this->GetImpl()->AddVertexPeriodicity(theEdge1Entry, theVertex1Entry, theEdge2Entry, theVertex2Entry);
3227 SMESH::TPythonDump pd;
3228 pd << _this() << ".AddVertexPeriodicity(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")";
3229 MESSAGE("IDL : AddVertexPeriodicityEntry END");
3233 //================================================================================
3235 * \brief Sets the file for export resulting mesh in GMF format
3236 * \param theFileName - full name of the file (.mesh, .meshb)
3238 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3240 //================================================================================
3241 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3242 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3244 MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
3245 bool valueChanged/*, modeChanged*/ = false;
3247 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3248 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3249 if (valueChanged)// or (!valueChanged && modeChanged))
3250 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3251 } catch (const std::exception& ex) {
3252 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3254 if (valueChanged)// or (!valueChanged && modeChanged))
3255 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3256 MESSAGE("IDL : SetGMFFile END ");
3259 //================================================================================
3261 * \brief Gets the file name for export resulting mesh in GMF format
3262 * \retval char* - The file name
3264 * Returns the GMF file name
3266 //================================================================================
3267 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3269 // MESSAGE("IDL : GetGMFFile()");
3270 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3273 // //================================================================================
3275 // * \brief Gets the file mode for export resulting mesh in GMF format
3276 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3278 // * Returns the GMF file mode
3280 // //================================================================================
3281 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3282 // ASSERT(myBaseImpl);
3283 // MESSAGE("IDL : GetGMFFileMode()");
3284 // return this->GetImpl()->GetGMFFileMode();
3287 //=============================================================================
3289 * BLSURFPlugin_Hypothesis_i::GetImpl
3291 * Get implementation
3293 //=============================================================================
3294 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3295 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
3296 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3299 //================================================================================
3301 * \brief Verify whether hypothesis supports given entity type
3302 * \param type - dimension (see SMESH::Dimension enumeration)
3303 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3305 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3307 //================================================================================
3308 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3309 return type == SMESH::DIM_2D;
3313 // Obsolete methods - To be removed in V7
3316 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3317 this->SetMinSize(theMinSize);
3319 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3320 return this->GetMinSize();
3322 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3323 this->SetMaxSize(theMaxSize);
3325 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3326 return this->GetMaxSize();
3328 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3329 this->SetMinSize(theMinSize);
3331 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3332 return this->GetMinSize();
3334 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3335 this->SetMaxSize(theMaxSize);
3337 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3338 return this->GetMaxSize();
3340 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3341 this->SetAngleMesh(theValue);
3343 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3344 return this->GetAngleMesh();
3346 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3347 this->SetAngleMesh(theValue);
3349 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3350 return this->GetAngleMesh();
3352 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3353 std::string theValueStr = theValue ? "1" : "0";
3354 this->SetOptionValue("respect_geometry",theValueStr.c_str());
3356 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3357 std::string theValueStr = this->GetOptionValue("respect_geometry");
3358 if (theValueStr.empty() || theValueStr == "respect")
3362 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3363 std::string theValueStr = theValue ? "1" : "0";
3364 this->SetPreCADOptionValue("remove_tiny_edges",theValueStr.c_str());
3366 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3367 std::string theValueStr = this->GetPreCADOptionValue("remove_tiny_edges");
3368 if (theValueStr == "1")
3372 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3373 std::ostringstream theValueStr;
3374 theValueStr << theValue;
3375 this->SetPreCADOptionValue("tiny_edge_length",theValueStr.str().c_str());
3377 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3378 std::istringstream theValueStr(this->GetPreCADOptionValue("tiny_edge_length"));
3380 theValueStr >> result;