1 #include "HOMARD_Zone_i.hxx"
2 #include "HOMARD_Gen_i.hxx"
3 #include "HOMARD_Zone.hxx"
4 #include "HOMARD_DriverTools.hxx"
8 //=============================================================================
10 * standard constructor
12 //=============================================================================
13 HOMARD_Zone_i::HOMARD_Zone_i()
15 MESSAGE( "Default constructor, not for use" );
19 //=============================================================================
21 * standard constructor
23 //=============================================================================
24 HOMARD_Zone_i::HOMARD_Zone_i( CORBA::ORB_ptr orb,
25 HOMARD::HOMARD_Gen_var engine )
27 MESSAGE( "HOMARD_Zone_i" );
30 myHomardZone = new ::HOMARD_Zone();
31 ASSERT( myHomardZone );
33 //=============================================================================
37 //=============================================================================
39 HOMARD_Zone_i::~HOMARD_Zone_i()
43 //=============================================================================
46 //=============================================================================
47 void HOMARD_Zone_i::SetName( const char* NomZone )
49 ASSERT( myHomardZone );
50 myHomardZone->SetName( NomZone );
53 //=============================================================================
54 char* HOMARD_Zone_i::GetName()
56 ASSERT( myHomardZone );
57 return CORBA::string_dup( myHomardZone->GetName().c_str() );
60 //=============================================================================
61 char* HOMARD_Zone_i::GetDumpPython()
63 ASSERT( myHomardZone );
64 return CORBA::string_dup( myHomardZone->GetDumpPython().c_str() );
68 //=============================================================================
69 void HOMARD_Zone_i::SetZoneType( CORBA::Long ZoneType )
71 ASSERT( myHomardZone );
72 myHomardZone->SetZoneType( ZoneType );
75 //=============================================================================
76 CORBA::Long HOMARD_Zone_i::GetZoneType()
78 ASSERT( myHomardZone );
79 return CORBA::Long( myHomardZone->GetZoneType() );
82 //=============================================================================
83 void HOMARD_Zone_i::SetBox( double X0, double X1, double X2, double X3, double X4, double X5 )
85 ASSERT( myHomardZone );
86 myHomardZone->SetBox( X0, X1, X2, X3, X4, X5 );
89 //=============================================================================
90 HOMARD::double_array* HOMARD_Zone_i::GetBox()
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;
98 for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
100 return aResult._retn();
103 //=============================================================================
104 void HOMARD_Zone_i::SetSphere( double Xcentre, double Ycentre, double ZCentre, double rayon )
106 ASSERT( myHomardZone );
107 myHomardZone->SetSphere( Xcentre, Ycentre, ZCentre, rayon );
110 //=============================================================================
111 HOMARD::double_array* HOMARD_Zone_i::GetSphere()
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;
119 for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
120 aResult[i++] = (*it);
121 return aResult._retn();
124 //=============================================================================
125 void HOMARD_Zone_i::SetLimit( double Xincr, double Yincr, double Zincr )
127 MESSAGE ("SetLimit, Xincr : " << Xincr << ", Yincr : " << Yincr << ", Zincr : " << Zincr) ;
128 ASSERT( myHomardZone );
129 myHomardZone->SetLimit( Xincr, Yincr, Zincr );
132 //=============================================================================
133 HOMARD::double_array* HOMARD_Zone_i::GetLimit()
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;
141 for ( it = mesCoor.begin(); it != mesCoor.end(); it++ )
142 aResult[i++] = (*it);
143 return aResult._retn();
146 //=============================================================================
147 void HOMARD_Zone_i::AddHypo( const char* NomHypo )
149 ASSERT( myHomardZone );
150 myHomardZone->AddHypo( NomHypo );
153 //=============================================================================
154 void HOMARD_Zone_i::SupprHypo( const char* NomHypo )
156 ASSERT( myHomardZone );
157 myHomardZone->SupprHypo( NomHypo );
159 //=============================================================================
160 HOMARD::listeHypo* HOMARD_Zone_i::GetHypo()
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;
168 for ( it = maListe.begin(); it != maListe.end(); it++ )
169 aResult[i++] = CORBA::string_dup( (*it).c_str() );
170 return aResult._retn();
173 //=============================================================================
174 std::string HOMARD_Zone_i::Dump() const
176 return HOMARD::Dump( *myHomardZone );
179 //=============================================================================
180 bool HOMARD_Zone_i::Restore( const std::string& stream )
182 return HOMARD::Restore( *myHomardZone, stream );