1 // Copyright (C) 2011-2013 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 // L'ordre de description des fonctions est le meme dans tous les fichiers
21 // HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
22 // 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
23 // 2. Les caracteristiques
24 // 3. Le lien avec les autres structures
26 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
29 #include "HOMARD_Zone_i.hxx"
30 #include "HOMARD_Gen_i.hxx"
31 #include "HOMARD_Zone.hxx"
32 #include "HOMARD_DriverTools.hxx"
34 #include "utilities.h"
36 //=============================================================================
38 * standard constructor
40 //=============================================================================
41 HOMARD_Zone_i::HOMARD_Zone_i()
43 MESSAGE( "Default constructor, not for use" );
47 //=============================================================================
49 * standard constructor
51 //=============================================================================
52 HOMARD_Zone_i::HOMARD_Zone_i( CORBA::ORB_ptr orb,
53 HOMARD::HOMARD_Gen_var engine )
55 MESSAGE( "HOMARD_Zone_i" );
58 myHomardZone = new ::HOMARD_Zone();
59 ASSERT( myHomardZone );
61 //=============================================================================
65 //=============================================================================
67 HOMARD_Zone_i::~HOMARD_Zone_i()
70 //=============================================================================
71 //=============================================================================
73 //=============================================================================
74 //=============================================================================
75 void HOMARD_Zone_i::SetName( const char* Name )
77 ASSERT( myHomardZone );
78 myHomardZone->SetName( Name );
80 //=============================================================================
81 char* HOMARD_Zone_i::GetName()
83 ASSERT( myHomardZone );
84 return CORBA::string_dup( myHomardZone->GetName().c_str() );
86 //=============================================================================
87 CORBA::Long HOMARD_Zone_i::Delete()
89 ASSERT( myHomardZone );
90 char* ZoneName = GetName() ;
91 MESSAGE ( "Delete : destruction de la zonee " << ZoneName );
92 return _gen_i->DeleteZone(ZoneName) ;
94 //=============================================================================
95 char* HOMARD_Zone_i::GetDumpPython()
97 ASSERT( myHomardZone );
98 return CORBA::string_dup( myHomardZone->GetDumpPython().c_str() );
100 //=============================================================================
101 std::string HOMARD_Zone_i::Dump() const
103 return HOMARD::Dump( *myHomardZone );
105 //=============================================================================
106 bool HOMARD_Zone_i::Restore( const std::string& stream )
108 return HOMARD::Restore( *myHomardZone, stream );
110 //=============================================================================
111 //=============================================================================
113 //=============================================================================
114 //=============================================================================
115 void HOMARD_Zone_i::SetType( CORBA::Long Type )
117 ASSERT( myHomardZone );
118 myHomardZone->SetType( Type );
120 //=============================================================================
121 CORBA::Long HOMARD_Zone_i::GetType()
123 ASSERT( myHomardZone );
124 return CORBA::Long( myHomardZone->GetType() );
126 //=============================================================================
127 void HOMARD_Zone_i::SetBox( double X0, double X1, double X2, double X3, double X4, double X5 )
129 ASSERT( myHomardZone );
130 myHomardZone->SetBox( X0, X1, X2, X3, X4, X5 );
132 //=============================================================================
133 void HOMARD_Zone_i::SetCylinder( double Xcentre, double Ycentre, double Zcentre,
134 double Xaxis, double Yaxis, double Zaxis,
135 double Rayon, double Haut )
137 ASSERT( myHomardZone );
138 myHomardZone->SetCylinder( Xcentre, Ycentre, Zcentre, Xaxis, Yaxis, Zaxis, Rayon, Haut );
140 //=============================================================================
141 void HOMARD_Zone_i::SetPipe( double Xcentre, double Ycentre, double Zcentre,
142 double Xaxis, double Yaxis, double Zaxis,
143 double Rayon, double Haut, double Rayonint )
145 ASSERT( myHomardZone );
146 myHomardZone->SetPipe( Xcentre, Ycentre, Zcentre, Xaxis, Yaxis, Zaxis, Rayon, Haut, Rayonint );
148 //=============================================================================
149 void HOMARD_Zone_i::SetSphere( double Xcentre, double Ycentre, double Zcentre, double Rayon )
151 ASSERT( myHomardZone );
152 myHomardZone->SetSphere( Xcentre, Ycentre, Zcentre, Rayon );
154 //=============================================================================
155 HOMARD::double_array* HOMARD_Zone_i::GetCoords()
157 ASSERT( myHomardZone );
158 HOMARD::double_array_var aResult = new HOMARD::double_array();
159 std::vector<double> mesCoor = myHomardZone->GetCoords();
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();
167 //=============================================================================
168 void HOMARD_Zone_i::SetLimit( double Xincr, double Yincr, double Zincr )
170 MESSAGE ("SetLimit, Xincr : " << Xincr << ", Yincr : " << Yincr << ", Zincr : " << Zincr) ;
171 ASSERT( myHomardZone );
172 myHomardZone->SetLimit( Xincr, Yincr, Zincr );
174 //=============================================================================
175 HOMARD::double_array* HOMARD_Zone_i::GetLimit()
177 ASSERT( myHomardZone );
178 HOMARD::double_array_var aResult = new HOMARD::double_array();
179 std::vector<double> mesCoor = myHomardZone->GetLimit();
180 aResult->length( mesCoor .size() );
181 std::vector<double>::const_iterator it;
183 for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
184 aResult[i++] = (*it);
185 return aResult._retn();
187 //=============================================================================
188 //=============================================================================
189 // Liens avec les autres structures
190 //=============================================================================
191 //=============================================================================
192 void HOMARD_Zone_i::AddHypo( const char* NomHypo )
194 MESSAGE ( " AddHypo, NomHypo= " << NomHypo);
195 ASSERT( myHomardZone );
196 myHomardZone->AddHypo( NomHypo );
198 //=============================================================================
199 HOMARD::listeHypo* HOMARD_Zone_i::GetHypo()
201 ASSERT( myHomardZone );
202 const std::list<std::string>& maListe = myHomardZone->GetHypo();
203 HOMARD::listeHypo_var aResult = new HOMARD::listeHypo;
204 aResult->length( maListe.size() );
205 std:: list<std::string>::const_iterator it;
207 for ( it = maListe.begin(); it != maListe.end(); it++ )
208 aResult[i++] = CORBA::string_dup( (*it).c_str() );
209 return aResult._retn();
211 //=============================================================================
212 void HOMARD_Zone_i::SupprHypo( const char* NomHypo )
214 ASSERT( myHomardZone );
215 myHomardZone->SupprHypo( NomHypo );