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 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
812 result->length(opts.size()+custom_opts.size());
815 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
816 for (; opIt != opts.end(); ++opIt, ++i) {
817 string name_value_type = opIt->first;
818 if (!opIt->second.empty()) {
819 name_value_type += ":";
820 name_value_type += opIt->second;
821 name_value_type += ":0";
823 result[i] = CORBA::string_dup(name_value_type.c_str());
826 opIt = custom_opts.begin();
827 for (; opIt != custom_opts.end(); ++opIt,++i) {
828 string name_value_type = opIt->first;
829 if (!opIt->second.empty()) {
830 name_value_type += ":";
831 name_value_type += opIt->second;
832 name_value_type += ":1";
834 result[i] = CORBA::string_dup(name_value_type.c_str());
836 return result._retn();
839 //=============================================================================
841 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
843 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
845 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
846 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomPreCADOptionValues();
847 result->length(opts.size()+custom_opts.size());
850 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
851 for (; opIt != opts.end(); ++opIt, ++i) {
852 string name_value_type = opIt->first;
853 if (!opIt->second.empty()) {
854 name_value_type += ":";
855 name_value_type += opIt->second;
856 name_value_type += ":0";
858 result[i] = CORBA::string_dup(name_value_type.c_str());
861 opIt = custom_opts.begin();
862 for (; opIt != custom_opts.end(); ++opIt,++i) {
863 string name_value_type = opIt->first;
864 if (!opIt->second.empty()) {
865 name_value_type += ":";
866 name_value_type += opIt->second;
867 name_value_type += ":1";
869 result[i] = CORBA::string_dup(name_value_type.c_str());
871 return result._retn();
874 //=============================================================================
876 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
877 throw (SALOME::SALOME_Exception) {
879 for (int i = 0; i < options.length(); ++i) {
880 string name_value_type = options[i].in();
881 if(name_value_type.empty())
883 int colonPos = name_value_type.find(':');
886 if (colonPos == string::npos) // ':' not found
887 name = name_value_type;
889 name = name_value_type.substr(0, colonPos);
890 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
891 string value_type = name_value_type.substr(colonPos + 1);
892 colonPos = value_type.find(':');
893 value = value_type.substr(0, colonPos);
894 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
895 custom = atoi((value_type.substr(colonPos + 1)).c_str());
898 custom ? AddOption(name.c_str(), value.c_str()) : SetOptionValue(name.c_str(), value.c_str());
902 //=============================================================================
904 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
905 throw (SALOME::SALOME_Exception) {
907 for (int i = 0; i < options.length(); ++i) {
908 string name_value_type = options[i].in();
909 if(name_value_type.empty())
911 int colonPos = name_value_type.find(':');
914 if (colonPos == string::npos) // ':' not found
915 name = name_value_type;
917 name = name_value_type.substr(0, colonPos);
918 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
919 string value_type = name_value_type.substr(colonPos + 1);
920 colonPos = value_type.find(':');
921 value = value_type.substr(0, colonPos);
922 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
923 custom = atoi((value_type.substr(colonPos + 1)).c_str());
926 custom ? AddPreCADOption(name.c_str(), value.c_str()) : SetPreCADOptionValue(name.c_str(), value.c_str());
930 //=============================================================================
932 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
935 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
937 this->GetImpl()->AddOption(optionName, optionValue);
938 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
942 //=============================================================================
944 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
947 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
949 this->GetImpl()->AddPreCADOption(optionName, optionValue);
950 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
954 //=============================================================================
956 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
959 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
962 //=============================================================================
964 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
967 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
970 //=============================================================================
972 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
973 throw (SALOME::SALOME_Exception) {
975 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
976 if ( !entry || !entry[0] )
977 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
978 bool valueChanged = false;
980 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
982 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
983 } catch (const std::invalid_argument& ex) {
984 SALOME::ExceptionStruct ExDescription;
985 ExDescription.text = ex.what();
986 ExDescription.type = SALOME::BAD_PARAM;
987 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
988 ExDescription.lineNumber = 0;
989 throw SALOME::SALOME_Exception(ExDescription);
990 } catch (SALOME_Exception& ex) {
991 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
993 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
995 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
998 //=============================================================================
1000 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1001 throw (SALOME::SALOME_Exception) {
1003 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1004 bool valueChanged = false;
1005 std::ostringstream sizeMapFunction;
1006 switch (shapeType) {
1007 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1008 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1009 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1013 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1015 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1016 } catch (const std::invalid_argument& ex) {
1017 SALOME::ExceptionStruct ExDescription;
1018 ExDescription.text = ex.what();
1019 ExDescription.type = SALOME::BAD_PARAM;
1020 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1021 ExDescription.lineNumber = 0;
1022 throw SALOME::SALOME_Exception(ExDescription);
1023 } catch (SALOME_Exception& ex) {
1024 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1026 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1028 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1031 //=============================================================================
1033 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1034 throw (SALOME::SALOME_Exception) {
1036 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1037 bool valueChanged = false;
1039 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1040 if ( valueChanged ) {
1041 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1042 if (!boost::regex_match(string(attractor), re))
1043 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1044 this->GetImpl()->SetAttractorEntry(entry, attractor);
1046 } catch (const std::invalid_argument& ex) {
1047 SALOME::ExceptionStruct ExDescription;
1048 ExDescription.text = ex.what();
1049 ExDescription.type = SALOME::BAD_PARAM;
1050 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1051 ExDescription.lineNumber = 0;
1052 throw SALOME::SALOME_Exception(ExDescription);
1053 } catch (SALOME_Exception& ex) {
1054 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1056 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1058 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1061 //=============================================================================
1063 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
1064 throw (SALOME::SALOME_Exception)
1067 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1068 //bool valueChanged = false;
1070 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1072 catch (const std::invalid_argument& ex) {
1073 SALOME::ExceptionStruct ExDescription;
1074 ExDescription.text = ex.what();
1075 ExDescription.type = SALOME::BAD_PARAM;
1076 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1077 ExDescription.lineNumber = 0;
1078 throw SALOME::SALOME_Exception(ExDescription);
1079 } catch (SALOME_Exception& ex) {
1080 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1082 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1083 //if ( valueChanged )
1084 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1085 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1088 //=============================================================================
1090 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1093 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1094 } catch (const std::invalid_argument& ex) {
1095 SALOME::ExceptionStruct ExDescription;
1096 ExDescription.text = ex.what();
1097 ExDescription.type = SALOME::BAD_PARAM;
1098 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1099 ExDescription.lineNumber = 0;
1100 throw SALOME::SALOME_Exception(ExDescription);
1101 } catch (SALOME_Exception& ex) {
1102 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1107 //=============================================================================
1109 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1112 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1113 } catch (const std::invalid_argument& ex) {
1114 SALOME::ExceptionStruct ExDescription;
1115 ExDescription.text = ex.what();
1116 ExDescription.type = SALOME::BAD_PARAM;
1117 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1118 ExDescription.lineNumber = 0;
1119 throw SALOME::SALOME_Exception(ExDescription);
1120 } catch (SALOME_Exception& ex) {
1121 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1126 // //=============================================================================
1128 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1129 // // A finir pour le dump
1130 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1131 // throw (SALOME::SALOME_Exception)
1133 // ASSERT(myBaseImpl);
1135 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1137 // catch (const std::invalid_argument& ex) {
1138 // SALOME::ExceptionStruct ExDescription;
1139 // ExDescription.text = ex.what();
1140 // ExDescription.type = SALOME::BAD_PARAM;
1141 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1142 // ExDescription.lineNumber = 0;
1143 // throw SALOME::SALOME_Exception(ExDescription);
1145 // catch (SALOME_Exception& ex) {
1146 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1151 //=============================================================================
1153 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1155 this->GetImpl()->ClearEntry(entry);
1156 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1159 //=============================================================================
1161 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1163 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1165 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1166 result->length(sizeMaps.size());
1168 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1169 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1170 string entry_sizemap = smIt->first;
1171 if (!smIt->second.empty()) {
1172 entry_sizemap += "|";
1173 entry_sizemap += smIt->second;
1175 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1177 return result._retn();
1180 //=============================================================================
1182 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1184 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1186 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1187 result->length(attractors.size());
1189 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1190 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1191 string entry_attractor = atIt->first;
1192 if (!atIt->second.empty()) {
1193 entry_attractor += "|";
1194 entry_attractor += atIt->second;
1196 result[i] = CORBA::string_dup(entry_attractor.c_str());
1198 return result._retn();
1201 //=============================================================================
1203 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1206 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1208 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1209 result->length( attractors.size() );
1211 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1212 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1213 string faceEntry = atIt->first;
1215 double startSize, endSize, infDist, constDist;
1216 if ( !atIt->second->Empty() ) {
1217 attEntry = atIt->second->GetAttractorEntry();
1218 MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
1219 std::vector<double> params = atIt->second->GetParameters();
1220 startSize = params[0];
1221 endSize = params[1];
1222 infDist = params[2];
1223 constDist = params[3];
1225 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1226 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1227 result[i].startSize = startSize;
1228 result[i].endSize = endSize;
1229 result[i].infDist = infDist;
1230 result[i].constDist = constDist;
1231 MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
1232 MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
1234 return result._retn();
1237 //=============================================================================
1239 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1240 throw (SALOME::SALOME_Exception) {
1242 for (int i = 0; i < sizeMaps.length(); ++i) {
1243 string entry_sizemap = sizeMaps[i].in();
1244 int colonPos = entry_sizemap.find('|');
1245 string entry, sizemap;
1246 if (colonPos == string::npos) // '|' separator not found
1247 entry = entry_sizemap;
1249 entry = entry_sizemap.substr(0, colonPos);
1250 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1251 sizemap = entry_sizemap.substr(colonPos + 1);
1253 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1257 //=============================================================================
1259 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1261 this->GetImpl()->ClearSizeMaps();
1264 //=============================================================================
1266 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1267 throw (SALOME::SALOME_Exception)
1271 entry = GeomObj->GetStudyEntry();
1272 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1273 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1274 SetSizeMapEntry(entry.c_str(), sizeMap);
1277 //=============================================================================
1279 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1281 string entry = GeomObj->GetStudyEntry();
1282 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1283 if (shapeType == GEOM::COMPOUND)
1284 shapeType = GeomObj->GetMaxShapeType();
1285 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1286 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1287 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1290 //=============================================================================
1291 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1294 entry = GeomObj->GetStudyEntry();
1295 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1296 MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
1297 UnsetEntry(entry.c_str());
1298 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
1301 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
1304 entry = GeomObj->GetStudyEntry();
1305 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1306 MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
1307 SetAttractorEntry(entry.c_str(), attractor);
1310 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
1313 entry = GeomObj->GetStudyEntry();
1314 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1315 MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
1316 UnsetEntry(entry.c_str());
1317 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
1320 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)
1323 string theFaceEntry;
1325 theFaceEntry = theFace->GetStudyEntry();
1326 theAttEntry = theAttractor->GetStudyEntry();
1328 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1329 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1332 if (theFaceEntry.empty()) {
1334 aName += theFace->GetEntry();
1335 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1336 if (!theSFace->_is_nil())
1337 theFaceEntry = theSFace->GetID();
1339 if (theFaceEntry.empty())
1340 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1342 if (theAttEntry.empty()) {
1343 if (theAttractor->GetShapeType() == GEOM::VERTEX)
1345 if (theAttractor->GetShapeType() == GEOM::EDGE)
1347 if (theAttractor->GetShapeType() == GEOM::WIRE)
1349 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
1350 aName = "Compound_";
1351 aName += theAttractor->GetEntry();
1352 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
1353 if (!theSAtt->_is_nil())
1354 theAttEntry = theSAtt->GetID();
1356 if (theAttEntry.empty())
1357 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1359 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
1360 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
1361 MESSAGE("IDL : GetName : " << theFace->GetName());
1362 MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
1363 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
1366 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
1367 GEOM::GEOM_Object_ptr theAttractor)
1370 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
1371 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
1373 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1374 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1377 // if (theFaceEntry.empty()) {
1379 // aName += theFace->GetEntry();
1380 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1381 // if (!theSFace->_is_nil())
1382 // theFaceEntry = theSFace->GetID();
1384 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
1385 !theAttrEntry.in() || !theAttrEntry.in()[0] )
1386 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1388 MESSAGE("IDL : GetName : " << theFace->GetName());
1389 MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
1390 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
1391 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
1392 << theFace << ", " << theAttractor << " )";
1395 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
1396 const char* attractorEntry)
1398 GetImpl()->ClearEntry( faceEntry, attractorEntry );
1399 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
1400 << faceEntry << "', '" << attractorEntry << "' )";
1405 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1408 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
1411 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
1414 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
1417 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
1420 this->GetImpl()->UnsetCustomSizeMap(entry);
1421 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
1425 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
1430 // ///////////////////////
1431 // // ENFORCED VERTICES //
1432 // ///////////////////////
1436 * Returns the list of enforced vertices for a given Face entry
1437 * @return A map of Face entry / List of enforced vertices
1440 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
1441 MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
1444 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
1446 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
1447 this->GetImpl()->_GetAllEnforcedVerticesByFace();
1448 resultMap->length(faceEntryEnfVertexListMap.size());
1449 MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
1451 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
1452 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
1453 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
1454 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
1455 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
1456 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1457 MESSAGE("Face Entry: " << mapElement->faceEntry);
1459 _enfVertexList = it_entry->second;
1460 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
1461 enfVertexList->length(_enfVertexList.size());
1462 MESSAGE("Number of enf vertex: " << enfVertexList->length());
1464 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
1465 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1466 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
1467 currentEnfVertex = (*it_enfVertex);
1469 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1472 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1475 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1478 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1479 coords->length(currentEnfVertex->coords.size());
1480 for (int i=0;i<coords->length();i++)
1481 coords[i] = currentEnfVertex->coords[i];
1482 enfVertex->coords = coords;
1485 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1488 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1489 faceEntryList->length(currentEnfVertex->faceEntries.size());
1490 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1491 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1492 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1493 enfVertex->faceEntries = faceEntryList;
1496 msg << "Enforced vertex: \n"
1497 << "Name: " << enfVertex->name << "\n";
1498 if (coords->length())
1499 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1500 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1501 << "Group Name: " << enfVertex->grpName;
1504 enfVertexList[j] = enfVertex;
1506 mapElement->enfVertexList = enfVertexList;
1508 resultMap[i] = mapElement;
1511 return resultMap._retn();
1515 * Returns the list of all enforced vertices
1516 * @return a list of enforced vertices
1519 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
1520 MESSAGE("IDL: GetAllEnforcedVertices()");
1522 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
1523 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
1524 resultMap->length(enfVertexList.size());
1525 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1527 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
1528 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1529 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
1530 MESSAGE("Enforced Vertex #" << i);
1531 currentEnfVertex = (*evlIt);
1532 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1534 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1536 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1538 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1539 coords->length(currentEnfVertex->coords.size());
1540 for (int ind = 0; ind < coords->length(); ind++)
1541 coords[ind] = currentEnfVertex->coords[ind];
1542 enfVertex->coords = coords;
1544 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1546 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1547 faceEntryList->length(currentEnfVertex->faceEntries.size());
1548 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1549 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1550 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1551 enfVertex->faceEntries = faceEntryList;
1554 msg << "Enforced vertex: \n"
1555 << "Name: " << enfVertex->name << "\n";
1556 if (coords->length())
1557 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1558 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1559 << "Group Name: " << enfVertex->grpName;
1562 resultMap[i] = enfVertex;
1564 return resultMap._retn();
1569 * Returns the list of enforced vertices coords for a given Face entry.
1570 * They are the coords of the "manual" enforced vertices.
1571 * @return A map of Face entry / List of enforced vertices coords
1574 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
1575 MESSAGE("IDL: GetAllCoordsByFace()");
1578 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
1580 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
1581 resultMap->length(entryCoordsListMap.size());
1582 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1584 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
1585 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
1586 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
1587 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
1588 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1589 MESSAGE("Face Entry: " << mapElement->faceEntry);
1591 _coordsList = it_entry->second;
1592 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
1593 coordsList->length(_coordsList.size());
1594 MESSAGE("Number of coords: " << coordsList->length());
1596 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
1597 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
1598 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1599 coords->length((*it_coords).size());
1600 for (int i=0;i<coords->length();i++)
1601 coords[i] = (*it_coords)[i];
1602 coordsList[j] = coords;
1603 MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
1605 mapElement->coordsList = coordsList;
1607 resultMap[i] = mapElement;
1610 return resultMap._retn();
1614 * Returns a map of enforced vertices coords / enforced vertex.
1615 * They are the coords of the "manual" enforced vertices.
1617 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
1618 MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
1621 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
1622 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
1623 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
1624 resultMap->length(coordsEnfVertexMap.size());
1625 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1627 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
1628 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1629 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
1630 MESSAGE("Enforced Vertex #" << i);
1631 currentEnfVertex = (it_coords->second);
1632 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
1633 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1634 coords->length(it_coords->first.size());
1635 for (int ind=0;ind<coords->length();ind++)
1636 coords[ind] = it_coords->first[ind];
1637 mapElement->coords = coords;
1638 MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
1640 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1642 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1644 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1646 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
1647 coords2->length(currentEnfVertex->coords.size());
1648 for (int ind=0;ind<coords2->length();ind++)
1649 coords2[ind] = currentEnfVertex->coords[ind];
1650 enfVertex->coords = coords2;
1652 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1654 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1655 faceEntryList->length(currentEnfVertex->faceEntries.size());
1656 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1657 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1658 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1659 enfVertex->faceEntries = faceEntryList;
1661 mapElement->enfVertex = enfVertex;
1663 msg << "Enforced vertex: \n"
1664 << "Name: " << enfVertex->name << "\n";
1665 if (coords->length())
1666 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1667 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1668 << "Group Name: " << enfVertex->grpName;
1671 resultMap[i] = mapElement;
1673 return resultMap._retn();
1677 * Returns the list of enforced vertices entries for a given Face entry.
1678 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
1679 * @return A map of Face entry / List of enforced vertices geom entries
1682 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
1683 MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
1686 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
1688 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
1689 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
1690 resultMap->length(entryEnfVertexEntryListMap.size());
1691 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1693 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
1694 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
1695 entryEnfVertexEntryListMap.begin();
1696 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
1697 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
1698 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
1699 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1700 MESSAGE("Face Entry: " << mapElement->faceEntry);
1702 _enfVertexEntryList = it_entry->second;
1703 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
1704 enfVertexEntryList->length(_enfVertexEntryList.size());
1705 MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
1707 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
1708 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
1709 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
1710 MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
1712 mapElement->enfVertexEntryList = enfVertexEntryList;
1714 resultMap[i] = mapElement;
1717 return resultMap._retn();
1721 * Returns a map of enforced vertices geom entry / enforced vertex.
1722 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
1724 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
1725 MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
1728 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
1729 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
1730 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
1731 resultMap->length(enfVertexEntryEnfVertexMap.size());
1732 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1734 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
1735 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1736 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
1737 MESSAGE("Enforced Vertex #" << i);
1738 currentEnfVertex = it_enfVertexEntry->second;
1739 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
1740 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
1741 MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
1743 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1745 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1747 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1749 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1750 coords->length(currentEnfVertex->coords.size());
1751 for (int ind=0;ind<coords->length();ind++)
1752 coords[ind] = currentEnfVertex->coords[ind];
1753 enfVertex->coords = coords;
1755 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1757 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1758 faceEntryList->length(currentEnfVertex->faceEntries.size());
1759 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1760 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1761 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1762 enfVertex->faceEntries = faceEntryList;
1765 msg << "Enforced vertex: \n"
1766 << "Name: " << enfVertex->name << "\n";
1767 if (coords->length())
1768 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1769 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1770 << "Group Name: " << enfVertex->grpName;
1773 mapElement->enfVertex = enfVertex;
1774 resultMap[i] = mapElement;
1776 return resultMap._retn();
1780 * Erase all enforced vertices
1782 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
1784 this->GetImpl()->ClearAllEnforcedVertices();
1785 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
1789 * Set/get/unset an enforced vertex on face
1791 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1792 CORBA::Double z) throw (SALOME::SALOME_Exception) {
1795 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1796 MESSAGE("theFace shape type is not FACE or COMPOUND");
1797 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1800 string theFaceEntry = theFace->GetStudyEntry();
1802 if (theFaceEntry.empty()) {
1803 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1804 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1806 if (theFace->GetShapeType() == GEOM::FACE)
1808 if (theFace->GetShapeType() == GEOM::COMPOUND)
1809 aName = "Compound_";
1810 aName += theFace->GetEntry();
1811 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1812 if (!theSFace->_is_nil())
1813 theFaceEntry = theSFace->GetID();
1815 if (theFaceEntry.empty())
1816 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1817 MESSAGE("IDL : GetName : " << theFace->GetName());
1818 MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
1820 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
1821 } catch (SALOME_Exception& ex) {
1822 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1827 * Set/get/unset an enforced vertex with name on face
1829 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1830 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
1833 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1834 MESSAGE("theFace shape type is not FACE or COMPOUND");
1835 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1838 string theFaceEntry = theFace->GetStudyEntry();
1840 if (theFaceEntry.empty()) {
1841 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1842 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1844 if (theFace->GetShapeType() == GEOM::FACE)
1846 if (theFace->GetShapeType() == GEOM::COMPOUND)
1847 aName = "Compound_";
1848 aName += theFace->GetEntry();
1849 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1850 if (!theSFace->_is_nil())
1851 theFaceEntry = theSFace->GetID();
1853 if (theFaceEntry.empty())
1854 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1856 MESSAGE("IDL : GetName : " << theFace->GetName());
1857 MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
1859 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
1860 } catch (SALOME_Exception& ex) {
1861 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1866 * Set/get/unset an enforced vertex with geom object on face
1868 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
1869 throw (SALOME::SALOME_Exception) {
1872 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1873 MESSAGE("theFace shape type is not FACE or COMPOUND");
1874 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1877 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1878 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1879 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1882 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1883 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
1884 // if (CORBA::is_nil(measureOp))
1887 // CORBA::Double x, y, z;
1889 // measureOp->PointCoordinates(theVertex, x, y, z);
1891 string theFaceEntry = theFace->GetStudyEntry();
1892 string theVertexEntry = theVertex->GetStudyEntry();
1894 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1895 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1898 if (theFaceEntry.empty()) {
1899 if (theFace->GetShapeType() == GEOM::FACE)
1901 if (theFace->GetShapeType() == GEOM::COMPOUND)
1902 aName = "Compound_";
1903 aName += theFace->GetEntry();
1904 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1905 if (!theSFace->_is_nil())
1906 theFaceEntry = theSFace->GetID();
1908 if (theFaceEntry.empty())
1909 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1911 if (theVertexEntry.empty()) {
1912 if (theVertex->GetShapeType() == GEOM::VERTEX)
1914 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1915 aName = "Compound_";
1916 aName += theVertex->GetEntry();
1917 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1918 if (!theSVertex->_is_nil())
1919 theVertexEntry = theSVertex->GetID();
1921 if (theVertexEntry.empty())
1922 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1924 string theVertexName = theVertex->GetName();
1925 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
1926 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
1927 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
1929 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
1930 } catch (SALOME_Exception& ex) {
1931 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1936 * Set an enforced vertex with group name on face
1938 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
1939 throw (SALOME::SALOME_Exception)
1943 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1944 MESSAGE("theFace shape type is not FACE or COMPOUND");
1945 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1948 string theFaceEntry = theFace->GetStudyEntry();
1950 if (theFaceEntry.empty()) {
1951 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1952 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1954 if (theFace->GetShapeType() == GEOM::FACE)
1956 if (theFace->GetShapeType() == GEOM::COMPOUND)
1957 aName = "Compound_";
1958 aName += theFace->GetEntry();
1959 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1960 if (!theSFace->_is_nil())
1961 theFaceEntry = theSFace->GetID();
1963 if (theFaceEntry.empty())
1964 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1965 MESSAGE("IDL : GetName : " << theFace->GetName());
1966 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
1968 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
1969 } catch (SALOME_Exception& ex) {
1970 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1975 * Set an enforced vertex with name and group name on face
1977 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
1978 const char* theVertexName, const char* theGroupName)
1979 throw (SALOME::SALOME_Exception)
1983 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1984 MESSAGE("theFace shape type is not FACE or COMPOUND");
1985 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1988 string theFaceEntry = theFace->GetStudyEntry();
1990 if (theFaceEntry.empty()) {
1991 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1992 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1994 if (theFace->GetShapeType() == GEOM::FACE)
1996 if (theFace->GetShapeType() == GEOM::COMPOUND)
1997 aName = "Compound_";
1998 aName += theFace->GetEntry();
1999 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2000 if (!theSFace->_is_nil())
2001 theFaceEntry = theSFace->GetID();
2003 if (theFaceEntry.empty())
2004 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2005 MESSAGE("IDL : GetName : " << theFace->GetName());
2006 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
2008 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2009 } catch (SALOME_Exception& ex) {
2010 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2015 * Set an enforced vertex with geom entry and group name on face
2017 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2018 throw (SALOME::SALOME_Exception)
2022 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2023 MESSAGE("theFace shape type is not FACE or COMPOUND");
2024 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2027 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2028 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2029 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2032 string theFaceEntry = theFace->GetStudyEntry();
2033 string theVertexEntry = theVertex->GetStudyEntry();
2035 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2036 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2039 if (theFaceEntry.empty()) {
2040 if (theFace->GetShapeType() == GEOM::FACE)
2042 if (theFace->GetShapeType() == GEOM::COMPOUND)
2043 aName = "Compound_";
2044 aName += theFace->GetEntry();
2045 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2046 if (!theSFace->_is_nil())
2047 theFaceEntry = theSFace->GetID();
2049 if (theFaceEntry.empty())
2050 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2052 if (theVertexEntry.empty()) {
2053 if (theVertex->GetShapeType() == GEOM::VERTEX)
2055 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2056 aName = "Compound_";
2057 aName += theVertex->GetEntry();
2058 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2059 if (!theSVertex->_is_nil())
2060 theVertexEntry = theSVertex->GetID();
2062 if (theVertexEntry.empty())
2063 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2065 string theVertexName = theVertex->GetName();
2066 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2067 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2068 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
2070 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2071 } catch (SALOME_Exception& ex) {
2072 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2076 //Enable internal enforced vertices on specific face if requested by user
2078 // * Are internal enforced vertices used for a face ?
2080 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2081 // throw (SALOME::SALOME_Exception) {
2082 // ASSERT(myBaseImpl);
2084 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2085 // MESSAGE("theFace shape type is not FACE or COMPOUND");
2086 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2089 // string theFaceEntry = theFace->GetStudyEntry();
2091 // if (theFaceEntry.empty()) {
2092 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2093 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2095 // if (theFace->GetShapeType() == GEOM::FACE)
2097 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2098 // aName = "Compound_";
2099 // aName += theFace->GetEntry();
2100 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2101 // if (!theSFace->_is_nil())
2102 // theFaceEntry = theSFace->GetID();
2104 // if (theFaceEntry.empty())
2105 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2107 // MESSAGE("IDL : GetName : " << theFace->GetName());
2108 // MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2110 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2111 // } catch (SALOME_Exception& ex) {
2112 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2117 * Get the list of all enforced vertices
2119 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2120 throw (SALOME::SALOME_Exception) {
2123 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2124 MESSAGE("theFace shape type is not FACE or COMPOUND");
2125 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2128 string theFaceEntry = theFace->GetStudyEntry();
2130 if (theFaceEntry.empty()) {
2131 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2132 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2134 if (theFace->GetShapeType() == GEOM::FACE)
2136 if (theFace->GetShapeType() == GEOM::COMPOUND)
2137 aName = "Compound_";
2138 aName += theFace->GetEntry();
2139 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2140 if (!theSFace->_is_nil())
2141 theFaceEntry = theSFace->GetID();
2143 if (theFaceEntry.empty())
2144 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2146 MESSAGE("IDL : GetName : " << theFace->GetName());
2147 MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
2149 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2150 } catch (SALOME_Exception& ex) {
2151 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2155 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2156 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2159 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2160 MESSAGE("theFace shape type is not FACE or COMPOUND");
2161 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2164 string theFaceEntry = theFace->GetStudyEntry();
2166 if (theFaceEntry.empty()) {
2167 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2168 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2170 if (theFace->GetShapeType() == GEOM::FACE)
2172 if (theFace->GetShapeType() == GEOM::COMPOUND)
2173 aName = "Compound_";
2174 aName += theFace->GetEntry();
2175 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2176 if (!theSFace->_is_nil())
2177 theFaceEntry = theSFace->GetID();
2179 if (theFaceEntry.empty())
2180 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2181 MESSAGE("IDL : GetName : " << theFace->GetName());
2182 MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2185 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2186 } catch (SALOME_Exception& ex) {
2187 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2191 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2192 throw (SALOME::SALOME_Exception) {
2195 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2196 MESSAGE("theFace shape type is not FACE or COMPOUND");
2197 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2199 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2200 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2201 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2204 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2205 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2206 // if (CORBA::is_nil(measureOp))
2209 // CORBA::Double x, y, z;
2211 // measureOp->PointCoordinates(theVertex, x, y, z);
2213 std::string theFaceEntry = theFace->GetStudyEntry();
2214 std::string theVertexEntry = theVertex->GetStudyEntry();
2216 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2217 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2220 if (theFaceEntry.empty()) {
2221 if (theFace->GetShapeType() == GEOM::FACE)
2223 if (theFace->GetShapeType() == GEOM::COMPOUND)
2224 aName = "Compound_";
2225 aName += theFace->GetEntry();
2226 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2227 if (!theSFace->_is_nil())
2228 theFaceEntry = theSFace->GetID();
2230 if (theFaceEntry.empty())
2231 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2233 if (theVertexEntry.empty()) {
2234 if (theVertex->GetShapeType() == GEOM::VERTEX)
2236 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2237 aName = "Compound_";
2238 aName += theVertex->GetEntry();
2239 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2240 if (!theSVertex->_is_nil())
2241 theVertexEntry = theSVertex->GetID();
2243 if (theVertexEntry.empty())
2244 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2246 MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
2249 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2250 } catch (SALOME_Exception& ex) {
2251 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2255 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2258 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2259 MESSAGE("theFace shape type is not FACE or COMPOUND");
2260 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2263 string theFaceEntry = theFace->GetStudyEntry();
2265 if (theFaceEntry.empty()) {
2266 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2267 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2269 if (theFace->GetShapeType() == GEOM::FACE)
2271 if (theFace->GetShapeType() == GEOM::COMPOUND)
2272 aName = "Compound_";
2273 aName += theFace->GetEntry();
2274 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2275 if (!theSFace->_is_nil())
2276 theFaceEntry = theSFace->GetID();
2278 if (theFaceEntry.empty())
2279 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2281 MESSAGE("IDL : GetName : " << theFace->GetName());
2282 MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
2285 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2286 } catch (SALOME_Exception& ex) {
2287 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2292 * Set/get/unset an enforced vertex on geom object given by entry
2294 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2295 CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
2296 throw (SALOME::SALOME_Exception) {
2298 MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
2299 bool newValue = false;
2300 if (string(theVertexEntry).empty()) {
2302 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
2303 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
2304 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
2305 coords.push_back(x);
2306 coords.push_back(y);
2307 coords.push_back(z);
2308 if (coordsList.find(coords) == coordsList.end()) {
2309 MESSAGE("Coords not found: add it in coordsList");
2312 MESSAGE("Coords already found, compare names");
2313 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
2314 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2315 MESSAGE("The names are different: update");
2316 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2320 MESSAGE("The names are identical");
2323 } catch (const std::invalid_argument& ex) {
2324 // no enforced vertex for entry
2325 MESSAGE("Face entry not found : add it to the list");
2329 if (string(theVertexName).empty()) {
2330 if (string(theGroupName).empty())
2331 SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
2333 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
2336 if (string(theGroupName).empty())
2337 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
2339 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
2340 << theVertexName << "\", \"" << theGroupName << "\")";
2345 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
2346 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
2347 if ( it == enfVertexEntryList.end()) {
2348 MESSAGE("Geom entry not found: add it in enfVertexEntryList");
2352 MESSAGE("Geom entry already found, compare names");
2353 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
2354 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2355 MESSAGE("The names are different: update");
2356 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2360 MESSAGE("The names are identical");
2363 } catch (const std::invalid_argument& ex) {
2364 // no enforced vertex for entry
2365 MESSAGE("Face entry not found : add it to the list");
2369 if (string(theGroupName).empty())
2370 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2372 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
2377 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
2379 MESSAGE("IDL : SetEnforcedVertexEntry END");
2383 //Enable internal enforced vertices on specific face if requested by user
2384 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry)
2385 // throw (SALOME::SALOME_Exception) {
2386 // ASSERT(myBaseImpl);
2388 // return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry);
2389 // } catch (const std::exception& ex) {
2390 // std::cout << "Exception: " << ex.what() << std::endl;
2391 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2395 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
2396 throw (SALOME::SALOME_Exception) {
2398 MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
2401 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
2402 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
2403 vertexList->length(_vList.size());
2404 MESSAGE("Number of enforced vertices: " << vertexList->length());
2405 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
2406 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
2407 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
2409 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2412 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
2413 // Geom Vertex Entry
2414 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
2416 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2417 coords->length(_enfVertex->coords.size());
2418 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
2419 coords[ind] = _enfVertex->coords[ind];
2420 enfVertex->coords = coords;
2422 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
2424 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2425 faceEntryList->length(_enfVertex->faceEntries.size());
2426 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
2427 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
2428 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2429 enfVertex->faceEntries = faceEntryList;
2431 vertexList[i] = enfVertex;
2433 MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
2434 return vertexList._retn();
2435 } catch (const std::invalid_argument& ex) {
2436 SALOME::ExceptionStruct ExDescription;
2437 ExDescription.text = ex.what();
2438 ExDescription.type = SALOME::BAD_PARAM;
2439 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
2440 ExDescription.lineNumber = 1385;
2441 throw SALOME::SALOME_Exception(ExDescription);
2442 } catch (const std::exception& ex) {
2443 std::cout << "Exception: " << ex.what() << std::endl;
2444 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2448 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2449 CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
2451 MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
2455 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
2457 if (string(theVertexEntry).empty())
2458 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
2461 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2463 } catch (const std::invalid_argument& ex) {
2465 } catch (const std::exception& ex) {
2466 std::cout << "Exception: " << ex.what() << std::endl;
2467 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2470 MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
2474 //bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
2475 // CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
2476 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
2478 // bool ret = false;
2481 // ret = _unsetEnfVertex(theFaceEntry, x, y, z);
2482 // } catch (SALOME_Exception& ex) {
2483 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2487 // SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
2490 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
2494 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
2496 MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
2499 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
2500 SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
2501 } catch (const std::invalid_argument& ex) {
2503 } catch (const std::exception& ex) {
2504 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2507 MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
2511 //=============================================================================
2513 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
2517 //=============================================================================
2518 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
2519 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
2521 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
2522 std::string theValueStr = theValue ? "True" : "False";
2523 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
2526 //=============================================================================
2528 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
2532 //=============================================================================
2533 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
2534 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
2536 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
2539 //=============================================================================
2541 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
2545 //=============================================================================
2546 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName) {
2547 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
2549 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
2550 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
2553 //=============================================================================
2555 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
2559 //=============================================================================
2560 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
2561 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
2563 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
2567 * Enable internal enforced vertices on specific face if requested by user
2569 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
2570 throw (SALOME::SALOME_Exception)
2572 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
2574 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
2575 } catch (SALOME_Exception& ex) {
2576 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2580 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2581 throw (SALOME::SALOME_Exception)
2583 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
2585 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2586 MESSAGE("theFace shape type is not FACE or COMPOUND");
2587 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2590 string theFaceEntry = theFace->GetStudyEntry();
2592 if (theFaceEntry.empty()) {
2593 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2594 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2596 if (theFace->GetShapeType() == GEOM::FACE)
2598 if (theFace->GetShapeType() == GEOM::COMPOUND)
2599 aName = "Compound_";
2600 aName += theFace->GetEntry();
2601 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2602 if (!theSFace->_is_nil())
2603 theFaceEntry = theSFace->GetID();
2605 if (theFaceEntry.empty())
2606 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2608 MESSAGE("IDL : GetName : " << theFace->GetName());
2609 MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2611 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
2612 } catch (SALOME_Exception& ex) {
2613 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2617 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2618 throw (SALOME::SALOME_Exception)
2620 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
2623 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
2624 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
2625 if (string(theGroupName).empty())
2626 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
2628 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
2629 } catch (const std::exception& ex) {
2630 std::cout << "Exception: " << ex.what() << std::endl;
2631 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2638 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
2639 throw (SALOME::SALOME_Exception)
2642 MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
2644 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
2646 catch (const std::invalid_argument& ex) {
2647 SALOME::ExceptionStruct ExDescription;
2648 ExDescription.text = ex.what();
2649 ExDescription.type = SALOME::BAD_PARAM;
2650 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
2651 ExDescription.lineNumber = 1146;
2652 throw SALOME::SALOME_Exception(ExDescription);
2654 catch (SALOME_Exception& ex) {
2655 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2657 MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
2662 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
2663 throw (SALOME::SALOME_Exception)
2666 MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
2668 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
2670 catch (const std::invalid_argument& ex) {
2671 SALOME::ExceptionStruct ExDescription;
2672 ExDescription.text = ex.what();
2673 ExDescription.type = SALOME::BAD_PARAM;
2674 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
2675 ExDescription.lineNumber = 1170;
2676 throw SALOME::SALOME_Exception(ExDescription);
2678 catch (SALOME_Exception& ex) {
2679 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2682 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
2683 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
2685 MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
2688 ///////////////////////
2690 ///////////////////////
2692 ///////////////////////
2695 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
2697 //enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
2698 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
2699 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
2700 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
2701 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
2702 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
2703 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
2704 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
2705 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
2706 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
2707 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
2708 std::string txtShapeType = MapShapeTypeToString[theShapeType];
2709 return txtShapeType;
2712 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
2714 // Check shape types
2716 std::stringstream typesTxt;
2717 for (std::size_t i=0; i<theShapeTypes.size(); i++)
2719 GEOM::shape_type theShapeType = theShapeTypes[i];
2720 if (shape->GetShapeType() == theShapeType)
2722 typesTxt << ShapeTypeToString(theShapeType);
2723 if (i < theShapeTypes.size()-1 )
2727 std::stringstream msg;
2728 msg << "shape shape type is not in" << typesTxt.str();
2730 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2734 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
2737 if (shape->GetShapeType() != theShapeType) {
2738 std::stringstream msg;
2739 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
2741 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2745 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
2747 // Check shape is published in the object browser
2748 string shapeEntry = shape->GetStudyEntry();
2750 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2751 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2754 // Publish shape if needed
2755 if (shapeEntry.empty()) {
2756 if (shape->GetShapeType() == theShapeType)
2758 aName += shape->GetEntry();
2759 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
2760 if (!theSFace1->_is_nil())
2761 shapeEntry = theSFace1->GetID();
2763 if (shapeEntry.empty())
2764 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2768 // Format the output of two vectors to use it in MESSAGE and PythonDump
2769 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
2771 std::stringstream listEntriesTxt;
2773 if (!theSourceVerticesEntries.empty())
2775 listEntriesTxt << ", [" ;
2777 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
2780 listEntriesTxt << ", ";
2781 listEntriesTxt << *it;
2784 listEntriesTxt << "], [" ;
2786 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
2789 listEntriesTxt << ", ";
2790 listEntriesTxt << *it;
2792 listEntriesTxt << "]" ;
2794 return listEntriesTxt.str();
2798 * Erase all PreCad periodicity associations
2800 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
2802 this->GetImpl()->ClearPreCadPeriodicityVectors();
2803 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
2806 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
2808 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
2809 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2810 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
2812 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2814 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
2815 return periodicityList._retn();
2818 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
2820 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
2821 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2822 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
2824 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2826 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
2827 return periodicityList._retn();
2830 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
2831 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
2833 MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
2834 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
2836 periodicityList->length(preCadPeriodicityVector.size());
2838 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
2840 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
2842 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
2843 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
2844 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
2846 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
2847 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
2849 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
2850 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
2851 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
2854 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
2856 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
2857 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
2859 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
2860 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
2861 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
2864 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
2866 periodicityList[i] = myPreCadPeriodicity;
2870 return periodicityList._retn();
2874 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
2875 throw (SALOME::SALOME_Exception)
2878 const GEOM::ListOfGO theSourceVertices;
2879 const GEOM::ListOfGO theTargetVertices;
2880 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
2884 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
2885 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2886 throw (SALOME::SALOME_Exception)
2889 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
2891 size_t theLength = theSourceVertices.length();
2892 if (theLength != theTargetVertices.length())
2893 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2895 std::vector<GEOM::shape_type> allowedShapeTypes;
2896 allowedShapeTypes.push_back(GEOM::FACE);
2897 allowedShapeTypes.push_back(GEOM::COMPOUND);
2899 string prefix1 = "Source_face_";
2900 CheckShapeTypes(theFace1, allowedShapeTypes);
2901 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
2903 string prefix2 = "Target_face_";
2904 CheckShapeTypes(theFace2, allowedShapeTypes);
2905 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
2907 string prefix3 = "Source_vertex_";
2908 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
2909 theSourceVerticesEntries->length(theLength);
2910 GEOM::GEOM_Object_ptr theVtx_i;
2912 for (size_t ind = 0; ind < theLength; ind++) {
2913 theVtx_i = theSourceVertices[ind];
2914 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
2915 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2918 string prefix4 = "Target_vertex_";
2919 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
2920 theTargetVerticesEntries->length(theLength);
2921 for (size_t ind = 0; ind < theLength; ind++) {
2922 theVtx_i = theTargetVertices[ind];
2923 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
2924 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2927 string theFace2Name = theFace2->GetName();
2928 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
2929 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
2930 MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
2932 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
2933 theSourceVerticesEntries, theTargetVerticesEntries);
2934 } catch (SALOME_Exception& ex) {
2935 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2940 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
2941 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
2942 throw (SALOME::SALOME_Exception)
2947 // Convert BLSURFPlugin::TEntryList to vector<string>
2948 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
2949 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
2950 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
2951 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
2954 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
2956 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
2958 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
2959 theSourceVerticesEntries, theTargetVerticesEntries);
2961 SMESH::TPythonDump pd;
2962 if (!theSourceVerticesEntries.empty())
2964 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
2965 pd << listEntriesTxt.c_str();
2969 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
2970 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
2973 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
2974 throw (SALOME::SALOME_Exception)
2977 const GEOM::ListOfGO theSourceVertices;
2978 const GEOM::ListOfGO theTargetVertices;
2979 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
2982 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
2983 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2984 throw (SALOME::SALOME_Exception)
2986 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
2989 size_t theLength = theSourceVertices.length();
2990 if (theLength != theTargetVertices.length())
2991 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2993 std::vector<GEOM::shape_type> allowedShapeTypes;
2994 allowedShapeTypes.push_back(GEOM::EDGE);
2995 allowedShapeTypes.push_back(GEOM::COMPOUND);
2997 string prefix1 = "Source_edge_";
2998 CheckShapeTypes(theEdge1, allowedShapeTypes);
2999 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3001 string prefix2 = "Target_edge_";
3002 CheckShapeTypes(theEdge2, allowedShapeTypes);
3003 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3005 string prefix3 = "Source_vertex_";
3006 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3007 theSourceVerticesEntries->length(theLength);
3008 GEOM::GEOM_Object_ptr theVtx_i;
3010 for (size_t ind = 0; ind < theLength; ind++) {
3011 theVtx_i = theSourceVertices[ind];
3012 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3013 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3016 string prefix4 = "Target_vertex_";
3017 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3018 theTargetVerticesEntries->length(theLength);
3019 for (size_t ind = 0; ind < theLength; ind++) {
3020 theVtx_i = theTargetVertices[ind];
3021 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3022 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3025 string theEdge2Name = theEdge2->GetName();
3026 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3027 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3028 MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
3030 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3031 theSourceVerticesEntries, theTargetVerticesEntries);
3032 } catch (SALOME_Exception& ex) {
3033 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3038 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3039 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3040 throw (SALOME::SALOME_Exception)
3045 // Convert BLSURFPlugin::TEntryList to vector<string>
3046 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3047 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3048 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3049 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3052 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3054 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
3055 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3056 theSourceVerticesEntries, theTargetVerticesEntries);
3058 SMESH::TPythonDump pd;
3059 if (!theSourceVerticesEntries.empty())
3061 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3062 pd << listEntriesTxt.c_str();
3066 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3068 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
3071 void BLSURFPlugin_Hypothesis_i::AddFacePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3072 throw (SALOME::SALOME_Exception)
3076 string prefix1 = "Source_face_";
3077 CheckShapeType(theFace1, GEOM::FACE);
3078 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3079 string prefix2 = "Target_face_";
3080 CheckShapeType(theFace2, GEOM::FACE);
3081 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3083 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3084 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3085 MESSAGE("IDL : AddFacePeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
3087 AddFacePeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str());
3088 } catch (SALOME_Exception& ex) {
3089 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3095 void BLSURFPlugin_Hypothesis_i::AddFacePeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry)
3096 throw (SALOME::SALOME_Exception){
3100 MESSAGE("IDL : AddFacePeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << ")");
3101 this->GetImpl()->AddFacePeriodicity(theFace1Entry, theFace2Entry);
3102 SMESH::TPythonDump pd;
3103 pd << _this() << ".AddFacePeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3104 MESSAGE("IDL : AddFacePeriodicityEntry END");
3108 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theEdge1,
3109 GEOM::GEOM_Object_ptr theFace2, GEOM::GEOM_Object_ptr theEdge2,
3110 CORBA::Long edge_orientation)
3111 throw (SALOME::SALOME_Exception){
3114 string prefix_theFace1 = "Source_face_";
3115 CheckShapeType(theFace1, GEOM::FACE);
3116 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix_theFace1);
3117 string prefix_theFace2 = "Target_face_";
3118 CheckShapeType(theFace2, GEOM::FACE);
3119 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix_theFace2);
3121 string prefix_theEdge1 = "Source_edge_";
3122 CheckShapeType(theEdge1, GEOM::EDGE);
3123 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3124 string prefix_theEdge2 = "Target_edge_";
3125 CheckShapeType(theEdge2, GEOM::EDGE);
3126 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3128 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3129 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3130 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3131 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3132 MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3134 AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
3135 } catch (SALOME_Exception& ex) {
3136 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3142 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityWithoutFaces(GEOM::GEOM_Object_ptr theEdge1,
3143 GEOM::GEOM_Object_ptr theEdge2,
3144 CORBA::Long edge_orientation)
3145 throw (SALOME::SALOME_Exception){
3148 string theFace1Entry = "";
3149 string theFace2Entry = "";
3151 string prefix_theEdge1 = "Source_edge_";
3152 CheckShapeType(theEdge1, GEOM::EDGE);
3153 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3154 string prefix_theEdge2 = "Target_edge_";
3155 CheckShapeType(theEdge2, GEOM::EDGE);
3156 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3158 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3159 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3160 MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3162 AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
3163 } catch (SALOME_Exception& ex) {
3164 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3170 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityEntry(const char* theFace1Entry, const char* theEdge1Entry, const char* theFace2Entry, const char* theEdge2Entry, const long edge_orientation)
3171 throw (SALOME::SALOME_Exception){
3175 MESSAGE("IDL : AddEdgePeriodicityEntry(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3176 this->GetImpl()->AddEdgePeriodicity(theFace1Entry, theEdge1Entry, theFace2Entry, theEdge2Entry, edge_orientation);
3177 SMESH::TPythonDump pd;
3179 pd << _this() << ".AddEdgePeriodicity(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")";
3181 pd << _this() << ".AddEdgePeriodicityWithoutFaces(" << theEdge1Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")";
3182 MESSAGE("IDL : AddEdgePeriodicityEntry END");
3185 void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theVertex1,
3186 GEOM::GEOM_Object_ptr theEdge2, GEOM::GEOM_Object_ptr theVertex2)
3187 throw (SALOME::SALOME_Exception){
3190 string prefix_theEdge1 = "Source_edge_";
3191 CheckShapeType(theEdge1, GEOM::EDGE);
3192 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3193 string prefix_theEdge2 = "Target_edge_";
3194 CheckShapeType(theEdge2, GEOM::EDGE);
3195 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3197 string prefix_theVertex1 = "Source_vertex_";
3198 CheckShapeType(theVertex1, GEOM::VERTEX);
3199 string theVertex1Entry = PublishIfNeeded(theVertex1, GEOM::VERTEX, prefix_theVertex1);
3200 string prefix_theVertex2 = "Target_vertex_";
3201 CheckShapeType(theVertex2, GEOM::VERTEX);
3202 string theVertex2Entry = PublishIfNeeded(theVertex2, GEOM::VERTEX, prefix_theVertex2);
3204 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3205 MESSAGE("IDL : theVertex1->GetName : " << theVertex1->GetName());
3206 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3207 MESSAGE("IDL : theVertex2->GetName : " << theVertex2->GetName());
3208 MESSAGE("IDL : AddVertexPeriodicity( "<< theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")");
3210 AddVertexPeriodicityEntry(theEdge1Entry.c_str(), theVertex1Entry.c_str(), theEdge2Entry.c_str(), theVertex2Entry.c_str());
3211 } catch (SALOME_Exception& ex) {
3212 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3218 void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicityEntry(const char* theEdge1Entry, const char* theVertex1Entry, const char* theEdge2Entry, const char* theVertex2Entry)
3219 throw (SALOME::SALOME_Exception){
3223 MESSAGE("IDL : AddVertexPeriodicityEntry(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")");
3224 this->GetImpl()->AddVertexPeriodicity(theEdge1Entry, theVertex1Entry, theEdge2Entry, theVertex2Entry);
3225 SMESH::TPythonDump pd;
3226 pd << _this() << ".AddVertexPeriodicity(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")";
3227 MESSAGE("IDL : AddVertexPeriodicityEntry END");
3231 //================================================================================
3233 * \brief Sets the file for export resulting mesh in GMF format
3234 * \param theFileName - full name of the file (.mesh, .meshb)
3236 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3238 //================================================================================
3239 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3240 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3242 MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
3243 bool valueChanged/*, modeChanged*/ = false;
3245 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3246 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3247 if (valueChanged)// or (!valueChanged && modeChanged))
3248 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3249 } catch (const std::exception& ex) {
3250 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3252 if (valueChanged)// or (!valueChanged && modeChanged))
3253 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3254 MESSAGE("IDL : SetGMFFile END ");
3257 //================================================================================
3259 * \brief Gets the file name for export resulting mesh in GMF format
3260 * \retval char* - The file name
3262 * Returns the GMF file name
3264 //================================================================================
3265 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3267 // MESSAGE("IDL : GetGMFFile()");
3268 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3271 // //================================================================================
3273 // * \brief Gets the file mode for export resulting mesh in GMF format
3274 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3276 // * Returns the GMF file mode
3278 // //================================================================================
3279 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3280 // ASSERT(myBaseImpl);
3281 // MESSAGE("IDL : GetGMFFileMode()");
3282 // return this->GetImpl()->GetGMFFileMode();
3285 //=============================================================================
3287 * BLSURFPlugin_Hypothesis_i::GetImpl
3289 * Get implementation
3291 //=============================================================================
3292 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3293 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
3294 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3297 //================================================================================
3299 * \brief Verify whether hypothesis supports given entity type
3300 * \param type - dimension (see SMESH::Dimension enumeration)
3301 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3303 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3305 //================================================================================
3306 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3307 return type == SMESH::DIM_2D;
3311 // Obsolete methods - To be removed in V7
3314 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3315 this->SetMinSize(theMinSize);
3317 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3318 return this->GetMinSize();
3320 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3321 this->SetMaxSize(theMaxSize);
3323 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3324 return this->GetMaxSize();
3326 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3327 this->SetMinSize(theMinSize);
3329 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3330 return this->GetMinSize();
3332 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3333 this->SetMaxSize(theMaxSize);
3335 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3336 return this->GetMaxSize();
3338 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3339 this->SetAngleMesh(theValue);
3341 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3342 return this->GetAngleMesh();
3344 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3345 this->SetAngleMesh(theValue);
3347 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3348 return this->GetAngleMesh();
3350 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3351 std::string theValueStr = theValue ? "1" : "0";
3352 this->SetOptionValue("respect_geometry",theValueStr.c_str());
3354 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3355 std::string theValueStr = this->GetOptionValue("respect_geometry");
3356 if (theValueStr.empty() || theValueStr == "respect")
3360 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3361 std::string theValueStr = theValue ? "1" : "0";
3362 this->SetPreCADOptionValue("remove_tiny_edges",theValueStr.c_str());
3364 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3365 std::string theValueStr = this->GetPreCADOptionValue("remove_tiny_edges");
3366 if (theValueStr == "1")
3370 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3371 std::ostringstream theValueStr;
3372 theValueStr << theValue;
3373 this->SetPreCADOptionValue("tiny_edge_length",theValueStr.str().c_str());
3375 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3376 std::istringstream theValueStr(this->GetPreCADOptionValue("tiny_edge_length"));
3378 theValueStr >> result;