1 // Copyright (C) 2011 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.
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
20 #include "HOMARD_Zone_i.hxx"
21 #include "HOMARD_Gen_i.hxx"
22 #include "HOMARD_Zone.hxx"
23 #include "HOMARD_DriverTools.hxx"
25 #include "utilities.h"
27 //=============================================================================
29 * standard constructor
31 //=============================================================================
32 HOMARD_Zone_i::HOMARD_Zone_i()
34 MESSAGE( "Default constructor, not for use" );
38 //=============================================================================
40 * standard constructor
42 //=============================================================================
43 HOMARD_Zone_i::HOMARD_Zone_i( CORBA::ORB_ptr orb,
44 HOMARD::HOMARD_Gen_var engine )
46 MESSAGE( "HOMARD_Zone_i" );
49 myHomardZone = new ::HOMARD_Zone();
50 ASSERT( myHomardZone );
52 //=============================================================================
56 //=============================================================================
58 HOMARD_Zone_i::~HOMARD_Zone_i()
62 //=============================================================================
65 //=============================================================================
66 void HOMARD_Zone_i::SetName( const char* NomZone )
68 ASSERT( myHomardZone );
69 myHomardZone->SetName( NomZone );
72 //=============================================================================
73 char* HOMARD_Zone_i::GetName()
75 ASSERT( myHomardZone );
76 return CORBA::string_dup( myHomardZone->GetName().c_str() );
79 //=============================================================================
80 char* HOMARD_Zone_i::GetDumpPython()
82 ASSERT( myHomardZone );
83 return CORBA::string_dup( myHomardZone->GetDumpPython().c_str() );
87 //=============================================================================
88 void HOMARD_Zone_i::SetZoneType( CORBA::Long ZoneType )
90 ASSERT( myHomardZone );
91 myHomardZone->SetZoneType( ZoneType );
94 //=============================================================================
95 CORBA::Long HOMARD_Zone_i::GetZoneType()
97 ASSERT( myHomardZone );
98 return CORBA::Long( myHomardZone->GetZoneType() );
101 //=============================================================================
102 void HOMARD_Zone_i::SetBox( double X0, double X1, double X2, double X3, double X4, double X5 )
104 ASSERT( myHomardZone );
105 myHomardZone->SetBox( X0, X1, X2, X3, X4, X5 );
108 //=============================================================================
109 HOMARD::double_array* HOMARD_Zone_i::GetCoords()
111 ASSERT( myHomardZone );
112 HOMARD::double_array_var aResult = new HOMARD::double_array();
113 std::vector<double> mesCoor = myHomardZone->GetCoords();
114 aResult->length( mesCoor .size() );
115 std::vector<double>::const_iterator it;
117 for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
118 aResult[i++] = (*it);
119 return aResult._retn();
122 //=============================================================================
123 void HOMARD_Zone_i::SetSphere( double Xcentre, double Ycentre, double Zcentre, double Rayon )
125 ASSERT( myHomardZone );
126 myHomardZone->SetSphere( Xcentre, Ycentre, Zcentre, Rayon );
129 //=============================================================================
130 void HOMARD_Zone_i::SetCylinder( double Xcentre, double Ycentre, double Zcentre,
131 double Xaxis, double Yaxis, double Zaxis,
132 double Rayon, double Haut )
134 ASSERT( myHomardZone );
135 myHomardZone->SetCylinder( Xcentre, Ycentre, Zcentre, Xaxis, Yaxis, Zaxis, Rayon, Haut );
137 //=============================================================================
138 void HOMARD_Zone_i::SetPipe( double Xcentre, double Ycentre, double Zcentre,
139 double Xaxis, double Yaxis, double Zaxis,
140 double Rayon, double Haut, double Rayonint )
142 ASSERT( myHomardZone );
143 myHomardZone->SetPipe( Xcentre, Ycentre, Zcentre, Xaxis, Yaxis, Zaxis, Rayon, Haut, Rayonint );
146 //=============================================================================
147 void HOMARD_Zone_i::SetLimit( double Xincr, double Yincr, double Zincr )
149 MESSAGE ("SetLimit, Xincr : " << Xincr << ", Yincr : " << Yincr << ", Zincr : " << Zincr) ;
150 ASSERT( myHomardZone );
151 myHomardZone->SetLimit( Xincr, Yincr, Zincr );
154 //=============================================================================
155 HOMARD::double_array* HOMARD_Zone_i::GetLimit()
157 ASSERT( myHomardZone );
158 HOMARD::double_array_var aResult = new HOMARD::double_array();
159 std::vector<double> mesCoor = myHomardZone->GetLimit();
160 aResult->length( mesCoor .size() );
161 std::vector<double>::const_iterator it;
163 for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
164 aResult[i++] = (*it);
165 return aResult._retn();
168 //=============================================================================
169 void HOMARD_Zone_i::AddHypo( const char* NomHypo )
171 MESSAGE ( " AddHypo, NomHypo= " << NomHypo);
172 ASSERT( myHomardZone );
173 myHomardZone->AddHypo( NomHypo );
174 MESSAGE ( " FIn de AddHypo");
177 //=============================================================================
178 void HOMARD_Zone_i::SupprHypo( const char* NomHypo )
180 ASSERT( myHomardZone );
181 myHomardZone->SupprHypo( NomHypo );
183 //=============================================================================
184 HOMARD::listeHypo* HOMARD_Zone_i::GetHypo()
186 ASSERT( myHomardZone );
187 const std::list<std::string>& maListe = myHomardZone->GetHypo();
188 HOMARD::listeHypo_var aResult = new HOMARD::listeHypo;
189 aResult->length( maListe.size() );
190 std:: list<std::string>::const_iterator it;
192 for ( it = maListe.begin(); it != maListe.end(); it++ )
193 aResult[i++] = CORBA::string_dup( (*it).c_str() );
194 return aResult._retn();
197 //=============================================================================
198 std::string HOMARD_Zone_i::Dump() const
200 return HOMARD::Dump( *myHomardZone );
203 //=============================================================================
204 bool HOMARD_Zone_i::Restore( const std::string& stream )
206 return HOMARD::Restore( *myHomardZone, stream );