Salome HOME
INT PAL 0052683: Parameter "Color group" in the "Create Group" dialog box is empty
[modules/smesh.git] / src / StdMeshers_I / StdMeshers_Adaptive1D_i.cxx
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : StdMeshers_Adaptive1D_i.cxx
23 //  Module : SMESH
24 //
25
26 #include "StdMeshers_Adaptive1D_i.hxx"
27 #include "SMESH_Gen_i.hxx"
28 #include "SMESH_Gen.hxx"
29 #include "SMESH_PythonDump.hxx"
30
31 #include "StdMeshers_Adaptive1D.hxx"
32
33 #include "Utils_CorbaException.hxx"
34 #include "utilities.h"
35
36 //=======================================================================
37 //function : StdMeshers_Adaptive1D_i
38 //purpose  : Constructor
39 //=======================================================================
40
41 StdMeshers_Adaptive1D_i::StdMeshers_Adaptive1D_i( PortableServer::POA_ptr thePOA,
42                                                   int                     theStudyId,
43                                                   ::SMESH_Gen*            theGenImpl )
44   : SALOME::GenericObj_i( thePOA ), 
45     SMESH_Hypothesis_i( thePOA )
46 {
47   myBaseImpl = new ::StdMeshers_Adaptive1D( theGenImpl->GetANewId(),
48                                             theStudyId,
49                                             theGenImpl );
50 }
51
52 //=======================================================================
53 //function : ~StdMeshers_Adaptive1D_i
54 //purpose  : Destructor
55 //=======================================================================
56
57 StdMeshers_Adaptive1D_i::~StdMeshers_Adaptive1D_i()
58 {
59   MESSAGE( "StdMeshers_Adaptive1D_i::~StdMeshers_Adaptive1D_i" );
60 }
61
62 //=======================================================================
63 //function : SetMinSize
64 //purpose  : Sets minimal allowed segment length
65 //=======================================================================
66
67 void StdMeshers_Adaptive1D_i::SetMinSize( CORBA::Double minSegLen )
68   throw (SALOME::SALOME_Exception)
69 {
70   ASSERT( myBaseImpl );
71   try {
72     this->GetImpl()->SetMinSize( minSegLen );
73   }
74   catch ( SALOME_Exception& S_ex ) {
75     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
76   }
77
78   // Update Python script
79   SMESH::TPythonDump() << _this() << ".SetMinSize( " << SMESH::TVar(minSegLen) << " )";
80 }
81
82 //=======================================================================
83 //function : GetMinSize
84 //purpose  : Returns minimal allowed segment length
85 //=======================================================================
86
87 CORBA::Double StdMeshers_Adaptive1D_i::GetMinSize()
88 {
89   ASSERT( myBaseImpl );
90   return this->GetImpl()->GetMinSize();
91 }
92
93 //=======================================================================
94 //function : SetMaxSize
95 //purpose  : Sets maximal allowed segment length
96 //=======================================================================
97
98 void StdMeshers_Adaptive1D_i::SetMaxSize( CORBA::Double maxSegLen )
99   throw (SALOME::SALOME_Exception)
100 {
101   ASSERT( myBaseImpl );
102   try {
103     this->GetImpl()->SetMaxSize( maxSegLen );
104   }
105   catch ( SALOME_Exception& S_ex ) {
106     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
107   }
108
109   // Update Python script
110   SMESH::TPythonDump() << _this() << ".SetMaxSize( " << SMESH::TVar(maxSegLen) << " )";
111 }
112
113 //=======================================================================
114 //function : GetMaxSize
115 //purpose  : Returns maximal allowed segment length
116 //=======================================================================
117
118 CORBA::Double StdMeshers_Adaptive1D_i::GetMaxSize()
119 {
120   ASSERT( myBaseImpl );
121   return this->GetImpl()->GetMaxSize();
122 }
123
124 //=======================================================================
125 //function : SetDeflection
126 //purpose  : Sets a maximal allowed distance between a segment and an edge.
127 //=======================================================================
128
129 void StdMeshers_Adaptive1D_i::SetDeflection( CORBA::Double theValue )
130   throw ( SALOME::SALOME_Exception )
131 {
132   ASSERT( myBaseImpl );
133   try {
134     this->GetImpl()->SetDeflection( theValue );
135   }
136   catch ( SALOME_Exception& S_ex ) {
137     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
138   }
139
140   // Update Python script
141   SMESH::TPythonDump() << _this() << ".SetDeflection( " << SMESH::TVar(theValue) << " )";
142 }
143
144 //=======================================================================
145 //function : GetDeflection
146 //purpose  : Returns deflection
147 //=======================================================================
148
149 CORBA::Double StdMeshers_Adaptive1D_i::GetDeflection()
150 {
151   ASSERT( myBaseImpl );
152   return this->GetImpl()->GetDeflection();
153 }
154
155 //=======================================================================
156 //function : GetImpl
157 //purpose  : Get implementation
158 //=======================================================================
159
160 ::StdMeshers_Adaptive1D* StdMeshers_Adaptive1D_i::GetImpl()
161 {
162   return ( ::StdMeshers_Adaptive1D* )myBaseImpl;
163 }
164
165 //=======================================================================
166 //function : IsDimSupported
167 //purpose  : Verify whether hypothesis supports given entity type
168 //=======================================================================
169
170 CORBA::Boolean StdMeshers_Adaptive1D_i::IsDimSupported( SMESH::Dimension type )
171 {
172   return type == SMESH::DIM_1D;
173 }