1 // Copyright (C) 2011-2023 CEA, EDF
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 // L'ordre de description des fonctions est le meme dans tous les fichiers
22 // HOMARD_aaaa.idl, HOMARD_aaaa.hxx, HOMARD_aaaa.cxx, HOMARD_aaaa_i.hxx, HOMARD_aaaa_i.cxx :
23 // 1. Les generalites : Name, Delete, DumpPython, Dump, Restore
24 // 2. Les caracteristiques
25 // 3. Le lien avec les autres structures
27 // Quand les 2 fonctions Setxxx et Getxxx sont presentes, Setxxx est decrit en premier
30 #include "HOMARD_Zone_i.hxx"
31 #include "HOMARD_Gen_i.hxx"
32 #include "HOMARD_Zone.hxx"
33 #include "HOMARD_DriverTools.hxx"
35 #include "utilities.h"
37 //=============================================================================
39 * standard constructor
41 //=============================================================================
42 HOMARD_Zone_i::HOMARD_Zone_i()
44 MESSAGE( "Default constructor, not for use" );
48 //=============================================================================
50 * standard constructor
52 //=============================================================================
53 HOMARD_Zone_i::HOMARD_Zone_i( CORBA::ORB_ptr orb,
54 HOMARD::HOMARD_Gen_var engine )
56 MESSAGE( "HOMARD_Zone_i" );
59 myHomardZone = new ::HOMARD_Zone();
60 ASSERT( myHomardZone );
62 //=============================================================================
66 //=============================================================================
68 HOMARD_Zone_i::~HOMARD_Zone_i()
71 //=============================================================================
72 //=============================================================================
74 //=============================================================================
75 //=============================================================================
76 void HOMARD_Zone_i::SetName( const char* Name )
78 ASSERT( myHomardZone );
79 myHomardZone->SetName( Name );
81 //=============================================================================
82 char* HOMARD_Zone_i::GetName()
84 ASSERT( myHomardZone );
85 return CORBA::string_dup( myHomardZone->GetName().c_str() );
87 //=============================================================================
88 CORBA::Long HOMARD_Zone_i::Delete()
90 ASSERT( myHomardZone );
91 char* ZoneName = GetName() ;
92 MESSAGE ( "Delete : destruction de la zone " << ZoneName );
93 return _gen_i->DeleteZone(ZoneName) ;
95 //=============================================================================
96 char* HOMARD_Zone_i::GetDumpPython()
98 ASSERT( myHomardZone );
99 return CORBA::string_dup( myHomardZone->GetDumpPython().c_str() );
101 //=============================================================================
102 std::string HOMARD_Zone_i::Dump() const
104 return HOMARD::Dump( *myHomardZone );
106 //=============================================================================
107 bool HOMARD_Zone_i::Restore( const std::string& stream )
109 return HOMARD::Restore( *myHomardZone, stream );
111 //=============================================================================
112 //=============================================================================
114 //=============================================================================
115 //=============================================================================
116 void HOMARD_Zone_i::SetType( CORBA::Long Type )
118 ASSERT( myHomardZone );
119 myHomardZone->SetType( Type );
121 //=============================================================================
122 CORBA::Long HOMARD_Zone_i::GetType()
124 ASSERT( myHomardZone );
125 return CORBA::Long( myHomardZone->GetType() );
127 //=============================================================================
128 void HOMARD_Zone_i::SetBox( double X0, double X1, double X2, double X3, double X4, double X5 )
130 ASSERT( myHomardZone );
131 myHomardZone->SetBox( X0, X1, X2, X3, X4, X5 );
133 //=============================================================================
134 void HOMARD_Zone_i::SetCylinder( double Xcentre, double Ycentre, double Zcentre,
135 double Xaxis, double Yaxis, double Zaxis,
136 double Rayon, double Haut )
138 ASSERT( myHomardZone );
139 myHomardZone->SetCylinder( Xcentre, Ycentre, Zcentre, Xaxis, Yaxis, Zaxis, Rayon, Haut );
141 //=============================================================================
142 void HOMARD_Zone_i::SetPipe( double Xcentre, double Ycentre, double Zcentre,
143 double Xaxis, double Yaxis, double Zaxis,
144 double Rayon, double Haut, double Rayonint )
146 ASSERT( myHomardZone );
147 myHomardZone->SetPipe( Xcentre, Ycentre, Zcentre, Xaxis, Yaxis, Zaxis, Rayon, Haut, Rayonint );
149 //=============================================================================
150 void HOMARD_Zone_i::SetSphere( double Xcentre, double Ycentre, double Zcentre, double Rayon )
152 ASSERT( myHomardZone );
153 myHomardZone->SetSphere( Xcentre, Ycentre, Zcentre, Rayon );
155 //=============================================================================
156 HOMARD::double_array* HOMARD_Zone_i::GetCoords()
158 ASSERT( myHomardZone );
159 HOMARD::double_array_var aResult = new HOMARD::double_array();
160 std::vector<double> mesCoor = myHomardZone->GetCoords();
161 aResult->length( mesCoor .size() );
162 std::vector<double>::const_iterator it;
164 for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
165 aResult[i++] = (*it);
166 return aResult._retn();
168 //=============================================================================
169 void HOMARD_Zone_i::SetLimit( double Xincr, double Yincr, double Zincr )
171 MESSAGE ("SetLimit, Xincr : " << Xincr << ", Yincr : " << Yincr << ", Zincr : " << Zincr) ;
172 ASSERT( myHomardZone );
173 myHomardZone->SetLimit( Xincr, Yincr, Zincr );
175 //=============================================================================
176 HOMARD::double_array* HOMARD_Zone_i::GetLimit()
178 ASSERT( myHomardZone );
179 HOMARD::double_array_var aResult = new HOMARD::double_array();
180 std::vector<double> mesCoor = myHomardZone->GetLimit();
181 aResult->length( mesCoor .size() );
182 std::vector<double>::const_iterator it;
184 for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
185 aResult[i++] = (*it);
186 return aResult._retn();
188 //=============================================================================
189 //=============================================================================
190 // Liens avec les autres structures
191 //=============================================================================
192 //=============================================================================
193 void HOMARD_Zone_i::AddHypo( const char* NomHypo )
195 MESSAGE ( " AddHypo, NomHypo= " << NomHypo);
196 ASSERT( myHomardZone );
197 myHomardZone->AddHypo( NomHypo );
199 //=============================================================================
200 HOMARD::listeHypo* HOMARD_Zone_i::GetHypo()
202 ASSERT( myHomardZone );
203 const std::list<std::string>& maListe = myHomardZone->GetHypo();
204 HOMARD::listeHypo_var aResult = new HOMARD::listeHypo;
205 aResult->length( maListe.size() );
206 std:: list<std::string>::const_iterator it;
208 for ( it = maListe.begin(); it != maListe.end(); it++ )
209 aResult[i++] = CORBA::string_dup( (*it).c_str() );
210 return aResult._retn();
212 //=============================================================================
213 void HOMARD_Zone_i::SupprHypo( const char* NomHypo )
215 ASSERT( myHomardZone );
216 myHomardZone->SupprHypo( NomHypo );