1 // Copyright (C) 2007-2015 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>
40 //=============================================================================
42 * BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
46 //=============================================================================
47 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA, int theStudyId,
48 ::SMESH_Gen* theGenImpl) :
49 SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA) {
50 MESSAGE( "BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i" );
51 myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(), theStudyId, theGenImpl);
54 //=============================================================================
56 * BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
60 //=============================================================================
61 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i() {
62 MESSAGE( "BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i" );
65 //=============================================================================
67 //=============================================================================
69 * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
74 //=============================================================================
75 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue) {
76 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh");
78 this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
79 SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
82 //=============================================================================
84 * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
88 //=============================================================================
89 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() {
90 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh");
92 return this->GetImpl()->GetPhysicalMesh();
95 //=============================================================================
97 * BLSURFPlugin_Hypothesis_i::SetGeometricMesh
102 //=============================================================================
103 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue) {
104 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh");
106 this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
107 SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
110 //=============================================================================
112 * BLSURFPlugin_Hypothesis_i::GetGeometricMesh
116 //=============================================================================
117 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh() {
118 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh");
120 return this->GetImpl()->GetGeometricMesh();
123 //=============================================================================
125 * BLSURFPlugin_Hypothesis_i::SetPhySize
129 //=============================================================================
130 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue) {
131 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize");
133 this->GetImpl()->SetPhySize(theValue, false);
134 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
137 //=============================================================================
139 * BLSURFPlugin_Hypothesis_i::SetPhySizeRel
141 * Set Relative PhySize
143 //=============================================================================
144 void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue) {
145 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySizeRel");
147 this->GetImpl()->SetPhySize(theValue, true);
148 SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
151 //=============================================================================
153 * BLSURFPlugin_Hypothesis_i::GetPhySize
157 //=============================================================================
158 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize() {
159 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhySize");
161 return this->GetImpl()->GetPhySize();
164 //=============================================================================
166 * BLSURFPlugin_Hypothesis_i::IsPhySizeRel
168 * Returns True if PhySize is relative
170 //=============================================================================
171 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel() {
172 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsPhySizeRel");
174 return this->GetImpl()->IsPhySizeRel();
177 //=============================================================================
178 void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize) {
180 if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
181 this->GetImpl()->SetMinSize(theMinSize, false);
182 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
186 //=============================================================================
187 void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize) {
189 if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
190 this->GetImpl()->SetMinSize(theMinSize, true);
191 SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
195 //=============================================================================
196 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize() {
198 return this->GetImpl()->GetMinSize();
201 //=============================================================================
202 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel() {
203 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsMinSizeRel");
205 return this->GetImpl()->IsMinSizeRel();
208 //=============================================================================
209 void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize) {
211 if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
212 this->GetImpl()->SetMaxSize(theMaxSize, false);
213 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
217 //=============================================================================
218 void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize) {
220 if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
221 this->GetImpl()->SetMaxSize(theMaxSize, true);
222 SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
226 //=============================================================================
227 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize() {
229 return this->GetImpl()->GetMaxSize();
232 //=============================================================================
233 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel() {
234 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsMaxSizeRel");
236 return this->GetImpl()->IsMaxSizeRel();
239 //=============================================================================
241 * BLSURFPlugin_Hypothesis_i::SetGradation
245 //=============================================================================
246 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) {
247 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation");
249 this->GetImpl()->SetGradation(theValue);
250 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
253 //=============================================================================
255 * BLSURFPlugin_Hypothesis_i::GetGradation
259 //=============================================================================
260 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() {
261 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation");
263 return this->GetImpl()->GetGradation();
266 //=============================================================================
268 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
272 //=============================================================================
273 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) {
274 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed");
276 this->GetImpl()->SetQuadAllowed(theValue);
277 std::string theValueStr = theValue ? "True" : "False";
278 SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )";
281 //=============================================================================
283 * BLSURFPlugin_Hypothesis_i::GetQuadAllowed
287 //=============================================================================
288 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() {
289 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed");
291 return this->GetImpl()->GetQuadAllowed();
294 //=============================================================================
296 * BLSURFPlugin_Hypothesis_i::SetAngleMesh
300 //=============================================================================
301 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue) {
302 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMesh");
304 this->GetImpl()->SetAngleMesh(theValue);
305 SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
308 //=============================================================================
310 * BLSURFPlugin_Hypothesis_i::GetAngleMesh
314 //=============================================================================
315 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh() {
316 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMesh");
318 return this->GetImpl()->GetAngleMesh();
321 //=============================================================================
323 * BLSURFPlugin_Hypothesis_i::SetChordalError
327 //=============================================================================
328 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue) {
329 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetChordalError");
331 this->GetImpl()->SetChordalError(theValue);
332 SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
335 //=============================================================================
337 * BLSURFPlugin_Hypothesis_i::GetChordalError
341 //=============================================================================
342 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError() {
343 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetChordalError");
345 return this->GetImpl()->GetChordalError();
348 //=============================================================================
350 * BLSURFPlugin_Hypothesis_i::SetAnisotropic
354 //=============================================================================
355 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue) {
356 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropic");
358 this->GetImpl()->SetAnisotropic(theValue);
359 std::string theValueStr = theValue ? "True" : "False";
360 SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
363 //=============================================================================
365 * BLSURFPlugin_Hypothesis_i::GetAnisotropic
369 //=============================================================================
370 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic() {
371 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropic");
373 return this->GetImpl()->GetAnisotropic();
376 //=============================================================================
378 * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
380 * Set Anisotropic Ratio
382 //=============================================================================
383 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue) {
384 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio");
386 this->GetImpl()->SetAnisotropicRatio(theValue);
387 SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
390 //=============================================================================
392 * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
394 * Get Anisotropic Ratio
396 //=============================================================================
397 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio() {
398 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio");
400 return this->GetImpl()->GetAnisotropicRatio();
404 //=============================================================================
406 * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
410 //=============================================================================
411 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
412 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges");
414 this->GetImpl()->SetRemoveTinyEdges(theValue);
415 std::string theValueStr = theValue ? "True" : "False";
416 SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
419 //=============================================================================
421 * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
425 //=============================================================================
426 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
427 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges");
429 return this->GetImpl()->GetRemoveTinyEdges();
432 //=============================================================================
434 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
436 * Set Tiny Edge Length
438 //=============================================================================
439 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
440 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength");
442 this->GetImpl()->SetTinyEdgeLength(theValue);
443 SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
446 //=============================================================================
448 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
450 * Get Tiny Edge Length
452 //=============================================================================
453 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
454 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength");
456 return this->GetImpl()->GetTinyEdgeLength();
459 //=============================================================================
461 * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
465 //=============================================================================
466 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
467 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementRemoval");
469 this->GetImpl()->SetBadElementRemoval(theValue);
470 std::string theValueStr = theValue ? "True" : "False";
471 SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
474 //=============================================================================
476 * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
480 //=============================================================================
481 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
482 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementRemoval");
484 return this->GetImpl()->GetBadElementRemoval();
487 //=============================================================================
489 * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
491 * Set Bad Surface Element Aspect Ratio
493 //=============================================================================
494 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
495 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio");
497 this->GetImpl()->SetBadElementAspectRatio(theValue);
498 SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
501 //=============================================================================
503 * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
505 * Get Bad Surface Element Aspect Ratio
507 //=============================================================================
508 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
509 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio");
511 return this->GetImpl()->GetBadElementAspectRatio();
514 //=============================================================================
516 * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
520 //=============================================================================
521 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
522 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimizeMesh");
524 this->GetImpl()->SetOptimizeMesh(theValue);
525 std::string theValueStr = theValue ? "True" : "False";
526 SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
529 //=============================================================================
531 * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
535 //=============================================================================
536 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
537 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimizeMesh");
539 return this->GetImpl()->GetOptimizeMesh();
542 //=============================================================================
544 * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
548 //=============================================================================
549 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
550 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadraticMesh");
552 this->GetImpl()->SetQuadraticMesh(theValue);
553 std::string theValueStr = theValue ? "True" : "False";
554 SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
557 //=============================================================================
559 * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
563 //=============================================================================
564 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
565 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadraticMesh");
567 return this->GetImpl()->GetQuadraticMesh();
575 * BLSURFPlugin_Hypothesis_i::SetTopology
580 //=============================================================================
581 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
582 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology");
584 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
585 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
588 //=============================================================================
590 * BLSURFPlugin_Hypothesis_i::GetTopology
594 //=============================================================================
595 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
596 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology");
598 return this->GetImpl()->GetTopology();
601 //=============================================================================
602 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
604 if (theVal < 0 || theVal > 100)
605 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
606 this->GetImpl()->SetVerbosity(theVal);
607 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
610 //=============================================================================
612 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
614 return (CORBA::Short) this->GetImpl()->GetVerbosity();
617 //=============================================================================
619 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
623 //=============================================================================
624 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
625 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges");
627 this->GetImpl()->SetPreCADMergeEdges(theValue);
628 std::string theValueStr = theValue ? "True" : "False";
629 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
632 //=============================================================================
634 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
638 //=============================================================================
639 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
640 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges");
642 return this->GetImpl()->GetPreCADMergeEdges();
645 //=============================================================================
647 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
651 //=============================================================================
652 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
653 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology");
655 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
656 std::string theValueStr = theValue ? "True" : "False";
657 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
660 //=============================================================================
662 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
666 //=============================================================================
667 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
668 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology");
670 return this->GetImpl()->GetPreCADProcess3DTopology();
673 //=============================================================================
675 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
679 //=============================================================================
680 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
681 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput");
683 this->GetImpl()->SetPreCADDiscardInput(theValue);
684 std::string theValueStr = theValue ? "True" : "False";
685 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
688 //=============================================================================
690 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
694 //=============================================================================
695 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
696 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput");
698 return this->GetImpl()->GetPreCADDiscardInput();
702 //=============================================================================
704 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
705 throw (SALOME::SALOME_Exception) {
707 bool valueChanged = false;
709 valueChanged = (this->GetImpl()->GetOptionValue(optionName) != optionValue);
711 this->GetImpl()->SetOptionValue(optionName, optionValue);
712 } catch (const std::invalid_argument& ex) {
713 SALOME::ExceptionStruct ExDescription;
714 ExDescription.text = ex.what();
715 ExDescription.type = SALOME::BAD_PARAM;
716 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetOptionValue(name,value)";
717 ExDescription.lineNumber = 0;
718 throw SALOME::SALOME_Exception(ExDescription);
719 } catch (SALOME_Exception& ex) {
720 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
723 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
726 //=============================================================================
728 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
729 throw (SALOME::SALOME_Exception) {
731 bool valueChanged = false;
733 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
735 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
736 } catch (const std::invalid_argument& ex) {
737 SALOME::ExceptionStruct ExDescription;
738 ExDescription.text = ex.what();
739 ExDescription.type = SALOME::BAD_PARAM;
740 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetPreCADOptionValue(name,value)";
741 ExDescription.lineNumber = 0;
742 throw SALOME::SALOME_Exception(ExDescription);
743 } catch (SALOME_Exception& ex) {
744 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
747 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
750 //=============================================================================
752 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
755 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName).c_str());
756 } catch (const std::invalid_argument& ex) {
757 SALOME::ExceptionStruct ExDescription;
758 ExDescription.text = ex.what();
759 ExDescription.type = SALOME::BAD_PARAM;
760 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetOptionValue(name)";
761 ExDescription.lineNumber = 0;
762 throw SALOME::SALOME_Exception(ExDescription);
763 } catch (SALOME_Exception& ex) {
764 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
769 //=============================================================================
771 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
774 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName).c_str());
775 } catch (const std::invalid_argument& ex) {
776 SALOME::ExceptionStruct ExDescription;
777 ExDescription.text = ex.what();
778 ExDescription.type = SALOME::BAD_PARAM;
779 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetPreCADOptionValue(name)";
780 ExDescription.lineNumber = 0;
781 throw SALOME::SALOME_Exception(ExDescription);
782 } catch (SALOME_Exception& ex) {
783 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
788 //=============================================================================
790 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
792 this->GetImpl()->ClearOption(optionName);
793 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
796 //=============================================================================
798 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
800 this->GetImpl()->ClearPreCADOption(optionName);
801 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
804 //=============================================================================
806 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
808 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
810 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
811 result->length(opts.size());
813 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
814 for (int i = 0; opIt != opts.end(); ++opIt, ++i) {
815 string name_value = opIt->first;
816 if (!opIt->second.empty()) {
818 name_value += opIt->second;
820 result[i] = CORBA::string_dup(name_value.c_str());
822 return result._retn();
825 //=============================================================================
827 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
829 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
831 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
832 result->length(opts.size());
834 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
835 for (int i = 0; opIt != opts.end(); ++opIt, ++i) {
836 string name_value = opIt->first;
837 if (!opIt->second.empty()) {
839 name_value += opIt->second;
841 result[i] = CORBA::string_dup(name_value.c_str());
843 return result._retn();
846 //=============================================================================
848 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
849 throw (SALOME::SALOME_Exception) {
851 for (int i = 0; i < options.length(); ++i) {
852 string name_value = options[i].in();
853 int colonPos = name_value.find(':');
855 if (colonPos == string::npos) // ':' not found
858 name = name_value.substr(0, colonPos);
859 if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ')
860 value = name_value.substr(colonPos + 1);
862 SetOptionValue(name.c_str(), value.c_str());
866 //=============================================================================
868 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
869 throw (SALOME::SALOME_Exception) {
871 for (int i = 0; i < options.length(); ++i) {
872 string name_value = options[i].in();
873 int colonPos = name_value.find(':');
875 if (colonPos == string::npos) // ':' not found
878 name = name_value.substr(0, colonPos);
879 if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ')
880 value = name_value.substr(colonPos + 1);
882 SetPreCADOptionValue(name.c_str(), value.c_str());
886 //=============================================================================
888 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
889 throw (SALOME::SALOME_Exception) {
891 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
892 if ( !entry || !entry[0] )
893 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
894 bool valueChanged = false;
896 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
898 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
899 } catch (const std::invalid_argument& ex) {
900 SALOME::ExceptionStruct ExDescription;
901 ExDescription.text = ex.what();
902 ExDescription.type = SALOME::BAD_PARAM;
903 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
904 ExDescription.lineNumber = 0;
905 throw SALOME::SALOME_Exception(ExDescription);
906 } catch (SALOME_Exception& ex) {
907 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
909 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
911 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
914 //=============================================================================
916 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
917 throw (SALOME::SALOME_Exception) {
919 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
920 bool valueChanged = false;
921 std::ostringstream sizeMapFunction;
923 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
924 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
925 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
928 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
930 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
931 } catch (const std::invalid_argument& ex) {
932 SALOME::ExceptionStruct ExDescription;
933 ExDescription.text = ex.what();
934 ExDescription.type = SALOME::BAD_PARAM;
935 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
936 ExDescription.lineNumber = 0;
937 throw SALOME::SALOME_Exception(ExDescription);
938 } catch (SALOME_Exception& ex) {
939 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
941 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
943 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
946 //=============================================================================
948 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
949 throw (SALOME::SALOME_Exception) {
951 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
952 bool valueChanged = false;
954 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
955 if ( valueChanged ) {
956 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
957 if (!boost::regex_match(string(attractor), re))
958 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
959 this->GetImpl()->SetAttractorEntry(entry, attractor);
961 } catch (const std::invalid_argument& ex) {
962 SALOME::ExceptionStruct ExDescription;
963 ExDescription.text = ex.what();
964 ExDescription.type = SALOME::BAD_PARAM;
965 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
966 ExDescription.lineNumber = 0;
967 throw SALOME::SALOME_Exception(ExDescription);
968 } catch (SALOME_Exception& ex) {
969 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
971 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
973 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
976 //=============================================================================
978 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
979 throw (SALOME::SALOME_Exception)
982 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
983 bool valueChanged = false;
985 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
987 catch (const std::invalid_argument& ex) {
988 SALOME::ExceptionStruct ExDescription;
989 ExDescription.text = ex.what();
990 ExDescription.type = SALOME::BAD_PARAM;
991 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
992 ExDescription.lineNumber = 0;
993 throw SALOME::SALOME_Exception(ExDescription);
994 } catch (SALOME_Exception& ex) {
995 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
997 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
998 //if ( valueChanged )
999 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1000 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1003 //=============================================================================
1005 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1008 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1009 } catch (const std::invalid_argument& ex) {
1010 SALOME::ExceptionStruct ExDescription;
1011 ExDescription.text = ex.what();
1012 ExDescription.type = SALOME::BAD_PARAM;
1013 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1014 ExDescription.lineNumber = 0;
1015 throw SALOME::SALOME_Exception(ExDescription);
1016 } catch (SALOME_Exception& ex) {
1017 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1022 //=============================================================================
1024 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1027 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1028 } catch (const std::invalid_argument& ex) {
1029 SALOME::ExceptionStruct ExDescription;
1030 ExDescription.text = ex.what();
1031 ExDescription.type = SALOME::BAD_PARAM;
1032 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1033 ExDescription.lineNumber = 0;
1034 throw SALOME::SALOME_Exception(ExDescription);
1035 } catch (SALOME_Exception& ex) {
1036 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1041 // //=============================================================================
1043 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1044 // // A finir pour le dump
1045 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1046 // throw (SALOME::SALOME_Exception)
1048 // ASSERT(myBaseImpl);
1050 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1052 // catch (const std::invalid_argument& ex) {
1053 // SALOME::ExceptionStruct ExDescription;
1054 // ExDescription.text = ex.what();
1055 // ExDescription.type = SALOME::BAD_PARAM;
1056 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1057 // ExDescription.lineNumber = 0;
1058 // throw SALOME::SALOME_Exception(ExDescription);
1060 // catch (SALOME_Exception& ex) {
1061 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1066 //=============================================================================
1068 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1070 this->GetImpl()->ClearEntry(entry);
1071 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1074 //=============================================================================
1076 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1078 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1080 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1081 result->length(sizeMaps.size());
1083 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1084 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1085 string entry_sizemap = smIt->first;
1086 if (!smIt->second.empty()) {
1087 entry_sizemap += "|";
1088 entry_sizemap += smIt->second;
1090 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1092 return result._retn();
1095 //=============================================================================
1097 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1099 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1101 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1102 result->length(attractors.size());
1104 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1105 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1106 string entry_attractor = atIt->first;
1107 if (!atIt->second.empty()) {
1108 entry_attractor += "|";
1109 entry_attractor += atIt->second;
1111 result[i] = CORBA::string_dup(entry_attractor.c_str());
1113 return result._retn();
1116 //=============================================================================
1118 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1121 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1123 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1124 result->length( attractors.size() );
1126 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1127 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1128 string faceEntry = atIt->first;
1130 double startSize, endSize, infDist, constDist;
1131 if ( !atIt->second->Empty() ) {
1132 attEntry = atIt->second->GetAttractorEntry();
1133 MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
1134 std::vector<double> params = atIt->second->GetParameters();
1135 startSize = params[0];
1136 endSize = params[1];
1137 infDist = params[2];
1138 constDist = params[3];
1140 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1141 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1142 result[i].startSize = startSize;
1143 result[i].endSize = endSize;
1144 result[i].infDist = infDist;
1145 result[i].constDist = constDist;
1146 MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
1147 MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
1149 return result._retn();
1152 //=============================================================================
1154 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1155 throw (SALOME::SALOME_Exception) {
1157 for (int i = 0; i < sizeMaps.length(); ++i) {
1158 string entry_sizemap = sizeMaps[i].in();
1159 int colonPos = entry_sizemap.find('|');
1160 string entry, sizemap;
1161 if (colonPos == string::npos) // '|' separator not found
1162 entry = entry_sizemap;
1164 entry = entry_sizemap.substr(0, colonPos);
1165 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1166 sizemap = entry_sizemap.substr(colonPos + 1);
1168 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1172 //=============================================================================
1174 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1176 this->GetImpl()->ClearSizeMaps();
1179 //=============================================================================
1181 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1182 throw (SALOME::SALOME_Exception)
1186 entry = GeomObj->GetStudyEntry();
1187 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1188 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1189 SetSizeMapEntry(entry.c_str(), sizeMap);
1192 //=============================================================================
1194 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1196 string entry = GeomObj->GetStudyEntry();
1197 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1198 if (shapeType == GEOM::COMPOUND)
1199 shapeType = GeomObj->GetMaxShapeType();
1200 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1201 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1202 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1205 //=============================================================================
1206 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1209 entry = GeomObj->GetStudyEntry();
1210 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1211 MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
1212 UnsetEntry(entry.c_str());
1213 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
1216 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
1219 entry = GeomObj->GetStudyEntry();
1220 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1221 MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
1222 SetAttractorEntry(entry.c_str(), attractor);
1225 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
1228 entry = GeomObj->GetStudyEntry();
1229 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1230 MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
1231 UnsetEntry(entry.c_str());
1232 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
1235 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)
1238 string theFaceEntry;
1240 theFaceEntry = theFace->GetStudyEntry();
1241 theAttEntry = theAttractor->GetStudyEntry();
1243 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1244 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1247 if (theFaceEntry.empty()) {
1249 aName += theFace->GetEntry();
1250 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1251 if (!theSFace->_is_nil())
1252 theFaceEntry = theSFace->GetID();
1254 if (theFaceEntry.empty())
1255 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1257 if (theAttEntry.empty()) {
1258 if (theAttractor->GetShapeType() == GEOM::VERTEX)
1260 if (theAttractor->GetShapeType() == GEOM::EDGE)
1262 if (theAttractor->GetShapeType() == GEOM::WIRE)
1264 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
1265 aName = "Compound_";
1266 aName += theAttractor->GetEntry();
1267 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
1268 if (!theSAtt->_is_nil())
1269 theAttEntry = theSAtt->GetID();
1271 if (theAttEntry.empty())
1272 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1274 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
1275 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
1276 MESSAGE("IDL : GetName : " << theFace->GetName());
1277 MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
1278 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
1281 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
1282 GEOM::GEOM_Object_ptr theAttractor)
1285 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
1286 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
1288 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1289 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1292 // if (theFaceEntry.empty()) {
1294 // aName += theFace->GetEntry();
1295 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1296 // if (!theSFace->_is_nil())
1297 // theFaceEntry = theSFace->GetID();
1299 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
1300 !theAttrEntry.in() || !theAttrEntry.in()[0] )
1301 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1303 MESSAGE("IDL : GetName : " << theFace->GetName());
1304 MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
1305 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
1306 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
1307 << theFace << ", " << theAttractor << " )";
1310 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
1311 const char* attractorEntry)
1313 GetImpl()->ClearEntry( faceEntry, attractorEntry );
1314 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
1315 << faceEntry << "', '" << attractorEntry << "' )";
1320 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1323 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
1326 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
1329 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
1332 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
1335 this->GetImpl()->UnsetCustomSizeMap(entry);
1336 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
1340 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
1345 // ///////////////////////
1346 // // ENFORCED VERTICES //
1347 // ///////////////////////
1351 * Returns the list of enforced vertices for a given Face entry
1352 * @return A map of Face entry / List of enforced vertices
1355 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
1356 MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
1359 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
1361 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
1362 this->GetImpl()->_GetAllEnforcedVerticesByFace();
1363 resultMap->length(faceEntryEnfVertexListMap.size());
1364 MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
1366 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
1367 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
1368 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
1369 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
1370 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
1371 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1372 MESSAGE("Face Entry: " << mapElement->faceEntry);
1374 _enfVertexList = it_entry->second;
1375 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
1376 enfVertexList->length(_enfVertexList.size());
1377 MESSAGE("Number of enf vertex: " << enfVertexList->length());
1379 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
1380 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1381 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
1382 currentEnfVertex = (*it_enfVertex);
1384 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1387 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1390 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1393 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1394 coords->length(currentEnfVertex->coords.size());
1395 for (int i=0;i<coords->length();i++)
1396 coords[i] = currentEnfVertex->coords[i];
1397 enfVertex->coords = coords;
1400 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1403 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1404 faceEntryList->length(currentEnfVertex->faceEntries.size());
1405 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1406 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1407 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1408 enfVertex->faceEntries = faceEntryList;
1411 msg << "Enforced vertex: \n"
1412 << "Name: " << enfVertex->name << "\n";
1413 if (coords->length())
1414 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1415 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1416 << "Group Name: " << enfVertex->grpName;
1419 enfVertexList[j] = enfVertex;
1421 mapElement->enfVertexList = enfVertexList;
1423 resultMap[i] = mapElement;
1426 return resultMap._retn();
1430 * Returns the list of all enforced vertices
1431 * @return a list of enforced vertices
1434 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
1435 MESSAGE("IDL: GetAllEnforcedVertices()");
1437 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
1438 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
1439 resultMap->length(enfVertexList.size());
1440 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1442 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
1443 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1444 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
1445 MESSAGE("Enforced Vertex #" << i);
1446 currentEnfVertex = (*evlIt);
1447 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1449 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1451 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1453 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1454 coords->length(currentEnfVertex->coords.size());
1455 for (int ind = 0; ind < coords->length(); ind++)
1456 coords[ind] = currentEnfVertex->coords[ind];
1457 enfVertex->coords = coords;
1459 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1461 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1462 faceEntryList->length(currentEnfVertex->faceEntries.size());
1463 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1464 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1465 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1466 enfVertex->faceEntries = faceEntryList;
1469 msg << "Enforced vertex: \n"
1470 << "Name: " << enfVertex->name << "\n";
1471 if (coords->length())
1472 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1473 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1474 << "Group Name: " << enfVertex->grpName;
1477 resultMap[i] = enfVertex;
1479 return resultMap._retn();
1484 * Returns the list of enforced vertices coords for a given Face entry.
1485 * They are the coords of the "manual" enforced vertices.
1486 * @return A map of Face entry / List of enforced vertices coords
1489 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
1490 MESSAGE("IDL: GetAllCoordsByFace()");
1493 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
1495 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
1496 resultMap->length(entryCoordsListMap.size());
1497 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1499 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
1500 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
1501 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
1502 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
1503 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1504 MESSAGE("Face Entry: " << mapElement->faceEntry);
1506 _coordsList = it_entry->second;
1507 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
1508 coordsList->length(_coordsList.size());
1509 MESSAGE("Number of coords: " << coordsList->length());
1511 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
1512 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
1513 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1514 coords->length((*it_coords).size());
1515 for (int i=0;i<coords->length();i++)
1516 coords[i] = (*it_coords)[i];
1517 coordsList[j] = coords;
1518 MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
1520 mapElement->coordsList = coordsList;
1522 resultMap[i] = mapElement;
1525 return resultMap._retn();
1529 * Returns a map of enforced vertices coords / enforced vertex.
1530 * They are the coords of the "manual" enforced vertices.
1532 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
1533 MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
1536 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
1537 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
1538 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
1539 resultMap->length(coordsEnfVertexMap.size());
1540 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1542 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
1543 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1544 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
1545 MESSAGE("Enforced Vertex #" << i);
1546 currentEnfVertex = (it_coords->second);
1547 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
1548 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1549 coords->length(it_coords->first.size());
1550 for (int ind=0;ind<coords->length();ind++)
1551 coords[ind] = it_coords->first[ind];
1552 mapElement->coords = coords;
1553 MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
1555 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1557 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1559 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1561 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
1562 coords2->length(currentEnfVertex->coords.size());
1563 for (int ind=0;ind<coords2->length();ind++)
1564 coords2[ind] = currentEnfVertex->coords[ind];
1565 enfVertex->coords = coords2;
1567 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1569 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1570 faceEntryList->length(currentEnfVertex->faceEntries.size());
1571 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1572 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1573 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1574 enfVertex->faceEntries = faceEntryList;
1576 mapElement->enfVertex = enfVertex;
1578 msg << "Enforced vertex: \n"
1579 << "Name: " << enfVertex->name << "\n";
1580 if (coords->length())
1581 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1582 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1583 << "Group Name: " << enfVertex->grpName;
1586 resultMap[i] = mapElement;
1588 return resultMap._retn();
1592 * Returns the list of enforced vertices entries for a given Face entry.
1593 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
1594 * @return A map of Face entry / List of enforced vertices geom entries
1597 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
1598 MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
1601 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
1603 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
1604 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
1605 resultMap->length(entryEnfVertexEntryListMap.size());
1606 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1608 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
1609 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
1610 entryEnfVertexEntryListMap.begin();
1611 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
1612 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
1613 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
1614 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1615 MESSAGE("Face Entry: " << mapElement->faceEntry);
1617 _enfVertexEntryList = it_entry->second;
1618 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
1619 enfVertexEntryList->length(_enfVertexEntryList.size());
1620 MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
1622 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
1623 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
1624 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
1625 MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
1627 mapElement->enfVertexEntryList = enfVertexEntryList;
1629 resultMap[i] = mapElement;
1632 return resultMap._retn();
1636 * Returns a map of enforced vertices geom entry / enforced vertex.
1637 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
1639 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
1640 MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
1643 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
1644 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
1645 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
1646 resultMap->length(enfVertexEntryEnfVertexMap.size());
1647 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1649 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
1650 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1651 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
1652 MESSAGE("Enforced Vertex #" << i);
1653 currentEnfVertex = it_enfVertexEntry->second;
1654 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
1655 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
1656 MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
1658 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1660 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1662 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1664 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1665 coords->length(currentEnfVertex->coords.size());
1666 for (int ind=0;ind<coords->length();ind++)
1667 coords[ind] = currentEnfVertex->coords[ind];
1668 enfVertex->coords = coords;
1670 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1672 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1673 faceEntryList->length(currentEnfVertex->faceEntries.size());
1674 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1675 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1676 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1677 enfVertex->faceEntries = faceEntryList;
1680 msg << "Enforced vertex: \n"
1681 << "Name: " << enfVertex->name << "\n";
1682 if (coords->length())
1683 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1684 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1685 << "Group Name: " << enfVertex->grpName;
1688 mapElement->enfVertex = enfVertex;
1689 resultMap[i] = mapElement;
1691 return resultMap._retn();
1695 * Erase all enforced vertices
1697 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
1699 this->GetImpl()->ClearAllEnforcedVertices();
1700 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
1704 * Set/get/unset an enforced vertex on face
1706 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1707 CORBA::Double z) throw (SALOME::SALOME_Exception) {
1710 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1711 MESSAGE("theFace shape type is not FACE or COMPOUND");
1712 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1715 string theFaceEntry = theFace->GetStudyEntry();
1717 if (theFaceEntry.empty()) {
1718 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1719 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1721 if (theFace->GetShapeType() == GEOM::FACE)
1723 if (theFace->GetShapeType() == GEOM::COMPOUND)
1724 aName = "Compound_";
1725 aName += theFace->GetEntry();
1726 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1727 if (!theSFace->_is_nil())
1728 theFaceEntry = theSFace->GetID();
1730 if (theFaceEntry.empty())
1731 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1732 MESSAGE("IDL : GetName : " << theFace->GetName());
1733 MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
1735 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
1736 } catch (SALOME_Exception& ex) {
1737 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1742 * Set/get/unset an enforced vertex with name on face
1744 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1745 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
1748 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1749 MESSAGE("theFace shape type is not FACE or COMPOUND");
1750 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1753 string theFaceEntry = theFace->GetStudyEntry();
1755 if (theFaceEntry.empty()) {
1756 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1757 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1759 if (theFace->GetShapeType() == GEOM::FACE)
1761 if (theFace->GetShapeType() == GEOM::COMPOUND)
1762 aName = "Compound_";
1763 aName += theFace->GetEntry();
1764 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1765 if (!theSFace->_is_nil())
1766 theFaceEntry = theSFace->GetID();
1768 if (theFaceEntry.empty())
1769 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1771 MESSAGE("IDL : GetName : " << theFace->GetName());
1772 MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
1774 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
1775 } catch (SALOME_Exception& ex) {
1776 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1781 * Set/get/unset an enforced vertex with geom object on face
1783 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
1784 throw (SALOME::SALOME_Exception) {
1787 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1788 MESSAGE("theFace shape type is not FACE or COMPOUND");
1789 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1792 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1793 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1794 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1797 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1798 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
1799 // if (CORBA::is_nil(measureOp))
1802 // CORBA::Double x, y, z;
1804 // measureOp->PointCoordinates(theVertex, x, y, z);
1806 string theFaceEntry = theFace->GetStudyEntry();
1807 string theVertexEntry = theVertex->GetStudyEntry();
1809 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1810 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1813 if (theFaceEntry.empty()) {
1814 if (theFace->GetShapeType() == GEOM::FACE)
1816 if (theFace->GetShapeType() == GEOM::COMPOUND)
1817 aName = "Compound_";
1818 aName += theFace->GetEntry();
1819 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1820 if (!theSFace->_is_nil())
1821 theFaceEntry = theSFace->GetID();
1823 if (theFaceEntry.empty())
1824 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1826 if (theVertexEntry.empty()) {
1827 if (theVertex->GetShapeType() == GEOM::VERTEX)
1829 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1830 aName = "Compound_";
1831 aName += theVertex->GetEntry();
1832 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1833 if (!theSVertex->_is_nil())
1834 theVertexEntry = theSVertex->GetID();
1836 if (theVertexEntry.empty())
1837 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1839 string theVertexName = theVertex->GetName();
1840 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
1841 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
1842 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
1844 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
1845 } catch (SALOME_Exception& ex) {
1846 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1851 * Set an enforced vertex with group name on face
1853 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
1854 throw (SALOME::SALOME_Exception)
1858 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1859 MESSAGE("theFace shape type is not FACE or COMPOUND");
1860 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1863 string theFaceEntry = theFace->GetStudyEntry();
1865 if (theFaceEntry.empty()) {
1866 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1867 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1869 if (theFace->GetShapeType() == GEOM::FACE)
1871 if (theFace->GetShapeType() == GEOM::COMPOUND)
1872 aName = "Compound_";
1873 aName += theFace->GetEntry();
1874 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1875 if (!theSFace->_is_nil())
1876 theFaceEntry = theSFace->GetID();
1878 if (theFaceEntry.empty())
1879 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1880 MESSAGE("IDL : GetName : " << theFace->GetName());
1881 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
1883 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
1884 } catch (SALOME_Exception& ex) {
1885 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1890 * Set an enforced vertex with name and group name on face
1892 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
1893 const char* theVertexName, const char* theGroupName)
1894 throw (SALOME::SALOME_Exception)
1898 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1899 MESSAGE("theFace shape type is not FACE or COMPOUND");
1900 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1903 string theFaceEntry = theFace->GetStudyEntry();
1905 if (theFaceEntry.empty()) {
1906 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1907 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1909 if (theFace->GetShapeType() == GEOM::FACE)
1911 if (theFace->GetShapeType() == GEOM::COMPOUND)
1912 aName = "Compound_";
1913 aName += theFace->GetEntry();
1914 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1915 if (!theSFace->_is_nil())
1916 theFaceEntry = theSFace->GetID();
1918 if (theFaceEntry.empty())
1919 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1920 MESSAGE("IDL : GetName : " << theFace->GetName());
1921 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
1923 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
1924 } catch (SALOME_Exception& ex) {
1925 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1930 * Set an enforced vertex with geom entry and group name on face
1932 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
1933 throw (SALOME::SALOME_Exception)
1937 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1938 MESSAGE("theFace shape type is not FACE or COMPOUND");
1939 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1942 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1943 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1944 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1947 string theFaceEntry = theFace->GetStudyEntry();
1948 string theVertexEntry = theVertex->GetStudyEntry();
1950 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1951 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1954 if (theFaceEntry.empty()) {
1955 if (theFace->GetShapeType() == GEOM::FACE)
1957 if (theFace->GetShapeType() == GEOM::COMPOUND)
1958 aName = "Compound_";
1959 aName += theFace->GetEntry();
1960 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1961 if (!theSFace->_is_nil())
1962 theFaceEntry = theSFace->GetID();
1964 if (theFaceEntry.empty())
1965 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1967 if (theVertexEntry.empty()) {
1968 if (theVertex->GetShapeType() == GEOM::VERTEX)
1970 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1971 aName = "Compound_";
1972 aName += theVertex->GetEntry();
1973 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1974 if (!theSVertex->_is_nil())
1975 theVertexEntry = theSVertex->GetID();
1977 if (theVertexEntry.empty())
1978 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1980 string theVertexName = theVertex->GetName();
1981 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
1982 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
1983 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
1985 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
1986 } catch (SALOME_Exception& ex) {
1987 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1991 //Enable internal enforced vertices on specific face if requested by user
1993 // * Are internal enforced vertices used for a face ?
1995 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
1996 // throw (SALOME::SALOME_Exception) {
1997 // ASSERT(myBaseImpl);
1999 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2000 // MESSAGE("theFace shape type is not FACE or COMPOUND");
2001 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2004 // string theFaceEntry = theFace->GetStudyEntry();
2006 // if (theFaceEntry.empty()) {
2007 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2008 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2010 // if (theFace->GetShapeType() == GEOM::FACE)
2012 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2013 // aName = "Compound_";
2014 // aName += theFace->GetEntry();
2015 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2016 // if (!theSFace->_is_nil())
2017 // theFaceEntry = theSFace->GetID();
2019 // if (theFaceEntry.empty())
2020 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2022 // MESSAGE("IDL : GetName : " << theFace->GetName());
2023 // MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2025 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2026 // } catch (SALOME_Exception& ex) {
2027 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2032 * Get the list of all enforced vertices
2034 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2035 throw (SALOME::SALOME_Exception) {
2038 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2039 MESSAGE("theFace shape type is not FACE or COMPOUND");
2040 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2043 string theFaceEntry = theFace->GetStudyEntry();
2045 if (theFaceEntry.empty()) {
2046 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2047 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2049 if (theFace->GetShapeType() == GEOM::FACE)
2051 if (theFace->GetShapeType() == GEOM::COMPOUND)
2052 aName = "Compound_";
2053 aName += theFace->GetEntry();
2054 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2055 if (!theSFace->_is_nil())
2056 theFaceEntry = theSFace->GetID();
2058 if (theFaceEntry.empty())
2059 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2061 MESSAGE("IDL : GetName : " << theFace->GetName());
2062 MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
2064 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2065 } catch (SALOME_Exception& ex) {
2066 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2070 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2071 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2074 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2075 MESSAGE("theFace shape type is not FACE or COMPOUND");
2076 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2079 string theFaceEntry = theFace->GetStudyEntry();
2081 if (theFaceEntry.empty()) {
2082 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2083 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2085 if (theFace->GetShapeType() == GEOM::FACE)
2087 if (theFace->GetShapeType() == GEOM::COMPOUND)
2088 aName = "Compound_";
2089 aName += theFace->GetEntry();
2090 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2091 if (!theSFace->_is_nil())
2092 theFaceEntry = theSFace->GetID();
2094 if (theFaceEntry.empty())
2095 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2096 MESSAGE("IDL : GetName : " << theFace->GetName());
2097 MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2100 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2101 } catch (SALOME_Exception& ex) {
2102 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2106 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2107 throw (SALOME::SALOME_Exception) {
2110 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2111 MESSAGE("theFace shape type is not FACE or COMPOUND");
2112 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2114 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2115 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2116 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2119 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2120 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2121 // if (CORBA::is_nil(measureOp))
2124 // CORBA::Double x, y, z;
2126 // measureOp->PointCoordinates(theVertex, x, y, z);
2128 std::string theFaceEntry = theFace->GetStudyEntry();
2129 std::string theVertexEntry = theVertex->GetStudyEntry();
2131 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2132 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2135 if (theFaceEntry.empty()) {
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 if (theVertexEntry.empty()) {
2149 if (theVertex->GetShapeType() == GEOM::VERTEX)
2151 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2152 aName = "Compound_";
2153 aName += theVertex->GetEntry();
2154 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2155 if (!theSVertex->_is_nil())
2156 theVertexEntry = theSVertex->GetID();
2158 if (theVertexEntry.empty())
2159 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2161 MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
2164 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2165 } catch (SALOME_Exception& ex) {
2166 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2170 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2173 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2174 MESSAGE("theFace shape type is not FACE or COMPOUND");
2175 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2178 string theFaceEntry = theFace->GetStudyEntry();
2180 if (theFaceEntry.empty()) {
2181 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2182 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2184 if (theFace->GetShapeType() == GEOM::FACE)
2186 if (theFace->GetShapeType() == GEOM::COMPOUND)
2187 aName = "Compound_";
2188 aName += theFace->GetEntry();
2189 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2190 if (!theSFace->_is_nil())
2191 theFaceEntry = theSFace->GetID();
2193 if (theFaceEntry.empty())
2194 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2196 MESSAGE("IDL : GetName : " << theFace->GetName());
2197 MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
2200 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2201 } catch (SALOME_Exception& ex) {
2202 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2207 * Set/get/unset an enforced vertex on geom object given by entry
2209 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2210 CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
2211 throw (SALOME::SALOME_Exception) {
2213 MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
2214 bool newValue = false;
2215 if (string(theVertexEntry).empty()) {
2217 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
2218 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
2219 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
2220 coords.push_back(x);
2221 coords.push_back(y);
2222 coords.push_back(z);
2223 if (coordsList.find(coords) == coordsList.end()) {
2224 MESSAGE("Coords not found: add it in coordsList");
2227 MESSAGE("Coords already found, compare names");
2228 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
2229 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2230 MESSAGE("The names are different: update");
2231 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2235 MESSAGE("The names are identical");
2238 } catch (const std::invalid_argument& ex) {
2239 // no enforced vertex for entry
2240 MESSAGE("Face entry not found : add it to the list");
2244 if (string(theVertexName).empty())
2245 if (string(theGroupName).empty())
2246 SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
2248 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
2250 if (string(theGroupName).empty())
2251 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
2253 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
2254 << theVertexName << "\", \"" << theGroupName << "\")";
2257 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
2258 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
2259 if ( it == enfVertexEntryList.end()) {
2260 MESSAGE("Geom entry not found: add it in enfVertexEntryList");
2264 MESSAGE("Geom entry already found, compare names");
2265 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
2266 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2267 MESSAGE("The names are different: update");
2268 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2272 MESSAGE("The names are identical");
2275 } catch (const std::invalid_argument& ex) {
2276 // no enforced vertex for entry
2277 MESSAGE("Face entry not found : add it to the list");
2281 if (string(theGroupName).empty())
2282 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2284 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
2288 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
2290 MESSAGE("IDL : SetEnforcedVertexEntry END");
2294 //Enable internal enforced vertices on specific face if requested by user
2295 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry)
2296 // throw (SALOME::SALOME_Exception) {
2297 // ASSERT(myBaseImpl);
2299 // return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry);
2300 // } catch (const std::exception& ex) {
2301 // std::cout << "Exception: " << ex.what() << std::endl;
2302 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2306 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
2307 throw (SALOME::SALOME_Exception) {
2309 MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
2312 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
2313 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
2314 vertexList->length(_vList.size());
2315 MESSAGE("Number of enforced vertices: " << vertexList->length());
2316 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
2317 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
2318 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
2320 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2323 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
2324 // Geom Vertex Entry
2325 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
2327 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2328 coords->length(_enfVertex->coords.size());
2329 for (int ind=0;ind<coords->length();ind++)
2330 coords[ind] = _enfVertex->coords[ind];
2331 enfVertex->coords = coords;
2333 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
2335 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2336 faceEntryList->length(_enfVertex->faceEntries.size());
2337 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
2338 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
2339 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2340 enfVertex->faceEntries = faceEntryList;
2342 vertexList[i] = enfVertex;
2344 MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
2345 return vertexList._retn();
2346 } catch (const std::invalid_argument& ex) {
2347 SALOME::ExceptionStruct ExDescription;
2348 ExDescription.text = ex.what();
2349 ExDescription.type = SALOME::BAD_PARAM;
2350 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
2351 ExDescription.lineNumber = 1385;
2352 throw SALOME::SALOME_Exception(ExDescription);
2353 } catch (const std::exception& ex) {
2354 std::cout << "Exception: " << ex.what() << std::endl;
2355 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2359 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2360 CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
2362 MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
2366 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
2368 if (string(theVertexEntry).empty())
2369 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
2372 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2374 } catch (const std::invalid_argument& ex) {
2376 } catch (const std::exception& ex) {
2377 std::cout << "Exception: " << ex.what() << std::endl;
2378 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2381 MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
2385 //bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
2386 // CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
2387 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
2389 // bool ret = false;
2392 // ret = _unsetEnfVertex(theFaceEntry, x, y, z);
2393 // } catch (SALOME_Exception& ex) {
2394 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2398 // SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
2401 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
2405 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
2407 MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
2410 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
2411 SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
2412 } catch (const std::invalid_argument& ex) {
2414 } catch (const std::exception& ex) {
2415 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2418 MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
2422 //=============================================================================
2424 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
2428 //=============================================================================
2429 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
2430 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
2432 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
2433 std::string theValueStr = theValue ? "True" : "False";
2434 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
2437 //=============================================================================
2439 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
2443 //=============================================================================
2444 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
2445 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
2447 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
2450 //=============================================================================
2452 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
2456 //=============================================================================
2457 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName) {
2458 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
2460 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
2461 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
2464 //=============================================================================
2466 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
2470 //=============================================================================
2471 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
2472 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
2474 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
2478 * Enable internal enforced vertices on specific face if requested by user
2480 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
2481 throw (SALOME::SALOME_Exception)
2483 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
2485 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
2486 } catch (SALOME_Exception& ex) {
2487 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2491 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2492 throw (SALOME::SALOME_Exception)
2494 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
2496 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2497 MESSAGE("theFace shape type is not FACE or COMPOUND");
2498 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2501 string theFaceEntry = theFace->GetStudyEntry();
2503 if (theFaceEntry.empty()) {
2504 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2505 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2507 if (theFace->GetShapeType() == GEOM::FACE)
2509 if (theFace->GetShapeType() == GEOM::COMPOUND)
2510 aName = "Compound_";
2511 aName += theFace->GetEntry();
2512 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2513 if (!theSFace->_is_nil())
2514 theFaceEntry = theSFace->GetID();
2516 if (theFaceEntry.empty())
2517 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2519 MESSAGE("IDL : GetName : " << theFace->GetName());
2520 MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2522 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
2523 } catch (SALOME_Exception& ex) {
2524 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2528 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2529 throw (SALOME::SALOME_Exception)
2531 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
2534 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
2535 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
2536 if (string(theGroupName).empty())
2537 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
2539 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
2540 } catch (const std::exception& ex) {
2541 std::cout << "Exception: " << ex.what() << std::endl;
2542 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2549 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
2550 throw (SALOME::SALOME_Exception)
2553 MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
2555 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
2557 catch (const std::invalid_argument& ex) {
2558 SALOME::ExceptionStruct ExDescription;
2559 ExDescription.text = ex.what();
2560 ExDescription.type = SALOME::BAD_PARAM;
2561 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
2562 ExDescription.lineNumber = 1146;
2563 throw SALOME::SALOME_Exception(ExDescription);
2565 catch (SALOME_Exception& ex) {
2566 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2568 MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
2573 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
2574 throw (SALOME::SALOME_Exception)
2577 MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
2579 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
2581 catch (const std::invalid_argument& ex) {
2582 SALOME::ExceptionStruct ExDescription;
2583 ExDescription.text = ex.what();
2584 ExDescription.type = SALOME::BAD_PARAM;
2585 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
2586 ExDescription.lineNumber = 1170;
2587 throw SALOME::SALOME_Exception(ExDescription);
2589 catch (SALOME_Exception& ex) {
2590 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2593 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
2594 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
2596 MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
2599 ///////////////////////
2601 ///////////////////////
2603 ///////////////////////
2606 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
2608 //enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
2609 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
2610 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
2611 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
2612 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
2613 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
2614 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
2615 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
2616 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
2617 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
2618 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
2619 std::string txtShapeType = MapShapeTypeToString[theShapeType];
2620 return txtShapeType;
2623 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
2625 // Check shape types
2627 std::stringstream typesTxt;
2628 for (std::size_t i=0; i<theShapeTypes.size(); i++)
2630 GEOM::shape_type theShapeType = theShapeTypes[i];
2631 if (shape->GetShapeType() == theShapeType)
2633 typesTxt << ShapeTypeToString(theShapeType);
2634 if (i < theShapeTypes.size()-1 )
2638 std::stringstream msg;
2639 msg << "shape shape type is not in" << typesTxt;
2641 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2645 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
2648 if (shape->GetShapeType() != theShapeType) {
2649 std::stringstream msg;
2650 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
2652 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2656 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
2658 // Check shape is published in the object browser
2659 string shapeEntry = shape->GetStudyEntry();
2661 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2662 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2665 // Publish shape if needed
2666 if (shapeEntry.empty()) {
2667 if (shape->GetShapeType() == theShapeType)
2669 aName += shape->GetEntry();
2670 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
2671 if (!theSFace1->_is_nil())
2672 shapeEntry = theSFace1->GetID();
2674 if (shapeEntry.empty())
2675 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2679 // Format the output of two vectors to use it in MESSAGE and PythonDump
2680 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
2682 std::stringstream listEntriesTxt;
2684 if (!theSourceVerticesEntries.empty())
2686 listEntriesTxt << ", [" ;
2688 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
2691 listEntriesTxt << ", ";
2692 listEntriesTxt << *it;
2695 listEntriesTxt << "], [" ;
2697 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
2700 listEntriesTxt << ", ";
2701 listEntriesTxt << *it;
2703 listEntriesTxt << "]" ;
2705 return listEntriesTxt.str();
2709 * Erase all PreCad periodicity associations
2711 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
2713 this->GetImpl()->ClearPreCadPeriodicityVectors();
2714 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
2717 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
2719 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
2720 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2721 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
2723 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2725 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
2726 return periodicityList._retn();
2729 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
2731 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
2732 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2733 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
2735 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2737 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
2738 return periodicityList._retn();
2741 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
2742 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
2744 MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
2745 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
2747 periodicityList->length(preCadPeriodicityVector.size());
2749 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
2751 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
2753 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
2754 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
2755 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
2757 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
2758 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
2760 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
2761 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
2762 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
2765 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
2767 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
2768 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
2770 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
2771 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
2772 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
2775 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
2777 periodicityList[i] = myPreCadPeriodicity;
2781 return periodicityList._retn();
2785 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
2786 throw (SALOME::SALOME_Exception)
2789 const GEOM::ListOfGO theSourceVertices;
2790 const GEOM::ListOfGO theTargetVertices;
2791 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
2795 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
2796 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2797 throw (SALOME::SALOME_Exception)
2800 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
2802 size_t theLength = theSourceVertices.length();
2803 if (theLength != theTargetVertices.length())
2804 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2806 std::vector<GEOM::shape_type> allowedShapeTypes;
2807 allowedShapeTypes.push_back(GEOM::FACE);
2808 allowedShapeTypes.push_back(GEOM::COMPOUND);
2810 string prefix1 = "Source_face_";
2811 CheckShapeTypes(theFace1, allowedShapeTypes);
2812 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
2814 string prefix2 = "Target_face_";
2815 CheckShapeTypes(theFace2, allowedShapeTypes);
2816 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
2818 string prefix3 = "Source_vertex_";
2819 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
2820 theSourceVerticesEntries->length(theLength);
2821 GEOM::GEOM_Object_ptr theVtx_i;
2823 for (size_t ind = 0; ind < theLength; ind++) {
2824 theVtx_i = theSourceVertices[ind];
2825 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
2826 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2829 string prefix4 = "Target_vertex_";
2830 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
2831 theTargetVerticesEntries->length(theLength);
2832 for (size_t ind = 0; ind < theLength; ind++) {
2833 theVtx_i = theTargetVertices[ind];
2834 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
2835 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2838 string theFace2Name = theFace2->GetName();
2839 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
2840 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
2841 MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
2843 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
2844 theSourceVerticesEntries, theTargetVerticesEntries);
2845 } catch (SALOME_Exception& ex) {
2846 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2851 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
2852 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
2853 throw (SALOME::SALOME_Exception)
2858 // Convert BLSURFPlugin::TEntryList to vector<string>
2859 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
2860 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
2861 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
2862 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
2865 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
2867 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
2869 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
2870 theSourceVerticesEntries, theTargetVerticesEntries);
2872 SMESH::TPythonDump pd;
2873 if (!theSourceVerticesEntries.empty())
2875 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
2876 pd << listEntriesTxt.c_str();
2880 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
2881 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
2884 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
2885 throw (SALOME::SALOME_Exception)
2888 const GEOM::ListOfGO theSourceVertices;
2889 const GEOM::ListOfGO theTargetVertices;
2890 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
2893 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
2894 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2895 throw (SALOME::SALOME_Exception)
2897 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
2900 size_t theLength = theSourceVertices.length();
2901 if (theLength != theTargetVertices.length())
2902 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2904 std::vector<GEOM::shape_type> allowedShapeTypes;
2905 allowedShapeTypes.push_back(GEOM::EDGE);
2906 allowedShapeTypes.push_back(GEOM::COMPOUND);
2908 string prefix1 = "Source_edge_";
2909 CheckShapeTypes(theEdge1, allowedShapeTypes);
2910 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
2912 string prefix2 = "Target_edge_";
2913 CheckShapeTypes(theEdge2, allowedShapeTypes);
2914 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
2916 string prefix3 = "Source_vertex_";
2917 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
2918 theSourceVerticesEntries->length(theLength);
2919 GEOM::GEOM_Object_ptr theVtx_i;
2921 for (size_t ind = 0; ind < theLength; ind++) {
2922 theVtx_i = theSourceVertices[ind];
2923 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
2924 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2927 string prefix4 = "Target_vertex_";
2928 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
2929 theTargetVerticesEntries->length(theLength);
2930 for (size_t ind = 0; ind < theLength; ind++) {
2931 theVtx_i = theTargetVertices[ind];
2932 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
2933 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2936 string theEdge2Name = theEdge2->GetName();
2937 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
2938 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
2939 MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
2941 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
2942 theSourceVerticesEntries, theTargetVerticesEntries);
2943 } catch (SALOME_Exception& ex) {
2944 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2949 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
2950 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
2951 throw (SALOME::SALOME_Exception)
2956 // Convert BLSURFPlugin::TEntryList to vector<string>
2957 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
2958 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
2959 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
2960 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
2963 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
2965 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
2966 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
2967 theSourceVerticesEntries, theTargetVerticesEntries);
2969 SMESH::TPythonDump pd;
2970 if (!theSourceVerticesEntries.empty())
2972 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
2973 pd << listEntriesTxt.c_str();
2977 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
2979 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
2982 void BLSURFPlugin_Hypothesis_i::AddFacePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
2983 throw (SALOME::SALOME_Exception)
2987 string prefix1 = "Source_face_";
2988 CheckShapeType(theFace1, GEOM::FACE);
2989 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
2990 string prefix2 = "Target_face_";
2991 CheckShapeType(theFace2, GEOM::FACE);
2992 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
2994 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
2995 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
2996 MESSAGE("IDL : AddFacePeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
2998 AddFacePeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str());
2999 } catch (SALOME_Exception& ex) {
3000 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3006 void BLSURFPlugin_Hypothesis_i::AddFacePeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry)
3007 throw (SALOME::SALOME_Exception){
3011 MESSAGE("IDL : AddFacePeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << ")");
3012 this->GetImpl()->AddFacePeriodicity(theFace1Entry, theFace2Entry);
3013 SMESH::TPythonDump pd;
3014 pd << _this() << ".AddFacePeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3015 MESSAGE("IDL : AddFacePeriodicityEntry END");
3019 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theEdge1,
3020 GEOM::GEOM_Object_ptr theFace2, GEOM::GEOM_Object_ptr theEdge2,
3021 CORBA::Long edge_orientation)
3022 throw (SALOME::SALOME_Exception){
3025 string prefix_theFace1 = "Source_face_";
3026 CheckShapeType(theFace1, GEOM::FACE);
3027 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix_theFace1);
3028 string prefix_theFace2 = "Target_face_";
3029 CheckShapeType(theFace2, GEOM::FACE);
3030 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix_theFace2);
3032 string prefix_theEdge1 = "Source_edge_";
3033 CheckShapeType(theEdge1, GEOM::EDGE);
3034 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3035 string prefix_theEdge2 = "Target_edge_";
3036 CheckShapeType(theEdge2, GEOM::EDGE);
3037 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3039 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3040 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3041 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3042 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3043 MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3045 AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
3046 } catch (SALOME_Exception& ex) {
3047 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3053 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityWithoutFaces(GEOM::GEOM_Object_ptr theEdge1,
3054 GEOM::GEOM_Object_ptr theEdge2,
3055 CORBA::Long edge_orientation)
3056 throw (SALOME::SALOME_Exception){
3059 string theFace1Entry = "";
3060 string theFace2Entry = "";
3062 string prefix_theEdge1 = "Source_edge_";
3063 CheckShapeType(theEdge1, GEOM::EDGE);
3064 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3065 string prefix_theEdge2 = "Target_edge_";
3066 CheckShapeType(theEdge2, GEOM::EDGE);
3067 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3069 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3070 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3071 MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3073 AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
3074 } catch (SALOME_Exception& ex) {
3075 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3081 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityEntry(const char* theFace1Entry, const char* theEdge1Entry, const char* theFace2Entry, const char* theEdge2Entry, const long edge_orientation)
3082 throw (SALOME::SALOME_Exception){
3086 MESSAGE("IDL : AddEdgePeriodicityEntry(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3087 this->GetImpl()->AddEdgePeriodicity(theFace1Entry, theEdge1Entry, theFace2Entry, theEdge2Entry, edge_orientation);
3088 SMESH::TPythonDump pd;
3090 pd << _this() << ".AddEdgePeriodicity(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")";
3092 pd << _this() << ".AddEdgePeriodicityWithoutFaces(" << theEdge1Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")";
3093 MESSAGE("IDL : AddEdgePeriodicityEntry END");
3096 void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theVertex1,
3097 GEOM::GEOM_Object_ptr theEdge2, GEOM::GEOM_Object_ptr theVertex2)
3098 throw (SALOME::SALOME_Exception){
3101 string prefix_theEdge1 = "Source_edge_";
3102 CheckShapeType(theEdge1, GEOM::EDGE);
3103 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3104 string prefix_theEdge2 = "Target_edge_";
3105 CheckShapeType(theEdge2, GEOM::EDGE);
3106 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3108 string prefix_theVertex1 = "Source_vertex_";
3109 CheckShapeType(theVertex1, GEOM::VERTEX);
3110 string theVertex1Entry = PublishIfNeeded(theVertex1, GEOM::VERTEX, prefix_theVertex1);
3111 string prefix_theVertex2 = "Target_vertex_";
3112 CheckShapeType(theVertex2, GEOM::VERTEX);
3113 string theVertex2Entry = PublishIfNeeded(theVertex2, GEOM::VERTEX, prefix_theVertex2);
3115 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3116 MESSAGE("IDL : theVertex1->GetName : " << theVertex1->GetName());
3117 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3118 MESSAGE("IDL : theVertex2->GetName : " << theVertex2->GetName());
3119 MESSAGE("IDL : AddVertexPeriodicity( "<< theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")");
3121 AddVertexPeriodicityEntry(theEdge1Entry.c_str(), theVertex1Entry.c_str(), theEdge2Entry.c_str(), theVertex2Entry.c_str());
3122 } catch (SALOME_Exception& ex) {
3123 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3129 void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicityEntry(const char* theEdge1Entry, const char* theVertex1Entry, const char* theEdge2Entry, const char* theVertex2Entry)
3130 throw (SALOME::SALOME_Exception){
3134 MESSAGE("IDL : AddVertexPeriodicityEntry(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")");
3135 this->GetImpl()->AddVertexPeriodicity(theEdge1Entry, theVertex1Entry, theEdge2Entry, theVertex2Entry);
3136 SMESH::TPythonDump pd;
3137 pd << _this() << ".AddVertexPeriodicity(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")";
3138 MESSAGE("IDL : AddVertexPeriodicityEntry END");
3142 //================================================================================
3144 * \brief Sets the file for export resulting mesh in GMF format
3145 * \param theFileName - full name of the file (.mesh, .meshb)
3147 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3149 //================================================================================
3150 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3151 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3153 MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
3154 bool valueChanged/*, modeChanged*/ = false;
3156 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3157 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3158 if (valueChanged)// or (!valueChanged && modeChanged))
3159 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3160 } catch (const std::exception& ex) {
3161 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3163 if (valueChanged)// or (!valueChanged && modeChanged))
3164 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3165 MESSAGE("IDL : SetGMFFile END ");
3168 //================================================================================
3170 * \brief Gets the file name for export resulting mesh in GMF format
3171 * \retval char* - The file name
3173 * Returns the GMF file name
3175 //================================================================================
3176 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3178 // MESSAGE("IDL : GetGMFFile()");
3179 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3182 // //================================================================================
3184 // * \brief Gets the file mode for export resulting mesh in GMF format
3185 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3187 // * Returns the GMF file mode
3189 // //================================================================================
3190 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3191 // ASSERT(myBaseImpl);
3192 // MESSAGE("IDL : GetGMFFileMode()");
3193 // return this->GetImpl()->GetGMFFileMode();
3196 //=============================================================================
3198 * BLSURFPlugin_Hypothesis_i::GetImpl
3200 * Get implementation
3202 //=============================================================================
3203 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3204 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
3205 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3208 //================================================================================
3210 * \brief Verify whether hypothesis supports given entity type
3211 * \param type - dimension (see SMESH::Dimension enumeration)
3212 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3214 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3216 //================================================================================
3217 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3218 return type == SMESH::DIM_2D;
3222 // Obsolete methods - To be removed in V7
3225 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3226 this->SetMinSize(theMinSize);
3228 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3229 return this->GetMinSize();
3231 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3232 this->SetMaxSize(theMaxSize);
3234 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3235 return this->GetMaxSize();
3237 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3238 this->SetMinSize(theMinSize);
3240 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3241 return this->GetMinSize();
3243 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3244 this->SetMaxSize(theMaxSize);
3246 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3247 return this->GetMaxSize();
3249 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3250 this->SetAngleMesh(theValue);
3252 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3253 return this->GetAngleMesh();
3255 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3256 this->SetAngleMesh(theValue);
3258 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3259 return this->GetAngleMesh();
3261 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3262 std::string theValueStr = theValue ? "1" : "0";
3263 this->SetOptionValue("respect_geometry",theValueStr.c_str());
3265 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3266 std::string theValueStr = this->GetOptionValue("respect_geometry");
3267 if (theValueStr.empty() || theValueStr == "respect")
3271 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3272 std::string theValueStr = theValue ? "1" : "0";
3273 this->SetPreCADOptionValue("remove_tiny_edges",theValueStr.c_str());
3275 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3276 std::string theValueStr = this->GetPreCADOptionValue("remove_tiny_edges");
3277 if (theValueStr == "1")
3281 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3282 std::ostringstream theValueStr;
3283 theValueStr << theValue;
3284 this->SetPreCADOptionValue("tiny_edge_length",theValueStr.str().c_str());
3286 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3287 std::istringstream theValueStr(this->GetPreCADOptionValue("tiny_edge_length"));
3289 theValueStr >> result;