Salome HOME
version 5_1_4 HOMARD_SRC
[modules/homard.git] / src / HOMARD_I / HOMARD_Zone_i.cxx
1 #include "HOMARD_Zone_i.hxx"
2 #include "HOMARD_Gen_i.hxx"
3 #include "HOMARD_Zone.hxx"
4 #include "HOMARD_DriverTools.hxx"
5
6 #include "utilities.h"
7
8 //=============================================================================
9 /*!
10  *  standard constructor
11  */
12 //=============================================================================
13 HOMARD_Zone_i::HOMARD_Zone_i()
14 {
15   MESSAGE( "Default constructor, not for use" );
16   ASSERT( 0 );
17 }
18
19 //=============================================================================
20 /*!
21  *  standard constructor
22  */
23 //=============================================================================
24 HOMARD_Zone_i::HOMARD_Zone_i( CORBA::ORB_ptr orb,
25                               HOMARD::HOMARD_Gen_var engine )
26 {
27   MESSAGE( "HOMARD_Zone_i" );
28   _gen_i = engine;
29   _orb = orb;
30   myHomardZone = new ::HOMARD_Zone();
31   ASSERT( myHomardZone );
32 }
33 //=============================================================================
34 /*!
35  *  standard destructor
36  */
37 //=============================================================================
38
39 HOMARD_Zone_i::~HOMARD_Zone_i()
40 {
41 }
42
43 //=============================================================================
44 /*!
45  */
46 //=============================================================================
47 void HOMARD_Zone_i::SetName( const char* NomZone )
48 {
49   ASSERT( myHomardZone );
50   myHomardZone->SetName( NomZone );
51 }
52
53 //=============================================================================
54 char* HOMARD_Zone_i::GetName()
55 {
56   ASSERT( myHomardZone );
57   return CORBA::string_dup( myHomardZone->GetName().c_str() );
58 }
59
60 //=============================================================================
61 char* HOMARD_Zone_i::GetDumpPython()
62 {
63   ASSERT( myHomardZone );
64   return CORBA::string_dup( myHomardZone->GetDumpPython().c_str() );
65 }
66
67
68 //=============================================================================
69 void HOMARD_Zone_i::SetZoneType( CORBA::Long ZoneType )
70 {
71   ASSERT( myHomardZone );
72   myHomardZone->SetZoneType( ZoneType );
73 }
74
75 //=============================================================================
76 CORBA::Long HOMARD_Zone_i::GetZoneType()
77 {
78   ASSERT( myHomardZone );
79   return  CORBA::Long( myHomardZone->GetZoneType() );
80 }
81
82 //=============================================================================
83 void HOMARD_Zone_i::SetBox( double X0, double X1, double X2, double X3, double X4, double X5 )
84 {
85   ASSERT( myHomardZone );
86   myHomardZone->SetBox( X0, X1, X2, X3, X4, X5 );
87 }
88
89 //=============================================================================
90 HOMARD::double_array* HOMARD_Zone_i::GetBox()
91 {
92   ASSERT( myHomardZone );
93   HOMARD::double_array_var aResult = new HOMARD::double_array();
94   std::vector<double> mesCoor = myHomardZone->GetBox();
95   aResult->length( mesCoor .size() );
96   std::vector<double>::const_iterator it;
97   int i = 0;
98   for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
99     aResult[i++] = (*it);
100   return aResult._retn();
101 }
102
103 //=============================================================================
104 void HOMARD_Zone_i::SetSphere( double Xcentre, double Ycentre, double ZCentre, double rayon )
105 {
106   ASSERT( myHomardZone );
107   myHomardZone->SetSphere( Xcentre, Ycentre, ZCentre, rayon );
108 }
109
110 //=============================================================================
111 HOMARD::double_array* HOMARD_Zone_i::GetSphere()
112 {
113   ASSERT( myHomardZone );
114   HOMARD::double_array_var aResult = new HOMARD::double_array();
115   std::vector<double> mesCoor = myHomardZone->GetSphere();
116   aResult->length( mesCoor .size() );
117   std::vector<double>::const_iterator it;
118   int i = 0;
119   for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
120     aResult[i++] = (*it);
121   return aResult._retn();
122 }
123
124 //=============================================================================
125 void HOMARD_Zone_i::SetLimit( double Xincr, double Yincr, double Zincr )
126 {
127   MESSAGE ("SetLimit, Xincr : " << Xincr << ", Yincr : " << Yincr << ", Zincr : " << Zincr) ;
128   ASSERT( myHomardZone );
129   myHomardZone->SetLimit( Xincr, Yincr, Zincr );
130 }
131
132 //=============================================================================
133 HOMARD::double_array* HOMARD_Zone_i::GetLimit()
134 {
135   ASSERT( myHomardZone );
136   HOMARD::double_array_var aResult = new HOMARD::double_array();
137   std::vector<double> mesCoor = myHomardZone->GetLimit();
138   aResult->length( mesCoor .size() );
139   std::vector<double>::const_iterator it;
140   int i = 0;
141   for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
142     aResult[i++] = (*it);
143   return aResult._retn();
144 }
145
146 //=============================================================================
147 void HOMARD_Zone_i::AddHypo( const char* NomHypo )
148 {
149   ASSERT( myHomardZone );
150   myHomardZone->AddHypo( NomHypo );
151 }
152
153 //=============================================================================
154 void HOMARD_Zone_i::SupprHypo( const char* NomHypo )
155 {
156   ASSERT( myHomardZone );
157   myHomardZone->SupprHypo( NomHypo );
158 }
159 //=============================================================================
160 HOMARD::listeHypo* HOMARD_Zone_i::GetHypo()
161 {
162   ASSERT( myHomardZone );
163   const std::list<std::string>& maListe = myHomardZone->GetHypo();
164   HOMARD::listeHypo_var aResult = new HOMARD::listeHypo;
165   aResult->length( maListe.size() );
166   std:: list<std::string>::const_iterator it;
167   int i = 0;
168   for ( it = maListe.begin(); it != maListe.end(); it++ )
169     aResult[i++] = CORBA::string_dup( (*it).c_str() );
170   return aResult._retn();
171 }
172
173 //=============================================================================
174 std::string HOMARD_Zone_i::Dump() const
175 {
176   return HOMARD::Dump( *myHomardZone );
177 }
178
179 //=============================================================================
180 bool HOMARD_Zone_i::Restore( const std::string& stream )
181 {
182   return HOMARD::Restore( *myHomardZone, stream );
183 }