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;
1012 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1014 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1015 } catch (const std::invalid_argument& ex) {
1016 SALOME::ExceptionStruct ExDescription;
1017 ExDescription.text = ex.what();
1018 ExDescription.type = SALOME::BAD_PARAM;
1019 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1020 ExDescription.lineNumber = 0;
1021 throw SALOME::SALOME_Exception(ExDescription);
1022 } catch (SALOME_Exception& ex) {
1023 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1025 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1027 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1030 //=============================================================================
1032 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1033 throw (SALOME::SALOME_Exception) {
1035 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1036 bool valueChanged = false;
1038 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1039 if ( valueChanged ) {
1040 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1041 if (!boost::regex_match(string(attractor), re))
1042 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1043 this->GetImpl()->SetAttractorEntry(entry, attractor);
1045 } catch (const std::invalid_argument& ex) {
1046 SALOME::ExceptionStruct ExDescription;
1047 ExDescription.text = ex.what();
1048 ExDescription.type = SALOME::BAD_PARAM;
1049 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1050 ExDescription.lineNumber = 0;
1051 throw SALOME::SALOME_Exception(ExDescription);
1052 } catch (SALOME_Exception& ex) {
1053 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1055 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1057 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1060 //=============================================================================
1062 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
1063 throw (SALOME::SALOME_Exception)
1066 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1067 bool valueChanged = false;
1069 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1071 catch (const std::invalid_argument& ex) {
1072 SALOME::ExceptionStruct ExDescription;
1073 ExDescription.text = ex.what();
1074 ExDescription.type = SALOME::BAD_PARAM;
1075 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1076 ExDescription.lineNumber = 0;
1077 throw SALOME::SALOME_Exception(ExDescription);
1078 } catch (SALOME_Exception& ex) {
1079 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1081 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1082 //if ( valueChanged )
1083 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1084 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1087 //=============================================================================
1089 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1092 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1093 } catch (const std::invalid_argument& ex) {
1094 SALOME::ExceptionStruct ExDescription;
1095 ExDescription.text = ex.what();
1096 ExDescription.type = SALOME::BAD_PARAM;
1097 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1098 ExDescription.lineNumber = 0;
1099 throw SALOME::SALOME_Exception(ExDescription);
1100 } catch (SALOME_Exception& ex) {
1101 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1106 //=============================================================================
1108 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1111 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1112 } catch (const std::invalid_argument& ex) {
1113 SALOME::ExceptionStruct ExDescription;
1114 ExDescription.text = ex.what();
1115 ExDescription.type = SALOME::BAD_PARAM;
1116 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1117 ExDescription.lineNumber = 0;
1118 throw SALOME::SALOME_Exception(ExDescription);
1119 } catch (SALOME_Exception& ex) {
1120 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1125 // //=============================================================================
1127 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1128 // // A finir pour le dump
1129 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1130 // throw (SALOME::SALOME_Exception)
1132 // ASSERT(myBaseImpl);
1134 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1136 // catch (const std::invalid_argument& ex) {
1137 // SALOME::ExceptionStruct ExDescription;
1138 // ExDescription.text = ex.what();
1139 // ExDescription.type = SALOME::BAD_PARAM;
1140 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1141 // ExDescription.lineNumber = 0;
1142 // throw SALOME::SALOME_Exception(ExDescription);
1144 // catch (SALOME_Exception& ex) {
1145 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1150 //=============================================================================
1152 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1154 this->GetImpl()->ClearEntry(entry);
1155 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1158 //=============================================================================
1160 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1162 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1164 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1165 result->length(sizeMaps.size());
1167 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1168 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1169 string entry_sizemap = smIt->first;
1170 if (!smIt->second.empty()) {
1171 entry_sizemap += "|";
1172 entry_sizemap += smIt->second;
1174 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1176 return result._retn();
1179 //=============================================================================
1181 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1183 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1185 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1186 result->length(attractors.size());
1188 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1189 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1190 string entry_attractor = atIt->first;
1191 if (!atIt->second.empty()) {
1192 entry_attractor += "|";
1193 entry_attractor += atIt->second;
1195 result[i] = CORBA::string_dup(entry_attractor.c_str());
1197 return result._retn();
1200 //=============================================================================
1202 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1205 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1207 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1208 result->length( attractors.size() );
1210 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1211 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1212 string faceEntry = atIt->first;
1214 double startSize, endSize, infDist, constDist;
1215 if ( !atIt->second->Empty() ) {
1216 attEntry = atIt->second->GetAttractorEntry();
1217 MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
1218 std::vector<double> params = atIt->second->GetParameters();
1219 startSize = params[0];
1220 endSize = params[1];
1221 infDist = params[2];
1222 constDist = params[3];
1224 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1225 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1226 result[i].startSize = startSize;
1227 result[i].endSize = endSize;
1228 result[i].infDist = infDist;
1229 result[i].constDist = constDist;
1230 MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
1231 MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
1233 return result._retn();
1236 //=============================================================================
1238 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1239 throw (SALOME::SALOME_Exception) {
1241 for (int i = 0; i < sizeMaps.length(); ++i) {
1242 string entry_sizemap = sizeMaps[i].in();
1243 int colonPos = entry_sizemap.find('|');
1244 string entry, sizemap;
1245 if (colonPos == string::npos) // '|' separator not found
1246 entry = entry_sizemap;
1248 entry = entry_sizemap.substr(0, colonPos);
1249 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1250 sizemap = entry_sizemap.substr(colonPos + 1);
1252 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1256 //=============================================================================
1258 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1260 this->GetImpl()->ClearSizeMaps();
1263 //=============================================================================
1265 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1266 throw (SALOME::SALOME_Exception)
1270 entry = GeomObj->GetStudyEntry();
1271 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1272 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1273 SetSizeMapEntry(entry.c_str(), sizeMap);
1276 //=============================================================================
1278 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1280 string entry = GeomObj->GetStudyEntry();
1281 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1282 if (shapeType == GEOM::COMPOUND)
1283 shapeType = GeomObj->GetMaxShapeType();
1284 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1285 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1286 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1289 //=============================================================================
1290 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1293 entry = GeomObj->GetStudyEntry();
1294 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1295 MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
1296 UnsetEntry(entry.c_str());
1297 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
1300 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
1303 entry = GeomObj->GetStudyEntry();
1304 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1305 MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
1306 SetAttractorEntry(entry.c_str(), attractor);
1309 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
1312 entry = GeomObj->GetStudyEntry();
1313 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1314 MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
1315 UnsetEntry(entry.c_str());
1316 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
1319 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)
1322 string theFaceEntry;
1324 theFaceEntry = theFace->GetStudyEntry();
1325 theAttEntry = theAttractor->GetStudyEntry();
1327 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1328 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1331 if (theFaceEntry.empty()) {
1333 aName += theFace->GetEntry();
1334 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1335 if (!theSFace->_is_nil())
1336 theFaceEntry = theSFace->GetID();
1338 if (theFaceEntry.empty())
1339 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1341 if (theAttEntry.empty()) {
1342 if (theAttractor->GetShapeType() == GEOM::VERTEX)
1344 if (theAttractor->GetShapeType() == GEOM::EDGE)
1346 if (theAttractor->GetShapeType() == GEOM::WIRE)
1348 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
1349 aName = "Compound_";
1350 aName += theAttractor->GetEntry();
1351 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
1352 if (!theSAtt->_is_nil())
1353 theAttEntry = theSAtt->GetID();
1355 if (theAttEntry.empty())
1356 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1358 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
1359 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
1360 MESSAGE("IDL : GetName : " << theFace->GetName());
1361 MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
1362 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
1365 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
1366 GEOM::GEOM_Object_ptr theAttractor)
1369 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
1370 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
1372 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1373 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1376 // if (theFaceEntry.empty()) {
1378 // aName += theFace->GetEntry();
1379 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1380 // if (!theSFace->_is_nil())
1381 // theFaceEntry = theSFace->GetID();
1383 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
1384 !theAttrEntry.in() || !theAttrEntry.in()[0] )
1385 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1387 MESSAGE("IDL : GetName : " << theFace->GetName());
1388 MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
1389 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
1390 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
1391 << theFace << ", " << theAttractor << " )";
1394 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
1395 const char* attractorEntry)
1397 GetImpl()->ClearEntry( faceEntry, attractorEntry );
1398 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
1399 << faceEntry << "', '" << attractorEntry << "' )";
1404 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1407 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
1410 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
1413 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
1416 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
1419 this->GetImpl()->UnsetCustomSizeMap(entry);
1420 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
1424 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
1429 // ///////////////////////
1430 // // ENFORCED VERTICES //
1431 // ///////////////////////
1435 * Returns the list of enforced vertices for a given Face entry
1436 * @return A map of Face entry / List of enforced vertices
1439 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
1440 MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
1443 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
1445 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
1446 this->GetImpl()->_GetAllEnforcedVerticesByFace();
1447 resultMap->length(faceEntryEnfVertexListMap.size());
1448 MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
1450 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
1451 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
1452 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
1453 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
1454 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
1455 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1456 MESSAGE("Face Entry: " << mapElement->faceEntry);
1458 _enfVertexList = it_entry->second;
1459 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
1460 enfVertexList->length(_enfVertexList.size());
1461 MESSAGE("Number of enf vertex: " << enfVertexList->length());
1463 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
1464 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1465 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
1466 currentEnfVertex = (*it_enfVertex);
1468 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1471 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1474 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1477 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1478 coords->length(currentEnfVertex->coords.size());
1479 for (int i=0;i<coords->length();i++)
1480 coords[i] = currentEnfVertex->coords[i];
1481 enfVertex->coords = coords;
1484 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1487 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1488 faceEntryList->length(currentEnfVertex->faceEntries.size());
1489 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1490 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1491 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1492 enfVertex->faceEntries = faceEntryList;
1495 msg << "Enforced vertex: \n"
1496 << "Name: " << enfVertex->name << "\n";
1497 if (coords->length())
1498 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1499 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1500 << "Group Name: " << enfVertex->grpName;
1503 enfVertexList[j] = enfVertex;
1505 mapElement->enfVertexList = enfVertexList;
1507 resultMap[i] = mapElement;
1510 return resultMap._retn();
1514 * Returns the list of all enforced vertices
1515 * @return a list of enforced vertices
1518 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
1519 MESSAGE("IDL: GetAllEnforcedVertices()");
1521 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
1522 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
1523 resultMap->length(enfVertexList.size());
1524 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1526 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
1527 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1528 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
1529 MESSAGE("Enforced Vertex #" << i);
1530 currentEnfVertex = (*evlIt);
1531 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1533 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1535 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1537 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1538 coords->length(currentEnfVertex->coords.size());
1539 for (int ind = 0; ind < coords->length(); ind++)
1540 coords[ind] = currentEnfVertex->coords[ind];
1541 enfVertex->coords = coords;
1543 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1545 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1546 faceEntryList->length(currentEnfVertex->faceEntries.size());
1547 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1548 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1549 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1550 enfVertex->faceEntries = faceEntryList;
1553 msg << "Enforced vertex: \n"
1554 << "Name: " << enfVertex->name << "\n";
1555 if (coords->length())
1556 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1557 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1558 << "Group Name: " << enfVertex->grpName;
1561 resultMap[i] = enfVertex;
1563 return resultMap._retn();
1568 * Returns the list of enforced vertices coords for a given Face entry.
1569 * They are the coords of the "manual" enforced vertices.
1570 * @return A map of Face entry / List of enforced vertices coords
1573 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
1574 MESSAGE("IDL: GetAllCoordsByFace()");
1577 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
1579 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
1580 resultMap->length(entryCoordsListMap.size());
1581 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1583 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
1584 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
1585 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
1586 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
1587 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1588 MESSAGE("Face Entry: " << mapElement->faceEntry);
1590 _coordsList = it_entry->second;
1591 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
1592 coordsList->length(_coordsList.size());
1593 MESSAGE("Number of coords: " << coordsList->length());
1595 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
1596 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
1597 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1598 coords->length((*it_coords).size());
1599 for (int i=0;i<coords->length();i++)
1600 coords[i] = (*it_coords)[i];
1601 coordsList[j] = coords;
1602 MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
1604 mapElement->coordsList = coordsList;
1606 resultMap[i] = mapElement;
1609 return resultMap._retn();
1613 * Returns a map of enforced vertices coords / enforced vertex.
1614 * They are the coords of the "manual" enforced vertices.
1616 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
1617 MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
1620 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
1621 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
1622 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
1623 resultMap->length(coordsEnfVertexMap.size());
1624 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1626 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
1627 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1628 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
1629 MESSAGE("Enforced Vertex #" << i);
1630 currentEnfVertex = (it_coords->second);
1631 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
1632 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1633 coords->length(it_coords->first.size());
1634 for (int ind=0;ind<coords->length();ind++)
1635 coords[ind] = it_coords->first[ind];
1636 mapElement->coords = coords;
1637 MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
1639 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1641 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1643 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1645 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
1646 coords2->length(currentEnfVertex->coords.size());
1647 for (int ind=0;ind<coords2->length();ind++)
1648 coords2[ind] = currentEnfVertex->coords[ind];
1649 enfVertex->coords = coords2;
1651 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1653 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1654 faceEntryList->length(currentEnfVertex->faceEntries.size());
1655 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1656 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1657 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1658 enfVertex->faceEntries = faceEntryList;
1660 mapElement->enfVertex = enfVertex;
1662 msg << "Enforced vertex: \n"
1663 << "Name: " << enfVertex->name << "\n";
1664 if (coords->length())
1665 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1666 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1667 << "Group Name: " << enfVertex->grpName;
1670 resultMap[i] = mapElement;
1672 return resultMap._retn();
1676 * Returns the list of enforced vertices entries for a given Face entry.
1677 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
1678 * @return A map of Face entry / List of enforced vertices geom entries
1681 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
1682 MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
1685 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
1687 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
1688 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
1689 resultMap->length(entryEnfVertexEntryListMap.size());
1690 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1692 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
1693 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
1694 entryEnfVertexEntryListMap.begin();
1695 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
1696 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
1697 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
1698 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1699 MESSAGE("Face Entry: " << mapElement->faceEntry);
1701 _enfVertexEntryList = it_entry->second;
1702 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
1703 enfVertexEntryList->length(_enfVertexEntryList.size());
1704 MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
1706 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
1707 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
1708 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
1709 MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
1711 mapElement->enfVertexEntryList = enfVertexEntryList;
1713 resultMap[i] = mapElement;
1716 return resultMap._retn();
1720 * Returns a map of enforced vertices geom entry / enforced vertex.
1721 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
1723 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
1724 MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
1727 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
1728 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
1729 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
1730 resultMap->length(enfVertexEntryEnfVertexMap.size());
1731 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1733 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
1734 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1735 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
1736 MESSAGE("Enforced Vertex #" << i);
1737 currentEnfVertex = it_enfVertexEntry->second;
1738 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
1739 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
1740 MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
1742 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1744 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1746 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1748 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1749 coords->length(currentEnfVertex->coords.size());
1750 for (int ind=0;ind<coords->length();ind++)
1751 coords[ind] = currentEnfVertex->coords[ind];
1752 enfVertex->coords = coords;
1754 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1756 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1757 faceEntryList->length(currentEnfVertex->faceEntries.size());
1758 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1759 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1760 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1761 enfVertex->faceEntries = faceEntryList;
1764 msg << "Enforced vertex: \n"
1765 << "Name: " << enfVertex->name << "\n";
1766 if (coords->length())
1767 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1768 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1769 << "Group Name: " << enfVertex->grpName;
1772 mapElement->enfVertex = enfVertex;
1773 resultMap[i] = mapElement;
1775 return resultMap._retn();
1779 * Erase all enforced vertices
1781 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
1783 this->GetImpl()->ClearAllEnforcedVertices();
1784 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
1788 * Set/get/unset an enforced vertex on face
1790 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1791 CORBA::Double z) throw (SALOME::SALOME_Exception) {
1794 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1795 MESSAGE("theFace shape type is not FACE or COMPOUND");
1796 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1799 string theFaceEntry = theFace->GetStudyEntry();
1801 if (theFaceEntry.empty()) {
1802 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1803 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1805 if (theFace->GetShapeType() == GEOM::FACE)
1807 if (theFace->GetShapeType() == GEOM::COMPOUND)
1808 aName = "Compound_";
1809 aName += theFace->GetEntry();
1810 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1811 if (!theSFace->_is_nil())
1812 theFaceEntry = theSFace->GetID();
1814 if (theFaceEntry.empty())
1815 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1816 MESSAGE("IDL : GetName : " << theFace->GetName());
1817 MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
1819 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
1820 } catch (SALOME_Exception& ex) {
1821 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1826 * Set/get/unset an enforced vertex with name on face
1828 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1829 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
1832 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1833 MESSAGE("theFace shape type is not FACE or COMPOUND");
1834 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1837 string theFaceEntry = theFace->GetStudyEntry();
1839 if (theFaceEntry.empty()) {
1840 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1841 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1843 if (theFace->GetShapeType() == GEOM::FACE)
1845 if (theFace->GetShapeType() == GEOM::COMPOUND)
1846 aName = "Compound_";
1847 aName += theFace->GetEntry();
1848 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1849 if (!theSFace->_is_nil())
1850 theFaceEntry = theSFace->GetID();
1852 if (theFaceEntry.empty())
1853 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1855 MESSAGE("IDL : GetName : " << theFace->GetName());
1856 MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
1858 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
1859 } catch (SALOME_Exception& ex) {
1860 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1865 * Set/get/unset an enforced vertex with geom object on face
1867 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
1868 throw (SALOME::SALOME_Exception) {
1871 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1872 MESSAGE("theFace shape type is not FACE or COMPOUND");
1873 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1876 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1877 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1878 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1881 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1882 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
1883 // if (CORBA::is_nil(measureOp))
1886 // CORBA::Double x, y, z;
1888 // measureOp->PointCoordinates(theVertex, x, y, z);
1890 string theFaceEntry = theFace->GetStudyEntry();
1891 string theVertexEntry = theVertex->GetStudyEntry();
1893 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1894 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1897 if (theFaceEntry.empty()) {
1898 if (theFace->GetShapeType() == GEOM::FACE)
1900 if (theFace->GetShapeType() == GEOM::COMPOUND)
1901 aName = "Compound_";
1902 aName += theFace->GetEntry();
1903 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1904 if (!theSFace->_is_nil())
1905 theFaceEntry = theSFace->GetID();
1907 if (theFaceEntry.empty())
1908 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1910 if (theVertexEntry.empty()) {
1911 if (theVertex->GetShapeType() == GEOM::VERTEX)
1913 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1914 aName = "Compound_";
1915 aName += theVertex->GetEntry();
1916 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1917 if (!theSVertex->_is_nil())
1918 theVertexEntry = theSVertex->GetID();
1920 if (theVertexEntry.empty())
1921 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1923 string theVertexName = theVertex->GetName();
1924 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
1925 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
1926 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
1928 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
1929 } catch (SALOME_Exception& ex) {
1930 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1935 * Set an enforced vertex with group name on face
1937 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
1938 throw (SALOME::SALOME_Exception)
1942 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1943 MESSAGE("theFace shape type is not FACE or COMPOUND");
1944 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1947 string theFaceEntry = theFace->GetStudyEntry();
1949 if (theFaceEntry.empty()) {
1950 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1951 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1953 if (theFace->GetShapeType() == GEOM::FACE)
1955 if (theFace->GetShapeType() == GEOM::COMPOUND)
1956 aName = "Compound_";
1957 aName += theFace->GetEntry();
1958 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1959 if (!theSFace->_is_nil())
1960 theFaceEntry = theSFace->GetID();
1962 if (theFaceEntry.empty())
1963 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1964 MESSAGE("IDL : GetName : " << theFace->GetName());
1965 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
1967 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
1968 } catch (SALOME_Exception& ex) {
1969 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1974 * Set an enforced vertex with name and group name on face
1976 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
1977 const char* theVertexName, const char* theGroupName)
1978 throw (SALOME::SALOME_Exception)
1982 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1983 MESSAGE("theFace shape type is not FACE or COMPOUND");
1984 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1987 string theFaceEntry = theFace->GetStudyEntry();
1989 if (theFaceEntry.empty()) {
1990 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1991 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1993 if (theFace->GetShapeType() == GEOM::FACE)
1995 if (theFace->GetShapeType() == GEOM::COMPOUND)
1996 aName = "Compound_";
1997 aName += theFace->GetEntry();
1998 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1999 if (!theSFace->_is_nil())
2000 theFaceEntry = theSFace->GetID();
2002 if (theFaceEntry.empty())
2003 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2004 MESSAGE("IDL : GetName : " << theFace->GetName());
2005 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
2007 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2008 } catch (SALOME_Exception& ex) {
2009 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2014 * Set an enforced vertex with geom entry and group name on face
2016 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2017 throw (SALOME::SALOME_Exception)
2021 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2022 MESSAGE("theFace shape type is not FACE or COMPOUND");
2023 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2026 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2027 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2028 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2031 string theFaceEntry = theFace->GetStudyEntry();
2032 string theVertexEntry = theVertex->GetStudyEntry();
2034 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2035 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2038 if (theFaceEntry.empty()) {
2039 if (theFace->GetShapeType() == GEOM::FACE)
2041 if (theFace->GetShapeType() == GEOM::COMPOUND)
2042 aName = "Compound_";
2043 aName += theFace->GetEntry();
2044 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2045 if (!theSFace->_is_nil())
2046 theFaceEntry = theSFace->GetID();
2048 if (theFaceEntry.empty())
2049 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2051 if (theVertexEntry.empty()) {
2052 if (theVertex->GetShapeType() == GEOM::VERTEX)
2054 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2055 aName = "Compound_";
2056 aName += theVertex->GetEntry();
2057 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2058 if (!theSVertex->_is_nil())
2059 theVertexEntry = theSVertex->GetID();
2061 if (theVertexEntry.empty())
2062 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2064 string theVertexName = theVertex->GetName();
2065 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2066 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2067 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
2069 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2070 } catch (SALOME_Exception& ex) {
2071 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2075 //Enable internal enforced vertices on specific face if requested by user
2077 // * Are internal enforced vertices used for a face ?
2079 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2080 // throw (SALOME::SALOME_Exception) {
2081 // ASSERT(myBaseImpl);
2083 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2084 // MESSAGE("theFace shape type is not FACE or COMPOUND");
2085 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2088 // string theFaceEntry = theFace->GetStudyEntry();
2090 // if (theFaceEntry.empty()) {
2091 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2092 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2094 // if (theFace->GetShapeType() == GEOM::FACE)
2096 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2097 // aName = "Compound_";
2098 // aName += theFace->GetEntry();
2099 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2100 // if (!theSFace->_is_nil())
2101 // theFaceEntry = theSFace->GetID();
2103 // if (theFaceEntry.empty())
2104 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2106 // MESSAGE("IDL : GetName : " << theFace->GetName());
2107 // MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2109 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2110 // } catch (SALOME_Exception& ex) {
2111 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2116 * Get the list of all enforced vertices
2118 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2119 throw (SALOME::SALOME_Exception) {
2122 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2123 MESSAGE("theFace shape type is not FACE or COMPOUND");
2124 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2127 string theFaceEntry = theFace->GetStudyEntry();
2129 if (theFaceEntry.empty()) {
2130 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2131 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2133 if (theFace->GetShapeType() == GEOM::FACE)
2135 if (theFace->GetShapeType() == GEOM::COMPOUND)
2136 aName = "Compound_";
2137 aName += theFace->GetEntry();
2138 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2139 if (!theSFace->_is_nil())
2140 theFaceEntry = theSFace->GetID();
2142 if (theFaceEntry.empty())
2143 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2145 MESSAGE("IDL : GetName : " << theFace->GetName());
2146 MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
2148 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2149 } catch (SALOME_Exception& ex) {
2150 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2154 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2155 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2158 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2159 MESSAGE("theFace shape type is not FACE or COMPOUND");
2160 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2163 string theFaceEntry = theFace->GetStudyEntry();
2165 if (theFaceEntry.empty()) {
2166 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2167 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2169 if (theFace->GetShapeType() == GEOM::FACE)
2171 if (theFace->GetShapeType() == GEOM::COMPOUND)
2172 aName = "Compound_";
2173 aName += theFace->GetEntry();
2174 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2175 if (!theSFace->_is_nil())
2176 theFaceEntry = theSFace->GetID();
2178 if (theFaceEntry.empty())
2179 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2180 MESSAGE("IDL : GetName : " << theFace->GetName());
2181 MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2184 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2185 } catch (SALOME_Exception& ex) {
2186 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2190 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2191 throw (SALOME::SALOME_Exception) {
2194 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2195 MESSAGE("theFace shape type is not FACE or COMPOUND");
2196 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2198 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2199 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2200 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2203 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2204 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2205 // if (CORBA::is_nil(measureOp))
2208 // CORBA::Double x, y, z;
2210 // measureOp->PointCoordinates(theVertex, x, y, z);
2212 std::string theFaceEntry = theFace->GetStudyEntry();
2213 std::string theVertexEntry = theVertex->GetStudyEntry();
2215 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2216 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2219 if (theFaceEntry.empty()) {
2220 if (theFace->GetShapeType() == GEOM::FACE)
2222 if (theFace->GetShapeType() == GEOM::COMPOUND)
2223 aName = "Compound_";
2224 aName += theFace->GetEntry();
2225 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2226 if (!theSFace->_is_nil())
2227 theFaceEntry = theSFace->GetID();
2229 if (theFaceEntry.empty())
2230 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2232 if (theVertexEntry.empty()) {
2233 if (theVertex->GetShapeType() == GEOM::VERTEX)
2235 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2236 aName = "Compound_";
2237 aName += theVertex->GetEntry();
2238 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2239 if (!theSVertex->_is_nil())
2240 theVertexEntry = theSVertex->GetID();
2242 if (theVertexEntry.empty())
2243 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2245 MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
2248 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2249 } catch (SALOME_Exception& ex) {
2250 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2254 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2257 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2258 MESSAGE("theFace shape type is not FACE or COMPOUND");
2259 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2262 string theFaceEntry = theFace->GetStudyEntry();
2264 if (theFaceEntry.empty()) {
2265 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2266 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2268 if (theFace->GetShapeType() == GEOM::FACE)
2270 if (theFace->GetShapeType() == GEOM::COMPOUND)
2271 aName = "Compound_";
2272 aName += theFace->GetEntry();
2273 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2274 if (!theSFace->_is_nil())
2275 theFaceEntry = theSFace->GetID();
2277 if (theFaceEntry.empty())
2278 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2280 MESSAGE("IDL : GetName : " << theFace->GetName());
2281 MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
2284 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2285 } catch (SALOME_Exception& ex) {
2286 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2291 * Set/get/unset an enforced vertex on geom object given by entry
2293 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2294 CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
2295 throw (SALOME::SALOME_Exception) {
2297 MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
2298 bool newValue = false;
2299 if (string(theVertexEntry).empty()) {
2301 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
2302 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
2303 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
2304 coords.push_back(x);
2305 coords.push_back(y);
2306 coords.push_back(z);
2307 if (coordsList.find(coords) == coordsList.end()) {
2308 MESSAGE("Coords not found: add it in coordsList");
2311 MESSAGE("Coords already found, compare names");
2312 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
2313 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2314 MESSAGE("The names are different: update");
2315 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2319 MESSAGE("The names are identical");
2322 } catch (const std::invalid_argument& ex) {
2323 // no enforced vertex for entry
2324 MESSAGE("Face entry not found : add it to the list");
2328 if (string(theVertexName).empty())
2329 if (string(theGroupName).empty())
2330 SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
2332 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
2334 if (string(theGroupName).empty())
2335 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
2337 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
2338 << theVertexName << "\", \"" << theGroupName << "\")";
2341 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
2342 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
2343 if ( it == enfVertexEntryList.end()) {
2344 MESSAGE("Geom entry not found: add it in enfVertexEntryList");
2348 MESSAGE("Geom entry already found, compare names");
2349 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
2350 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2351 MESSAGE("The names are different: update");
2352 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2356 MESSAGE("The names are identical");
2359 } catch (const std::invalid_argument& ex) {
2360 // no enforced vertex for entry
2361 MESSAGE("Face entry not found : add it to the list");
2365 if (string(theGroupName).empty())
2366 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2368 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
2372 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
2374 MESSAGE("IDL : SetEnforcedVertexEntry END");
2378 //Enable internal enforced vertices on specific face if requested by user
2379 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry)
2380 // throw (SALOME::SALOME_Exception) {
2381 // ASSERT(myBaseImpl);
2383 // return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry);
2384 // } catch (const std::exception& ex) {
2385 // std::cout << "Exception: " << ex.what() << std::endl;
2386 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2390 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
2391 throw (SALOME::SALOME_Exception) {
2393 MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
2396 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
2397 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
2398 vertexList->length(_vList.size());
2399 MESSAGE("Number of enforced vertices: " << vertexList->length());
2400 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
2401 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
2402 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
2404 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2407 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
2408 // Geom Vertex Entry
2409 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
2411 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2412 coords->length(_enfVertex->coords.size());
2413 for (int ind=0;ind<coords->length();ind++)
2414 coords[ind] = _enfVertex->coords[ind];
2415 enfVertex->coords = coords;
2417 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
2419 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2420 faceEntryList->length(_enfVertex->faceEntries.size());
2421 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
2422 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
2423 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2424 enfVertex->faceEntries = faceEntryList;
2426 vertexList[i] = enfVertex;
2428 MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
2429 return vertexList._retn();
2430 } catch (const std::invalid_argument& ex) {
2431 SALOME::ExceptionStruct ExDescription;
2432 ExDescription.text = ex.what();
2433 ExDescription.type = SALOME::BAD_PARAM;
2434 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
2435 ExDescription.lineNumber = 1385;
2436 throw SALOME::SALOME_Exception(ExDescription);
2437 } catch (const std::exception& ex) {
2438 std::cout << "Exception: " << ex.what() << std::endl;
2439 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2443 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2444 CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
2446 MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
2450 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
2452 if (string(theVertexEntry).empty())
2453 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
2456 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2458 } catch (const std::invalid_argument& ex) {
2460 } catch (const std::exception& ex) {
2461 std::cout << "Exception: " << ex.what() << std::endl;
2462 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2465 MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
2469 //bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
2470 // CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
2471 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
2473 // bool ret = false;
2476 // ret = _unsetEnfVertex(theFaceEntry, x, y, z);
2477 // } catch (SALOME_Exception& ex) {
2478 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2482 // SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
2485 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
2489 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
2491 MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
2494 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
2495 SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
2496 } catch (const std::invalid_argument& ex) {
2498 } catch (const std::exception& ex) {
2499 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2502 MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
2506 //=============================================================================
2508 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
2512 //=============================================================================
2513 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
2514 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
2516 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
2517 std::string theValueStr = theValue ? "True" : "False";
2518 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
2521 //=============================================================================
2523 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
2527 //=============================================================================
2528 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
2529 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
2531 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
2534 //=============================================================================
2536 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
2540 //=============================================================================
2541 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName) {
2542 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
2544 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
2545 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
2548 //=============================================================================
2550 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
2554 //=============================================================================
2555 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
2556 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
2558 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
2562 * Enable internal enforced vertices on specific face if requested by user
2564 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
2565 throw (SALOME::SALOME_Exception)
2567 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
2569 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
2570 } catch (SALOME_Exception& ex) {
2571 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2575 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2576 throw (SALOME::SALOME_Exception)
2578 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
2580 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2581 MESSAGE("theFace shape type is not FACE or COMPOUND");
2582 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2585 string theFaceEntry = theFace->GetStudyEntry();
2587 if (theFaceEntry.empty()) {
2588 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2589 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2591 if (theFace->GetShapeType() == GEOM::FACE)
2593 if (theFace->GetShapeType() == GEOM::COMPOUND)
2594 aName = "Compound_";
2595 aName += theFace->GetEntry();
2596 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2597 if (!theSFace->_is_nil())
2598 theFaceEntry = theSFace->GetID();
2600 if (theFaceEntry.empty())
2601 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2603 MESSAGE("IDL : GetName : " << theFace->GetName());
2604 MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2606 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
2607 } catch (SALOME_Exception& ex) {
2608 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2612 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2613 throw (SALOME::SALOME_Exception)
2615 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
2618 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
2619 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
2620 if (string(theGroupName).empty())
2621 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
2623 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
2624 } catch (const std::exception& ex) {
2625 std::cout << "Exception: " << ex.what() << std::endl;
2626 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2633 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
2634 throw (SALOME::SALOME_Exception)
2637 MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
2639 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
2641 catch (const std::invalid_argument& ex) {
2642 SALOME::ExceptionStruct ExDescription;
2643 ExDescription.text = ex.what();
2644 ExDescription.type = SALOME::BAD_PARAM;
2645 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
2646 ExDescription.lineNumber = 1146;
2647 throw SALOME::SALOME_Exception(ExDescription);
2649 catch (SALOME_Exception& ex) {
2650 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2652 MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
2657 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
2658 throw (SALOME::SALOME_Exception)
2661 MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
2663 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
2665 catch (const std::invalid_argument& ex) {
2666 SALOME::ExceptionStruct ExDescription;
2667 ExDescription.text = ex.what();
2668 ExDescription.type = SALOME::BAD_PARAM;
2669 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
2670 ExDescription.lineNumber = 1170;
2671 throw SALOME::SALOME_Exception(ExDescription);
2673 catch (SALOME_Exception& ex) {
2674 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2677 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
2678 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
2680 MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
2683 ///////////////////////
2685 ///////////////////////
2687 ///////////////////////
2690 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
2692 //enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
2693 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
2694 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
2695 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
2696 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
2697 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
2698 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
2699 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
2700 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
2701 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
2702 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
2703 std::string txtShapeType = MapShapeTypeToString[theShapeType];
2704 return txtShapeType;
2707 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
2709 // Check shape types
2711 std::stringstream typesTxt;
2712 for (std::size_t i=0; i<theShapeTypes.size(); i++)
2714 GEOM::shape_type theShapeType = theShapeTypes[i];
2715 if (shape->GetShapeType() == theShapeType)
2717 typesTxt << ShapeTypeToString(theShapeType);
2718 if (i < theShapeTypes.size()-1 )
2722 std::stringstream msg;
2723 msg << "shape shape type is not in" << typesTxt;
2725 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2729 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
2732 if (shape->GetShapeType() != theShapeType) {
2733 std::stringstream msg;
2734 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
2736 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2740 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
2742 // Check shape is published in the object browser
2743 string shapeEntry = shape->GetStudyEntry();
2745 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2746 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2749 // Publish shape if needed
2750 if (shapeEntry.empty()) {
2751 if (shape->GetShapeType() == theShapeType)
2753 aName += shape->GetEntry();
2754 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
2755 if (!theSFace1->_is_nil())
2756 shapeEntry = theSFace1->GetID();
2758 if (shapeEntry.empty())
2759 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2763 // Format the output of two vectors to use it in MESSAGE and PythonDump
2764 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
2766 std::stringstream listEntriesTxt;
2768 if (!theSourceVerticesEntries.empty())
2770 listEntriesTxt << ", [" ;
2772 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
2775 listEntriesTxt << ", ";
2776 listEntriesTxt << *it;
2779 listEntriesTxt << "], [" ;
2781 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
2784 listEntriesTxt << ", ";
2785 listEntriesTxt << *it;
2787 listEntriesTxt << "]" ;
2789 return listEntriesTxt.str();
2793 * Erase all PreCad periodicity associations
2795 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
2797 this->GetImpl()->ClearPreCadPeriodicityVectors();
2798 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
2801 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
2803 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
2804 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2805 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
2807 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2809 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
2810 return periodicityList._retn();
2813 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
2815 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
2816 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2817 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
2819 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2821 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
2822 return periodicityList._retn();
2825 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
2826 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
2828 MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
2829 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
2831 periodicityList->length(preCadPeriodicityVector.size());
2833 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
2835 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
2837 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
2838 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
2839 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
2841 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
2842 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
2844 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
2845 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
2846 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
2849 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
2851 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
2852 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
2854 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
2855 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
2856 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
2859 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
2861 periodicityList[i] = myPreCadPeriodicity;
2865 return periodicityList._retn();
2869 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
2870 throw (SALOME::SALOME_Exception)
2873 const GEOM::ListOfGO theSourceVertices;
2874 const GEOM::ListOfGO theTargetVertices;
2875 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
2879 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
2880 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2881 throw (SALOME::SALOME_Exception)
2884 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
2886 size_t theLength = theSourceVertices.length();
2887 if (theLength != theTargetVertices.length())
2888 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2890 std::vector<GEOM::shape_type> allowedShapeTypes;
2891 allowedShapeTypes.push_back(GEOM::FACE);
2892 allowedShapeTypes.push_back(GEOM::COMPOUND);
2894 string prefix1 = "Source_face_";
2895 CheckShapeTypes(theFace1, allowedShapeTypes);
2896 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
2898 string prefix2 = "Target_face_";
2899 CheckShapeTypes(theFace2, allowedShapeTypes);
2900 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
2902 string prefix3 = "Source_vertex_";
2903 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
2904 theSourceVerticesEntries->length(theLength);
2905 GEOM::GEOM_Object_ptr theVtx_i;
2907 for (size_t ind = 0; ind < theLength; ind++) {
2908 theVtx_i = theSourceVertices[ind];
2909 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
2910 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2913 string prefix4 = "Target_vertex_";
2914 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
2915 theTargetVerticesEntries->length(theLength);
2916 for (size_t ind = 0; ind < theLength; ind++) {
2917 theVtx_i = theTargetVertices[ind];
2918 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
2919 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2922 string theFace2Name = theFace2->GetName();
2923 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
2924 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
2925 MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
2927 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
2928 theSourceVerticesEntries, theTargetVerticesEntries);
2929 } catch (SALOME_Exception& ex) {
2930 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2935 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
2936 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
2937 throw (SALOME::SALOME_Exception)
2942 // Convert BLSURFPlugin::TEntryList to vector<string>
2943 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
2944 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
2945 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
2946 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
2949 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
2951 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
2953 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
2954 theSourceVerticesEntries, theTargetVerticesEntries);
2956 SMESH::TPythonDump pd;
2957 if (!theSourceVerticesEntries.empty())
2959 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
2960 pd << listEntriesTxt.c_str();
2964 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
2965 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
2968 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
2969 throw (SALOME::SALOME_Exception)
2972 const GEOM::ListOfGO theSourceVertices;
2973 const GEOM::ListOfGO theTargetVertices;
2974 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
2977 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
2978 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2979 throw (SALOME::SALOME_Exception)
2981 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
2984 size_t theLength = theSourceVertices.length();
2985 if (theLength != theTargetVertices.length())
2986 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2988 std::vector<GEOM::shape_type> allowedShapeTypes;
2989 allowedShapeTypes.push_back(GEOM::EDGE);
2990 allowedShapeTypes.push_back(GEOM::COMPOUND);
2992 string prefix1 = "Source_edge_";
2993 CheckShapeTypes(theEdge1, allowedShapeTypes);
2994 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
2996 string prefix2 = "Target_edge_";
2997 CheckShapeTypes(theEdge2, allowedShapeTypes);
2998 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3000 string prefix3 = "Source_vertex_";
3001 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3002 theSourceVerticesEntries->length(theLength);
3003 GEOM::GEOM_Object_ptr theVtx_i;
3005 for (size_t ind = 0; ind < theLength; ind++) {
3006 theVtx_i = theSourceVertices[ind];
3007 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3008 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3011 string prefix4 = "Target_vertex_";
3012 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3013 theTargetVerticesEntries->length(theLength);
3014 for (size_t ind = 0; ind < theLength; ind++) {
3015 theVtx_i = theTargetVertices[ind];
3016 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3017 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3020 string theEdge2Name = theEdge2->GetName();
3021 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3022 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3023 MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
3025 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3026 theSourceVerticesEntries, theTargetVerticesEntries);
3027 } catch (SALOME_Exception& ex) {
3028 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3033 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3034 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3035 throw (SALOME::SALOME_Exception)
3040 // Convert BLSURFPlugin::TEntryList to vector<string>
3041 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3042 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3043 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3044 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3047 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3049 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
3050 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3051 theSourceVerticesEntries, theTargetVerticesEntries);
3053 SMESH::TPythonDump pd;
3054 if (!theSourceVerticesEntries.empty())
3056 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3057 pd << listEntriesTxt.c_str();
3061 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3063 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
3066 void BLSURFPlugin_Hypothesis_i::AddFacePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3067 throw (SALOME::SALOME_Exception)
3071 string prefix1 = "Source_face_";
3072 CheckShapeType(theFace1, GEOM::FACE);
3073 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3074 string prefix2 = "Target_face_";
3075 CheckShapeType(theFace2, GEOM::FACE);
3076 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3078 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3079 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3080 MESSAGE("IDL : AddFacePeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
3082 AddFacePeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str());
3083 } catch (SALOME_Exception& ex) {
3084 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3090 void BLSURFPlugin_Hypothesis_i::AddFacePeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry)
3091 throw (SALOME::SALOME_Exception){
3095 MESSAGE("IDL : AddFacePeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << ")");
3096 this->GetImpl()->AddFacePeriodicity(theFace1Entry, theFace2Entry);
3097 SMESH::TPythonDump pd;
3098 pd << _this() << ".AddFacePeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3099 MESSAGE("IDL : AddFacePeriodicityEntry END");
3103 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theEdge1,
3104 GEOM::GEOM_Object_ptr theFace2, GEOM::GEOM_Object_ptr theEdge2,
3105 CORBA::Long edge_orientation)
3106 throw (SALOME::SALOME_Exception){
3109 string prefix_theFace1 = "Source_face_";
3110 CheckShapeType(theFace1, GEOM::FACE);
3111 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix_theFace1);
3112 string prefix_theFace2 = "Target_face_";
3113 CheckShapeType(theFace2, GEOM::FACE);
3114 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix_theFace2);
3116 string prefix_theEdge1 = "Source_edge_";
3117 CheckShapeType(theEdge1, GEOM::EDGE);
3118 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3119 string prefix_theEdge2 = "Target_edge_";
3120 CheckShapeType(theEdge2, GEOM::EDGE);
3121 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3123 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3124 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3125 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3126 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3127 MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3129 AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
3130 } catch (SALOME_Exception& ex) {
3131 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3137 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityWithoutFaces(GEOM::GEOM_Object_ptr theEdge1,
3138 GEOM::GEOM_Object_ptr theEdge2,
3139 CORBA::Long edge_orientation)
3140 throw (SALOME::SALOME_Exception){
3143 string theFace1Entry = "";
3144 string theFace2Entry = "";
3146 string prefix_theEdge1 = "Source_edge_";
3147 CheckShapeType(theEdge1, GEOM::EDGE);
3148 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3149 string prefix_theEdge2 = "Target_edge_";
3150 CheckShapeType(theEdge2, GEOM::EDGE);
3151 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3153 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3154 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3155 MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3157 AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
3158 } catch (SALOME_Exception& ex) {
3159 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3165 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityEntry(const char* theFace1Entry, const char* theEdge1Entry, const char* theFace2Entry, const char* theEdge2Entry, const long edge_orientation)
3166 throw (SALOME::SALOME_Exception){
3170 MESSAGE("IDL : AddEdgePeriodicityEntry(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3171 this->GetImpl()->AddEdgePeriodicity(theFace1Entry, theEdge1Entry, theFace2Entry, theEdge2Entry, edge_orientation);
3172 SMESH::TPythonDump pd;
3174 pd << _this() << ".AddEdgePeriodicity(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")";
3176 pd << _this() << ".AddEdgePeriodicityWithoutFaces(" << theEdge1Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")";
3177 MESSAGE("IDL : AddEdgePeriodicityEntry END");
3180 void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theVertex1,
3181 GEOM::GEOM_Object_ptr theEdge2, GEOM::GEOM_Object_ptr theVertex2)
3182 throw (SALOME::SALOME_Exception){
3185 string prefix_theEdge1 = "Source_edge_";
3186 CheckShapeType(theEdge1, GEOM::EDGE);
3187 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3188 string prefix_theEdge2 = "Target_edge_";
3189 CheckShapeType(theEdge2, GEOM::EDGE);
3190 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3192 string prefix_theVertex1 = "Source_vertex_";
3193 CheckShapeType(theVertex1, GEOM::VERTEX);
3194 string theVertex1Entry = PublishIfNeeded(theVertex1, GEOM::VERTEX, prefix_theVertex1);
3195 string prefix_theVertex2 = "Target_vertex_";
3196 CheckShapeType(theVertex2, GEOM::VERTEX);
3197 string theVertex2Entry = PublishIfNeeded(theVertex2, GEOM::VERTEX, prefix_theVertex2);
3199 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3200 MESSAGE("IDL : theVertex1->GetName : " << theVertex1->GetName());
3201 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3202 MESSAGE("IDL : theVertex2->GetName : " << theVertex2->GetName());
3203 MESSAGE("IDL : AddVertexPeriodicity( "<< theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")");
3205 AddVertexPeriodicityEntry(theEdge1Entry.c_str(), theVertex1Entry.c_str(), theEdge2Entry.c_str(), theVertex2Entry.c_str());
3206 } catch (SALOME_Exception& ex) {
3207 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3213 void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicityEntry(const char* theEdge1Entry, const char* theVertex1Entry, const char* theEdge2Entry, const char* theVertex2Entry)
3214 throw (SALOME::SALOME_Exception){
3218 MESSAGE("IDL : AddVertexPeriodicityEntry(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")");
3219 this->GetImpl()->AddVertexPeriodicity(theEdge1Entry, theVertex1Entry, theEdge2Entry, theVertex2Entry);
3220 SMESH::TPythonDump pd;
3221 pd << _this() << ".AddVertexPeriodicity(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")";
3222 MESSAGE("IDL : AddVertexPeriodicityEntry END");
3226 //================================================================================
3228 * \brief Sets the file for export resulting mesh in GMF format
3229 * \param theFileName - full name of the file (.mesh, .meshb)
3231 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3233 //================================================================================
3234 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3235 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3237 MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
3238 bool valueChanged/*, modeChanged*/ = false;
3240 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3241 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3242 if (valueChanged)// or (!valueChanged && modeChanged))
3243 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3244 } catch (const std::exception& ex) {
3245 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3247 if (valueChanged)// or (!valueChanged && modeChanged))
3248 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3249 MESSAGE("IDL : SetGMFFile END ");
3252 //================================================================================
3254 * \brief Gets the file name for export resulting mesh in GMF format
3255 * \retval char* - The file name
3257 * Returns the GMF file name
3259 //================================================================================
3260 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3262 // MESSAGE("IDL : GetGMFFile()");
3263 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3266 // //================================================================================
3268 // * \brief Gets the file mode for export resulting mesh in GMF format
3269 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3271 // * Returns the GMF file mode
3273 // //================================================================================
3274 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3275 // ASSERT(myBaseImpl);
3276 // MESSAGE("IDL : GetGMFFileMode()");
3277 // return this->GetImpl()->GetGMFFileMode();
3280 //=============================================================================
3282 * BLSURFPlugin_Hypothesis_i::GetImpl
3284 * Get implementation
3286 //=============================================================================
3287 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3288 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
3289 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3292 //================================================================================
3294 * \brief Verify whether hypothesis supports given entity type
3295 * \param type - dimension (see SMESH::Dimension enumeration)
3296 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3298 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3300 //================================================================================
3301 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3302 return type == SMESH::DIM_2D;
3306 // Obsolete methods - To be removed in V7
3309 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3310 this->SetMinSize(theMinSize);
3312 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3313 return this->GetMinSize();
3315 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3316 this->SetMaxSize(theMaxSize);
3318 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3319 return this->GetMaxSize();
3321 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3322 this->SetMinSize(theMinSize);
3324 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3325 return this->GetMinSize();
3327 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3328 this->SetMaxSize(theMaxSize);
3330 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3331 return this->GetMaxSize();
3333 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3334 this->SetAngleMesh(theValue);
3336 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3337 return this->GetAngleMesh();
3339 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3340 this->SetAngleMesh(theValue);
3342 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3343 return this->GetAngleMesh();
3345 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3346 std::string theValueStr = theValue ? "1" : "0";
3347 this->SetOptionValue("respect_geometry",theValueStr.c_str());
3349 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3350 std::string theValueStr = this->GetOptionValue("respect_geometry");
3351 if (theValueStr.empty() || theValueStr == "respect")
3355 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3356 std::string theValueStr = theValue ? "1" : "0";
3357 this->SetPreCADOptionValue("remove_tiny_edges",theValueStr.c_str());
3359 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3360 std::string theValueStr = this->GetPreCADOptionValue("remove_tiny_edges");
3361 if (theValueStr == "1")
3365 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3366 std::ostringstream theValueStr;
3367 theValueStr << theValue;
3368 this->SetPreCADOptionValue("tiny_edge_length",theValueStr.str().c_str());
3370 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3371 std::istringstream theValueStr(this->GetPreCADOptionValue("tiny_edge_length"));
3373 theValueStr >> result;